]> git.donarmstrong.com Git - mrbayes.git/commitdiff
import mrbayes mrbayes/3.2.6
authorDon Armstrong <don@donarmstrong.com>
Thu, 21 Jan 2016 17:31:15 +0000 (11:31 -0600)
committerDon Armstrong <don@donarmstrong.com>
Thu, 21 Jan 2016 17:31:15 +0000 (11:31 -0600)
37 files changed:
documentation/Manual_MrBayes_v3.2.pdf [new file with mode: 0644]
documentation/commref_mb3.2.txt [new file with mode: 0644]
documentation/release_note.txt [new file with mode: 0644]
examples/avian_ovomucoids.nex [new file with mode: 0644]
examples/codon.nex [new file with mode: 0644]
examples/cynmix.nex [new file with mode: 0644]
examples/finch.nex [new file with mode: 0644]
examples/hymfossil.nex [new file with mode: 0644]
examples/primates.nex [new file with mode: 0644]
examples/replicase.nex [new file with mode: 0644]
examples/sceloporus.nex [new file with mode: 0644]
src/CompileInstructions.txt [new file with mode: 0644]
src/Makefile.in [new file with mode: 0644]
src/bayes.c [new file with mode: 0644]
src/bayes.h [new file with mode: 0644]
src/best.c [new file with mode: 0644]
src/best.h [new file with mode: 0644]
src/command.c [new file with mode: 0644]
src/command.h [new file with mode: 0644]
src/config.h.in [new file with mode: 0644]
src/configure.in [new file with mode: 0644]
src/gpl.txt [new file with mode: 0644]
src/install-sh [new file with mode: 0644]
src/likelihood.c [new file with mode: 0644]
src/likelihood.h [new file with mode: 0644]
src/mbbeagle.c [new file with mode: 0644]
src/mbbeagle.h [new file with mode: 0644]
src/mcmc.c [new file with mode: 0644]
src/mcmc.h [new file with mode: 0644]
src/model.c [new file with mode: 0644]
src/model.h [new file with mode: 0644]
src/proposal.c [new file with mode: 0644]
src/proposal.h [new file with mode: 0644]
src/sumpt.c [new file with mode: 0644]
src/sumpt.h [new file with mode: 0644]
src/utils.c [new file with mode: 0644]
src/utils.h [new file with mode: 0644]

diff --git a/documentation/Manual_MrBayes_v3.2.pdf b/documentation/Manual_MrBayes_v3.2.pdf
new file mode 100644 (file)
index 0000000..91a1e62
Binary files /dev/null and b/documentation/Manual_MrBayes_v3.2.pdf differ
diff --git a/documentation/commref_mb3.2.txt b/documentation/commref_mb3.2.txt
new file mode 100644 (file)
index 0000000..481dc3e
--- /dev/null
@@ -0,0 +1,3305 @@
+                                                                                 \r
+                                                                                 \r
+                                                                                 \r
+                                                                                 \r
+                   Command Reference for MrBayes ver. 3.2.6                   \r
+                                                                                 \r
+                   (c) John P. Huelsenbeck, Fredrik Ronquist                     \r
+                               and Maxim Teslenko                                \r
+                                                                                 \r
+                                                                                 \r
+   ***************************************************************************   \r
+   *                                                                         *   \r
+   *  1. Command summary                                                     *   \r
+   *                                                                         *   \r
+   ***************************************************************************   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   Commands that are available from the command                                  \r
+   line or from a MrBayes block include:                                         \r
+                                                                                 \r
+   About            -- Describes the program\r
+   Acknowledgments  -- Shows program acknowledgments\r
+   Calibrate        -- Assigns dates to terminals or interior nodes\r
+   Charset          -- Assigns a group of sites to a set\r
+   Charstat         -- Shows status of characters\r
+   Citations        -- Citation of program, models, and methods\r
+   Comparetree      -- Compares the trees from two tree files\r
+   Constraint       -- Defines a constraint on tree topology\r
+   Ctype            -- Assigns ordering for the characters\r
+   Databreaks       -- Defines data breaks for autodiscrete gamma model\r
+   Delete           -- Deletes taxa from the analysis\r
+   Disclaimer       -- Describes program disclaimer\r
+   Exclude          -- Excludes sites from the analysis\r
+   Execute          -- Executes a file\r
+   Help             -- Provides detailed description of commands\r
+   Include          -- Includes sites\r
+   Link             -- Links parameters across character partitions\r
+   Log              -- Logs screen output to a file\r
+   Lset             -- Sets the parameters of the likelihood model\r
+   Manual           -- Prints a command reference to a text file\r
+   Mcmc             -- Starts Markov chain Monte Carlo analysis\r
+   Mcmcp            -- Sets parameters of a chain (without starting analysis)\r
+   Outgroup         -- Changes outgroup taxon\r
+   Pairs            -- Defines nucleotide pairs (doublets) for stem models\r
+   Partition        -- Assigns a character partition\r
+   Plot             -- Plots parameters from MCMC analysis\r
+   Prset            -- Sets the priors for the parameters\r
+   Propset          -- Sets proposal probabilities and tuning parameters\r
+   Quit             -- Quits the program\r
+   Report           -- Controls how model parameters are reported\r
+   Restore          -- Restores taxa\r
+   Set              -- Sets run conditions and defines active data partition\r
+   Showbeagle       -- Show available BEAGLE resources\r
+   Showmatrix       -- Shows current character matrix\r
+   Showmcmctrees    -- Shows trees used in mcmc analysis\r
+   Showmodel        -- Shows model settings\r
+   Showmoves        -- Shows moves for current model\r
+   Showparams       -- Shows parameters in current model\r
+   Showusertrees    -- Shows user-defined trees\r
+   Speciespartition -- Defines a partition of tips into species\r
+   Ss               -- Starts stepping-stone sampling\r
+   Ssp              -- Sets parameters of stepping-stone analysis (without starting)\r
+   Startvals        -- Sets starting values of parameters\r
+   Sump             -- Summarizes parameters from MCMC analysis\r
+   Sumss            -- Summarizes parameters from stepping-stone analysis\r
+   Sumt             -- Summarizes trees from MCMC analysis\r
+   Taxastat         -- Shows status of taxa\r
+   Taxset           -- Assigns a group of taxa to a set\r
+   Unlink           -- Unlinks parameters across character partitions\r
+   Version          -- Shows program version\r
+                                                                                 \r
+   Commands that should be in a NEXUS file (data                                 \r
+   block, trees block or taxa block) include:                                                \r
+                                                                                 \r
+   Begin            -- Denotes beginning of block in file\r
+   Dimensions       -- Defines size of character matrix\r
+   End              -- Denotes end of a block in file\r
+   Endblock         -- Alternative way of denoting end of a block\r
+   Format           -- Defines character format in data block\r
+   Matrix           -- Defines matrix of characters in data block\r
+   Taxlabels        -- Defines taxon labels\r
+   Translate        -- Defines alternative names for taxa\r
+   Tree             -- Defines a tree\r
+                                                                                 \r
+   Note that this program supports the use of the shortest unambiguous           \r
+   spelling of the above commands (e.g., "exe" instead of "execute").        \r
+   ---------------------------------------------------------------------------   \r
+                                                                                 \r
+   ***************************************************************************   \r
+   *                                                                         *   \r
+   *  2. MrBayes commands                                                    *   \r
+   *                                                                         *   \r
+   ***************************************************************************   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   About                                                                         \r
+                                                                                 \r
+   This command provides some general information about the program.             \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Acknowledgments                                                               \r
+                                                                                 \r
+   This command shows the authors' acknowledgments.                              \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Calibrate                                                                     \r
+                                                                                 \r
+   This command dates a terminal or interior node in the tree. The format is     \r
+                                                                                 \r
+      calibrate <node_name> = <age_prior>                                        \r
+                                                                                 \r
+   where <node_name> is the name of a defined interior constraint node or the    \r
+   name of a terminal node (tip) and <age_prior> is a prior probability distribu-\r
+   tion on the age of the node. The latter can either be a fixed date or a date  \r
+   drawn from one of the available prior probability distributions. In general,  \r
+   the available prior probability distributions are parameterized in terms of   \r
+   the expected mean age of the distribution to facilitate for users. Some dis-  \r
+   tributions put a positive probability on all ages above 0.0, while others in- \r
+   clude a minimum-age constraint and sometimes a maximum-age constraint. The    \r
+   available distributions and their parameters are:                             \r
+                                                                                 \r
+      calibrate <node_name> = fixed(<age>)                                       \r
+      calibrate <node_name> = uniform(<min_age>,<max_age>)                       \r
+      calibrate <node_name> = offsetexponential(<min_age>,<mean_age>)            \r
+      calibrate <node_name> = truncatednormal(<min_age>,<mean_age>,<stdev>)      \r
+      calibrate <node_name> = lognormal(<mean_age>,<stdev>)                      \r
+      calibrate <node_name> = offsetlognormal(<min_age>,<mean_age>,<stdev>)      \r
+      calibrate <node_name> = gamma(<mean_age>,<stdev>)                          \r
+      calibrate <node_name> = offsetgamma(<min_age>,<mean_age>,<stdev>)          \r
+                                                                                 \r
+   Note that mean_age is always the mean age and stdev the standard deviation of \r
+   the distribution measured in user-defined time units. This way of specifying  \r
+   the distribution parameters is often different from the parameterization used \r
+   elsewhere in the program. For instance, the standard parameters of the gamma  \r
+   distribution used by MrBayes are shape (alpha) and rate (beta). If you want   \r
+   to use the standard parameterization, the conversions are as follows:         \r
+                                                                                 \r
+      exponential distributon: mean    = 1 / rate                                \r
+      gamma distributon:       mean    = alpha / beta                            \r
+                               st.dev. = square_root (alpha / beta^2)            \r
+      lognormal distributon:   mean    = exp (mean_log + st.dev._log^2/2)        \r
+                               st.dev. = square_root ((exp (st.dev._log^2) - 1)  \r
+                                         * (exp (2*mean_log + st.dev._log^2))    \r
+                                                                                 \r
+   The truncated normal distribution is an exception in that the mean_age and    \r
+   stdev parameters are the mean and standard deviation of the underlying non-   \r
+   truncated normal distribution. The truncation will cause the modified distri- \r
+   bution to have a higher mean and lower standard deviation. The magnitude of   \r
+   that effect depends on how much of the tail of the distribution is removed.   \r
+                                                                                 \r
+   Note that previous to version 3.2.2, MrBayes used the standard rate parameter-\r
+   ization of the offset exponential. This should not cause a problem in most    \r
+   cases because the old parameterization will result in an error in more recent \r
+   versions of MrBayes, and the likely source of the error is given in the error \r
+   message.                                                                      \r
+                                                                                 \r
+   For a practical example, assume that we had three fossil terminals named      \r
+   'FossilA', 'FossilB', and 'FossilC'. Assume further that we want to fix the   \r
+   age of FossilA to 100.0 million years, we think that FossilB is somewhere     \r
+   between 100.0 and 200.0 million years old, and that FossilC is at least 300.0 \r
+   million years old, possibly older but relatively unlikely to be more than     \r
+   400.0 million years old. Then we might use the commands:                      \r
+                                                                                 \r
+      calibrate FossilA = fixed(100) FossilB = uniform(100,200)                  \r
+      calibrate FossilC = offsetexponential(300,400)                             \r
+                                                                                 \r
+   Note that it is possible to give more than one calibration for each           \r
+   'calibrate' statement. Thus, 'calibrate FossilA=<setting> FossilB=<setting>'  \r
+   would be a valid statement.                                                   \r
+                                                                                 \r
+   To actually use the calibrations to obtain dated trees, you also need to set  \r
+   a clock model using relevant 'brlenspr' and 'nodeagepr' options of the 'prset'\r
+   command. You may also want to examine the 'clockvarpr' and 'clockratepr' op-  \r
+   tions. Furthermore, you need to activate the relevant constraint(s) using     \r
+   'topologypr', if you use any dated interior nodes in the tree.                \r
+                                                                                 \r
+   You may wish to remove a calibration from an interior or terminal node, which \r
+   has previously been calibrated. You can do that using                         \r
+                                                                                 \r
+      calibrate <node_name> = unconstrained                                      \r
+                                                                                 \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Charset                                                                       \r
+                                                                                 \r
+   This command defines a character set. The format for the charset command      \r
+   is                                                                            \r
+                                                                                 \r
+      charset <name> = <character numbers>                                       \r
+                                                                                 \r
+   For example, "charset first_pos = 1-720\3" defines a character set         \r
+   called "first_pos" that includes every third site from 1 to 720.            \r
+   The character set name cannot have any spaces in it. The slash (\)           \r
+   is a nifty way of telling the program to assign every third (or               \r
+   second, or fifth, or whatever) character to the character set.                \r
+   This option is best used not from the command line, but rather as a           \r
+   line in the mrbayes block of a file. Note that you can use "." to           \r
+   stand in for the last character (e.g., charset 1-.\3).                       \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Charstat                                                                      \r
+                                                                                 \r
+   This command shows the status of all the characters. The correct usage        \r
+   is                                                                            \r
+                                                                                 \r
+      charstat                                                                   \r
+                                                                                 \r
+   After typing "charstat", the character number, whether it is excluded       \r
+   or included, and the partition identity are shown. The output is paused       \r
+   every 100 characters. This pause can be turned off by setting autoclose       \r
+   to "yes" (set autoclose=yes).                                               \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Citations                                                                     \r
+                                                                                 \r
+   This command shows a thorough list of citations you may consider using        \r
+   when publishing the results of a MrBayes analysis.                            \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Comparetree                                                                   \r
+                                                                                 \r
+   This command compares the trees in two files, called "filename1" and        \r
+   "filename2". It will output a bivariate plot of the split frequencies       \r
+   as well as plots of the tree distance as a function of the generation. The    \r
+   plots can be used to get a quick indication of whether two runs have con-     \r
+   verged onto the same set of trees. The "Comparetree" command will also      \r
+   produce a ".pairs" file and a ".dists" file (these file endings are added \r
+   to the end of the "Outputname"). The ".pairs" file contains the paired    \r
+   split frequencies from the two tree samples; the ".dists" file contains the \r
+   tree distance values.                                                         \r
+                                                                                 \r
+   Note that the "Sumt" command provides a different set of convergence diag-  \r
+   nostics tools that you may also want to explore. Unlike "Comparetree",      \r
+   "Sumt" can compare more than two tree samples and will calculate consensus  \r
+   trees and split frequencies from the pooled samples.                          \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Relburnin     -- If this option is set to 'Yes', then a proportion of the     \r
+                    samples will be discarded as burnin when calculating summary \r
+                    statistics. The proportion to be discarded is set with       \r
+                    Burninfrac (see below). When the Relburnin option is set to  \r
+                    'No', then a specific number of samples is discarded instead.\r
+                    This number is set by Burnin (see below). Note that the      \r
+                    burnin setting is shared with the 'mcmc', 'sumt', 'sump' and \r
+                    'plot' commands.                                             \r
+   Burnin        -- Determines the number of samples (not generations) that will \r
+                    be discarded when summary statistics are calculated. The     \r
+                    value of this option is only relevant when Relburnin is set  \r
+                    to 'No'.                                                     \r
+   BurninFrac    -- Determines the fraction of samples that will be discarded    \r
+                    when summary statistics are calculated. The value of this    \r
+                    option is only relevant when Relburnin is set to 'Yes'.      \r
+                    Example: A value for this option of 0.25 means that 25% of  \r
+                    the samples will be discarded.                               \r
+   Minpartfreq   -- The minimum probability of partitions to include in summary  \r
+                    statistics.                                                  \r
+   Filename1     -- The name of the first tree file to compare.                  \r
+   Filename2     -- The name of the second tree file to compare.                 \r
+   Outputname    -- Name of the file to which 'comparetree' results will be      \r
+                    printed.                                                     \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter       Options                  Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Relburnin       Yes/No                   Yes                                   \r
+   Burnin          <number>                 0                                   \r
+   Burninfrac      <number>                 0.25                               \r
+   Minpartfreq     <number>                 0.00                               \r
+   Filename1       <name>                   temp.t                                   \r
+   Filename2       <name>                   temp.t                                   \r
+   Outputname      <name>                   temp.comp                                   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Constraint                                                                    \r
+                                                                                 \r
+   This command defines a tree constraint. The format for the constraint         \r
+   command is                                                                    \r
+                                                                                 \r
+      constraint <name> [hard|negative|partial] = <taxon list> [:<taxon list>]   \r
+                                                                                 \r
+   There are three types of constraint implemented in MrBayes. The type of the   \r
+   constraint is specified by using one of the three keywords 'hard', 'negative',\r
+   or 'partial' right after the name of the constraint. If no type is specified, \r
+   then the constraint is assumed to be 'hard'.                                  \r
+                                                                                 \r
+   In a rooted tree, a 'hard' constraint forces the taxa in the list to form a   \r
+   monophyletic group. In an unrooted tree, the taxon split that separates the   \r
+   taxa in the list from other taxa is forced to be present. The interpretation  \r
+   of this depends on whether the tree is rooted on a taxon outside the list or  \r
+   a taxon in the list. If the outgroup is excluded , the taxa in the list are   \r
+   assumed to form a monophyletic group, but if the outgroup is included, the    \r
+   taxa that are not in the list are forced together.                            \r
+                                                                                 \r
+   A 'negative' constraint bans all the trees that have the listed taxa in the   \r
+   same subtree. In other words, it is the opposite of a hard constraint.        \r
+                                                                                 \r
+   A 'partial' or backbone constraint is defined in terms of two sets of taxa    \r
+   separated by a colon character. The constraint forces all taxa in the first   \r
+   list to form a monophyletic group that does not include any taxon in the      \r
+   second list. Taxa that are not included in either list can be placed in any   \r
+   position on the tree, either inside or outside the constrained group. In an   \r
+   unrooted tree, the two taxon lists can be switched with each other with no    \r
+   effect. For a rooted tree, it is the taxa in the first list that have to be   \r
+   monophyletic, that is, these taxa must share a common ancestor not shared with\r
+   any taxon in the second list. The taxa in the second list may or may not fall \r
+   in a monophyletic group depending on the rooting of the tree.                 \r
+                                                                                 \r
+   A list of taxa can be specified using a taxset, taxon names, taxon numbers, or\r
+   any combination of the above, sepatated by spaces. The constraint is treated  \r
+   as an absolute requirement of trees, that is, trees that are not compatible   \r
+   with the constraint have zero prior (and hence zero posterior) probabilty.    \r
+                                                                                 \r
+   If you are interested in inferring ancestral states for a particular node,    \r
+   you need to 'hard' constrain that node first using the 'constraint' command.  \r
+   The same applies if you wish to calibrate an interior node in a dated         \r
+   analysis. For more information on how to infer ancestral states, see the help \r
+   for the 'report' command. For more on dating, see the 'calibrate' command.    \r
+                                                                                 \r
+   It is important to note that simply defining a constraint using this          \r
+   command is not sufficient for the program to actually implement the           \r
+   constraint in an analysis. You must also enforce the constraints using        \r
+   'prset topologypr = constraints (<list of constraints>)'. For more infor-     \r
+   mation on this, see the help on the 'prset' command.                          \r
+                                                                                 \r
+   Examples:                                                                     \r
+                                                                                 \r
+      constraint myclade = Homo Pan Gorilla                                      \r
+                                                                                 \r
+   Defines a hard constraint forcing Homo, Pan, and Gorilla to form a mono-      \r
+   phyletic group or a split that does not include any other taxa.               \r
+                                                                                 \r
+      constraint forbiddenclade negative = Homo Pan Gorilla                      \r
+                                                                                 \r
+   Defines a negative constraint that associates all trees where Homon, Pan, and \r
+   Gorilla form a monophyletic group with zero posterior probability. In other   \r
+   words, such trees will not be sampled during MCMC.                            \r
+                                                                                 \r
+      constraint backbone partial = Homo Gorilla : Mus                           \r
+                                                                                 \r
+   Defines a partial constraint that keeps Mus outside of the clade defined by   \r
+   the most recent common ancestor of Homo and Gorilla. Other taxa are allowed to\r
+   sit anywhere in the tree. Note that this particular constraint is meaningless \r
+   in unrooted trees. MrBayes does not assume anything about the position of the \r
+   outgroup unless it is explicitly included in the partial constraint. Therefore\r
+   a partial constraint must have at least two taxa on each side of the ':' to be\r
+   useful in analyses of unrooted trees. The case is different for rooted trees, \r
+   where it is sufficient for a partial constraint to have more than one taxon   \r
+   before the ':', as in the example given above, to constrain tree space.       \r
+                                                                                 \r
+   To define a more complex constraint tree, simply combine constraints into a   \r
+   list when issuing the 'prset topologypr' command.                             \r
+                                                                                 \r
+                                                                                \r
+   --------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Ctype                                                                         \r
+                                                                                 \r
+   This command sets the character ordering for standard-type data. The          \r
+   correct usage is:                                                             \r
+                                                                                 \r
+      ctype <ordering>:<characters>                                              \r
+                                                                                 \r
+   The available options for the <ordering> specifier are:                       \r
+                                                                                 \r
+     unordered    -- Movement directly from one state to another is              \r
+                     allowed in an instant of time.                              \r
+     ordered      -- Movement is only allowed between adjacent characters.       \r
+                     For example, perhaps only between 0 <-> 1 and 1 <-> 2       \r
+                     for a three state character ordered as 0 - 1 - 2.           \r
+     irreversible -- Rates of change for losses are 0.                           \r
+                                                                                 \r
+   The characters to which the ordering is applied is specified in manner        \r
+   that is identical to commands such as "include" or "exclude". For         \r
+   example,                                                                      \r
+                                                                                 \r
+      ctype ordered: 10 23 45                                                    \r
+                                                                                 \r
+   defines charactes 10, 23, and 45 to be of type ordered. Similarly,            \r
+                                                                                 \r
+      ctype irreversible: 54 - 67  71-92                                         \r
+                                                                                 \r
+   defines characters 54 to 67 and characters 71 to 92 to be of type             \r
+   irreversible. You can use the "." to denote the last character, and         \r
+   "all" to denote all of the characters. Finally, you can use the             \r
+   specifier "\" to apply the ordering to every n-th character or             \r
+   you can use predefined charsets to specify the character.                     \r
+                                                                                 \r
+   Only one ordering can be used on any specific application of ctype.           \r
+   If you want to apply different orderings to different characters, then        \r
+   you need to use ctype multiple times. For example,                            \r
+                                                                                 \r
+      ctype ordered: 1-50                                                        \r
+      ctype irreversible: 51-100                                                 \r
+                                                                                 \r
+   sets characters 1 to 50 to be ordered and characters 51 to 100 to be          \r
+   irreversible.                                                                 \r
+                                                                                 \r
+   The ctype command is only sensible with morphological (here called            \r
+   "standard") characters. The program ignores attempts to apply char-         \r
+   acter orderings to other types of characters, such as DNA characters.         \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Databreaks                                                                    \r
+                                                                                 \r
+   This command is used to specify breaks in your input data matrix. Your        \r
+   data may be a mixture of genes or a mixture of different types of data.       \r
+   Some of the models implemented by MrBayes account for nonindependence at      \r
+   adjacent characters. The autocorrelated gamma model, for example, allows      \r
+   rates at adjacent sites to be correlated. However, there is no way for        \r
+   such a model to tell whether two sites, adjacent in the matrix, are           \r
+   actually separated by many kilobases or megabases in the genome. The          \r
+   databreaks command allows you to specify such breaks. The correct             \r
+   usage is:                                                                     \r
+                                                                                 \r
+      databreaks <break 1> <break 2> <break 3> ...                               \r
+                                                                                 \r
+   For example, say you have a data matrix of 3204 characters that include       \r
+   nucleotide data from three genes. The first gene covers characters 1 to       \r
+   970, the second gene covers characters 971 to 2567, and the third gene        \r
+   covers characters 2568 to 3204. Also, let's assume that the genes are         \r
+   not directly adjacent to one another in the genome, as might be likely        \r
+   if you have mitochondrial sequences. In this case, you can specify            \r
+   breaks between the genes using:                                               \r
+                                                                                 \r
+      databreaks 970 2567;                                                       \r
+                                                                                 \r
+   The first break, between genes one and two, is after character 970 and        \r
+   the second break, between genes two and three, is after character 2567.       \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Delete                                                                        \r
+                                                                                 \r
+   This command deletes taxa from the analysis. The correct usage is:            \r
+                                                                                 \r
+      delete <name and/or number and/or taxset> ...                              \r
+                                                                                 \r
+   A list of the taxon names or taxon numbers (labelled 1 to ntax in the order   \r
+   in the matrix) or taxset(s) can be used.  For example, the following:         \r
+                                                                                 \r
+      delete 1 2 Homo_sapiens                                                    \r
+                                                                                 \r
+   deletes taxa 1, 2, and the taxon labelled Homo_sapiens from the analysis.     \r
+   You can also use "all" to delete all of the taxa. For example,              \r
+                                                                                 \r
+      delete all                                                                 \r
+                                                                                 \r
+   deletes all of the taxa from the analysis. Of course, a phylogenetic anal-    \r
+   ysis that does not include any taxa is fairly uninteresting.                  \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Disclaimer                                                                    \r
+                                                                                 \r
+   This command shows the disclaimer for the program. In short, the disclaimer   \r
+   states that the authors are not responsible for any silly things you may do   \r
+   to your computer or any unforseen but possibly nasty things the computer      \r
+   program may inadvertently do to you.                                          \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Exclude                                                                       \r
+                                                                                 \r
+   This command excludes characters from the analysis. The correct usage is      \r
+                                                                                 \r
+      exclude <number> <number> <number>                                         \r
+                                                                                 \r
+   or                                                                            \r
+                                                                                 \r
+      exclude <number> - <number>                                                \r
+                                                                                 \r
+   or                                                                            \r
+                                                                                 \r
+      exclude <charset>                                                          \r
+                                                                                 \r
+   or some combination thereof. Moreover, you can use the specifier "\" to    \r
+   exclude every nth character. For example, the following                       \r
+                                                                                 \r
+      exclude 1-100\3                                                           \r
+                                                                                 \r
+   would exclude every third character. As a specific example,                   \r
+                                                                                 \r
+      exclude 2 3 10-14 22                                                       \r
+                                                                                 \r
+   excludes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also,      \r
+                                                                                 \r
+      exclude all                                                                \r
+                                                                                 \r
+   excludes all of the characters from the analysis. Excluding all characters    \r
+   does not leave you much information for inferring phylogeny.                  \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Execute                                                                       \r
+                                                                                 \r
+   This command executes a file called <file name>. The correct usage is:        \r
+                                                                                 \r
+      execute <file name>                                                        \r
+                                                                                 \r
+   For example,                                                                  \r
+                                                                                 \r
+      execute replicase.nex                                                      \r
+                                                                                 \r
+   would execute the file named "replicase.nex". This file must be in the      \r
+   same directory as the executable.                                             \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Help                                                                          \r
+                                                                                 \r
+   This command provides useful information on the use of this program. The      \r
+   correct usage is                                                              \r
+                                                                                 \r
+      help                                                                       \r
+                                                                                 \r
+   which gives a list of all available commands with a brief description of      \r
+   each or                                                                       \r
+                                                                                 \r
+      help <command>                                                             \r
+                                                                                 \r
+   which gives detailed information on the use of <command>.                     \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Include                                                                       \r
+                                                                                 \r
+   This command includes characters that were previously excluded from the       \r
+   analysis. The correct usage is                                                \r
+                                                                                 \r
+      include <number> <number> <number>                                         \r
+                                                                                 \r
+   or                                                                            \r
+                                                                                 \r
+      include <number> - <number>                                                \r
+                                                                                 \r
+   or                                                                            \r
+                                                                                 \r
+      include <charset>                                                          \r
+                                                                                 \r
+   or some combination thereof. Moreover, you can use the specifier "\" to    \r
+   include every nth character. For example, the following                       \r
+                                                                                 \r
+      include 1-100\3                                                           \r
+                                                                                 \r
+   would include every third character. As a specific example,                   \r
+                                                                                 \r
+      include 2 3 10-14 22                                                       \r
+                                                                                 \r
+   includes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also,      \r
+                                                                                 \r
+      include all                                                                \r
+                                                                                 \r
+   includes all of the characters in the analysis. Including all of the          \r
+   characters (even if many of them are bad) is a very total-evidence-like       \r
+   thing to do. Doing this will make a certain group of people very happy.       \r
+   On the other hand, simply using this program would make those same people     \r
+   unhappy.                                                                      \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Link                                                                          \r
+                                                                                 \r
+   This command links model parameters across partitions of the data. The        \r
+   correct usage is:                                                             \r
+                                                                                 \r
+      link <parameter name> = (<all> or <partition list>)                        \r
+                                                                                 \r
+   The list of parameters that can be linked includes:                           \r
+                                                                                 \r
+      Tratio          -- Transition/transversion rate ratio                      \r
+      Revmat          -- Substitution rates of GTR model                         \r
+      Omega           -- Nonsynonymous/synonymous rate ratio                     \r
+      Statefreq       -- Character state frequencies                             \r
+      Shape           -- Gamma/LNorm shape parameter                             \r
+      Pinvar          -- Proportion of invariable sites                          \r
+      Correlation     -- Correlation parameter of autodiscrete gamma             \r
+      Ratemultiplier  -- Rate multiplier for partitions                          \r
+      Switchrates     -- Switching rates for covarion model                      \r
+      Topology        -- Topology of tree                                        \r
+      Brlens          -- Branch lengths of tree                                  \r
+      Speciationrate  -- Speciation rates for birth-death process                \r
+      Extinctionrate  -- Extinction rates for birth-death process                \r
+      Popsize         -- Population size for coalescence process                 \r
+      Growthrate      -- Growth rate of coalescence process                      \r
+      Aamodel         -- Aminoacid rate matrix                                   \r
+      Cpprate         -- Rate of Compound Poisson Process (CPP)                  \r
+      Cppmultdev      -- Standard dev. of CPP rate multipliers (log scale)       \r
+      Cppevents       -- CPP events                                              \r
+      TK02var         -- Variance increase in TK02 relaxed clock model           \r
+      Igrvar          -- Variance increase in IGR relaxed clock model            \r
+      Mixedvar        -- Variance increase in Mixed relaxed clock model          \r
+                                                                                 \r
+   For example,                                                                  \r
+                                                                                 \r
+      link shape=(all)                                                           \r
+                                                                                 \r
+   links the gamma/lnorm shape parameter across all partitions of the data.      \r
+   You can use "showmodel" to see the current linking status of the            \r
+   characters. For more information on this command, see the help menu           \r
+   for link's converse, unlink ("help unlink");                                \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Log                                                                           \r
+                                                                                 \r
+   This command allows output to the screen to also be output to a file.         \r
+   The useage is:                                                                \r
+                                                                                 \r
+      log start/stop filename=<name> append/replace                              \r
+                                                                                 \r
+   The options are:                                                              \r
+                                                                                 \r
+   Start/Stop     -- Starts or stops logging of output to file.                  \r
+   Append/Replace -- Either append to or replace existing file.                  \r
+   Filename       -- Name of log file (currently, the name of the log            \r
+                     file is "log.out").\r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Lset                                                                          \r
+                                                                                 \r
+   This command sets the parameters of the likelihood model. The likelihood      \r
+   function is the probability of observing the data conditional on the phylo-   \r
+   genetic model. In order to calculate the likelihood, you must assume a        \r
+   model of character change. This command lets you tailor the biological        \r
+   assumptions made in the phylogenetic model. The correct usage is              \r
+                                                                                 \r
+      lset <parameter>=<option> ... <parameter>=<option>                         \r
+                                                                                 \r
+   For example, "lset nst=6 rates=gamma" would set the model to a general      \r
+   model of DNA substition (the GTR) with gamma-distributed rate variation       \r
+   across sites.                                                                 \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Applyto   -- This option allows you to apply the lset commands to specific    \r
+                partitions. This command should be the first in the list of      \r
+                commands specified in lset. Moreover, it only makes sense to     \r
+                be using this command if the data have been partitioned. A       \r
+                default partition is set on execution of a matrix. If the data   \r
+                are homogeneous (i.e., all of the same data type), then this     \r
+                partition will not subdivide the characters. Up to 30 other      \r
+                partitions can be defined, and you can switch among them using   \r
+                "set partition=<partition name>". Now, you may want to         \r
+                specify different models to different partitions of the data.    \r
+                Applyto allows you to do this. For example, say you have         \r
+                partitioned the data by codon position, and you want to apply    \r
+                a nst=2 model to the first two partitions and nst=6 to the       \r
+                last. This could be implemented in two uses of lset:             \r
+                                                                                 \r
+                   lset applyto=(1,2) nst=2                                      \r
+                                                                                 \r
+                   lset applyto=(3) nst=6                                        \r
+                                                                                 \r
+                The first applies the parameters after "applyto" to the        \r
+                first and second partitions. The second lset applies nst=6       \r
+                to the third partition. You can also use applyto=(all), which    \r
+                attempts to apply the parameter settings to all of the data      \r
+                partitions. Importantly, if the option is not consistent with    \r
+                the data in the partition, the program will not apply the        \r
+                lset option to that partition.                                   \r
+   Nucmodel  -- This specifies the general form of the nucleotide substitution   \r
+                model. The options are "4by4" [the standard model of DNA       \r
+                substitution in which there are only four states (A,C,G,T/U)],   \r
+                "doublet" (a model appropriate for modelling the stem regions  \r
+                of ribosomal genes where the state space is the 16 doublets of   \r
+                nucleotides), "codon" (the substitution model is expanded      \r
+                around triplets of nucleotides--a codon), and "Protein"        \r
+                (triplets of nucleotides are translated to amino acids, which    \r
+                form the basis of the substitution model).                       \r
+   Nst       -- Sets the number of substitution types: "1" constrains all of   \r
+                the rates to be the same (e.g., a JC69 or F81 model); "2" all- \r
+                ows transitions and transversions to have potentially different  \r
+                rates (e.g., a K80 or HKY85 model); "6" allows all rates to    \r
+                be different, subject to the constraint of time-reversibility    \r
+                (e.g., a GTR model). Finally, 'nst' can be set to 'mixed', which \r
+                results in the Markov chain sampling over the space of all poss- \r
+                ible reversible substitution models, including the GTR model and \r
+                all models that can be derived from it model by grouping the six \r
+                rates in various combinations. This includes all the named models\r
+                above and a large number of others, with or without name.        \r
+   Code      -- Enforces the use of a particular genetic code. The default       \r
+                is the universal code. Other options include "vertmt" for      \r
+                vertebrate mitocondrial, "invermt", "mycoplasma", "yeast", \r
+                "ciliate", "echinoderm", "euplotid", and "metmt" (for    \r
+                metazoan mitochondrial except vertebrates).                      \r
+   Ploidy    -- Specifies the ploidy of the organism. Options are "Haploid",   \r
+                "Diploid" or "Zlinked". This option is used when a coalescent\r
+                prior is used on trees.                                          \r
+   Rates     -- Sets the model for among-site rate variation. In general, the    \r
+                rate at a site is considered to be an unknown random variable.   \r
+                The valid options are:                                           \r
+                * equal    -- No rate variation across sites.                    \r
+                * gamma    -- Gamma-distributed rates across sites. The rate     \r
+                              at a site is drawn from a gamma distribution.      \r
+                              The gamma distribution has a single parameter      \r
+                              that describes how much rates vary.                \r
+                * lnorm    -- Log Normal-distributed rates across sites. The     \r
+                              rate at a site is drawn from a lognormal           \r
+                              distribution. the lognormal distribiton has a      \r
+                              single parameter, sigma (SD) that describes how    \r
+                              much rates vary (mean fixed to log(1.0) == 0.0.    \r
+                * adgamma  -- Autocorrelated rates across sites. The marg-       \r
+                              inal rate distribution is gamma, but adjacent      \r
+                              sites have correlated rates.                       \r
+                * propinv  -- A proportion of the sites are invariable.          \r
+                * invgamma -- A proportion of the sites are invariable while     \r
+                              the rate for the remaining sites are drawn from    \r
+                              a gamma distribution.                              \r
+                Note that MrBayes versions 2.0 and earlier supported options     \r
+                that allowed site specific rates (e.g., ssgamma). In versions    \r
+                3.0 and later, site specific rates are allowed, but set using    \r
+                the 'prset ratepr' command for each partition.                   \r
+   Ngammacat -- Sets the number of rate categories for the gamma distribution.   \r
+                The gamma distribution is continuous. However, it is virtually   \r
+                impossible to calculate likelihoods under the continuous gamma   \r
+                distribution. Hence, an approximation to the continuous gamma    \r
+                is used; the gamma distribution is broken into ncat categories   \r
+                of equal weight (1/ncat). The mean rate for each category rep-   \r
+                resents the rate for the entire cateogry. This option allows     \r
+                you to specify how many rate categories to use when approx-      \r
+                imating the gamma. The approximation is better as ncat is inc-   \r
+                reased. In practice, "ncat=4" does a reasonable job of         \r
+                approximating the continuous gamma.                              \r
+                It is also used to set the number of rate categories for the     \r
+                lognormal distribution to avoid changing too much of the code,   \r
+                although the name is bad (should add Nlnormcat in future).       \r
+   Nbetacat  -- Sets the number of rate categories for the beta distribution.    \r
+                A symmetric beta distribution is used to model the stationary    \r
+                frequencies when morphological data are used. This option        \r
+                specifies how well the beta distribution will be approximated.   \r
+   Omegavar  -- Allows the nonsynonymous/synonymous rate ratio (omega) to vary   \r
+                across codons. Ny98 assumes that there are three classes, with   \r
+                potentially different omega values (omega1, omega2, omega3):     \r
+                omega2 = 1; 0 < omega1 < 1; and omega3 > 1. Like the Ny98 model, \r
+                the M3 model has three omega classes. However, their values are  \r
+                less constrained, with omega1 < omega2 < omega3. The default     \r
+                (omegavar = equal) has no variation on omega across sites.       \r
+   Covarion  -- This forces the use of a covarion-like model of substitution     \r
+                for nucleotide or amino acid data. The valid options are "yes" \r
+                and "no". The covarion model allows the rate at a site to      \r
+                change over its evolutionary history. Specifically, the site     \r
+                is either on or off. When it is off, no substitutions are poss-  \r
+                ible. When the process is on, substitutions occur according to   \r
+                a specified substitution model (specified using the other        \r
+                lset options).                                                   \r
+   Coding    -- This specifies how characters were sampled. If all site patterns \r
+                had the possibility of being sampled, then "All" should be     \r
+                specified (the default). Otherwise "Variable" (only variable   \r
+                characters had the possibility of being sampled), "Informative"\r
+                (only parsimony informative characters has the possibility of    \r
+                being sampled), "Nosingletons" (characters which are constant  \r
+                in all but one taxon were not sampled), "Noabsencesites" (char-\r
+                acters for which all taxa were coded as absent were not sampled),\r
+                "Nopresencesites" (characters for which all taxa were coded as \r
+                present were not sampled). "All" works for all data types.     \r
+                However, the others only work for morphological (All/Variable/   \r
+                Informative/Nosingletons) or restriction site (All/Variable/     \r
+                Informative/Nosingletons/Noabsencesites/Nopresencesites/         \r
+                Nosingletonpresence/Nosingletonabsence) data.                    \r
+   Parsmodel -- This forces calculation under the so-called parsimony model      \r
+                described by Tuffley and Steel (1998). The options are "yes"   \r
+                or "no". Note that the biological assumptions of this model    \r
+                are anything but parsimonious. In fact, this model assumes many  \r
+                more parameters than the next most complicated model implemented \r
+                in this program. If you really believe that the parsimony model  \r
+                makes the biological assumptions described by Tuffley and Steel, \r
+                then the parsimony method is miss-named.                         \r
+                                                                                 \r
+   Default model settings:                                                       \r
+                                                                                 \r
+   Parameter    Options                               Current Setting            \r
+   ------------------------------------------------------------------            \r
+   Nucmodel     4by4/Doublet/Codon/Protein              4by4                       \r
+   Nst          1/2/6/Mixed                             1                       \r
+   Code         Universal/Vertmt/Invermt/Yeast/Mycoplasma/                       \r
+                Ciliate/Echinoderm/Euplotid/Metmt       Universal                       \r
+   Ploidy       Haploid/Diploid/Zlinked                 Diploid                       \r
+   Rates        Equal/Gamma/LNorm/Propinv/                                       \r
+                Invgamma/Adgamma                        Equal                       \r
+   Ngammacat    <number>                                4                       \r
+   Nbetacat     <number>                                5                       \r
+   Omegavar     Equal/Ny98/M3                           Equal                       \r
+   Covarion     No/Yes                                  No                       \r
+   Coding       All/Variable/Informative/Nosingletons                            \r
+                Noabsencesites/Nopresencesites/                                  \r
+                Nosingletonabsence/Nosingletonpresence  All                       \r
+   Parsmodel    No/Yes                                  No                       \r
+   ------------------------------------------------------------------            \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   Manual                                                                        \r
+                                                                                 \r
+   This command allows you to generate a text file containing help information   \r
+   on all the available commands. This text file can be used as an up-to-date    \r
+   command reference. You can set the name of the text file using the            \r
+   "filename" option; the default is "commref_mb<version>.txt".              \r
+                                                                                 \r
+   Parameter       Options                  Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Filename        <name>                   commref_mb3.2.7-svn.txt                                   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Mcmc                                                                          \r
+                                                                                 \r
+   This command starts the Markov chain Monte Carlo (MCMC) analysis. The         \r
+   posterior probability of phylogenetic trees (and other parameters of the      \r
+   substitution model) cannot be determined analytically. Instead, MCMC is       \r
+   used to approximate the posterior probabilities of trees by drawing           \r
+   (dependent) samples from the posterior distribution. This program can         \r
+   implement a variant of MCMC called "Metropolis-coupled Markov chain Monte    \r
+   Carlo", or MCMCMC for short. Basically, "Nchains" are run, with            \r
+   Nchains - 1 of them heated. The chains are labelled 1, 2, ..., Nchains.       \r
+   The heat that is applied to the i-th chain is B = 1 / (1 + temp X i). B       \r
+   is the power to which the posterior probability is raised. When B = 0, all    \r
+   trees have equal probability and the chain freely visits trees. B = 1 is      \r
+   the "cold" chain (or the distribution of interest). MCMCMC can mix          \r
+   better than ordinary MCMC; after all of the chains have gone through          \r
+   one cycle, two chains are chosen at random and an attempt is made to          \r
+   swap the states (with the probability of a swap being determined by the       \r
+   Metropolis et al. equation). This allows the chain to potentially jump        \r
+   a valley in a single bound. The correct usage is                              \r
+                                                                                 \r
+      mcmc <parameter> = <value> ... <parameter> = <value>                       \r
+                                                                                 \r
+   For example,                                                                  \r
+                                                                                 \r
+      mcmc ngen=100000 nchains=4 temp=0.5                                        \r
+                                                                                 \r
+   performs a MCMCMC analysis with four chains with the temperature set to       \r
+   0.5. The chains would be run for 100,000 cycles.                              \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Ngen         -- This option sets the number of cycles for the MCMC alg-       \r
+                   orithm. This should be a big number as you want the chain     \r
+                   to first reach stationarity, and then remain there for        \r
+                   enough time to take lots of samples.                          \r
+   Nruns        -- How many independent analyses are started simultaneously.     \r
+   Nchains      -- How many chains are run for each analysis for the MCMCMC      \r
+                   variant. The default is 4: 1 cold chain and 3 heated chains.  \r
+                   If Nchains is set to 1, MrBayes will use regular MCMC sam-    \r
+                   pling, without heating.                                       \r
+   Temp         -- The temperature parameter for heating the chains. The higher  \r
+                   the temperature, the more likely the heated chains are to     \r
+                   move between isolated peaks in the posterior distribution.    \r
+                   However, excessive heating may lead to very low acceptance    \r
+                   rates for swaps between different chains. Before changing the \r
+                   default setting, however, note that the acceptance rates of   \r
+                   swaps tend to fluctuate during the burn-in phase of the run.  \r
+   Reweight     -- Here, you specify three numbers, that respectively represent  \r
+                   the percentage of characters to decrease in weight, the       \r
+                   percentage of characters to increase in weight, and the       \r
+                   increment. An increase/decrease in weight is acheived by      \r
+                   replicating/removing a character in the matrix. This is       \r
+                   only done to non-cold chains. The format for this parameter   \r
+                   is "reweight=(<number>,<number>)" or "reweight=(<number>,  \r
+                   <number>,<number>)".                                         \r
+   Swapfreq     -- This specifies how often swaps of states between chains are   \r
+                   attempted. You must be running at least two chains for this   \r
+                   option to be relevant. The default is Swapfreq=1, resulting   \r
+                   in Nswaps (see below) swaps being tried each generation of    \r
+                   the run. If Swapfreq is set to 10, then Nswaps swaps will be  \r
+                   tried every tenth generation of the run.                      \r
+   Nswaps       -- The number of swaps tried for each swapping generation of the \r
+                   chain (see also Swapfreq).                                    \r
+   Samplefreq   -- This specifies how often the Markov chain is sampled. You     \r
+                   can sample the chain every cycle, but this results in very    \r
+                   large output files. Thinning the chain is a way of making     \r
+                   these files smaller and making the samples more independent.  \r
+   Printfreq    -- This specifies how often information about the chain is       \r
+                   printed to the screen.                                        \r
+   Printall     -- If set to NO, only cold chains in a MCMC analysis are printed \r
+                   to screen. If set to YES, both cold and heated chains will be \r
+                   output. This setting only affects the printing to screen, it  \r
+                   does not change the way values are written to file.           \r
+   Printmax     -- The maximum number of chains to print to screen.              \r
+   Mcmcdiagn    -- Determines whether acceptance ratios of moves and swaps will  \r
+                   be printed to file. The file will be named similarly to the   \r
+                   '.p' and '.t' files, but will have the ending '.mcmc'. If     \r
+                   more than one independent analysis is run simultaneously (see \r
+                   Nruns below), convergence diagnostics for tree topology will  \r
+                   also be printed to this file. The convergence diagnostic used \r
+                   is the average standard deviation in partition frequency      \r
+                   values across independent analyses. The Burnin setting (see   \r
+                   below) determines how many samples will be discarded as burnin\r
+                   before calculating the partition frequencies. The Minpartfreq \r
+                   setting (see below) determines the minimum partition frequency\r
+                   required for a partition to be included in the calculation. As\r
+                   the independent analyses approach stationarity (converge), the\r
+                   value of the diagnostic is expected to approach zero.         \r
+   Diagnfreq    -- The number of generations between the calculation of MCMC     \r
+                   diagnostics (see Mcmcdiagn above).                            \r
+   Diagnstat    -- The statistic to use for run-time convergence diagnostics.    \r
+                   Choices are 'Avgstddev' for average standard deviation of     \r
+                   split frequencies and 'Maxstddev' for maximum standard devia- \r
+                   tion of split frequencies.                                    \r
+   Savetrees    -- If you are using a relative burnin for run-time convergence   \r
+                   diagnostics, tree samples need to be deleted from split       \r
+                   frequency counters as the cut-off point for the burnin moves  \r
+                   during the run. If 'Savetrees' is set to 'No', tree samples   \r
+                   to be discarded are read back in from file. If 'Savetrees' is \r
+                   set to 'Yes', the tree samples to be removed will be stored   \r
+                   in the internal memory instead. This can use up a lot of      \r
+                   memory in large analyses.                                     \r
+   Minpartfreq  -- The minimum frequency required for a partition to be included \r
+                   in the calculation of the topology convergence diagnostic. The\r
+                   partition is included if the minimum frequency is reached in  \r
+                   at least one of the independent tree samples that are com-    \r
+                   pared.                                                        \r
+   Allchains    -- If this option is set to YES, acceptance ratios for moves are \r
+                   recorded for all chains, cold or heated. By default, only the \r
+                   acceptance ratios for the cold chain are recorded.            \r
+   Allcomps     -- If this option is set to YES, topological convergence diag-   \r
+                   nostics are calculated over all pairwise comparisons of runs. \r
+                   If it is set to NO, only the overall value is reported.       \r
+   Relburnin    -- If this option is set to YES, then a proportion of the sampled\r
+                   values will be discarded as burnin when calculating the con-  \r
+                   vergence diagnostic. The proportion to be discarded is set    \r
+                   with Burninfrac (see below). When the Relburnin option is set \r
+                   to NO, then a specific number of samples will be discarded    \r
+                   instead. This number is set by Burnin (see below).            \r
+   Burnin       -- Determines the number of samples (not generations) that will  \r
+                   be discarded when convergence diagnostics are calculated.     \r
+                   The value of this option is only relevant when Relburnin is   \r
+                   set to NO.                                                    \r
+   BurninFrac   -- Determines the fraction of samples that will be discarded     \r
+                   when convergence diagnostics are calculated. The value of     \r
+                   this option is only relevant when Relburnin is set to YES.    \r
+                   Example: A value for this option of 0.25 means that 25% of   \r
+                   the samples will be discarded.                                \r
+   Stoprule     -- If this option is set to NO, then the chain is run the number \r
+                   of generations determined by Ngen. If it is set to YES, and   \r
+                   topological convergence diagnostics are calculated (Mcmcdiagn \r
+                   is set to YES), then the chain will be stopped before the pre-\r
+                   determined number of generations if the convergence diagnostic\r
+                   falls below the stop value.                                   \r
+   Stopval      -- The critical value for the topological convergence diagnostic.\r
+                   Only used when Stoprule and Mcmcdiagn are set to yes, and     \r
+                   more than one analysis is run simultaneously (Nruns > 1).     \r
+   Checkpoint   -- If this parameter is set to 'Yes', all the current parameter  \r
+                   values of all chains will be printed to a check-pointing file \r
+                   every 'Checkfreq' generation of the analysis. The file will be\r
+                   named <Filename>.ckp and allows you to restart the analysis   \r
+                   from the last check point. This can be handy if you are       \r
+                   running a long analysis and want to extend it, or if there is \r
+                   a risk that a long analysis will be inadvertently interupted  \r
+                   by hardware failure or other factors that are out of your     \r
+                   control.                                                      \r
+   Checkfreq    -- The number of generations between check-pointing. See the     \r
+                   'Checkpoint' parameter above for more information.            \r
+   Filename     -- The name of the files that will be generated. Two files       \r
+                   are generated: "<Filename>.t" and "<Filename>.p".         \r
+                   The .t file contains the trees whereas the .p file con-       \r
+                   tains the sampled values of the parameters.                   \r
+   Startparams  -- The starting values for the model parameters are set to       \r
+                   arbitrary or random values when the parameters are created.   \r
+                   These starting values can be altered using the 'Startvals'    \r
+                   command. The 'Startparams=reset' option allows you to reset   \r
+                   the starting values to the default at the start of the ana-   \r
+                   lysis, overriding any previous user-defined starting values.  \r
+                   Under the default option, 'current', the chains will use the  \r
+                   current starting values.                                      \r
+   Starttree    -- The starting tree(s) for the chain can either be randomly     \r
+                   selected or user-defined. It might be a good idea to          \r
+                   start from randomly chosen trees; convergence seems           \r
+                   likely if independently run chains, each of which             \r
+                   started from different random trees, converge to the same     \r
+                   answer. If you want the chain to start from user-defined      \r
+                   trees instead, you first need to read in your tree(s) from a  \r
+                   Nexus file with a 'trees' block, and then you need to set the \r
+                   starting tree(s) using the 'Startvals' command. Finally, you  \r
+                   need to make sure that 'Starttree' is set to 'current'. If    \r
+                   you do not set the starting tree(s), the chains will start    \r
+                   with random trees. Setting 'Starttree' to 'random' causes     \r
+                   new starting trees to be drawn randomly at the start of the   \r
+                   run, overwriting any previous user-defined starting trees.    \r
+   Nperts       -- This is the number of random perturbations to apply to the    \r
+                   user starting tree. This allows you to have something         \r
+                   between completely random and user-defined trees start        \r
+                   the chain.                                                    \r
+   Data         -- When Data is set to NO, the chain is run without data. This   \r
+                   should be used only for examining induced priors. DO NOT SET  \r
+                   'DATA' TO 'NO' UNLESS YOU KNOW WHAT YOU ARE DOING!            \r
+   Ordertaxa    -- Determines whether taxa should be ordered before trees are    \r
+                   printed to file. If set to 'Yes', terminals in the sampled    \r
+                   trees will be reordered to match the order of the taxa in the \r
+                   data matrix as closely as possible. By default, trees will be \r
+                   printed without reordering of taxa.                           \r
+   Append       -- Set this to 'Yes' to append the results of the current run to \r
+                   a previous run. MrBayes will first read in the results of the \r
+                   previous run (number of generations and sampled splits) and   \r
+                   will then continue that run where you left it off. Make sure  \r
+                   that the output file names used in the previous run are the   \r
+                   same as those in the current run.                             \r
+   Autotune     -- Set this to 'Yes' to autotune the proposals that change       \r
+                   substitution model parameters. When set to 'No', the tuning   \r
+                   parameters are fixed to their starting values. Note that the  \r
+                   autotuning occurs independently for each chain. The target    \r
+                   acceptance rate for each move can be changed using the        \r
+                   'Propset' command.                                            \r
+   Tunefreq     -- When a proposal has been tried 'Tunefreq' times, its tuning   \r
+                   parameter is adjusted to reach the target acceptance rate     \r
+                   if 'Autotune' is set to 'Yes'.                                \r
+                                                                                 \r
+   Parameter       Options               Current Setting                         \r
+   -----------------------------------------------------                         \r
+   Ngen            <number>              1000000                                      \r
+   Nruns           <number>              2                                      \r
+   Nchains         <number>              4                                      \r
+   Temp            <number>              0.100000                                     \r
+   Reweight        <number>,<number>     0.00 v 0.00 ^                       \r
+   Swapfreq        <number>              1                                      \r
+   Nswaps          <number>              1                                      \r
+   Samplefreq      <number>              500                                      \r
+   Printfreq       <number>              1000                                      \r
+   Printall        Yes/No                Yes                                      \r
+   Printmax        <number>              8                                      \r
+   Mcmcdiagn       Yes/No                Yes                                      \r
+   Diagnfreq       <number>              5000                                      \r
+   Diagnstat       Avgstddev/Maxstddev   Avgstddev                                     \r
+   Minpartfreq     <number>              0.10                                 \r
+   Allchains       Yes/No                No                                     \r
+   Allcomps        Yes/No                No                                     \r
+   Relburnin       Yes/No                Yes                                     \r
+   Burnin          <number>              0                                     \r
+   Burninfrac      <number>              0.25                                 \r
+   Stoprule        Yes/No                No                                     \r
+   Stopval         <number>              0.05                                 \r
+   Savetrees       Yes/No                No                                     \r
+   Checkpoint      Yes/No                Yes                                     \r
+   Checkfreq       <number>              2000                                     \r
+   Filename        <name>                temp.<p/t>\r
+   Startparams     Current/Reset         Current                                     \r
+   Starttree       Current/Random/       Current                                     \r
+                   Parsimony                                                    \r
+   Nperts          <number>              0                                     \r
+   Data            Yes/No                Yes                                     \r
+   Ordertaxa       Yes/No                No                                     \r
+   Append          Yes/No                No                                     \r
+   Autotune        Yes/No                Yes                                     \r
+   Tunefreq        <number>              100                                     \r
+                                                                                \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Mcmcp                                                                         \r
+                                                                                 \r
+   This command sets the parameters of the Markov chain Monte Carlo (MCMC)       \r
+   analysis without actually starting the chain. This command is identical       \r
+   in all respects to Mcmc, except that the analysis will not start after        \r
+   this command is issued. For more details on the options, check the help       \r
+   menu for Mcmc.\r
+                                                                                 \r
+   Parameter       Options               Current Setting                         \r
+   -----------------------------------------------------                         \r
+   Ngen            <number>              1000000                                      \r
+   Nruns           <number>              2                                      \r
+   Nchains         <number>              4                                      \r
+   Temp            <number>              0.100000                                     \r
+   Reweight        <number>,<number>     0.00 v 0.00 ^                       \r
+   Swapfreq        <number>              1                                      \r
+   Nswaps          <number>              1                                      \r
+   Samplefreq      <number>              500                                      \r
+   Printfreq       <number>              1000                                      \r
+   Printall        Yes/No                Yes                                      \r
+   Printmax        <number>              8                                      \r
+   Mcmcdiagn       Yes/No                Yes                                      \r
+   Diagnfreq       <number>              5000                                      \r
+   Diagnstat       Avgstddev/Maxstddev   Avgstddev                                     \r
+   Minpartfreq     <number>              0.10                                 \r
+   Allchains       Yes/No                No                                     \r
+   Allcomps        Yes/No                No                                     \r
+   Relburnin       Yes/No                Yes                                     \r
+   Burnin          <number>              0                                     \r
+   Burninfrac      <number>              0.25                                 \r
+   Stoprule        Yes/No                No                                     \r
+   Stopval         <number>              0.05                                 \r
+   Savetrees       Yes/No                No                                     \r
+   Checkpoint      Yes/No                Yes                                     \r
+   Checkfreq       <number>              2000                                     \r
+   Filename        <name>                temp.<p/t>\r
+   Startparams     Current/Reset         Current                                     \r
+   Starttree       Current/Random/       Current                                     \r
+                   Parsimony                                                    \r
+   Nperts          <number>              0                                     \r
+   Data            Yes/No                Yes                                     \r
+   Ordertaxa       Yes/No                No                                     \r
+   Append          Yes/No                No                                     \r
+   Autotune        Yes/No                Yes                                     \r
+   Tunefreq        <number>              100                                     \r
+                                                                                \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Outgroup                                                                      \r
+                                                                                 \r
+   This command assigns a taxon to the outgroup. The correct usage is:           \r
+                                                                                 \r
+      outgroup <number>/<taxon name>                                             \r
+                                                                                 \r
+   For example, "outgroup 3" assigns the third taxon in the matrix to be       \r
+   the outgroup. Similarly, "outgroup Homo_sapiens" assings the taxon          \r
+   "Homo_sapiens" to be the outgroup (assuming that there is a taxon named     \r
+   "Homo_sapiens" in the matrix). Only a single taxon can be assigned to       \r
+   be the outgroup.                                                              \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Pairs                                                                         \r
+                                                                                 \r
+   This command is used to specify pairs of nucleotides. For example, your       \r
+   data may be RNA sequences with a known secondary structure of stems and       \r
+   loops. Substitutions in nucleotides involved in a Watson-Crick pairing        \r
+   in stems are not strictly independent; a change in one changes the prob-      \r
+   ability of a change in the partner. A solution to this problem is to          \r
+   expand the model around the pair of nucleotides in the stem. This             \r
+   command allows you to do this. The correct usage is:                          \r
+                                                                                 \r
+      pairs <NUC1>:<NUC2>, <NUC1>:<NUC2>,..., <NUC1>:<NUC2>;                     \r
+                                                                                 \r
+   For example,                                                                  \r
+                                                                                 \r
+      pairs 30:56, 31:55, 32:54, 33:53, 34:52, 35:51, 36:50;                     \r
+                                                                                 \r
+   specifies pairings between nucleotides 30 and 56, 31 and 55, etc. Only        \r
+   nucleotide data (DNA or RNA) may be paired using this command. Note that      \r
+   in order for the program to actually implement a "doublet" model            \r
+   involving a 16 X 16 rate matrix, you must specify that the structure of       \r
+   the model is 16 X 16 using "lset nucmodel=doublet".                         \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Partition                                                                     \r
+                                                                                 \r
+   This command allows you to specify a character partition. The format for      \r
+   this command is                                                               \r
+                                                                                 \r
+      partition <name> = <num parts>:<chars in first>, ...,<chars in last>       \r
+                                                                                 \r
+   For example, "partition by_codon = 3:1st_pos,2nd_pos,3rd_pos" specifies     \r
+   a partition called "by_codon" which consists of three parts (first,         \r
+   second, and third codon positions). Here, we are assuming that the sites      \r
+   in each partition were defined using the charset command. You can specify     \r
+   a partition without using charset as follows:                                 \r
+                                                                                 \r
+      partition by_codon = 3:1 4 6 9 12,2 5 7 10 13,3 6 8 11 14                  \r
+                                                                                 \r
+   However, we recommend that you use the charsets to define a set of char-      \r
+   acters and then use these predefined sets when defining the partition.        \r
+   Also, it makes more sense to define a partition as a line in the mrbayes      \r
+   block than to issue the command from the command line (then again, you        \r
+   may be a masochist, and want to do extra work).                               \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Plot                                                                          \r
+                                                                                 \r
+   This command plots specified parameters in the .p file or one of the .p files \r
+   created during an MCMC analysis. An x-y graph of the parameter over the course\r
+   of the chain is created. The command can be useful for visually diagnosing    \r
+   convergence for many of the parameters of the phylogenetic model. The para-   \r
+   meter to be plotted is specified by the "parameter" option. Several para-   \r
+   meters can be plotted at once by using the "match" option, which has a      \r
+   default value of "perfect". For example, if you were to set "parameter = pi"\r
+   and "match = consistentwith", then all of the state frequency parameters    \r
+   would be plotted. You can also set "match=all", in which case all of the    \r
+   parameters are plotted.                                                       \r
+                                                                                 \r
+   Note that the "Sump" command provides a different set of convergence diag-  \r
+   nostics tools that you may also want to explore. Unlike "Plot", "Sump" can\r
+   compare two or more parameter samples and will calculate convergence diagnos- \r
+   tics as wel as parameter summaries for the pooled sample.                     \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Relburnin     -- If this option is set to 'Yes', then a proportion of the     \r
+                    samples will be discarded as burnin when creating the plot.  \r
+                    The proportion to be discarded is set with Burninfrac (see   \r
+                    Burninfrac below). When the Relburnin option is set to 'No', \r
+                    then a specific number of samples is discarded instead. This \r
+                    number is set by Burnin (see below). Note that the burnin    \r
+                    setting is shared across the 'comparetree', 'sump' and 'sumt'\r
+                    commands.                                                    \r
+   Burnin        -- Determines the number of samples (not generations) that will \r
+                    be discarded when summary statistics are calculated. The     \r
+                    value of this option is only relevant when Relburnin is set  \r
+                    to 'No'.                                                     \r
+   Burninfrac    -- Determines the fraction of samples that will be discarded    \r
+                    when creating a plot. The value of this parameter is only    \r
+                    relevant when Relburnin is set to 'Yes'. Example: A value of \r
+                    this option of 0.25 means that 25% of the samples will be   \r
+                    discarded.                                                   \r
+   Filename      -- The name of the file to plot.                                \r
+   Parameter     -- Specification of parameters to be plotted. See above for     \r
+                    details.                                                     \r
+   Match         -- Specifies how to match parameter names to the Parameter      \r
+                    specification. See above for details.                        \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter       Options                      Current Setting                  \r
+   ------------------------------------------------------------                  \r
+   Relburnin       Yes/No                       Yes                               \r
+   Burnin          <number>                     0                               \r
+   Burninfrac      <number>                     0.25                           \r
+   Filename        <name>                       temp.p                               \r
+   Parameter       <name>                       lnL                               \r
+   Match           Perfect/Consistentwith/All   Perfect                               \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Prset                                                                         \r
+                                                                                 \r
+   This command sets the priors for the phylogenetic model. Remember that        \r
+   in a Bayesian analysis, you must specify a prior probability distribution     \r
+   for the parameters of the likelihood model. The prior distribution rep-       \r
+   resents your prior beliefs about the parameter before observation of the      \r
+   data. This command allows you to tailor your prior assumptions to a large     \r
+   extent.                                                                       \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Applyto       -- This option allows you to apply the prset commands to        \r
+                    specific partitions. This command should be the first        \r
+                    in the list of commands specified in prset. Moreover, it     \r
+                    only makes sense to be using this command if the data        \r
+                    have been partitioned. A default partition is set on         \r
+                    execution of a matrix. If the data are homogeneous           \r
+                    (i.e., all of the same data type), then this partition       \r
+                    will not subdivide the characters. Up to 30 other part-      \r
+                    itions can be defined, and you can switch among them using   \r
+                    "set partition=<partition name>". Now, you may want to     \r
+                    specify different priors to different partitions of the      \r
+                    data. Applyto allows you to do this. For example, say        \r
+                    you have partitioned the data by codon position, and         \r
+                    you want to fix the statefreqs to equal for the first two    \r
+                    partitions but apply a flat Dirichlet prior to the state-    \r
+                    freqs of the last. This could be implemented in two uses of  \r
+                    prset:                                                       \r
+                                                                                 \r
+                       prset applyto=(1,2) statefreqs=fixed(equal)               \r
+                                                                                 \r
+                       prset applyto=(3) statefreqs=dirichlet(1,1,1,1)           \r
+                                                                                 \r
+                    The first applies the parameters after "applyto"           \r
+                    to the first and second partitions. The second prset         \r
+                    applies a flat Dirichlet to the third partition. You can     \r
+                    also use applyto=(all), which attempts to apply the para-    \r
+                    meter settings to all of the data partitions. Importantly,   \r
+                    if the option is not consistent with the data in the part-   \r
+                    ition, the program will not apply the prset option to        \r
+                    that partition.                                              \r
+   Tratiopr      -- This parameter sets the prior for the transition/trans-      \r
+                    version rate ratio (tratio). The options are:                \r
+                                                                                 \r
+                       prset tratiopr = beta(<number>, <number>)                 \r
+                       prset tratiopr = fixed(<number>)                          \r
+                                                                                 \r
+                    The program assumes that the transition and transversion     \r
+                    rates are independent gamma-distributed random variables     \r
+                    with the same scale parameter when beta is selected. If you  \r
+                    want a diffuse prior that puts equal emphasis on transition/ \r
+                    transversion rate ratios above 1.0 and below 1.0, then use a \r
+                    flat Beta, beta(1,1), which is the default. If you wish to   \r
+                    concentrate this distribution more in the equal-rates region,\r
+                    then use a prior of the type beta(x,x), where the magnitude  \r
+                    of x determines how much the prior is concentrated in the    \r
+                    equal rates region. For instance, a beta(20,20) puts more    \r
+                    probability on rate ratios close to 1.0 than a beta(1,1). If \r
+                    you think it is likely that the transition/transversion rate \r
+                    ratio is 2.0, you can use a prior of the type beta(2x,x),    \r
+                    where x determines how strongly the prior is concentrated on \r
+                    tratio values near 2.0. For instance, a beta(2,1) is much    \r
+                    more diffuse than a beta(80,40) but both have the expected   \r
+                    tratio 2.0 in the absence of data. The parameters of the     \r
+                    Beta can be interpreted as counts: if you have observed x    \r
+                    transitions and y transversions, then a beta(x+1,y+1) is a   \r
+                    good representation of this information. The fixed option    \r
+                    allows you to fix the tratio to a particular value.          \r
+   Revmatpr      -- This parameter sets the prior for the substitution rates     \r
+                    of the GTR model for nucleotide data. The options are:       \r
+                                                                                 \r
+                       prset revmatpr = dirichlet(<number>,<number>,...,<number>)\r
+                       prset revmatpr = fixed(<number>,<number>,...,<number>)    \r
+                                                                                 \r
+                    The program assumes that the six substitution rates          \r
+                    are independent gamma-distributed random variables with the  \r
+                    same scale parameter when dirichlet is selected. The six     \r
+                    numbers in brackets each corresponds to a particular substi- \r
+                    tution type. Together, they determine the shape of the prior.\r
+                    The six rates are in the order A<->C, A<->G, A<->T, C<->G,   \r
+                    C<->T, and G<->T. If you want an uninformative prior you can \r
+                    use dirichlet(1,1,1,1,1,1), also referred to as a 'flat'     \r
+                    Dirichlet. This is the default setting. If you wish a prior  \r
+                    where the C<->T rate is 5 times and the A<->G rate 2 times   \r
+                    higher, on average, than the transversion rates, which are   \r
+                    all the same, then you should use a prior of the form        \r
+                    dirichlet(x,2x,x,x,5x,x), where x determines how much the    \r
+                    prior is focused on these particular rates. For more info,   \r
+                    see tratiopr. The fixed option allows you to fix the substi- \r
+                    tution rates to particular values.                           \r
+   Revratepr     -- This parameter sets the prior for each substitution rate of  \r
+                    the GTR model subspace when 'nst' is set to 'mixed' (see the \r
+                    'lset' command). The only option is                          \r
+                                                                                 \r
+                       prset revratepr = symdir(<number>)                        \r
+                                                                                 \r
+                    which will associate each independent rate in the rate matrix\r
+                    with a modified symmetric Dirichlet prior, where a singleton \r
+                    rate has the specified alpha parameter, while a rate that    \r
+                    applies to n pairwise substitution types has an alpha that is\r
+                    n times the specified number. The higher the specified num-  \r
+                    ber, the more focused the prior will be on equal rates. The  \r
+                    default value is 1, which gives an effect similar to a flat  \r
+                    Dirichlet.                                                   \r
+   Aamodelpr     -- This parameter sets the rate matrix for amino acid data.     \r
+                    You can either fix the model by specifying aamodelpr=fixed   \r
+                    (<model name>), where <model name> is 'poisson' (a glorified \r
+                    Jukes-Cantor model), 'jones', 'dayhoff', 'mtrev', 'mtmam',   \r
+                    'wag', 'rtrev', 'cprev', 'vt', 'blosum', 'lg', 'equalin'     \r
+                    (a glorified Felsenstein 1981 model), or 'gtr'. You can also \r
+                    average over the first ten models by specifying aamodelpr=   \r
+                    mixed. If you do so, the Markov chain will sample each model \r
+                    according to its probability. The sampled model is reported  \r
+                    as an index: poisson(0), jones(1), dayhoff(2), mtrev(3),     \r
+                    mtmam(4), wag(5), rtrev(6), cprev(7), vt(8), or blosum(9).   \r
+                    The 'Sump' command summarizes the MCMC samples and calculates\r
+                    the posterior probability estimate for each of these models. \r
+   Aarevmatpr    -- This parameter sets the prior for the substitution rates     \r
+                    of the GTR model for amino acid data. The options are:       \r
+                                                                                 \r
+                       prset aarevmatpr = dirichlet(<number>,<number>,...,<number>)\r
+                       prset aarevmatpr = fixed(<number>,<number>,...,<number>)  \r
+                                                                                 \r
+                    The options are the same as those for 'Revmatpr' except that \r
+                    they are defined over the 190 rates of the time-reversible   \r
+                    GTR model for amino acids instead of over the 6 rates of the \r
+                    GTR model for nucleotides. The rates are in the order A<->R, \r
+                    A<->N, etc to Y<->V. In other words, amino acids are listed  \r
+                    in alphabetic order based on their full name. The first amino\r
+                    acid (Alanine) is then combined in turn with all amino acids \r
+                    following it in the list, starting with amino acid 2 (Argi-  \r
+                    nine) and finishing with amino acid 20 (Valine). The second  \r
+                    amino acid (Arginine) is then combined in turn with all amino\r
+                    acids following it, starting with amino acid 3 (Asparagine)  \r
+                    and finishing with amino acid 20 (Valine), and so on.        \r
+   Omegapr       -- This parameter specifies the prior on the nonsynonymous/     \r
+                    synonymous rate ratio. The options are:                      \r
+                                                                                 \r
+                       prset omegapr = dirichlet(<number>,<number>)              \r
+                       prset omegapr = fixed(<number>)                           \r
+                                                                                 \r
+                    This parameter is only in effect if the nucleotide sub-      \r
+                    stitution model is set to codon using the lset command       \r
+                    (lset nucmodel=codon). Moreover, it only applies to the      \r
+                    case when there is no variation in omega across sites (i.e., \r
+                    "lset omegavar=equal").                                    \r
+   Ny98omega1pr  -- This parameter specifies the prior on the nonsynonymous/     \r
+                    synonymous rate ratio for sites under purifying selection.   \r
+                    The options are:                                             \r
+                                                                                 \r
+                       prset Ny98omega1pr = beta(<number>,<number>)              \r
+                       prset Ny98omega1pr = fixed(<number>)                      \r
+                                                                                 \r
+                    This parameter is only in effect if the nucleotide sub-      \r
+                    stitution model is set to codon using the lset command       \r
+                    (lset nucmodel=codon). Moreover, it only applies to the      \r
+                    case where omega varies across sites using the model of      \r
+                    Nielsen and Yang (1998) (i.e., "lset omegavar=ny98"). If   \r
+                    fixing the parameter, you must specify a number between      \r
+                    0 and 1.                                                     \r
+   Ny98omega3pr  -- This parameter specifies the prior on the nonsynonymous/     \r
+                    synonymous rate ratio for positively selected sites. The     \r
+                    options are:                                                 \r
+                                                                                 \r
+                       prset Ny98omega3pr = uniform(<number>,<number>)           \r
+                       prset Ny98omega3pr = exponential(<number>)                \r
+                       prset Ny98omega3pr = fixed(<number>)                      \r
+                                                                                 \r
+                    This parameter is only in effect if the nucleotide sub-      \r
+                    stitution model is set to codon using the lset command       \r
+                    (lset nucmodel=codon). Moreover, it only applies to the      \r
+                    case where omega varies across sites according to the        \r
+                    NY98 model. Note that if the NY98 model is specified         \r
+                    that this parameter must be greater than 1, so you should    \r
+                    not specify a uniform(0,10) prior, for example.              \r
+   M3omegapr     -- This parameter specifies the prior on the nonsynonymous/     \r
+                    synonymous rate ratios for all three classes of sites for    \r
+                    the M3 model. The options are:                               \r
+                                                                                 \r
+                       prset M3omegapr = exponential                             \r
+                       prset M3omegapr = fixed(<number>,<number>,<number>)       \r
+                                                                                 \r
+                    This parameter is only in effect if the nucleotide sub-      \r
+                    stitution model is set to codon using the lset command       \r
+                    (lset nucmodel=codon). Moreover, it only applies to the      \r
+                    case where omega varies across sites using the M3 model of   \r
+                    Yang et al. (2000) (i.e., "lset omegavar=M3"). Under the   \r
+                    exponential prior, the four rates (dN1, dN2, dN3, and dS)    \r
+                    are all considered to be independent draws from the same     \r
+                    exponential distribution (the parameter of the exponential   \r
+                    does not matter, and so you don't need to specify it). The   \r
+                    rates dN1, dN2, and dN3 are taken to be the order statistics \r
+                    with dN1 < dN2 < dN3. These three rates are all scaled to    \r
+                    the same synonymous rate, dS. The other option is to simply  \r
+                    fix the three rate ratios to some values.                    \r
+   Codoncatfreqs -- This parameter specifies the prior on frequencies of sites   \r
+                    under purifying, neutral, and positive selection. The        \r
+                    options are:                                                 \r
+                                                                                 \r
+                       prset codoncatfreqs = dirichlet(<num>,<num>,<num>)        \r
+                       prset codoncatfreqs = fixed(<number>,<number>,<number>)   \r
+                                                                                 \r
+                    This parameter is only in effect if the nucleotide sub-      \r
+                    stitution model is set to codon using the lset command       \r
+                    (lset nucmodel=codon). Moreover, it only applies to the      \r
+                    case where omega varies across sites using the models of     \r
+                    Nielsen and Yang (1998) (i.e., "lset omegavar=ny98")       \r
+                    or Yang et al. (2000) (i.e., "lset omegavar=M3")           \r
+                    Note that the sum of the three frequencies must be 1.        \r
+   Statefreqpr   -- This parameter specifies the prior on the state freq-        \r
+                    uencies. The options are:                                    \r
+                                                                                 \r
+                       prset statefreqpr = dirichlet(<number>)                   \r
+                       prset statefreqpr = dirichlet(<number>,...,<number>)      \r
+                       prset statefreqpr = fixed(equal)                          \r
+                       prset statefreqpr = fixed(empirical)                      \r
+                       prset statefreqpr = fixed(<number>,...,<number>)          \r
+                                                                                 \r
+                    For the dirichlet, you can specify either a single number    \r
+                    or as many numbers as there are states. If you specify a     \r
+                    single number, then the prior has all states equally         \r
+                    probable with a variance related to the single parameter     \r
+                    passed in.                                                   \r
+   Shapepr       -- This parameter specifies the prior for the gamma/lnorm shape \r
+                    parameter for among-site rate variation. The options are:    \r
+                                                                                 \r
+                       prset shapepr = uniform(<number>,<number>)                \r
+                       prset shapepr = exponential(<number>)                     \r
+                       prset shapepr = fixed(<number>)                           \r
+                                                                                 \r
+   Pinvarpr      -- This parameter specifies the prior for the proportion of     \r
+                    invariable sites. The options are:                           \r
+                                                                                 \r
+                       prset pinvarpr = uniform(<number>,<number>)               \r
+                       prset pinvarpr = fixed(<number>)                          \r
+                                                                                 \r
+                    Note that the valid range for the parameter is between 0     \r
+                    and 1. Hence, "prset pinvarpr=uniform(0,0.8)" is valid     \r
+                    while "prset pinvarpr=uniform(0,10)" is not. The def-      \r
+                    ault setting is "prset pinvarpr=uniform(0,1)".             \r
+   Ratecorrpr    -- This parameter specifies the prior for the autocorrelation   \r
+                    parameter of the autocorrelated gamma distribution for       \r
+                    among-site rate variation. The options are:                  \r
+                                                                                 \r
+                       prset ratecorrpr = uniform(<number>,<number>)             \r
+                       prset ratecorrpr = fixed(<number>)                        \r
+                                                                                 \r
+                    Note that the valid range for the parameter is between -1    \r
+                    and 1. Hence, "prset ratecorrpr=uniform(-1,1)" is valid    \r
+                    while "prset ratecorrpr=uniform(-11,10)" is not. The       \r
+                    default setting is "prset ratecorrpr=uniform(-1,1)".       \r
+   Covswitchpr   -- This option sets the prior for the covarion switching        \r
+                    rates. The options are:                                      \r
+                                                                                 \r
+                       prset covswitchpr = uniform(<number>,<number>)            \r
+                       prset covswitchpr = exponential(<number>)                 \r
+                       prset covswitchpr = fixed(<number>,<number>)              \r
+                                                                                 \r
+                    The covarion model has two rates: a rate from on to off      \r
+                    and a rate from off to on. The rates are assumed to have     \r
+                    independent priors that individually are either uniformly    \r
+                    or exponentially distributed. The other option is to         \r
+                    fix the switching rates, in which case you must specify      \r
+                    both rates. (The first number is off->on and the second      \r
+                    is on->off).                                                 \r
+   Symdirihyperpr - This option sets the prior for the stationary frequencies    \r
+                    of the states for morphological (standard) data. There can   \r
+                    be as many as 10 states for standard data. However, the      \r
+                    labelling of the states is somewhat arbitrary. For example,  \r
+                    the state "1" for different characters does not have the   \r
+                    same meaning. This is not true for DNA characters, for ex-   \r
+                    ample, where a "G" has the same meaning across characters. \r
+                    The fact that the labelling of morphological characters is   \r
+                    arbitrary makes it difficult to allow unequal character-     \r
+                    state frequencies. MrBayes gets around this problem by       \r
+                    assuming that the states have a symmetric Dirichlet prior    \r
+                    (i.e. all Dirichlet parameters are equal). The variation in  \r
+                    the Dirichlet can be controlled by this parameter.           \r
+                    Symdirihyperpr specifies the distribution on the parameter   \r
+                    of the symmetric Dirichlet. The valid options are:           \r
+                                                                                 \r
+                       prset Symdirihyperpr = uniform(<number>,<number>)         \r
+                       prset Symdirihyperpr = exponential(<number>)              \r
+                       prset Symdirihyperpr = fixed(<number>)                    \r
+                       prset Symdirihyperpr = fixed(infinity)                    \r
+                                                                                 \r
+                    If "fixed(infinity)" is chosen, the Dirichlet prior is     \r
+                    fixed such that all character states have equal frequency.   \r
+   Topologypr    -- This parameter specifies the prior probabilities of          \r
+                    phylogenies. The options are:                                \r
+                                                                                 \r
+                       prset topologypr = uniform                                \r
+                       prset topologypr = speciestree                            \r
+                       prset topologypr = constraints(<list>)                    \r
+                       prset topologypr = fixed(<treename>)                      \r
+                                                                                 \r
+                    If the prior is selected to be "uniform", the default,     \r
+                    then all possible trees are considered a priori equally      \r
+                    probable. The 'speciestree' option is used when the topology \r
+                    is constrained to fold inside a species tree together with   \r
+                    other (gene) trees. The constraints option allows you to     \r
+                    specify complicated prior probabilities on trees (constraints\r
+                    are discussed more fully in "help constraint"). Note that  \r
+                    you must specify a list of constraints that you wish to be   \r
+                    obeyed. The list can be either the constraints' name or      \r
+                    number. Finally, you can fix the topology to that of a user  \r
+                    tree defined in a trees block. Branch lengths will still be  \r
+                    sampled as usual on the fixed topology.                      \r
+   Brlenspr      -- This parameter specifies the prior probability dist-         \r
+                    ribution on branch lengths. The options are specified using: \r
+                                                                                 \r
+                       prset brlenspr = <setting>                                \r
+                                                                                 \r
+                    where <setting> is one of                                    \r
+                                                                                 \r
+                       unconstrained:uniform(<num>,<num>)                        \r
+                       unconstrained:exponential(<number>)                       \r
+                       unconstrained:twoexp(<num>,<num>)                         \r
+                       unconstrained:gammadir(<num>,<num>,<num>,<num>)           \r
+                       unconstrained:invgamdir(<num>,<num>,<num>,<num>)          \r
+                       clock:uniform                                             \r
+                       clock:birthdeath                                          \r
+                       clock:coalescence                                         \r
+                       clock:fossilization                                       \r
+                       clock:speciestree                                         \r
+                       fixed(<treename>)                                         \r
+                                                                                 \r
+                    Trees with unconstrained branch lengths are unrooted         \r
+                    whereas clock-constrained trees are rooted. The option       \r
+                    after the colon specifies the details of the probability     \r
+                    density of branch lengths. If you choose a birth-death       \r
+                    or coalescence prior, you may want to modify the details     \r
+                    of the parameters of those processes (speciation rate,       \r
+                    extinction rate and sample probability for the birth-death   \r
+                    prior; population size and clock rate parameter for the      \r
+                    coalescence prior). When gene trees are constrained to fold  \r
+                    inside species trees, the appropriate branch length prior is \r
+                    'clock:speciestree'. Under this model, it is possible to     \r
+                    control whether the population size is constant or variable  \r
+                    across the species tree using the 'popvarpr' setting.        \r
+                    Branch lengths can also be fixed but only if the topology is \r
+                    fixed.                                                       \r
+                                                                                 \r
+                    For unconstrained branch lengths, MrBayes offers five alter- \r
+                    native prior distributions. The first two are the simple     \r
+                    'uniform' and 'exponential' priors. The 'uniform' prior takes\r
+                    two parameters, the lower and upper bound of the uniform dis-\r
+                    tribution, respectively. The 'exponential' prior takes a sin-\r
+                    gle parameter, the rate of the exponential distribution. The \r
+                    mean of the exponential distribution is the inverse of the   \r
+                    rate. For instance, an 'exp(10)' distribution has an expected\r
+                    mean of 0.1.                                                 \r
+                    MrBayes also offers three more complex prior distributions   \r
+                    on unconstrained branch lengths. The two-exponential prior   \r
+                    (Yang and Rannala 2005; Yang 2007) uses two different expo-  \r
+                    nential distributions, one for internal and one for external \r
+                    branch lengths. The two-exponential prior is invoked using   \r
+                    'twoexp(<r_I>,<r_E>)', where '<r_I>' is a number specifying  \r
+                    the rate of the exponential distribution on internal branch  \r
+                    lengths, while '<r_E>' is the rate for external branch       \r
+                    lengths. The prior mean for internal branch lengths is then  \r
+                    1/r_I, and for external ones is 1/r_E. For instance, to set  \r
+                    prior mean of internal branch lengths to 0.01, and external  \r
+                    ones to 0.1, use 'twoexp(100,10)'.                           \r
+                    The setting 'twoexp(10,10)' is equivalent to 'exp(10)'.      \r
+                    The compound Dirichlet priors 'gammadir(<a_T>,<b_T>,<a>,<c>)'\r
+                    and 'invgamdir(<a_T>,<b_T>,<a>,<c>)' specify a fairly diffuse\r
+                    prior on tree length 'T', and then partition the tree length \r
+                    into branch lengths according to a Dirichlet distribution    \r
+                    (Rannala et al. 2012). If 'T' is considered drawn from a     \r
+                    gamma distribution with parameters a_T and b_T, and with mean\r
+                    a_T/b_T, we recommend setting a_T = 1; if it is instead con- \r
+                    sidered drawn from an inverse gamma (invgamma) distribution  \r
+                    with parameters a_T and b_T, and with mean b_T/(a_T -1), then\r
+                    we reccommend setting a_T = 3. In the latter case, b_T should\r
+                    be chosen so that the prior mean of T is reasonable for the  \r
+                    data. In the former case, setting b_T = 0.1 (corresponding to\r
+                    a mean tree length of 10) should be appropriate for a wide   \r
+                    range of tree lengths (at least in the interval 1 to 100).   \r
+                    The concentration parameter a of the Dirichlet distribution  \r
+                    is inversely related to the variance of the branch lengths,  \r
+                    while c is the ratio of the prior means for the internal and \r
+                    external branch lengths. The default setting, a = c = 1,     \r
+                    specifies a uniform Dirichlet distribution of branch lengths \r
+                    given the tree length. For instance, 'gammadir(1,0.1,1,1)'   \r
+                    specifies a compound Dirichlet prior on branch lengths, where\r
+                    tree length is associated with a gamma distribution with mean\r
+                    10, and branch length proportions are associated with a uni- \r
+                    form Dirichlet distribution (default).                       \r
+                                                                                 \r
+                    For clock trees with calibrated external nodes (fossils),    \r
+                    MrBayes also offers the fossilized birth-death prior:        \r
+                    'clock:fossilization'.                                       \r
+                    If 'SampleStrat' is set to 'fossiltip', it assumes that upon \r
+                    sampling the lineage is dead and won't produce descendants,  \r
+                    meaning each fossil sample is a tip. If 'SampleStrat' is set \r
+                    to 'random' (default), fossils are sampled serially along the\r
+                    birth-death tree (Stadler 2010), so they can be tips or an-  \r
+                    cestors. See 'Speciationpr', 'Extinctionpr', 'SampleStrat',  \r
+                    'Fossilizationpr' for more information.                      \r
+                                                                                 \r
+   Treeagepr     -- This parameter specifies the prior probability distribution  \r
+                    on the tree age when a uniform or fossilization prior is used\r
+                    on the branch lengths of a clock tree.                       \r
+                                                                                 \r
+                    The options are:                                             \r
+                                                                                 \r
+                       prset treeagepr = <setting>                               \r
+                                                                                 \r
+                    where <setting> is one of                                    \r
+                                                                                 \r
+                       fixed(<age>)                                              \r
+                       uniform(<min_age>,<max_age>)                              \r
+                       offsetexponential(<min_age>,<mean_age>)                   \r
+                       truncatednormal(<min_age>,<mean_age>,<st.dev.>)           \r
+                       lognormal(<mean_age>,<st.dev.>)                           \r
+                       offsetlognormal(<min_age>,<mean_age>,<st.dev.>)           \r
+                       gamma(<mean_age>,<st.dev.>)                               \r
+                       offsetgamma(<min_age>,<mean_age>,<st.dev.>)               \r
+                                                                                 \r
+                    These are the same options used for the 'Calibrate' command. \r
+                    Note that, unlike elsewhere in MrMayes, we always use the    \r
+                    mean and standard deviation of the resulting age distribution\r
+                    rather than the standard parameterization, if different. This\r
+                    is to facilitate for the users who want to focus on the in-  \r
+                    formation conveyed about the age. For those who wish to use  \r
+                    the standard parameterization, there are simple conversions  \r
+                    between the two. See the 'Calibrate' command for more infor- \r
+                    mation.                                                      \r
+                                                                                 \r
+                    The tree age is simply the age of the most recent common     \r
+                    ancestor of the tree. If the clock rate is fixed to 1.0,     \r
+                    which is the default, the tree age is equivalent to the      \r
+                    expected number of substitutions from the root to the tip of \r
+                    the tree, that is, tree height. The tree age prior ensures   \r
+                    that the joint probability for the uniform prior (or fossil- \r
+                    ization prior) model of branch lengths on a clock tree is    \r
+                    proper. The default setting is 'gamma(1,1)'. If the root node\r
+                    in the tree is calibrated, the root calibration replaces the \r
+                    tree age prior.                                              \r
+   Speciationpr  -- This parameter sets the prior on the net speciation rate (net\r
+                    diversification), that is, (lambda - mu) in the birth-death  \r
+                    model and the general case of fossilized birth-death model.  \r
+                    Or, (lambda - mu - psi) in the special case of f-b-d model   \r
+                    (fossiltip). Values of this parameter are > 0. Prior options:\r
+                                                                                 \r
+                       prset speciationpr = uniform(<number>,<number>)           \r
+                       prset speciationpr = exponential(<number>)                \r
+                       prset speciationpr = fixed(<number>)                      \r
+                                                                                 \r
+                    This parameter is only relevant if the (fossil) birth-death  \r
+                    process is selected as the prior on branch lengths.          \r
+   Extinctionpr  -- This parameter sets the prior on the relative extinction rate\r
+                    (turnover), that is, (mu / lambda) in the birth-death model  \r
+                    and the general case of fossilized birth-death model.        \r
+                    Or, (mu + psi) / lambda in the special case of f-b-d model   \r
+                    (fossiltip). Values of this parameter are in range (0,1).    \r
+                                                                                 \r
+                       prset extinctionpr = beta(<number>,<number>)              \r
+                       prset extinctionpr = fixed(<number>)                      \r
+                                                                                 \r
+                    This parameter is only relevant if the (fossil) birth-death  \r
+                    process is selected as the prior on branch lengths.          \r
+ Fossilizationpr -- This parameter sets the prior on the relative fossilization  \r
+                    rate (sampling proportion), psi/(mu+psi), in the fossilized  \r
+                    b-d model. Values of this parameter are in range (0,1).      \r
+                    If SampleStrat is used to divide up time intervals, it sets  \r
+                    the prior for the fossilization parameter in each interval.  \r
+                                                                                 \r
+                       prset fossilizationpr = beta(<number>,<number>)           \r
+                       prset fossilizationpr = fixed(<number>)                   \r
+                                                                                 \r
+                    This parameter is only relevant if the fossilized birth-death\r
+                    process is selected as the prior on branch lengths.          \r
+   SampleStrat   -- This parameter sets the strategy under which species were    \r
+                    sampled in the analysis. For the birth-death prior, 'birth-  \r
+                    death' (Hohna et al. 2011), three strategies: 'random',      \r
+                    'diversity' and 'cluster' sampling can be used for extant    \r
+                    taxa. No extinct sample (fossil) is allowed in this prior.   \r
+                    For data with extant and extinct samples, use 'prset brlenspr\r
+                    =clock:fossilization'. (Stadler 2010; Zhang et al. 2015)     \r
+                    For the fossilized birth-death prior, 'fossiltip' assumes    \r
+                    extant taxa are sampled randomly, and extinct taxa (fossils) \r
+                    are sampled with constant rate and upon sampling the lineage \r
+                    is dead and won't produce any descendant. So fossils are all \r
+                    at tips. Except 'fossiltip', the following strategies allow  \r
+                    fossils also being ancestors of other samples.               \r
+                    'random' (default) assumes extant taxa are sampled randomly  \r
+                    with prob rho, while fossils are sampled on the birth-death  \r
+                    tree with piecewise constant rates, psi_i (i = 1,...,s+1).   \r
+                    'diversity' assumes extant taxa are sampled to maximize      \r
+                    diversity, while fossils are sampled randomly.               \r
+                    Time is divided by <s> slice samping events in the past, each\r
+                    at time <t_i> with probability <rho_i> (s >= 0). If rho_i = 0\r
+                    the slice is only used to divide up time intervals not for   \r
+                    sampling of fossils.  Extant taxa are sampled with prob.     \r
+                    (proportion) rho (set in sampleprob).                        \r
+                                                                                 \r
+                       prset samplestrat = random                                \r
+                       prset samplestrat = diversity                             \r
+                       prset samplestrat = cluster                               \r
+                       prset samplestrat = fossiltip                             \r
+                       prset samplestrat = random    <s>:...,<t_i> <rho_i>,...   \r
+                       prset samplestrat = diversity <s>:...,<t_i> <rho_i>,...   \r
+                                                                                 \r
+   Sampleprob    -- This parameter sets the fraction of extant species that are  \r
+                    sampled in the analysis. This is used with the birth-death   \r
+                    prior on trees (Yang and Rannala 1997; Stadler 2009; Hohna   \r
+                    et al. 2011), and the fossilized birth-death prior (Stadler  \r
+                    2010, Zhang et al. 2015).                                    \r
+                                                                                 \r
+                       prset sampleprob = <number>                               \r
+                                                                                 \r
+   Popsizepr     -- This parameter sets the prior on the population size compo-  \r
+                    nent of the coalescent parameter. The options are:           \r
+                                                                                 \r
+                       prset popsizepr = uniform(<number>,<number>)              \r
+                       prset popsizepr = lognormal(<number>,<number>)            \r
+                       prset popsizepr = normal(<number>,<number>)               \r
+                       prset popsizepr = gamma(<number>,<number>)                \r
+                       prset popsizepr = fixed(<number>)                         \r
+                                                                                 \r
+                    This parameter is only relevant if the coalescence process is\r
+                    selected as the prior on branch lengths. Note that the set-  \r
+                    ting of 'ploidy' in 'lset' is important for how this para-   \r
+                    meter is interpreted.                                        \r
+   Popvarpr      -- In a gene tree - species tree model, this parameter deter-   \r
+                    mines whether the population size is the same for the entire \r
+                    species tree ('popvarpr = equal', the default), or varies    \r
+                    across branches of the species tree ('popvarpr=variable').   \r
+   Nodeagepr     -- This parameter specifies the assumptions concerning the age  \r
+                    of the terminal and interior nodes in the tree. The default  \r
+                    model ('nodeagepr = unconstrained') assumes that all terminal\r
+                    nodes are of the same age while the age of interior nodes is \r
+                    unconstrained. The alternative ('nodeagepr = calibrated')    \r
+                    option derives a prior probability distribution on terminal  \r
+                    and interior node ages from the calibration settings (see    \r
+                    the 'calibrate' command). The 'nodeagepr' parameter is only  \r
+                    relevant for clock trees.                                    \r
+   Clockratepr   -- This parameter specifies the prior assumptions concerning the\r
+                    base substitution rate of the tree, measured in expected num-\r
+                    ber of substitutions per site per time unit. The default set-\r
+                    ting is 'Fixed(1.0)', which effectively means that the time  \r
+                    unit is the number of expected substitutions per site.       \r
+                    If you do not have any age calibrations in the tree, you can \r
+                    still calibrate the tree using 'Clockratepr'. For instance,  \r
+                    if you know that your sequence data evolve at a rate of 0.20 \r
+                    substitutions per million years, you might calibrate the tree\r
+                    by fixing the substitution rate to 0.20 using                \r
+                                                                                 \r
+                       prset clockratepr = fixed(0.20)                           \r
+                                                                                 \r
+                    after which the tree will be calibrated using millions of    \r
+                    years as the unit.                                           \r
+                                                                                 \r
+                    You can also assign a prior probability distribution to the  \r
+                    substitution rate, accommodating the uncertainty of it.      \r
+                    When you calibrate the nodes, you should properly set this   \r
+                    prior to match the time unit of the calibrations.            \r
+                    You can choose among normal, lognormal, exponential and gamma\r
+                    distributions for this purpose. For instance, to assign a    \r
+                    normal distribution truncated at 0, so that only positive    \r
+                    values are allowed, and with mean 0.20 and standard deviation\r
+                    of 0.02, you would use                                       \r
+                                                                                 \r
+                       prset clockratepr = normal(0.20,0.02)                     \r
+                                                                                 \r
+                    The lognormal distribution is parameterized in terms of the  \r
+                    mean and standard deviation on the log scale (natural logs). \r
+                    For instance,                                                \r
+                                                                                 \r
+                       prset clockratepr = lognormal(-1.61,0.10)                 \r
+                                                                                 \r
+                    specifies a lognormal distribution with a mean of log values \r
+                    of -1.61 and a standard deviation of log values of 0.10. In  \r
+                    such a case, the mean value of the lognormal distribution is \r
+                    equal to e^(-1.61 + 0.10^2/2) = 0.20.                        \r
+                                                                                 \r
+                    Note that the 'Clockratepr' parameter has no effect on non-  \r
+                    clock trees.                                                 \r
+   Clockvarpr    -- This parameter allows you to specify the type of clock you   \r
+                    are assuming. The default is 'strict', which corresponds to  \r
+                    the standard clock model where the evolutionary rate is      \r
+                    constant throughout the tree. For relaxed clock models, you  \r
+                    can use 'cpp', 'tk02', 'igr'. ('mixed' is not working)       \r
+                    'cpp' invokes a relaxed clock model where the rate evolves   \r
+                    according to a Compound Poisson Process (CPP) (Huelsenbeck   \r
+                    et al., 2000).                                               \r
+                    'tk02' invokes the Brownian Motion model described by Thorne \r
+                    and Kishino (2002). [autocorrelated lognormal distributions] \r
+                    'igr' invokes the Independent Gamma Rate (IGR) model where   \r
+                    each branch has an independent rate drawn from a gamma       \r
+                    distribution (LePage et al., 2007).                          \r
+                    Each of the relaxed clock models has additional parameters   \r
+                    with priors. For the CPP model, it is 'cppratepr' and        \r
+                    'cppmultdevpr'; for the TK02 model, it is 'tk02varpr'; for   \r
+                    the IGR  model, it is 'igrvarpr'.                            \r
+                    The 'clockvarpr' parameter is only relevant for clock trees. \r
+                                                                                 \r
+                    For backward compatibility, 'bm' is allowed as a synonym of  \r
+                    'tk02', and 'ibr' as a synonym of 'igr'.                     \r
+   Cppratepr     -- This parameter allows you to specify a prior probability     \r
+                    distribution on the rate of the Poisson process generating   \r
+                    changes in the evolutionary rate in the CPP relaxed clock    \r
+                    model. You can either fix the rate or associate it with an   \r
+                    exponential prior using                                      \r
+                                                                                 \r
+                       prset cppratepr = fixed(<number>)                         \r
+                       prset cppratepr = exponential(<number>)                   \r
+                                                                                 \r
+                    For instance, if you fix the rate to 2, then on a branch     \r
+                    with the length equual to one expresed in terms of average   \r
+                    expected number of substitution per site, you expect to see, \r
+                    on average, two rate-modifying events.                       \r
+                    If you put an exponential(0.1) on the rate, you will be      \r
+                    estimating the rate against a prior probability distribution \r
+                    where the expected rate is 10 (= 1/0.1).                     \r
+   Cppmultdevpr  -- This parameter allows you to specify the standard deviation  \r
+                    of the log-normal distribution from which the rate multi-    \r
+                    pliers of the CPP relaxed clock model are drawn. The standard\r
+                    deviation is given on the log scale. The default value of 1.0\r
+                    thus corresponds to rate multipliers varying from 0.37 (1/e) \r
+                    to 2.7 (e) when they are +/- one standard deviation from the \r
+                    expected mean. The expected mean of the logarithm of the mul-\r
+                    pliers is fixed to 0, ensuring that the expected mean rate is\r
+                    1.0. You can change the default value by using               \r
+                                                                                 \r
+                       prset cppmultdevpr = fixed(<number>)                      \r
+                                                                                 \r
+                    where <number> is the standard deviation on the log scale.   \r
+   TK02varpr     -- This parameter allows you to specify the prior probability   \r
+                    distribution for the variance of the rate multiplier in the  \r
+                    Thorne-Kishino ('Brownian motion') relaxed clock model.      \r
+                    Specifically, the parameter specifies the rate at which the  \r
+                    variance increases with respect to the base rate of the      \r
+                    clock. If you have a branch of a length corresponding to 0.4 \r
+                    expected changes per site according to the base rate of the  \r
+                    clock, and the tk02var parameter has a value of 2.0, then the\r
+                    rate multiplier at the end of the branch will be drawn from a\r
+                    lognormal distribution with a variance of 0.4*2.0 (on the    \r
+                    linear, not the logarithm scale). The mean is the same as the\r
+                    rate multiplier at the start of the branch (again on the     \r
+                    linear scale).                                               \r
+                                                                                 \r
+                    You can set the parameter to a fixed value, or specify that  \r
+                    it is drawn from an exponential or uniform distribution:     \r
+                                                                                 \r
+                       prset tk02varpr = fixed(<number>)                         \r
+                       prset tk02varpr = exponential(<number>)                   \r
+                       prset tk02varpr = uniform(<number>,<number>)              \r
+                                                                                 \r
+                    For backward compatibility, 'bmvarpr' is allowed as a synonym\r
+                    of 'tko2varpr'.                                              \r
+   Igrvarpr      -- This parameter allows you to specify a prior on the variance \r
+                    of the gamma distribution from which the branch lengths are  \r
+                    drawn in the independent branch rate (IGR) relaxed clock     \r
+                    model. Specifically, the parameter specifies the rate at     \r
+                    which the variance increases with respect to the base rate of\r
+                    the clock. If you have a branch of a length corresponding to \r
+                    0.4 expected changes per site according to the base rate of  \r
+                    the clock, and the igrvar parameter has a value of 2.0, then \r
+                    the effective branch length will be drawn from a distribution\r
+                    with a variance of 0.4*2.0.                                  \r
+                                                                                 \r
+                    You can set the parameter to a fixed value, or specify that  \r
+                    it is drawn from an exponential or uniform distribution:     \r
+                                                                                 \r
+                       prset igrvarpr = fixed(<number>)                          \r
+                       prset igrvarpr = exponential(<number>)                    \r
+                       prset igrvarpr = uniform(<number>,<number>)               \r
+                                                                                 \r
+                    For backward compatibility, 'ibrvarpr' is allowed as a syn-  \r
+                    onym of 'igrvarpr'.                                          \r
+   Ratepr        -- This parameter allows you to specify the site specific rates \r
+                    model or any other model that allows different partitions to \r
+                    evolve at different rates. First, you must have defined a    \r
+                    partition of the characters. For example, you may define a   \r
+                    partition that divides the characters by codon position, if  \r
+                    you have DNA data. You can also divide your data using a     \r
+                    partition that separates different genes from each other.    \r
+                    The next step is to make the desired partition the active one\r
+                    using the set command. For example, if your partition is     \r
+                    called "by_codon", then you make that the active partition \r
+                    using "set partition=by_codon". Now that you have defined  \r
+                    and activated a partition, you can specify the rate multi-   \r
+                    pliers for the various partitions. The options are:          \r
+                                                                                 \r
+                       prset ratepr = fixed                                      \r
+                       prset ratepr = variable                                   \r
+                       prset ratepr = dirichlet(<number>,<number>,...,<number>)  \r
+                                                                                 \r
+                    If you specify "fixed", then the rate multiplier for       \r
+                    that partition is set to 1 (i.e., the rate is fixed to       \r
+                    the average rate across partitions). On the other hand,      \r
+                    if you specify "variable", then the rate is allowed to     \r
+                    vary across partitions subject to the constraint that the    \r
+                    average rate of substitution across the partitions is 1.     \r
+                    You must specify a variable rate prior for at least two      \r
+                    partitions, otherwise the option is not activated when       \r
+                    calculating likelihoods. The variable option automatically   \r
+                    associates the partition rates with a dirichlet(1,...,1)     \r
+                    prior. The dirichlet option is an alternative way of setting \r
+                    a partition rate to be variable, and also gives accurate     \r
+                    control of the shape of the prior. The parameters of the     \r
+                    Dirichlet are listed in the order of the partitions that the \r
+                    ratepr is applied to. For instance, "prset applyto=(1,3,4)  \r
+                    ratepr = dirichlet(10,40,15)" would set the Dirichlet para- \r
+                    meter 10 to partition 1, 40 to partition 3, and 15 to parti- \r
+                    tion 4. The Dirichlet distribution is applied to the weighted\r
+                    rates; that is, it weights the partition rates according to  \r
+                    the number of included characters in each partition.         \r
+   Generatepr    -- This parameter is similar to 'Ratepr' but applies to gene    \r
+                    trees in the multispecies coalescent, whereas 'Ratepr' app-  \r
+                    lies to partitions within genes.                             \r
+                                                                                 \r
+   Default model settings:                                                       \r
+                                                                                 \r
+   Parameter        Options                      Current Setting                 \r
+   ------------------------------------------------------------------            \r
+   Tratiopr         Beta/Fixed                   Beta(1.0,1.0)\r
+   Revmatpr         Dirichlet/Fixed              Dirichlet(1.0,1.0,1.0,1.0,1.0,1.0)\r
+   Aamodelpr        Fixed/Mixed                  Fixed(Poisson)\r
+   Aarevmatpr       Dirichlet/Fixed              Dirichlet(1.0,1.0,...)\r
+   Omegapr          Dirichlet/Fixed              Dirichlet(1.0,1.0)\r
+   Ny98omega1pr     Beta/Fixed                   Beta(1.0,1.0)\r
+   Ny98omega3pr     Uniform/Exponential/Fixed    Exponential(1.0)\r
+   M3omegapr        Exponential/Fixed            Exponential\r
+   Codoncatfreqs    Dirichlet/Fixed              Dirichlet(1.0,1.0,1.0)\r
+   Statefreqpr      Dirichlet/Fixed              Dirichlet(1.0,1.0,1.0,1.0)\r
+   Shapepr          Uniform/Exponential/Fixed    Exponential(1.0)\r
+   Ratecorrpr       Uniform/Fixed                Uniform(-1.0,1.0)\r
+   Pinvarpr         Uniform/Fixed                Uniform(0.0,1.0)\r
+   Covswitchpr      Uniform/Exponential/Fixed    Uniform(0.0,100.0)\r
+   Symdirihyperpr   Uniform/Exponential/Fixed    Fixed(Infinity)\r
+   Topologypr       Uniform/Constraints/Fixed/   Uniform\r
+                    Speciestree                  \r
+   Brlenspr         Unconstrained/Clock/Fixed    Unconstrained:GammaDir(1.0,0.100,1.0,1.0)\r
+   Treeagepr        Gamma/Uniform/Fixed/         Gamma(1.00,1.00)\r
+                    Truncatednormal/Lognormal/   \r
+                    Offsetlognormal/Offsetgamma/ \r
+                    Offsetexponential            \r
+   Speciationpr     Uniform/Exponential/Fixed    Exponential(10.0)\r
+   Extinctionpr     Beta/Fixed                   Beta(1.0,1.0)\r
+   Fossilizationpr  Beta/Fixed                   Beta(1.0,1.0)\r
+   SampleStrat      Random/Diversity/Cluster/    Random\r
+                    FossilTip                    \r
+   Sampleprob       <number>                     1.00000000\r
+   Popsizepr        Lognormal/Gamma/Uniform/     Gamma(1.0,10.0)\r
+                    Normal/Fixed                 \r
+   Popvarpr         Equal/Variable               Equal\r
+   Nodeagepr        Unconstrained/Calibrated     Unconstrained\r
+   Clockratepr      Fixed/Normal/Lognormal/      Fixed(1.00)\r
+                    Exponential/Gamma            \r
+   Clockvarpr       Strict/Cpp/TK02/Igr/Mixed    Strict\r
+   Cppratepr        Fixed/Exponential            Exponential(0.10)\r
+   Cppmultdevpr     Fixed                        Fixed(0.40)\r
+   TK02varpr        Fixed/Exponential/Uniform    Exponential(1.00)\r
+   Igrvarpr         Fixed/Exponential/Uniform    Exponential(10.00)\r
+   Ratepr           Fixed/Variable=Dirichlet     Fixed\r
+   Generatepr       Fixed/Variable=Dirichlet     Fixed\r
+   ------------------------------------------------------------------            \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   Propset                                                                       \r
+                                                                                 \r
+   This command allows the user to change the details of the MCMC samplers       \r
+   (moves) that update the state of the chain. The useage is:                    \r
+                                                                                 \r
+      propset  <move_name>$<tuning-parameter>=<value>                            \r
+                                                                                 \r
+   Assume we have a topology parameter called 'Tau{all}', which is sampled by    \r
+   the move 'ExtTBR(Tau{all})' (note that the parameter name is included in the  \r
+   move name). This move has three tuning parameters: (1) 'prob', the relative   \r
+   proposal probability (a weight defining its probability relative to other     \r
+   moves); (2) 'p_ext', the extension probability; and (3) 'lambda', the tuning  \r
+   parameter of the branch length multiplier. A list of the tuning parameters is \r
+   available by using 'Showmoves' (see below). To change the relative proposal   \r
+   probability to 20 and the extension probability to 0.7, use:                  \r
+                                                                                 \r
+      propset etbr(tau{all})$prob=20 etbr(tau{all})$p_ext=0.7                    \r
+                                                                                 \r
+   This change would apply to all chains in all runs. It is also possible to set \r
+   the tuning parameters of individual runs and chains using the format:         \r
+                                                                                 \r
+      propset  <move_name>$<tuning-parameter>(<run>,<chain>)=<value>             \r
+                                                                                 \r
+   where <run> and <chain> are the index numbers of the run and chain for which  \r
+   you want to change the value. If you leave out the index of the run, the      \r
+   change will apply to all runs; if you leave out the index of the chain, the   \r
+   change will similarly apply to all chains. To switch off the exttbr(tau{all}) \r
+   move in chain 2 of all runs, use:                                             \r
+                                                                                 \r
+      propset  etbr(tau{all})$prob(,2)=0                                         \r
+                                                                                 \r
+   It is important to note that all moves are not available until the model has  \r
+   been completely defined. Any change to the model will cause all proposal      \r
+   tuning parameters to return to their default values. To see a list of all the \r
+   moves that are currently switched on for the model, use 'showmoves'. You can  \r
+   also see other available moves by using 'showmoves allavailable=yes'. A list  \r
+   of the moves for each parameter in the model is available by using the command\r
+   'Showparams'. If you change proposal probabilities, make sure that all        \r
+   parameters that are not fixed in your model have at least one move switched   \r
+   on.                                                                           \r
+                                                                                 \r
+   One word of warning: You should be extremely careful when modifying any       \r
+   of the chain parameters using 'propset'. It is quite possible to completely   \r
+   wreck any hope of achieving convergence by inappropriately setting the        \r
+   tuning parameters. In general, you want to set move tuning parameters such    \r
+   that the acceptance rate of the move is intermediate (we suggest targeting    \r
+   the range 10% to 70% acceptance, if possible). If the acceptance rate is    \r
+   outside of this range, the MCMC chain will probably not sample that parameter \r
+   very efficiently. The acceptance rates for all moves in the cold chain(s) are \r
+   summarized at the end of each run in the screen output. The acceptance rates  \r
+   (potentially for all chains, cold and heated) are also printed to the .mcmc   \r
+   file if Mcmc convergence diagnostics are turned on (using 'Mcmc' or 'Mcmcp'). \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Quit                                                                          \r
+                                                                                 \r
+   This command quits the program. The correct usage is:                         \r
+                                                                                 \r
+      quit                                                                       \r
+                                                                                 \r
+   It is a very easy command to use properly.                                    \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Report                                                                        \r
+                                                                                 \r
+   This command allows you to control how the posterior distribution is          \r
+   reported. For rate parameters, it allows you to choose among several popular  \r
+   parameterizations. The report command also allows you to request printing of  \r
+   some model aspects that are usually not reported. For instance, if a node is  \r
+   constrained in the analysis, MrBayes can print the probabilities of the       \r
+   ancestral states at that node. Similarly, if there is rate variation in the   \r
+   model, MrBayes can print the inferred site rates, and if there is omega varia-\r
+   tion, MrBayes can print the inferred omega (positive selection) values for    \r
+   each codon. In a complex model with several partitions, each partition is     \r
+   controlled separately using the same 'Applyto' mechanism as in the 'Lset' and \r
+   'Prset' commands.                                                             \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Applyto   -- This option allows you to apply the report commands to specific  \r
+                partitions. This command should be the first in the list of      \r
+                commands specified in 'report'.                                  \r
+                For example,                                                     \r
+                                                                                 \r
+                   report applyto=(1,2) tratio=ratio                             \r
+                                                                                 \r
+                   report applyto=(3) tratio=dirichlet                           \r
+                                                                                 \r
+                would result in the transition and transversion rates of the     \r
+                first and second partitions in the model being reported as a     \r
+                ratio and the transition and transversion rates of the third     \r
+                partition being reported as proportions of the rate sum (the     \r
+                Dirichlet parameterization).                                     \r
+   Tratio    -- This specifies the report format for the transition and trans-   \r
+                version rates of a nucleotide substituion model with nst=2.      \r
+                If 'ratio' is selected, the rates will be reported as a ratio    \r
+                (transition rate/transversion rate). If 'dirichlet' is selected, \r
+                the transition and transversion rates will instead be reported   \r
+                as proportions of the rate sum. For example, if the transition   \r
+                rate is three times the transversion rate and 'ratio' is selec-  \r
+                ted, this will reported as a single value, '3.0'. If 'dirichlet' \r
+                is selected instead, the same rates will be reported using two   \r
+                values, '0.75 0.25'. The sum of the Dirichlet values is always 1.\r
+                Although the Dirichlet format may be unfamiliar to some users,   \r
+                it is more convenient for specifying priors than the ratio       \r
+                format.                                                          \r
+   Revmat    -- This specifies the report format for the substitution rates of   \r
+                a GTR substitution model for nucleotide or amino acid data. If   \r
+                'ratio' is selected, the rates will be reported scaled to the    \r
+                G-T rate (for nucleotides) or the Y-V rate (for amino acids). If \r
+                'dirichlet' is specified instead, the rates are reported as pro- \r
+                portions of the rate sum. For instance, assume that the C-T rate \r
+                is twice the A-G rate and four times the transversion rates,     \r
+                which are equal. If the report format is set to 'ratio', this    \r
+                would be reported as '1.0 2.0 1.0 1.0 4.0 1.0' since the rates   \r
+                are reported in the order rAC, rAG, rAT, rCG, rCT, rGT and scaled\r
+                relative to the last rate, the G-T rate. If 'dirichlet' is selec-\r
+                ted instead, the same rates would have been reported as '0.1 0.2 \r
+                0.1 0.1 0.4 0.1' since the rates are now scaled so that they sum \r
+                to 1.0. The Dirichlet format is the parameterization used for    \r
+                formulating priors on the rates.                                 \r
+   Ratemult  -- This specifies the report format used for the rate multiplier of \r
+                different model partitions. Three formats are available. If      \r
+                'scaled' is selected, then rates are scaled such that the mean   \r
+                rate per site across partitions is 1.0. If 'ratio' is chosen,    \r
+                the rates are scaled relative to the rate of the first parti-    \r
+                tion. Finally, if 'dirichlet' is chosen, the rates are given as  \r
+                proportions of the rate sum. The latter is the format used       \r
+                when formulating priors on the rate multiplier.                  \r
+   Tree      -- This specifies the report format used for the tree(s). Two op-   \r
+                tions are available. 'Topology' results in only the topology     \r
+                being printed to file, whereas 'brlens' causes branch lengths to \r
+                to be printed as well.                                           \r
+   Ancstates -- If this option is set to 'yes', MrBayes will print the pro-      \r
+                bability of the ancestral states at all constrained nodes. Typ-  \r
+                ically, you are interested in the ancestral states of only a few \r
+                characters and only at one node in the tree. To perform such     \r
+                an analysis, first define and enforce a topology constraint      \r
+                using 'constraint' and 'prset topologypr = constraints (...)'.   \r
+                Then put the character(s) of interest in a separate partition and\r
+                set MrBayes to report the ancestral states for that partition.   \r
+                For instance, if the characters of interest are in partition 2,  \r
+                use 'report applyto=(2) ancstates=yes' to force MrBayes to print \r
+                the probability of the ancestral states of those characters at   \r
+                the constrained node to the '.p' file.                           \r
+   Siterates -- If this option is set to 'yes' and the relevant model has rate   \r
+                variation across sites, then the site rates, weighted over rate  \r
+                categories, will be reported to the '.p' file.                   \r
+   Possel    -- If this option is set to 'yes' and the relevant model has omega  \r
+                variation across sites, the probability that each model site     \r
+                (codon in this case) is positively selected will be written to   \r
+                file.                                                            \r
+   Siteomega -- If this option is set to 'yes' and the relevant model has omega  \r
+                variation across sites, the weighted omega value (over omega     \r
+                categories) for each model site will be reported to file.        \r
+                                                                                 \r
+   Default report settings:                                                       \r
+                                                                                 \r
+   Parameter       Options                  Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Tratio          Ratio/Dirichlet          Ratio                                   \r
+   Revmat          Ratio/Dirichlet          Dirichlet                                   \r
+   Ratemult        Scaled/Ratio/Dirichlet   Scaled                                   \r
+   Tree            Brlens/Topology          Brlens                                   \r
+   Ancstates       Yes/No                   No                                   \r
+   Siterates       Yes/No                   No                                   \r
+   Possel          Yes/No                   No                                   \r
+   Siteomega       Yes/No                   No                                   \r
+                                                                                 \r
+   ------------------------------------------------------------------            \r
+   ---------------------------------------------------------------------------   \r
+   Restore                                                                       \r
+                                                                                 \r
+   This command restores taxa to the analysis. The correct usage is:             \r
+                                                                                 \r
+      restore <name and/or number and/or taxset> ...                             \r
+                                                                                 \r
+   A list of the taxon names or taxon numbers (labelled 1 to ntax in the order   \r
+   in the matrix) or taxset(s) can be used.  For example, the following:         \r
+                                                                                 \r
+      restore 1 2 Homo_sapiens                                                   \r
+                                                                                 \r
+   restores taxa 1, 2, and the taxon labelled Homo_sapiens to the analysis.      \r
+   You can also use "all" to restore all of the taxa. For example,             \r
+                                                                                 \r
+      restore all                                                                \r
+                                                                                 \r
+   restores all of the taxa to the analysis.                                     \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Set                                                                           \r
+                                                                                 \r
+   This command is used to set some general features of the model or program     \r
+   behavior. The correct usage is                                                \r
+                                                                                 \r
+      set <parameter>=<value> ... <parameter>=<value>                            \r
+                                                                                 \r
+   Available options:                                                            \r
+                                                                                 \r
+   Seed         -- Sets the seed number for the random number generator. The     \r
+                   random number seed is initialized haphazardly at the beg-     \r
+                   inning of each MrBayes session. This option allows you to     \r
+                   set the seed to some specific value, thereby allowing you     \r
+                   to exactly repeat an analysis. If the analysis uses swapping  \r
+                   between cold and heated chains, you must also set the swap    \r
+                   seed (see below) to exactly repeat the analysis.              \r
+   Swapseed     -- Sets the seed used for generating the swapping sequence       \r
+                   when Metropolis-coupled heated chains are used. This seed     \r
+                   is initialized haphazardly at the beginning of each MrBayes   \r
+                   session. This option allows you to set the seed to some       \r
+                   specific value, thereby allowing you to exactly repeat a      \r
+                   swap sequence. See also the 'Seed' option.                    \r
+   Dir          -- The working directory. Specifies the absolute or relative path\r
+                   to the working directory. If left empty, the working directory\r
+                   is the current directory.                                     \r
+   Partition    -- Set this option to a valid partition id, either the number or \r
+                   name of a defined partition, to enforce a specific partition- \r
+                   ing of the data. When a data matrix is read in, a partition   \r
+                   called "Default" is automatically created. It divides the   \r
+                   data into one part for each data type. If you only have one   \r
+                   data type, DNA for instance, the default partition will not   \r
+                   divide up the data at all. The default partition is always    \r
+                   the first partition, so 'set partition=1' is the same as      \r
+                   'set partition=default'.                                      \r
+   Speciespartition -- Set this option to a valid speciespartition id, either the\r
+                   number or name of a defined speciespartition, to enforce a    \r
+                   specific partitioning of taxa to species. When a data matrix  \r
+                   is read in, a speciespartition called "Default" is auto-    \r
+                   matically created. It assigns one taxon for each species. The \r
+                   default speciespartition is always the first speciespartition,\r
+                   so 'set speciespartition=1' is the same as                    \r
+                   'set speciespartition=default'.                               \r
+   Autoclose    -- If autoclose is set to 'yes', then the program will not prompt\r
+                   you during the course of executing a file. This is particular-\r
+                   ly useful when you run MrBayes in batch mode.                 \r
+   Nowarnings   -- If nowarnings is set to yes, then the program will not prompt \r
+                   you when overwriting or appending an ouput file that is al-   \r
+                   ready present. If 'nowarnings=no' (the default setting), then \r
+                   the program propts the user before overwriting output files.  \r
+   Autoreplace  -- When nowarnings is set to yes, then MrBayes will by default   \r
+                   overwrite output files that already exists. This may cause    \r
+                   irrecoverable loss of previous results if you have not removed\r
+                   or renamed the files from previous runs. To override this be- \r
+                   havior, set autoreplace to no, in which case new output will  \r
+                   be appended to existing files instead.                        \r
+   Quitonerror  -- If quitonerror is set to yes, then the program will quit when \r
+                   an error is encountered, after printing an error message. If  \r
+                   quitonerror is set to no (the default setting), then the      \r
+                   program will wait for additional commands from the command    \r
+                   line after the error message is printed.                      \r
+   Scientific   -- Set this option to 'Yes' to write sampled values to file in   \r
+                   scientific format and to 'No' to write them in fixed format.  \r
+                   Fixed format is easier for humans to read but you risk losing \r
+                   precision for small numbers. For instance, sampled values that\r
+                   are less than 1E-6 will print to file as '0.000000' if fixed  \r
+                   format is used and 'precision' is set to 6.                   \r
+   Precision    -- Precision allows you to set the number of decimals to be prin-\r
+                   ted when sampled values are written to file. Precision must be\r
+                   in the range 3 to 15.                                         \r
+   Usebeagle    -- Set this option to 'Yes' to attempt to use the BEAGLE library \r
+                   to compute the phylogenetic likelihood on a variety of high-  \r
+                   performance hardware including multicore CPUs and GPUs. Some  \r
+                   models in MrBayes are not yet supported by BEAGLE.            \r
+   Beagleresource -- Set this option to the number of a specific resource you    \r
+                   wish to use with BEAGLE (use 'Showbeagle' to see the list of  \r
+                   available resources). Set to '99' for auto-resource selection.\r
+   Beagledevice -- Set this option to 'GPU' or 'CPU' to select processor.        \r
+   Beagleprecision -- Selection 'Single' or 'Double' precision computation.      \r
+   Beaglescaling -- 'Always' rescales partial likelihoods at each evaluation.    \r
+                    'Dynamic' rescales less frequently and should run faster.    \r
+   Beaglesse    -- Use SSE instructions on Intel CPU processors.                 \r
+   Beagleopenmp -- Use OpenMP to parallelize across multi-core CPU processors.   \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter          Options               Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Seed               <number>              1448443295                                  \r
+   Swapseed           <number>              1448443295                                  \r
+   Dir                <name>                ""\r
+   Partition          <name>                ""\r
+   Speciespartition   <name>                ""\r
+   Autoclose          Yes/No                No                                   \r
+   Nowarnings         Yes/No                No                                   \r
+   Autoreplace        Yes/No                Yes                                   \r
+   Quitonerror        Yes/No                No                                   \r
+   Scientific         Yes/No                Yes                                   \r
+   Precision          <number>              6                                   \r
+   Usebeagle          Yes/No                No                                   \r
+   Beagleresource     <number>              99                                   \r
+   Beagledevice       CPU/GPU               CPU                                   \r
+   Beagleprecision    Single/Double         Double                                   \r
+   Beaglescaling      Always/Dynamic        Always                                   \r
+   Beaglesse          Yes/No                No                                   \r
+   Beagleopenmp       Yes/No                No                                   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showbeagle                                                                    \r
+                                                                                 \r
+   This command shows available BEAGLE resources.                                \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showmatrix                                                                    \r
+                                                                                 \r
+   This command shows the character matrix currently in memory.                  \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showmcmctrees                                                                 \r
+                                                                                 \r
+   This command shows the current trees used by the Markov chains.               \r
+   is "showmcmctrees".                                                         \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showmodel                                                                     \r
+                                                                                 \r
+   This command shows the current model settings. The correct usage is           \r
+                                                                                 \r
+      showmodel                                                                  \r
+                                                                                 \r
+   After typing "showmodel", the modelling assumptions are shown on a          \r
+   partition-by-partition basis.                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showmoves                                                                     \r
+                                                                                 \r
+   This command shows the MCMC samplers (moves) that are switched on for the     \r
+   parameters in the current model. The basic usage is                           \r
+                                                                                 \r
+      showmoves                                                                  \r
+                                                                                 \r
+   If you want to see all available moves, use                                   \r
+                                                                                 \r
+      showmoves allavailable=yes                                                 \r
+                                                                                 \r
+   If you want to change any of the tuning parameters for the moves, use the     \r
+   'propset' command.                                                            \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showparams                                                                    \r
+                                                                                 \r
+   This command shows all of the parameters in the current model. The basic      \r
+   usage is                                                                      \r
+                                                                                 \r
+      showparams                                                                 \r
+                                                                                 \r
+   The parameters are listed together with their priors, the available moves,    \r
+   and the current value(s), which will be used as the starting values in the    \r
+   next mcmc analysis.                                                           \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Showusertrees                                                                 \r
+                                                                                 \r
+   This command shows the currently defined user trees. The correct usage        \r
+   is "showusertrees".                                                         \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Speciespartition                                                              \r
+                                                                                 \r
+   Defines a partition of tips into species. The format for the speciespartition \r
+   command is                                                                    \r
+                                                                                 \r
+      Speciespartition <name> = <species name>:<taxon list> ,...,<sp nm>:<tx lst>\r
+                                                                                 \r
+   The command enumerates comma separated list of pairs consisting of 'species   \r
+   name' and 'taxon list'. The 'taxon list' is a standard taxon list, as used by \r
+   the 'Taxset' command. This means that you can use either the index or the name\r
+   of a sequence ('taxon'). Ranges are specified using a dash, and a period can  \r
+   be used as a synonym of the last sequence in the matrix.                      \r
+                                                                                 \r
+   For exammple: speciespartition species = SpeciesA: 1, SpeciesB: 2-.           \r
+   Here, we name two species. SpeciesA is represented by a single sequence while \r
+   SpeciesB is represented by all remaining sequences in the matrix.             \r
+   Each sequence is specified by its row index in the data matrix.               \r
+                                                                                 \r
+   As with ordinary partitioning you may define multiple species partitioning    \r
+   scheme. You have to use command 'set speciespartition' to enable use of one of\r
+   them.                                                                         \r
+                                                                                 \r
+   Currently defined Speciespartitions:                                          \r
+                                                                                 \r
+   Number  Speciespartition name        Number of species                        \r
+   --------------------------------------------------------------------------    \r
+                                                                                \r
+   --------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Ss                                                                            \r
+                                                                                 \r
+   This command is used to start stepping-stone sampling, which is an efficient  \r
+   and accurate method for estimating the marginal likelihood of the currently   \r
+   specified model. It is considerably more accurate than the harmonic mean of   \r
+   the likelihoods from a standard MCMC run on the model (calculated by the      \r
+   'Sump' command) but it requires a separate MCMC-like run. To be more specific,\r
+   stepping-stone sampling uses importance sampling to estimate each ratio in a  \r
+   series of discrete steps bridging the posterior and prior distributions.      \r
+   The importance distributions that are used are called power posterior distri- \r
+   butions, and are defined as prior*(likelihood^beta). By varying beta from 1 to\r
+   0, we get a series of distributions that connect the posterior (beta = 1) to  \r
+   the prior (beta = 0).                                                         \r
+                                                                                 \r
+   The power posterior distributions are sampled using MCMC. First, we start a   \r
+   standard MCMC chain on the posterior distribution, and let it run until we    \r
+   have reached the criterion specified by the 'Burninss' option. After this, we \r
+   step through the power posterior distributions until we reach the prior dis-  \r
+   tribution. In each of the 'Nsteps' steps, we sample from a new power poster-  \r
+   ior distribution with a distinct beta value. The beta values correspond to    \r
+   'Nsteps' evenly spaced quantiles in a Beta distribution with the parameters   \r
+   'Alpha' and 1.0. For the first sampling step, the beta value is equal to the  \r
+   last quantile, i.e., it is close to 1.0. For each successive step, the beta   \r
+   value takes on the value of the next quantile, in decreasing order, until it  \r
+   reaches the value of 0.0. If you change value of 'FromPrior' from default 'No'\r
+   to 'Yes' then the direction of power posterior change during SS analizes is   \r
+   opposite to the one described above, i.e. we start from sampling prior and    \r
+   finish close to posterior.                                                    \r
+                                                                                 \r
+   The 'Ss' procedure uses the same machinery as the standard 'Mcmc' algorithm,  \r
+   and shares most of its parameters with the 'Mcmc' and 'Mcmcp' commands. All   \r
+   'Mcmc' parameters, except those related to burnin, have the same meaning and  \r
+   usage in the 'Ss' command as they have in the 'Mcmc' command. The 'Mcmc'      \r
+   burnin parameters are used to set up burnin within each step. The 'Ss' command\r
+   also uses its own burnin parameter, 'Burninss' (see below for details). The   \r
+   'Ss' command also has its own parameters for specifying the number of steps   \r
+   and the shape of the Beta distribution from which the beta values are computed\r
+   (see below).                                                                  \r
+                                                                                 \r
+   Note that the 'Ngen' parameter of 'Mcmc' is used to set the maximum number of \r
+   generations processed, including both the burnin and the following steps in   \r
+   the stepping-stone sampling phase. For instance, assume that 'Burninss' is set\r
+   to '-1', 'Nsteps' to '49', 'Ngen' to '1000000' and 'Samplefreq' to '1000'.    \r
+   We will then get 1,000 samples in total (1,000,000 / 1,000). These will fall  \r
+   into 50 bins, one of which represents the burnin and is discarded. Each step  \r
+   in the algorithm will thus be represented by 20 samples.                      \r
+                                                                                 \r
+   More information on 'Mcmc' parameters is available in the help for the 'Mcmc' \r
+   and 'Mcmcp' commands. Only the exclusive 'Ss' parameters are listed below.    \r
+   These can only be set up using the 'Ss' command, while the parameters shared  \r
+   with 'Mcmc' and 'Mcmcp' can also be set up using those commands.              \r
+                                                                                 \r
+   The correct usage is                                                          \r
+                                                                                 \r
+      ss <parameter>=<value> ... <parameter>=<value>                             \r
+                                                                                 \r
+   Note that a command:                                                          \r
+                                                                                 \r
+      ss <setting parameters shared with mcmc> <setting exclusive ss parameters> \r
+                                                                                 \r
+   would be equivalent to executing two commands:                                \r
+                                                                                 \r
+     mcmcp <setting parameters shared with mcmc>;                                \r
+     ss <setting exclusive ss parameters>;                                       \r
+                                                                                 \r
+   For more information on the stepping-stone algorithm, see:                    \r
+                                                                                 \r
+   Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving marginal\r
+      likelihood estimation for Bayesian phylogenetic model selection. Systematic\r
+      Biology 60:150-160.                                                        \r
+                                                                                 \r
+   Available options:                                                            \r
+   (NB: Only exclusive ss parameters listed here. For additional parameters, see \r
+        help on 'mcmc' or 'mcmcp'.                                               \r
+                                                                                 \r
+   Alpha        -- The beta values used in the stepping-stone sampling procedure \r
+                   correspond to evenly spaced quantiles from a Beta('Alpha',1.0)\r
+                   distribution. The parameter 'Alpha' determines the skewness of\r
+                   the beta values. If 'Alpha' is set to '1.0', the beta values  \r
+                   would be spaced uniformly on the interval (0.0,1.0). However, \r
+                   better results are obtained if the beta values are skewed.    \r
+                   Empirically, it was observed that 'Alpha' values in the range \r
+                   of 0.3 to 0.5 produce the most accurate results.              \r
+   Burninss     -- Fixed number of samples discarded before sampling of the first\r
+                   step starts. 'Burninss' can be specified using either a pos-  \r
+                   itive or a negative number. If the number is positive, it is  \r
+                   interpreted as the number of samples to discard as burnin. If \r
+                   the number is negative, its absolute value is interpreted as  \r
+                   the length of the burnin in terms of the length of each of the\r
+                   following steps in the stepping-stone algorithm. For instance,\r
+                   a value of '-1' means that the length of the burnin is the    \r
+                   same as the length of each of the subsequent steps.           \r
+   Nsteps       -- Number of steps in the stepping-stone algorithm. Typically, a \r
+                   number above 30 is sufficient for accurate results.           \r
+   FromPrior    -- If it is set to 'Yes', it indicates that in the first step we \r
+                   sample from the prior, with each consequtive step we sample   \r
+                   closer to the posterior. 'No' indicates the opposite direction\r
+                   of power posterior change, i.e. in the first step we sample   \r
+                   close to the posterior, and with each consequtive step we     \r
+                   sample closer to the prior.                                   \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter          Options               Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Alpha              <number>              0.40\r
+   BurninSS           <number>              -1\r
+   Nsteps             <number>              50\r
+   FromPrior           Yes/No               No                                   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Ssp                                                                           \r
+                                                                                 \r
+   This command sets the parameters of the stepping-stone sampling               \r
+   analysis without actually starting the chain. This command is identical       \r
+   in all respects to Ss, except that the analysis will not start after          \r
+   this command is issued. For more details on the options, check the help       \r
+   menu for Ss.\r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter          Options               Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Alpha              <number>              0.40\r
+   BurninSS           <number>              -1\r
+   Nsteps             <number>              50\r
+   FromPrior           Yes/No               No                                   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Startvals                                                                     \r
+                                                                                 \r
+   Use this command to change the current values for parameters in your model.   \r
+   These values will be used as the starting values in the next mcmc analysis.   \r
+   The basic format is:                                                          \r
+                                                                                 \r
+      startvals <param>=(<value_1>,<value_2>,...,<value_n>)                      \r
+                                                                                 \r
+   for all substitution model parameters. The format is slightly different for   \r
+   parameters that are written to a tree file:                                   \r
+                                                                                 \r
+      startvals <param>=<tree_name>                                              \r
+                                                                                 \r
+   This version of the command will look for a tree with the specified name      \r
+   among the trees read in previously when parsing a tree block. The information \r
+   stored in that tree will be used to set the starting value of the parameter.  \r
+   The parameters that are set using this mechanism include topology and branch  \r
+   length parameters, as well as relaxed clock branch rates, cpp events and      \r
+   cpp branch rate multipliers.                                                  \r
+                                                                                 \r
+   The above versions of the command will set the value for all runs and chains. \r
+   You can also set the value for an individual run and chain by using the format\r
+                                                                                 \r
+      startvals <param>(<run>,<chain>)=(<value_1>,...)                           \r
+                                                                                 \r
+   where <run> is the index of the run and <chain> the index of the chain. If    \r
+   the run index is omitted, the values will be changed for all runs. Similarly, \r
+   if the chain index is omitted, all chains will be set to the specified value. \r
+   For example, if we wanted to set the values of the stationary frequency       \r
+   parameter pi{1} to (0.1,0.1,0.4,0.4) for all chains in run 1, and to          \r
+   (0.3,0.3,0.2,0.2) for chain 3 of run 2, we would use                          \r
+                                                                                 \r
+      startvals pi{1}(1,)=(0.1,0.1,0.4,0.4) pi{1}(2,3)=(0.3,0.3,0.2,0.2)         \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Sump                                                                          \r
+                                                                                 \r
+   During an MCMC analysis, MrBayes prints the sampled parameter values to one or\r
+   more tab-delimited text files, one for each independent run in your analysis. \r
+   The command 'Sump' summarizes the information in this parameter file or these \r
+   parameter files. By default, the root of the parameter file name(s) is assumed\r
+   to be the name of the last matrix-containing nexus file. MrBayes also remem-  \r
+   bers the number of independent runs in the last analysis that you set up, re- \r
+   gardless of whether you actually ran it. For instance, if there were two in-  \r
+   dependent runs, which is the initial setting when you read in a new matrix,   \r
+   MrBayes will assume that there are two parameter files with the endings       \r
+   '.run1.p' and '.run2.p'. You can change the root of the file names and the    \r
+   number of runs using the 'Filename' and 'Nruns' settings.                     \r
+                                                                                 \r
+   When you invoke the 'Sump' command, three items are output: (1) a generation  \r
+   plot of the likelihood values; (2) estimates of the marginal likelihood of    \r
+   the model; and (3) a table with the mean, variance, and 95 percent credible   \r
+   interval for the sampled parameters. All three items are output to screen.    \r
+   The table of marginal likelihoods is also printed to a file with the ending   \r
+   '.lstat' and the parameter table to a file with the ending '.pstat'. For some \r
+   model parameters, there may also be a '.mstat' file.                          \r
+                                                                                 \r
+   When running 'Sump' you typically want to discard a specified number or       \r
+   fraction of samples from the beginning of the chain as the burn in. This is   \r
+   done using the same mechanism used by the 'mcmc' command. That is, if you     \r
+   run an mcmc analysis with a relative burn in of 25 % of samples for con-     \r
+   vergence diagnostics, then the same burn in will be used for a subsequent     \r
+   sump command, unless a different burn in is specified. That is, issuing       \r
+                                                                                 \r
+   sump                                                                          \r
+                                                                                 \r
+   immediately after 'mcmc', will result in using the same burn in settings as   \r
+   for the 'mcmc' command. All burnin settings are reset to default values every \r
+   time a new matrix is read in, namely relative burnin ('relburnin=yes') with   \r
+   25 % of samples discarded ('burninfrac = 0.25').                             \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Relburnin    -- If this option is set to 'Yes', then a proportion of the      \r
+                   samples will be discarded as burnin when calculating summary  \r
+                   statistics. The proportion to be discarded is set with        \r
+                   'Burninfrac' (see below). When the 'Relburnin' option is set  \r
+                   to 'No', then a specific number of samples is discarded       \r
+                   instead. This number is set by 'Burnin' (see below). Note that\r
+                   the burnin setting is shared across the 'sumt', 'sump', and   \r
+                   'mcmc' commands.                                              \r
+   Burnin       -- Determines the number of samples (not generations) that will  \r
+                   be discarded when summary statistics are calculated. The      \r
+                   value of this option is only applicable when 'Relburnin' is   \r
+                   set to 'No'.                                                  \r
+   Burninfrac   -- Determines the fraction of samples that will be discarded when\r
+                   summary statistics are calculated. The setting only takes     \r
+                   effect if 'Relburnin' is set to 'Yes'.                        \r
+   Nruns        -- Determines how many '.p' files from independent analyses that \r
+                   will be summarized. If Nruns > 1 then the names of the files  \r
+                   are derived from 'Filename' by adding '.run1.p', '.run2.p',   \r
+                   etc. If Nruns=1, then the single file name is obtained by     \r
+                   adding '.p' to 'Filename'.                                    \r
+   Filename     -- The name of the file to be summarized. This is the base of the\r
+                   file name to which endings are added according to the current \r
+                   setting of the 'Nruns' parameter. If 'Nruns' is 1, then only  \r
+                   '.p' is added to the file name. Otherwise, the endings will   \r
+                   be '.run1.p', '.run2.p', etc.                                 \r
+   Outputname   -- Base name of the file(s) to which 'Sump' results will be      \r
+                   printed.                                                      \r
+   Hpd          -- Determines whether credibility intervals will be given as the \r
+                   region of Highest Posterior Density ('Yes') or as the interval\r
+                   containing the median 95 % of sampled values ('No').         \r
+   Minprob      -- Determines the minimum probability of submodels to be included\r
+                   in summary statistics. Only applicable to models that explore \r
+                   submodel spaces, like 'nst=mixed' and 'aamodelpr=mixed'.      \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter       Options                  Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Relburnin       Yes/No                   Yes                                   \r
+   Burnin          <number>                 0                                   \r
+   Burninfrac      <number>                 0.25                               \r
+   Nruns           <number>                 2                                   \r
+   Filename        <name>                   temp<.run<i>.p>\r
+   Outputname      <name>                   temp<.pstat etc>\r
+   Hpd             Yes/No                   Yes                                   \r
+   Minprob         <number>                 0.050                               \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Sumss                                                                         \r
+                                                                                 \r
+   This command summarizes results of stepping stone analyses. It is a tool to   \r
+   investigate the obtained results, and to help find the proper step burn-in.   \r
+   To get more help information on stepping-stone analyses, use 'help ss'.       \r
+                                                                                 \r
+   During stepping-stone analysis, MrBayes collects the sampled likelihoods in   \r
+   order to estimate the marginal likelihood at the end. It also prints the sam- \r
+   pled parameter values to one or more tab-delimited text files, one for each   \r
+   independent run in your analysis. The command 'Sumss' summarizes likelihood   \r
+   values stored in these parameter files and calculates marginal likelihood es- \r
+   timates. The names of the files that are summarized are exactly the same as   \r
+   the names of the files used for the 'sump' command. In fact, the 'filename'   \r
+   setting is a shared setting for the 'sump' and 'sumss' commands. That is, if  \r
+   you change the setting in one of the commands, it would change the setting in \r
+   the other command as well.                                                    \r
+                                                                                 \r
+   When you invoke the 'Sumss' command, three items are output: (1) 'Step contri-\r
+   bution table' - summarizes the contribution of each step to the overall esti- \r
+   mate; (2) 'Step plot' - plot of the likelihood values for the initial burn-in \r
+   phase or a chosen step in the stepping-stone algorithm; (3) 'Joined plot' -   \r
+   summarizes sampling across all steps in the algorithm.                        \r
+                                                                                 \r
+   Step contribution table                                                       \r
+   The printed table is similar to the one output to the .ss file. The main pur- \r
+   pose of the table is to summarize marginal likelihood for different values of \r
+   the step burn-in after the stepping stone  analysis has finished. The burn-in \r
+   is controlled by the 'Relburnin', 'Burnin' and 'Burninfrac' settings.         \r
+   Note that during stepping-stone analyses, step contributions to marginal      \r
+   likelihood are calculated based on all generations excluding burn-in. 'Sumss' \r
+   on the other hand makes estimates based only on the sampled generations. This \r
+   may lead to slight difference in results compared to the one printed to the   \r
+   .ss file.                                                                     \r
+                                                                                 \r
+   Step plot                                                                     \r
+   The main objective of the plot is to provide a close look at a given step in  \r
+   the analysis. Which step is printed here is defined by the 'Steptoplot' set-  \r
+   ting. The plot could be used to inspect if the chosen step burn-in is appro-  \r
+   priate for the given step. It could also be used to check if the initial burn-\r
+   in phase has converged. Note that the amount of discarded samples is controled\r
+   by the 'Discardfrac' setting, and not by the ordinary burn-in settings.       \r
+                                                                                 \r
+   Joined plot                                                                   \r
+   Different steps sample from different power posterior distributions. When we  \r
+   switch from one distribution to another, it takes some number of generations  \r
+   before the chain settles at the correct stationary distribution. This lag is  \r
+   called a 'temperature lag' and if the corresponding samples are not removed,  \r
+   it will result in a biased estimate. It is difficult to determine the lag be- \r
+   forehand, but MrBayes allows you to explore different step burn-in settings   \r
+   after you have finished the stepping-stone algorithm, without having to rerun \r
+   the whole analysis. The 'Joined plot' helps to facilitate the choice of the   \r
+   right step burn-in. The plot summarizes samples across all steps and gives you\r
+   a quick overview of the whole analysis.                                       \r
+                                                                                 \r
+   Specifically, the following procedure is used to obtain the joined plot. Each \r
+   step has the same number N of samples taken. We number each sample 1 to N     \r
+   within steps according to the order in which the samples are taken. The first \r
+   sample in each step is numbered 1, and the last sample is N. For each number i\r
+   in [1,..., N], we sum up log likelihoods for all samples numbered i across all\r
+   steps. The joined plot is a graph of the step number versus the normalized    \r
+   sums we get in the procedure describe above. This directly visualizes the tem-\r
+   perature lag and allows you to select the appropriate step burn-in.           \r
+                                                                                 \r
+   Ideally, after you discard the appropriate step burn-in, the graph should     \r
+   appear as white noise around the estimated value. If you see an increasing or \r
+   decreasing tendency in the beginning of the graph, you should increase the    \r
+   step burn-in. If you see an increasing or decreasing tendency across the whole\r
+   graph, then the initial burn-in phase was not long enough. In this case, you  \r
+   need to rerun the analysis with a longer initial burn-in.                     \r
+                                                                                 \r
+   To make it easier to observe tendencies in the plotted graph you can choose   \r
+   different levels of curve smoothing. If 'Smoothing' is set to k, it means that\r
+   for each step i we take an average over step i and k neighboring samples in   \r
+   both directions, i.e., the k-smoothed estimate for step i is an average over  \r
+   values for steps [i-k,...,i+k].                                               \r
+                                                                                 \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Allruns      -- If set to 'Yes', it forces all runs to be printed on the same \r
+                   graph when drawing joined and step plots. If set to 'No', each\r
+                   run is printed on a separat plot.                             \r
+   Askmore      -- Long analyses may produce huge .p files. Reading in them may  \r
+                   take several minutes. If you want to investigate different    \r
+                   aspects of your analyses, it could be very inconvenient to    \r
+                   wait for several minutes each time you want to get a new sum- \r
+                   mary for different settings. If you set 'Askmore' to 'YES',   \r
+                   sumss will read .p files only once. After responding to the   \r
+                   original query, it will interactivaly ask you if you wish to  \r
+                   produce more tables and plots for different settings of       \r
+                   'Burnin' or 'Smoothing' (see below).                          \r
+   Relburnin    -- If this option is set to 'Yes', then a proportion of the      \r
+                   samples from each step will be discarded as burnin when calcu-\r
+                   lsting summary statistics. The proportion to be discarded is  \r
+                   set with 'Burninfrac' (see below). When the 'Relburnin' option\r
+                   is set to 'No', then a specific number of samples is discarded\r
+                   instead. This number is set by 'Burnin'. Note that the burnin \r
+                   settings --- 'Relburnin', 'Burnin', and 'Burninfrac' --- are  \r
+                   shared across the 'sumt', 'sump', 'sumss' and 'mcmc' commands.\r
+   Burnin       -- Determines the number of samples (not generations) that will  \r
+                   be discarded from each step when summary statistics are calcu-\r
+                   lated. The value of this option is only applicable when       \r
+                   'Relburnin' is set to 'No'.                                   \r
+   Burninfrac   -- Determines the fraction of samples that will be discarded from\r
+                   each step when summary statistics are calculated. The setting \r
+                   only takes effect if 'Relburnin' is set to 'Yes'.             \r
+   Discardfrac  -- Determines the fraction of samples that will be discarded when\r
+                   a step plot is printed. It is similar to the 'Burninfrac' set-\r
+                   ting, but unlike 'Burninfrac' it is used only for better vis- \r
+                   ualization of the step plot. It has no effect on the number of\r
+                   samples discarded during marginal likelihood computation.     \r
+   Filename     -- The name of the file to be summarized. This is the base of the\r
+                   file name to which endings are added according to the current \r
+                   setting of the 'Nruns' parameter. If 'Nruns' is 1, then only  \r
+                   '.p' is added to the file name. Otherwise, the endings will   \r
+                   be '.run1.p', '.run2.p', etc. Note that the 'Filename' setting\r
+                   is shared with 'sump' command.                                \r
+   Nruns        -- Determines how many '.p' files from independent analyses that \r
+                   will be summarized. If Nruns > 1 then the names of the files  \r
+                   are derived from 'Filename' by adding '.run1.p', '.run2.p',   \r
+                   etc. If Nruns=1, then the single file name is obtained by     \r
+                   adding '.p' to 'Filename'.                                    \r
+   Steptoplot   -- Defines which step will be printed in the step plot.If the    \r
+                   value is set to 0, then the initial sample from the posterior \r
+                   will be used.                                                 \r
+   Smoothing    -- Determines smoothing of the joined plot (see above). A value  \r
+                   equal to 0 results in no smoothing.                           \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter       Options                  Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Allruns         Yes/No                   Yes                                   \r
+   Askmore         Yes/No                   Yes                                   \r
+   Relburnin       Yes/No                   Yes                                   \r
+   Burnin          <number>                 0                                   \r
+   Burninfrac      <number>                 0.25                               \r
+   Discardfrac     <number>                 0.80                               \r
+   Filename        <name>                   temp<.run<i>.p>\r
+   Nruns           <number>                 2                                   \r
+   Steptoplot      <number>                 0                                   \r
+   Smoothing       <number>                 0                                   \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Sumt                                                                          \r
+                                                                                 \r
+   This command is used to produce summary statistics for trees sampled during   \r
+   a Bayesian MCMC analysis. You can either summarize trees from one individual  \r
+   analysis, or trees coming from several independent analyses. In either case,  \r
+   all the sampled trees are read in and the proportion of the time any single   \r
+   taxon bipartition (split) is found is counted. The proportion of the time that\r
+   the bipartition is found is an approximation of the posterior probability of  \r
+   the bipartition. (Remember that a taxon bipartition is defined by removing a  \r
+   branch on the tree, dividing the tree into those taxa to the left and right   \r
+   of the removed branch. This set is called a taxon bipartition.) The branch    \r
+   length of the bipartition is also recorded, if branch lengths have been saved \r
+   to file. The result is a list of the taxon bipartitions found, the frequency  \r
+   with which they were found, the posterior probability of the bipartition      \r
+   and, the mean and variance of the branch lengths or node depths, and various  \r
+   other statistics.                                                             \r
+                                                                                 \r
+   The key to the partitions is output to a file with the suffix '.parts'. The   \r
+   summary statistics pertaining to bipartition probabilities are output to a    \r
+   file with the suffix '.tstat', and the statistics pertaining to branch or node\r
+   parameters are output to a file with the suffix '.vstat'.                     \r
+                                                                                 \r
+   A consensus tree is also printed to a file with the suffix '.con.tre' and     \r
+   printed to the screen as a cladogram, and as a phylogram if branch lengths    \r
+   have been saved. The consensus tree is either a 50 percent majority rule tree \r
+   or a majority rule tree showing all compatible partitions. If branch lengths  \r
+   have been recorded during the run, the '.con.tre' file will contain a consen- \r
+   sus tree with branch lengths and interior nodes labelled with support values. \r
+   By default, the consensus tree will also contain other summary information in \r
+   a format understood by the program 'FigTree'. To use a simpler format under-  \r
+   stood by other tree-drawing programs, such as 'TreeView', set 'Conformat' to  \r
+   'Simple'.                                                                     \r
+                                                                                 \r
+   MrBayes alo produces a file with the ending ".trprobs" that contains a list \r
+   of all the trees that were found during the MCMC analysis, sorted by their    \r
+   probabilities. This list of trees can be used to construct a credible set of  \r
+   trees. For example, if you want to construct a 95 percent credible set of     \r
+   trees, you include all of those trees whose cumulative probability is less    \r
+   than or equal to 0.95. You have the option of displaying the trees to the     \r
+   screen using the "Showtreeprobs" option. The default is to not display the  \r
+   trees to the screen; the number of different trees sampled by the chain can   \r
+   be quite large. If you are analyzing a large set of taxa, you may actually    \r
+   want to skip the calculation of tree probabilities entirely by setting        \r
+   'Calctreeprobs' to 'No'.                                                      \r
+                                                                                 \r
+   When calculating summary statistics you probably want to skip those trees that\r
+   were sampled in the initial part of the run, the so-called burn-in period. The\r
+   number of skipped samples is controlled by the 'Relburnin', 'Burnin', and     \r
+   'Burninfrac' settings, just as for the 'Mcmc' command. Since version 3.2.0,   \r
+   the burn-in settings are shared across the 'Sumt', 'Sump' and 'Mcmc' commands.\r
+   That is, changing the burn-in setting for one command will change the settings\r
+   for subsequent calls to any of the other commands.                            \r
+                                                                                 \r
+   If you are summarizing the trees sampled in several independent analyses,     \r
+   such as those resulting from setting the 'Nruns' option of the 'Mcmc' command \r
+   to a value larger than 1, MrBayes will also calculate convergence diagnostics \r
+   for the sampled topologies and branch lengths. These values can help you      \r
+   determine whether it is likely that your chains have converged.               \r
+                                                                                 \r
+   The 'Sumt' command expands the 'Filename' according to the current values of  \r
+   the 'Nruns' and 'Ntrees' options. For instance, if both 'Nruns' and 'Ntrees'  \r
+   are set to 1, 'Sumt' will try to open a file named '<Filename>.t'. If 'Nruns' \r
+   is set to 2 and 'Ntrees' to 1, then 'Sumt' will open two files, the first     \r
+   named '<Filename>.run1.t' and the second '<Filename>.run2.t', etc. By default,\r
+   the 'Filename' option is set such that 'Sumt' automatically summarizes all the\r
+   results from your immediately preceding 'Mcmc' command. You can also use the  \r
+   'Sumt' command to summarize tree samples in older analyses. If you want to do \r
+   that, remember to first read in a matrix so that MrBayes knows what taxon     \r
+   names to expect in the trees. Then set the 'Nruns', 'Ntrees' and 'Filename'   \r
+   options appropriately if they differ from the MrBayes defaults.               \r
+                                                                                 \r
+   Options:                                                                      \r
+                                                                                 \r
+   Relburnin     -- If this option is set to YES, then a proportion of the       \r
+                    samples will be discarded as burnin when calculating summary \r
+                    statistics. The proportion to be discarded is set with       \r
+                    Burninfrac (see below). When the Relburnin option is set to  \r
+                    NO, then a specific number of samples is discarded instead.  \r
+                    This number is set by Burnin (see below). Note that the      \r
+                    burnin setting is shared across the 'sumt', 'sump', and      \r
+                    'mcmc' commands.                                             \r
+   Burnin        -- Determines the number of samples (not generations) that will \r
+                    be discarded when summary statistics are calculated. The     \r
+                    value of this option is only relevant when Relburnin is set  \r
+                    to NO.                                                       \r
+   BurninFrac    -- Determines the fraction of samples that will be discarded    \r
+                    when summary statistics are calculated. The value of this    \r
+                    option is only relevant when Relburnin is set to YES.        \r
+                    Example: A value for this option of 0.25 means that 25% of  \r
+                    the samples will be discarded.                               \r
+   Nruns         -- Determines how many '.t' files from independent analyses that\r
+                    will be summarized. If Nruns > 1 then the names of the files \r
+                    are derived from 'Filename' by adding '.run1.t', '.run2.t',  \r
+                    etc. If Nruns=1 and Ntrees=1 (see below), then only '.t' is  \r
+                    added to 'Filename'.                                         \r
+   Ntrees        -- Determines how many trees there are in the sampled model. If \r
+                    'Ntrees' > 1 then the names of the files are derived from    \r
+                    'Filename' by adding '.tree1.t', '.tree2.t', etc. If there   \r
+                    are both multiple trees and multiple runs, the filenames will\r
+                    be '<Filename>.tree1.run1.t', '<Filename>.tree1.run2.t', etc.\r
+   Filename      -- The name of the file(s) to be summarized. This is the base of\r
+                    the file name, to which endings are added according to the   \r
+                    current settings of the 'Nruns' and 'Ntrees' options.        \r
+   Minpartfreq   -- The minimum probability of partitions to include in summary  \r
+                    statistics.                                                  \r
+   Contype       -- Type of consensus tree. 'Halfcompat' results in a 50% major-\r
+                    ity rule tree, 'Allcompat' adds all compatible groups to such\r
+                    a tree.                                                      \r
+   Conformat     -- Format of consensus tree. The 'Figtree' setting results in a \r
+                    consensus tree formatted for the program FigTree, with rich  \r
+                    summary statistics. The 'Simple' setting results in a simple \r
+                    consensus tree written in a format read by a variety of pro- \r
+                    grams.                                                       \r
+   Outputname    -- Base name of the file(s) to which 'sumt' results will be     \r
+                    printed. The default is the same as 'Filename'.              \r
+   Calctreeprobs -- Determines whether tree probabilities should be calculated.  \r
+   Showtreeprobs -- Determines whether tree probabilities should be displayed on \r
+                    screen.                                                      \r
+   Hpd           -- Determines whether credibility intervals will be given as the\r
+                    region of Highest Posterior Density ('Yes') or as the inter- \r
+                    val containing the median 95 % of sampled values ('No').    \r
+                                                                                 \r
+   Current settings:                                                             \r
+                                                                                 \r
+   Parameter       Options                  Current Setting                      \r
+   --------------------------------------------------------                      \r
+   Relburnin       Yes/No                   Yes                                   \r
+   Burnin          <number>                 0                                   \r
+   Burninfrac      <number>                 0.25                               \r
+   Nruns           <number>                 2                                   \r
+   Ntrees          <number>                 1                                   \r
+   Filename        <name>                   temp<.run<i>.t>\r
+   Minpartfreq     <number>                 0.10                               \r
+   Contype         Halfcompat/Allcompat     Halfcompat\r
+   Conformat       Figtree/Simple           Figtree                                   \r
+   Outputname      <name>                   temp<.parts etc>\r
+   Calctreeprobs   Yes/No                   Yes                                   \r
+   Showtreeprobs   Yes/No                   No                                   \r
+   Hpd             Yes/No                   Yes                                   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Taxastat                                                                      \r
+                                                                                 \r
+   This command shows the status of all the taxa. The correct usage is           \r
+                                                                                 \r
+      taxastat                                                                   \r
+                                                                                 \r
+   After typing "taxastat", the taxon number, name, and whether it is          \r
+   excluded or included are shown.                                               \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Taxset                                                                        \r
+                                                                                 \r
+   This command defines a taxon set. The format for the taxset command           \r
+   is                                                                            \r
+                                                                                 \r
+      taxset <name> = <taxon names or numbers>                                   \r
+                                                                                 \r
+   For example, "taxset apes = Homo Pan Gorilla Orang gibbon" defines a        \r
+   taxon set called "apes" that includes five taxa (namely, apes).             \r
+   You can assign up to 30 taxon sets. This option is best used                  \r
+   not from the command line but rather as a line in the mrbayes block           \r
+   of a file.                                                                    \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Unlink                                                                        \r
+                                                                                 \r
+   This command unlinks model parameters across partitions of the data. The      \r
+   correct usage is:                                                             \r
+                                                                                 \r
+      unlink <parameter name> = (<all> or <partition list>)                      \r
+                                                                                 \r
+   A little background is necessary to understand this command. Upon exe-        \r
+   cution of a file, a default partition is set up. This partition refer-        \r
+   enced either by its name ("default") or number (0). If your data are        \r
+   all of one type, then this default partition does not actually divide up      \r
+   your characters. However, if your datatype is mixed, then the default         \r
+   partition contains as many divisions as there are datatypes in your           \r
+   character matrix. Of course, you can also define other partitions, and        \r
+   switch among them using the set command ("set partition=<name/number>").    \r
+   Importantly, you can also assign model parameters to individual part-         \r
+   itions or to groups of them using the "applyto" option in lset and          \r
+   prset. When the program attempts to perform an analysis, the model is         \r
+   set for individual partitions. If the same parameter applies to differ-       \r
+   partitions and if that parameter has the same prior, then the program         \r
+   will link the parameters: that is, it will use a single value for the         \r
+   parameter. The program's default, then, is to strive for parsimony.           \r
+   However, there are lots of cases where you may want unlink a parameter        \r
+   across partitions. For example, you may want a different transition/          \r
+   transversion rate ratio to apply to different partitions. This command        \r
+   allows you to unlink the parameters, or to make them different across         \r
+   partitions. The converse of this command is "link", which links to-         \r
+   gether parameters that were previously told to be different. The list         \r
+   of parameters that can be unlinked includes:                                  \r
+                                                                                 \r
+      Tratio          -- Transition/transversion rate ratio                      \r
+      Revmat          -- Substitution rates of GTR model                         \r
+      Omega           -- Nonsynonymous/synonymous rate ratio                     \r
+      Statefreq       -- Character state frequencies                             \r
+      Shape           -- Gamma/LNorm shape parameter                             \r
+      Pinvar          -- Proportion of invariable sites                          \r
+      Correlation     -- Correlation parameter of autodiscrete gamma             \r
+      Ratemultiplier  -- Rate multiplier for partitions                          \r
+      Switchrates     -- Switching rates for covarion model                      \r
+      Topology        -- Topology of tree                                        \r
+      Brlens          -- Branch lengths of tree                                  \r
+      Speciationrate  -- Speciation rates for birth-death process                \r
+      Extinctionrate  -- Extinction rates for birth-death process                \r
+      Popsize         -- Population size for coalescence process                 \r
+      Growthrate      -- Growth rate of coalescence process                      \r
+      Aamodel         -- Aminoacid rate matrix                                   \r
+      Cpprate         -- Rate of Compound Poisson Process (CPP)                  \r
+      Cppmultdev      -- Standard dev. of CPP rate multipliers (log scale)       \r
+      Cppevents       -- CPP events                                              \r
+      TK02var         -- Variance increase in TK02 relaxed clock model           \r
+      Igrvar          -- Variance increase in IGR relaxed clock model            \r
+      Mixedvar        -- Variance increase in Mixed relaxed clock model          \r
+                                                                                 \r
+   For example,                                                                  \r
+                                                                                 \r
+      unlink shape=(all)                                                         \r
+                                                                                 \r
+   unlinks the gamma/lnorm shape parameter across all partitions of the data.    \r
+   You can use "showmodel" to see the current linking status of the            \r
+   characters.                                                                   \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Version                                                                       \r
+                                                                                 \r
+   This command shows the release version of the program.                        \r
+   ---------------------------------------------------------------------------   \r
+                                                                                 \r
+   ***************************************************************************   \r
+   *                                                                         *   \r
+   *  3. 'Data' or 'tree' block commands (in #NEXUS file)                    *   \r
+   *                                                                         *   \r
+   ***************************************************************************   \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
+   Begin                                                                         \r
+                                                                                 \r
+   This command is used to format data or commands in the program. The correct   \r
+   usage is                                                                      \r
+                                                                                 \r
+      begin <data or mrbayes>;                                                   \r
+                                                                                 \r
+   The two valid uses of the "begin" command, then, are                        \r
+                                                                                 \r
+      begin data;                                                                \r
+      begin mrbayes;                                                             \r
+                                                                                 \r
+   The "data" specifier is used to specify the beginning of a data block; your \r
+   character data should follow. For example, the following is an example of     \r
+   a data block for four taxa and ten DNA sites:                                 \r
+                                                                                 \r
+      begin data;                                                                \r
+         dimensions ntax=4 nchar=10;                                             \r
+         format datatype=dna;                                                    \r
+         matrix                                                                  \r
+         taxon_1  AACGATTCGT                                                     \r
+         taxon_2  AAGGATTCCA                                                     \r
+         taxon_3  AACGACTCCT                                                     \r
+         taxon_4  AAGGATTCCT                                                     \r
+         ;                                                                       \r
+      end;                                                                       \r
+                                                                                 \r
+   The other commands -- dimensions, format, and matrix -- are discussed         \r
+   in the appropriate help menu. The only thing to note here is that the         \r
+   block begins with a "begin data" command. The "mrbayes" command is        \r
+   used to enter commands specific to the MrBayes program into the file.         \r
+   This allows you to automatically process commands on execution of the         \r
+   program. The following is a simple mrbayes block:                             \r
+                                                                                 \r
+      begin mrbayes;                                                             \r
+         charset first  = 1-10\3;                                               \r
+         charset second = 2-10\3;                                               \r
+         charset third  = 3-10\3;                                               \r
+      end;                                                                       \r
+                                                                                 \r
+   This mrbayes block sets off the three "charset" commands, used to           \r
+   predefine some blocks of characters. The mrbayes block can be very useful.    \r
+   For example, in this case, it would save you the time of typing the char-     \r
+   acter sets each time you executed the file. Also, note that every             \r
+   "begin <data or mrbayes>" command ends with an "end". Finally, you can    \r
+   have so-called foreign blocks in the file. An example of a foreign block      \r
+   would be "begin paup". The program will simply skip this block. This is     \r
+   useful because it means that you can use the same file for MrBayes, PAUP*     \r
+   or MacClade (although it isn't clear why you would want to use those other    \r
+   programs).                                                                    \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Dimensions                                                                    \r
+                                                                                 \r
+   This command is used in a data block to define the number of taxa and         \r
+   characters. The correct usage is                                              \r
+                                                                                 \r
+      dimensions ntax=<number> nchar=<number>                                    \r
+                                                                                 \r
+   The dimensions must be the first command in a data block. The following       \r
+   provides an example of the proper use of this command:                        \r
+                                                                                 \r
+      begin data;                                                                \r
+         dimensions ntax=4 nchar=10;                                             \r
+         format datatype=dna;                                                    \r
+         matrix                                                                  \r
+         taxon_1  AACGATTCGT                                                     \r
+         taxon_2  AAGGATTCCA                                                     \r
+         taxon_3  AACGACTCCT                                                     \r
+         taxon_4  AAGGATTCCT                                                     \r
+         ;                                                                       \r
+      end;                                                                       \r
+                                                                                 \r
+   Here, the dimensions command tells MrBayes to expect a matrix with four       \r
+   taxa and 10 characters.                                                       \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   End                                                                           \r
+                                                                                 \r
+   This command is used to terminate a data or mrbayes block. The correct        \r
+   usage is                                                                      \r
+                                                                                 \r
+      end;                                                                       \r
+                                                                                 \r
+   For more information on this, check the help for the "begin" command.       \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Endblock                                                                      \r
+                                                                                 \r
+   This is an older, deprecated version of "End", see that command.            \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Format                                                                        \r
+                                                                                 \r
+   This command is used in a data block to define the format of the char-        \r
+   acter matrix. The correct usage is                                            \r
+                                                                                 \r
+      format datatype=<name> ... <parameter>=<option>                            \r
+                                                                                 \r
+   The format command must be the second command in a data block. The following  \r
+   provides an example of the proper use of this command:                        \r
+                                                                                 \r
+      begin data;                                                                \r
+         dimensions ntax=4 nchar=10;                                             \r
+         format datatype=dna gap=-;                                              \r
+         matrix                                                                  \r
+         taxon_1  AACGATTCGT                                                     \r
+         taxon_2  AAGGAT--CA                                                     \r
+         taxon_3  AACGACTCCT                                                     \r
+         taxon_4  AAGGATTCCT                                                     \r
+         ;                                                                       \r
+      end;                                                                       \r
+                                                                                 \r
+   Here, the format command tells MrBayes to expect a matrix with DNA char-      \r
+   acters and with gaps coded as "-".                                          \r
+                                                                                 \r
+   The following are valid options for format:                                   \r
+                                                                                 \r
+   Datatype   -- This parameter MUST BE INCLUDED in the format command. More-    \r
+                 over, it must be the first parameter in the line. The           \r
+                 datatype command specifies what type of characters are          \r
+                 in the matrix. The following are valid options:                 \r
+                    Datatype = Dna: DNA states (A,C,G,T,R,Y,M,K,S,W,H,B,         \r
+                               V,D,N)                                            \r
+                    Datatype = Rna: DNA states (A,C,G,U,R,Y,M,K,S,W,H,B,         \r
+                               V,D,N)                                            \r
+                    Datatype = Protein: Amino acid states (A,R,N,D,C,Q,E,        \r
+                               G,H,I,L,K,M,F,P,S,T,W,Y,V)                        \r
+                    Datatype = Restriction: Restriction site (0,1) states        \r
+                    Datatype = Standard: Morphological (0,1) states              \r
+                    Datatype = Continuous: Real number valued states             \r
+                    Datatype = Mixed(<type>:<range>,...,<type>:<range>): A       \r
+                               mixture of the above datatypes. For example,      \r
+                               "datatype=mixed(dna:1-100,protein:101-200)"     \r
+                               would specify a mixture of DNA and amino acid     \r
+                               characters with the DNA characters occupying      \r
+                               the first 100 sites and the amino acid char-      \r
+                               acters occupying the last 100 sites.              \r
+                                                                                 \r
+   Interleave -- This parameter specifies whether the data matrix is in          \r
+                 interleave format. The valid options are "Yes" or "No",     \r
+                 with "No" as the default. An interleaved matrix looks like    \r
+                                                                                 \r
+                    format datatype=dna gap=- interleave=yes;                    \r
+                    matrix                                                       \r
+                    taxon_1  AACGATTCGT                                          \r
+                    taxon_2  AAGGAT--CA                                          \r
+                    taxon_3  AACGACTCCT                                          \r
+                    taxon_4  AAGGATTCCT                                          \r
+                                                                                 \r
+                    taxon_1  CCTGGTAC                                            \r
+                    taxon_2  CCTGGTAC                                            \r
+                    taxon_3  ---GGTAG                                            \r
+                    taxon_4  ---GGTAG                                            \r
+                    ;                                                            \r
+                                                                                 \r
+   Gap        -- This parameter specifies the format for gaps. Note that         \r
+                 gap character can only be a single character and that it        \r
+                 cannot correspond to a standard state (e.g., A,C,G,T,R,Y,       \r
+                 M,K,S,W,H,B,V,D,N for nucleotide data).                         \r
+                                                                                 \r
+   Missing    -- This parameter specifies the format for missing data. Note      \r
+                 that the missing character can only be a single character and   \r
+                 cannot correspond to a standard state (e.g., A,C,G,T,R,Y,       \r
+                 M,K,S,W,H,B,V,D,N for nucleotide data). This is often an        \r
+                 unnecessary parameter to set because many data types, such      \r
+                 as nucleotide or amino acid, already have a missing char-       \r
+                 acter specified. However, for morphological or restriction      \r
+                 site data, "missing=?" is often used to specify ambiguity     \r
+                 or unobserved data.                                             \r
+                                                                                 \r
+   Matchchar  -- This parameter specifies the matching character for the         \r
+                 matrix. For example,                                            \r
+                                                                                 \r
+                    format datatype=dna gap=- matchchar=.;                       \r
+                    matrix                                                       \r
+                    taxon_1  AACGATTCGT                                          \r
+                    taxon_2  ..G...--CA                                          \r
+                    taxon_3  .....C..C.                                          \r
+                    taxon_4  ..G.....C.                                          \r
+                    ;                                                            \r
+                                                                                 \r
+                 is equivalent to                                                \r
+                                                                                 \r
+                    format datatype=dna gap=-;                                   \r
+                    matrix                                                       \r
+                    taxon_1  AACGATTCGT                                          \r
+                    taxon_2  AAGGAT--CA                                          \r
+                    taxon_3  AACGACTCCT                                          \r
+                    taxon_4  AAGGATTCCT                                          \r
+                    ;                                                            \r
+                                                                                 \r
+   The only non-standard NEXUS format option is the use of the "mixed",        \r
+   "restriction", "standard" and "continuous" datatypes. Hence, if         \r
+   you use any of these datatype specifiers, a program like PAUP* or             \r
+   MacClade will report an error (as they should because MrBayes is not          \r
+   strictly NEXUS compliant).                                                    \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Matrix                                                                        \r
+                                                                                 \r
+   This command specifies the actual data for the phylogenetic analysis.         \r
+   The character matrix should follow the dimensions and format commands         \r
+   in a data block. The matrix can have all of the characters for a taxon        \r
+   on a single line:                                                             \r
+                                                                                 \r
+      begin data;                                                                \r
+         dimensions ntax=4 nchar=10;                                             \r
+         format datatype=dna gap=-;                                              \r
+         matrix                                                                  \r
+         taxon_1  AACGATTCGT                                                     \r
+         taxon_2  AAGGAT--CA                                                     \r
+         taxon_3  AACGACTCCT                                                     \r
+         taxon_4  AAGGATTCCT                                                     \r
+         ;                                                                       \r
+      end;                                                                       \r
+                                                                                 \r
+   or be in "interleaved" format:                                              \r
+                                                                                 \r
+      begin data;                                                                \r
+         dimensions ntax=4 nchar=20;                                             \r
+         format datatype=dna gap=- interleave=yes;                               \r
+         matrix                                                                  \r
+         taxon_1  AACGATTCGT                                                     \r
+         taxon_2  AAGGAT--CA                                                     \r
+         taxon_3  AACGACTCCT                                                     \r
+         taxon_4  AAGGATTCCT                                                     \r
+                                                                                 \r
+         taxon_1  TTTTCGAAGC                                                     \r
+         taxon_2  TTTTCGGAGC                                                     \r
+         taxon_3  TTTTTGATGC                                                     \r
+         taxon_4  TTTTCGGAGC                                                     \r
+         ;                                                                       \r
+      end;                                                                       \r
+                                                                                 \r
+   Note that the taxon names must not have spaces. If you really want to         \r
+   indicate a space in a taxon name (perhaps between a genus and species         \r
+   name), then you might use an underline ("_"). There should be at            \r
+   least a single space after the taxon name, separating the name from           \r
+   the actual data on that line. There can be spaces between the char-           \r
+   acters.                                                                       \r
+                                                                                 \r
+   If you have mixed data, then you specify all of the data in the same          \r
+   matrix. Here is an example that includes two different data types:            \r
+                                                                                 \r
+      begin data;                                                                \r
+         dimensions ntax=4 nchar=20;                                             \r
+         format datatype=mixed(dna:1-10,standard:21-30) interleave=yes;          \r
+         matrix                                                                  \r
+         taxon_1  AACGATTCGT                                                     \r
+         taxon_2  AAGGAT--CA                                                     \r
+         taxon_3  AACGACTCCT                                                     \r
+         taxon_4  AAGGATTCCT                                                     \r
+                                                                                 \r
+         taxon_1  0001111111                                                     \r
+         taxon_2  0111110000                                                     \r
+         taxon_3  1110000000                                                     \r
+         taxon_4  1000001111                                                     \r
+         ;                                                                       \r
+      end;                                                                       \r
+                                                                                 \r
+   The matrix command is terminated by a semicolon.                              \r
+                                                                                 \r
+   Finally, just a note on data presentation. It is much easier for others       \r
+   to (1) understand your data and (2) repeat your analyses if you make          \r
+   your data clean, comment it liberally (using the square brackets), and        \r
+   embed the commands you used in a publication in the mrbayes block.            \r
+   Remember that the data took a long time for you to collect. You might         \r
+   as well spend a little time making the data file look nice and clear to       \r
+   any that may later request the data for further analysis.                     \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Taxlabels                                                                     \r
+                                                                                 \r
+   This command defines taxon labels. It could be used within taxa block.        \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Translate                                                                     \r
+                                                                                 \r
+   This command is used by MrBayes to specify the mapping between taxon names    \r
+   and taxon numbers in a Nexus tree file. For instance,                         \r
+                                                                                 \r
+      translate                                                                  \r
+         1 Homo,                                                                 \r
+         2 Pan,                                                                  \r
+         3 Gorilla,                                                              \r
+         4 Hylobates;                                                            \r
+                                                                                 \r
+   establishes that the taxon labeled 1 in the trees that follow is Homo, the    \r
+   taxon labeled 2 is Pan, etc.                                                  \r
+   ---------------------------------------------------------------------------   \r
+   ---------------------------------------------------------------------------   \r
+   Tree                                                                          \r
+                                                                                 \r
+   This command is used by MrBayes to write trees to a nexus tree file. Trees    \r
+   are written in the Newick format. For instance,                               \r
+                                                                                 \r
+      tree ((1,2),3,4);                                                          \r
+                                                                                 \r
+   describes an unrooted tree with taxa 1 and 2 being more closely related to    \r
+   each other than to taxa 3 and 4. If branch lengths are saved to file, they    \r
+   are given after a colon sign immediately following the terminal taxon or the  \r
+   interior node they refer to. An example of an unrooted tree with branch       \r
+   lengths is:                                                                   \r
+                                                                                 \r
+      tree ((1:0.064573,2:0.029042):0.041239,3:0.203988,4:0.187654);             \r
+                                                                                 \r
+   Trees that are rooted (clock trees) are written with a basal dichotomy        \r
+   instead of a basal trichotomy. If the tree described above had been rooted    \r
+   on the branch leading to taxon 4, it would have been represented as:          \r
+                                                                                 \r
+      tree (((1,2),3),4);                                                        \r
+                                                                                 \r
+   ---------------------------------------------------------------------------   \r
diff --git a/documentation/release_note.txt b/documentation/release_note.txt
new file mode 100644 (file)
index 0000000..7e92f45
--- /dev/null
@@ -0,0 +1,46 @@
+Release Note\r
+\r
+v3.2.6 (Nov 25 2015)\r
+  1. Add invertebrate mt, Echinoderm and Euplotid codes [lset code=invermt].\r
+  2. Fix a bug of updating brls in tree-stretch move.\r
+  3. Correct the proposal ratio in the add/delete branch move.\r
+  4. Add more coding options for restriction site chars.\r
+\r
+v3.2.5 (Apr 8 2015)\r
+  1. Fix pdf in the coalescent prior.\r
+  2. Fix a few issues when appending to the previous run.\r
+  3. Improve the efficiency of moving ancestral fossils.\r
+  4. Add lognormal rate variation among sites [lset rate=lnorm].\r
+  5. Add parsimony-biased SPR and TBR proposals (for developers).\r
+  6. Other minor bug fixes and improvements.\r
+\r
+v3.2.4 (Jan 27 2015)\r
+  1. Correct the proposal ratio in the node slider move for non-clock tree.\r
+  2. Fix reporting ancestral states under GTR+I+G model.\r
+  3. Fix the sliding window in the move of updating omega in codon model.\r
+  4. Fix the likelihood and proposal ratio of NaN in the multi-species coalescent analysis.\r
+  5. Correct screen output messages for a few commands.\r
+  6. Fix the interaction of MrBayes with Beagle for the Windows executable. \r
+  7. Fix prior pdf of relative rates (rate multipliers).\r
+\r
+v3.2.3 (Oct 22 2014)\r
+  1. Correct the proposal ratio in the extending TBR move for non-clock tree.\r
+  2. Fix numerical error of calculating proposal ratio in parsimony-biased SPR moves.\r
+  3. Set unconstrained:gammadir prior as default to help avoid overestimating branch lengths.\r
+  4. Add clock:fossilization prior for total-evidence dating analysis.\r
+  5. Add LG model to Aamodelpr [prset aamodelpr=fixed(LG)].\r
+  6. Rearrange the code to be more concise.\r
+  7. Other minor bug fixes and improvements.\r
+\r
+v3.2.2 (Aug 22 2013)\r
+  1. Disable LIKE_EPSILON warning for standard users.\r
+  2. Fix segmentation fault errors in 64bit version.\r
+  3. Fix some issues when dealing with constraints.\r
+  4. Fix setting aarevmatpr parameters to fixed for GTR.\r
+  5. Other bug fixes and improvements.\r
+\r
+v3.2.1 (Feb 8 2012)\r
+v3.2.0 (Nov 16 2011)\r
+  Major release.\r
+\r
+For a full list of bug fixes, see https://sourceforge.net/p/mrbayes/bugs/milestone/v3.2.x/\r
diff --git a/examples/avian_ovomucoids.nex b/examples/avian_ovomucoids.nex
new file mode 100644 (file)
index 0000000..78c0890
--- /dev/null
@@ -0,0 +1,113 @@
+#NEXUS \r
+\r
+[ Data from: Laskowski, M., Jr., and W.M. Fitch.  1989.  Evolution of avian ovomucoids and of birds.\r
+             Pp. 371-387 in B. Fernholm, K. Bremer, and H. Jornvall (eds.), The Hierarchy of Life. Elsevier Press, Amsterdam. ]\r
+\r
+begin data;\r
+       dimensions ntax=89 nchar=88;\r
+       format datatype=protein missing=? gap=- matchchar=.;\r
+\r
+       matrix\r
+       [                                        10        20        30        40        50        60        70        80       ]\r
+       [                                        .         .         .         .         .         .         .         .        ]\r
+       Struthio_camelus                VKYPNTNEEGKEVVLPKILSPIGSDGVYSNELANIEYTNVSK??????FAT--VDDYKPVPLDYMLDSKTSNKNNVVESSGTLRHFGK\r
+       Rhea_americana                  .............L..E..N.V.T................?.D?????...--...H...S.E..........D.....N...S....\r
+       Pterocnemia_pennata             .............L..E..N.V.A..................DHD?EV...--...H...S.E..........D.....N...S....\r
+       Casuarius_casuarius             ........D....L.....N.........DD......A....DHDKEV...--..E....SPE.......N..DS....N...G....\r
+       Dromaius_novaehollandiae        ........D....L.....N..........D......A..??D?????...--.......S.E.......N..D.....N...G....\r
+       Nothoprocta_cinerascens         .....A.D.....P...TP...A.NA.FGS....V....I..DHDK?????T-..G...AT.E.F..NQ.A..A....KNV....L..\r
+       Eudromia_elegans                .R.....D.....P...TP..V.AN....S....V....I?.?????????S-I.G...AT.EFF..NQ....A.A..KNV..N.I.E\r
+       Pygoscelis_adeliae_f            .TF..........LVT.......T..................DHDKEVI..--.......S.E..............D.N...S....\r
+       Pygoscelis_adeliae_y            .T...........LVT.......T..................DHDKEVI..--.......S.E..............D.N...S....\r
+       Spheniscus_humboldti            .T.S.........LIT.......T..................D?DKEVI..--I......S.E..............D.N.I.S....\r
+       Phalacrocorax_sulcirostris      .S.SK.......ALVT.......T..............KI..DHDKEVI..--.......S.E.............AD.N...S....\r
+       Anhinga_novaehollandeae         .L.S.........LVT.......T................T.DHDKEVI.S--.......S.E..............D.N...S....\r
+       Nycticorax_nycticorax           .T.S.A....R..LVT.......A..........M....I..DHDGEVIV.--.......SPEN.V.......D..AD.N...S....\r
+       Chauna_chavaria                 .R...........L.T.T.....T..................DRDKEAV..--......AT.E....NQ....S...D.N...S....\r
+       Anseranas_semipalmata           .R...S.......L.T.D...................A....DHDKEAV..--..E...AT.E....NQ........D.N...S....\r
+       Dendrocygna_arcuata             .RF..........L.T.E...V.................I..D?DKEAV..--......AT.E....N..G......D.N...S....\r
+       Dendrocygna_autumnalis          .RF..........L.T.D.....................I..DHDKEAV..--......AT.E....N..G......D.N...S....\r
+       Dendrocygna_eytoni_d            .RF..........L.T.DVI.V............L....I..DHDKEAV..--....R.DT.E....N..G......D.N...S....\r
+       Dendrocygna_eytoni_e            .RF..........L.T.DVI.V............L....I..DHDKEAV..--..E.R.DT.E....N..G......D.N...S....\r
+       Dendrocygna_viduata             .RFS.........L.T.E...V.................I..D?D?EAV..--......AT.E....N..G.R....D.N...S....\r
+       Coscoroba_coscoroba             ..F..........L.T.D.I...T...............I..DHDKEAV..--..G...ATME....N..G......D.N...S....\r
+       Cygnus_atratus                  .RF..........L.T.D.....T...............I..DHDKEAV..--......ATME....N..G......D.N...S....\r
+       Goose                           .RF..........L.T.D.....T...............I..DHDKEAV..--......ATVE....N..D......D.N...S....\r
+       Anser_indicus                   .RF..........L.T.D.A...T...............I..DHDKEAV..--......ATVE....N..D......D.N...S....\r
+       Branta_canadensis               .RF.......R..L.T.D.....T...............I..DHD???V..--......ATVE....N..G......D.N...S....\r
+       Cereopsis_novaehollandiae       ..F..........L...DVI.T.T...............I..D?D??AV..--......ARME....N..G......D.N...S....\r
+       Chloephaga_picta                .RF..........L.T.E.....T...............I..D??KEAV..--..G...ATME....N..G......D.N...S...E\r
+       Duck                            .RF..........L.T.E...V.T...............I..DHDKEAV..--..G...ATME....N..G......D.N...S...E\r
+       Anas_platyrhynchos              .RF........D.L.T.E...V.T...............I..DHDKEAV..--..G...ATME....N..G......D.N...S...E\r
+       Megapodius_freycinet            .R...........LVTQDV?...T....?....G...??I????????LV.--......ST.EDK..NQ....S...D.N...S....\r
+       Leipoa_ocellata                 IRH..........LVTEDS....T...............I..E?DK??VV.--..G.THAT.ELK..NQ....G..AQ.N...S....\r
+       Ortalis_vetula                  ...........D.LA.EDPNL.......T-.......???????????..PN-...H..ALQEQKI.N..D..S...D.N...S....\r
+       Penelope_jacquacu               ...........D.LA.EDP.........T-.........I..ERDKEA..PN-...H..ALQEQK..N..D..S...D.N...S....\r
+       Penelope_superciliaris          ...........D.LVAEDP....................I..E?DKEA..PN-...H..ALQEQK..N..D..S...D.N...S....\r
+       Bonasa_umbellus                 .RF........V.LV.EDPR...T.A.....M.......I..EHD???L.AS-..E...ATME.R..N..G........N.N.S...T\r
+       Tympanuchus_cupido              .RF........D.LVTED.H...T...............I..EHD???L.AS-..E...ATME.R..N..G........N...S....\r
+       Oreortyx_pictus                 .RF........D.LAT.E.H...T........S......I..EHDTEA..AS-..E...AT.E.R.....A........N...S....\r
+       Callipepla_squamata_n           .RF........D.LAT.E.H...T........Y......I..EHD??A..AS-..E...DT.E.R..N..A........N...S....\r
+       Callipepla_squamata_s           .RF........D.LAT.E.H...T........Y......I..EHD??A..AS-..E...DT.E.R..N..AS.......N...S....\r
+       Lophortyx_californicus          .RF........D.LVT.E.Q...T........Y......I..EHD?EA..AS-..E...AT.E.R..N..A........N...S....\r
+       Colinus_virginianus             .RF........D.LATEE.H...T....MS.MF......T..EHDTEA..AS-..E...AMSE.R..N..V........N...S....\r
+       Cyrtonyx_montezumae_l           .RF........D.LVTEEV....T........S..A.?.I.?E?D???..AS-..E...AT.E.VI.N..G........N...S....\r
+       Cyrtonyx_montezumae_s           .RF........D.LVTEEV....T........S..A.?.I.?E?D???..AS-..E...ATSE.VI.N..G........N...S....\r
+       Alectoris_chukar                ARF..A.....D..VTED.R...T....T-.........I..EHDGETL.A--..E...AT.E.R.....G........N...S....\r
+       Alectoris_rufa                  ARF..A.....D..VTED.H...T....T-.........I..EHD???L.A--..E...AT.E.R.....G........N...S....\r
+       Francolinus_afer                .RF..A....RD..VSEN.R...TH........SM....I..EHDREAP.AS-..E...ATME.RV.NI.G......K.N...S....\r
+       Francolinus_erckelii            .RF..A.....D.AVSEN.R...T...N-.....M....I??EHD?EAP.AS-..E...ATME.RV.NI.G......K.N...S.K..\r
+       Francolinus_coqui_v             .RF..A....RD..VSEN.R...T.........SMN...I..E?D?EA???S-..E...GTME.RV.NI.G......K.N...S....\r
+       Francolinus_coqui_a             .RF..A....RD.AVSEN.R...T.........SMN...I..E?D?EA???S-..E...GTME.RV.NI.G......K.N...S....\r
+       Francolinus_francolinus_a       ARF........V.LDS.D.I...T..LHDS..S...H.KIK.EHDRE????S-..G...ETAEET..N..R........N........\r
+       Francolinus_francolinus_v       .RF........V.LDS.D.I...T..LHDS..S...H.KIK.EHDRE????S-..G...ETAEET..N..R........N........\r
+       Francolinus_pondicerianus       ARFS.A.....D.LVIDDPR.M.T....DS..F.M....I..EHD???LPAS-..E...DTTEER..N..G........N...S....\r
+       Perdix_perdix                   .RF........D.LVTED.Q...T...............I..EHT???L.AS-..E...ATME.R..N..G..D.....N...N....\r
+       Coturnix_delegorguei            .RF........DE.V.DE.RF..T....NH.MF.K....I..EQDGET???S-..E...A.K..RV.N..G........N...NR...\r
+       Coturnix_coturnix_japonica_1    .RF........DE.V.DE.RL..T....NH.MF.K....I..EQDGETL.AS-..E...A.K..RV.N...........N...N....\r
+       Coturnix_coturnix_japonica_2    .RF........DE.V.DE.RL..T....NH.MF.K....I..EQDGETL.AS-..E...A.K..RV.N..G........N...N....\r
+       Arborophilia_torqueola          .RF..S.....V..VKEDPR...T.........H..T??I?.?????????S-....M.ATME.RV.N..G........N...S....\r
+       Bambusicola_thoracica           ARF..A.....V.LDTQE.R...T.......MS......I.IK?DKE?L.AS-..E...ETAEERI.N..G........N....N...\r
+       Tragopan_satyra                 .RF........D.LVTED.H...T...............I..GHDREAL.AS-..E...ATME.R..N..G........N...S....\r
+       Tragopan_temmincki              .RF........D.LVTED.R...T...............I..GHD???L.AS-..E...ATME.R..N..G........N...S....\r
+       Lophophorus_impejanus           .RF..A.....D.LVTED.R...T...............I..EHDREAL.AS-..E...ATME.R..N..G........N...S....\r
+       Crossoptilon_auritum            .RF........D.LVAED.R...T...............I..ERDGEAL.AS-..E...ATME.R..N..G........N...S....\r
+       Lophura_edwardsi                .RF........D.LVAED.R...T.......M.......I..ERDGEAL.AS-..E...ATME.R..N..G........N...S....\r
+       Lophura_ignita                  .RF........D.LVGEDIR...T.......M.......N..ERDGEAL.AS-..E...ATME.R..N.SD........N...S....\r
+       Gallus_gallus                   ARF..ADK...D.LVN.D.R...T....T.D..S..F..I..EHDKETL.AS-..E...DTAEDR..N..G........N...S....\r
+       Grey_jungle_fowl                ARF..ADK...D.LVN.D.R...T....T.D..S..F..I..EHDKETL.AS-..E...DTVEDR..N..G........N...S....\r
+       Phasianus_colchicus             .RF..........LVAED.R.V.T.....S.........I..EHEGEAL.AS-..E...ATME.R..N..G........N...NR..Q\r
+       Syrmaticus_ellioti              .RF..K.....D.LVAED.H...T...............I..ER?G??L.AS-..E...ATME.R..N..G........N...S....\r
+       Syrmaticus_reevesii             .RF..K.......LVAED.H...T.....S.........I..ERNGEAL.AS-..E...ATME.R..N..G........N...SR..E\r
+       Chrysolophus_amherstiae         .RFL.....S.D-LVAED.H...T...............I..EHDG?AL.AS-..E...ATME.R..N..G........N...N....\r
+       Polyplectron_bicalcaratum       .RF....K...D.LA.EEVR...T.....D.S..RD...I..EHDR?????S-..E.Q.TTTEHRVNNE.G......K.N..VS....\r
+       Argusianus_argus_argus          .RF........D.LVSEDRH...T.....H..T......I..EHD?EAL.A--..EH..AT.EDR..N.I...D..L..N...S....\r
+       Pavo_cristatus                  .RF..A.....D.LVSED.H...T.....H.........I..EHDREAL.AS-..E...AT.EHR..N..G........N...S....\r
+       Afropavo_congensis              .RF........D.SAS.D.R...T.....H.........I..EHDGEAL.AS-..E...ATMEQR..N..G........N...S....\r
+       Numida_meleagris                .RF..A.....D.LVTED.R...T......D........I.?????EAL.A--..E...ATME.R..N..D........N...S....\r
+       Acryllium_vulturinum            .RF..A.....D.LVIED.R...T......D........I..EHD???L.A--..E...ATME.R..N..D........N...S....\r
+       Meleagris_gallopavo             .RF........D.LVTED.R...T...H.-.........I..EHDREAL.AS-..E...AT.E.R..N..G........N...S....\r
+       Grus_carunculatus               .T...........LVT.......T..................DHDKEAT..--......AT.E..F...........D.N...S....\r
+       Anthropoides_virgo              .T...........LVT.......T..................DHDKEVT..--......AT.E..F...........D.N...S....\r
+       Grus_vipio                      IT...........LVT.......T..................DHDKEAT..--......AT.E..F...........D.N...S....\r
+       Fulica_atra                     .T...........LVT.....V.TN......S..........DYDKEVT..--..G.Q.AS.E.VF.N.....D..AD.N...S....\r
+       Vanellus_spinosus               .T...........LVT.......T..........L.......DYDKEVI..--......AS................D.N...S..E.\r
+       Larus_rudibundus                .T...........LAT.A...V....................DYDKEDI..--......AS................D.N...S..E.\r
+       Turnix_sylvatica                .RF........DT.AD.D.P.........-.M.......I..EHD??T???S-..E...GMMERL..N..ND.......N...N...E\r
+       Gallirallus_australis           .T.........V.LVT.NI..V.TN...T..S.I...S....DYD???T..??..G.QSA.Q..VF.N........AD.N...S....\r
+       Geococcyx_californianus         .A...A......ALVTTARLH..T....G.....L.H..I..DYNKEVI.S--.N.....S.L....N..G.....AD.N...S....\r
+       Dacelo_novaeguineae             .......D.....LVTE......T.R................EHDKEAI..-Q..EH..AT...RI.......D..MD.N...S....\r
+       Carpococcyx_renauldi            .R...S......GLATT.R....T....G.....L....I..DYD???I..--.......T.ED...NI.H..Y..AH.N..FS....\r
+       Podargus_strigoides             .T.......S...LVDEV.....T..........L.-..I..DRDK??I..--....Q..MG...............D.N...N....\r
+       ;\r
+end;\r
+\r
+[\r
+begin mrbayes;\r
+       [The following line will let the mcmc chain integrate\r
+        over the ten fixed amino-acid rate matrices. You can also fix\r
+        the rates to those in one of the rate matrices.]\r
+       prset aamodelpr=mixed;\r
+end;\r
+]\r
+\r
diff --git a/examples/codon.nex b/examples/codon.nex
new file mode 100644 (file)
index 0000000..76092cb
--- /dev/null
@@ -0,0 +1,47 @@
+#NEXUS\r
+\r
+[ Example command file, which reads in a data file and sets up different codon models.\r
+  Use one of the blocks to set up the model you are interested in. ]\r
+\r
+begin mrbayes;\r
+       [The following line is useful for automatic execution with no\r
+        warnings issued before files are overwritten and automatic\r
+        termination of chains after the prespecified number of generations.]\r
+       set autoclose=yes nowarn=yes;\r
+          \r
+    [Read in a data file with protein-coding sequences]\r
+    execute replicase.nex;\r
+\r
+    [Use ONE of the blocks below depending one what model you like]\r
+\r
+    [One omega value for the gene\r
+     The estimated single omega value, valid for\r
+     the entire gene or gene fragment, is printed\r
+     to the .p file(s)]\r
+    lset nucmodel=codon;\r
+\r
+    [Omega variation across sites with three classes,\r
+     omega_1 < 1, omega_2 = 1, omega_3 > 1.\r
+     The estimated omega_1 and omega_3 are printed to\r
+     the .p file(s) as omega(-) and omega(+).\r
+     If you set report possel=yes, you\r
+     will also get the probability of each site being in\r
+     the positively selected omega class.\r
+     If you set report siteomega=yes, you\r
+     will also get the omega value for each site.]\r
+    lset nucmodel=codon omegavar=ny98;\r
+    report possel=yes;\r
+    report siteomega=yes;\r
+    \r
+    [Omega variation across sites with three classes,\r
+     omega_1 < omega_2 < omega_3. Otherwise very similar\r
+     to the Nielsen and Yang model.]\r
+    lset nucmodel=codon omegavar=m3;\r
+    report possel=yes;\r
+    \r
+    [These models are slow, so print to screen more frequently]\r
+    mcmcp printfreq = 10;\r
+\r
+    [Only the mcmc command is missing now to run the analysis]\r
+end;\r
+\r
diff --git a/examples/cynmix.nex b/examples/cynmix.nex
new file mode 100644 (file)
index 0000000..6ca372f
--- /dev/null
@@ -0,0 +1,705 @@
+#NEXUS \r
+\r
+[ Data from: Nylander JAA, Ronquist F, Huelsenbeck JP, Nieves-Aldrey JL. 2004. Bayesian phylogenetic analysis of combined data. Systematic Biology 53:47-67. ]\r
+\r
+Begin data;\r
+       Dimensions ntax=32 nchar=3246;\r
+       Format datatype=mixed(Standard:1-166,DNA:167-3246) interleave=yes gap=- missing=?;\r
+       Matrix\r
+Synergus        1-1-100000000202110201011010110100000000010121001120101010101000000001100020000000111000102010000211010010001001110110000011100000100111000000011112100001001101100005\r
+Periclistus     1-1-100000000202110201011110110100000000010100101000101010011000000001100021001000111000112010000211010010000001110111000011100000100111010000111112100001001111100002\r
+Ceroptres       1-1-1000100002021002010111101001000000000111000???10101010010000000000100021001000111000100000000200010010101001010111000011100000100111100000101112101001100111????05\r
+Synophromorpha  1-1-00001000021-100101001111110100000000010100101000100010010000000000100001200000111000110000000200010010001001000111000011100001120011110000111112100001001101100002\r
+Xestophanes     1-1-00001000011-10-110001011010100000000010110101000100010010101000000100001201000121000110000000100111010001000000111000011100000110011100000010012100000100120001002\r
+Diastrophus     011-10101000021-10-210001011010100000100000011101000100010012000000000001101201100101000110000000100100000000000000011000011100001120011100100000012000000100120001002\r
+Gonaspis        1-1-10001000011-10-210001011010100000100000021101000100010012000000000000101201000100000110000000200110000000000000111000011100101120011100101000010-00000100120001002\r
+Liposthenes_gle 01000030000101022020000010110111000001001000101100001000100120000000010000112011001010001120100001001110000000000000100000100010011210111-0201100012000000000120000003\r
+Liposthenes_ker 0000102000000101????????????????????????????110???0?10001001000000??00000011101100101000112010000????1000000000??????1?1?0100000011210111-01011000???0?000?001?1????03\r
+Antistrophus    1-010120000?01001010000110110001000001020000101???001011111100210000000002210011101210101110200001001100021000000000110000100000011210011-1201000112000000000120????00\r
+Rhodus          1-01000000000000????????????0??????????0????1010000?10101111000000??00000121001110121010112010000????1000200001??????1?000100010011211011-12010000?200?001?001?0????03\r
+Hedickiana      1-01010000000000?????0??10101??????1???0????0010000110101111000000??00000121001100121010111010000???11000100000??????1?000100000011200111012010001??00?001?00??0????03\r
+Neaylax         1-01010000000000100000011010000100010000000000{01}???0110001111000000000000002100110010201011{12}010000100111001000000000011000010000001120011100101000110-00001000110????03\r
+Isocolus        0100001000000100100100011110000100000000000010110001101010110000000000000020000010002000112010000100010001001000000010000010001001020011011100000111000001001100000100\r
+Aulacidea       00000000000001001002000110100001000000000000101???01101010110000000000000021000000000000112010000100010001001000000011000010000001010011110100100111000001001100????00\r
+Panteliella     0000003000100200??1?000????0??010?00????????200???1?101010111020?0??000001210010101200001{12}2110010???11?01100?????00????0?010?000021210111-020000?1?????000100120????03\r
+Barbotinia      1-010100000?0100002000000011000100010200000020010021101010111001000000000021001000100000111000000100110000101000000011000010000001110111110100001012010000100011001101\r
+Aylax           0100002000100101101000010010100110010200000020010021101010110000000003000021001010100000110010000100110000000000001011010010010001120111110200100010-10000000110001101\r
+Iraella         0100003000100100101100010010100110010200000020{01}???21101010110001100000000021000010110010121020000100111000000000001011000000020001120111110100100010-00000000020????01\r
+Timaspis        0000002000100201001100010010100101000000000021100120102010201001100003000021011000111000121001100000111100000100001011000010010000010101100210000010-01000000120000100\r
+Phanacis_1      00011000001001011011000110101001010000000010201???0110201021000010000300012101100012100012102100000011011000000000101100001001000011011111021000001000001000000200??00\r
+Phanacis_2      00000020001002000002010110101001110000000000111???01102010210001100003000021010000122000121021100000110010000010001011000010010000010111100110000010-00000100020????00\r
+Eschatocerus    000010310-1012002002000100101-110?101-0---20112101311--1112100011011120-0021-1001--321-012102110-00010--0011-1-1001001-0-000010001131--01-1200001-10-010-00?0120010106\r
+Diplolepis      000000300010120220020000001011111100120000202110013011-11021100110111201002101001001200011000100000010010001-110001011001000000111010111100210000010-01000000010????02\r
+Pediaspis       000000201011021-20100000001111111100121000{012}021010111100?101101011110010110011011011001-1110001001100101100000010000011001100010001120011100210000010-01010100020001117\r
+Plagiotrochus   000000000110120120010000001201101100121000102000013011-01021001110100001101120001111100012{01}0010011001011001001110110?1011000010002120011100210000000-010-0110120011015\r
+Andricus        0{01}00002001{01}01202200100001012011{01}1000111000{01}0{12}100003111-1101110101010000110{12}1{01}000011020001100000{01}010010{01}0001010110100110110010100{01}2120111110210{01}01110-01111110010011015\r
+Neuroterus      00001031021112022020001000121110111012121020310???3011-0102110101011010110012100010320001200011000001011001001-1011001111001020002120011000200000000-01110110000????15\r
+Biorhiza        010000310211120220200010001201101110121110202100103111-110111011101101011001200001101000110000010100101100100011010001111001020012120011100210000000-01111100020010015\r
+Parnips         1-00000000000100???????????????1????????????11110001111000101000?-??00000021001000021000112000000?0??00100000000?????0?00010?001000001010002110001???-?00??001?1????01\r
+Paramblynotus   0100000002000000100000000000110100000100000010{01}10000001000-0000000000000000000000--00000000001000200100-1-001000000-010000100000000111100-01000000020000000001000???0-\r
+Ibalia          000000000000002-000000000000??00000000000000100{01}0100001-00100000-0000000000010000-000000000011010000-0000000000-0---000000000200---01010000100000000-000000??00000000-\r
+\r
+Synergus        TATACTATACTTTATATTTGGTATTTGAACTGGAATAATTGGATCAGCATTAAGATTAATTATTCGTATAGAATTAAGATCAACATTACAATTAATTAATAATGATCAAATTTATAATTCAATTGTAACTGCTCATGCATTTATCATAATTTTTTTTATAGTAATA\r
+Periclistus     ATTAATATATTTTATTTTAGGGATTTGATCAGGTATAATTGGGTCAAGATTAAGAATAATTATTCGATTAGAACTTGGTAATCCTTTACAATTAATTGGAAATGATCAAATTTATAATTCAATTGTAACTGTTCATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Ceroptres       TATATTATATTTTATATTTGGGGTATATTCTGGAATAATTGGATCATCCTTAAGAATAATTATTCGAATAGAATTAGGAACTCCTACTCAGTTAATTAATAATGACCAAATTTATAATTCAATTGTAACTGCTCATGCTTTTATTATAATTTTTTTTATAGTTATA\r
+Synophromorpha  AATACTATATTTTATTTTTGGAATTTGATCTGGTATAATTGGATCTAGATTAAGAATAATTATTCGAATAGAACTTGGTAATCCATCTCAATTAATTGGAAATGATCAAATTTATAATTCAATTGTTACAATTCATGCTTTTATTATAATTTTTTTTATAGTTATA\r
+Xestophanes     AATATTATATTTTATTTTTGGAATTTGATCTGGTATAATTGGATCTAGATTAAGAATAATTATTCGAATAGAACTTGGAATTCCTACACAATTAATTGGTAATGACCAAATTTATAATTCAATTGTAACAATTCATGCATTTATTATAATTTTTTTTATAGTAATA\r
+Diastrophus     AATATTATATATAGTTTTTGGTATTTGATCTGGAATAATTGGATCAAGATTAAGAATAATTATTCGTACAGAACTTGGAACTCCTACACAATTAATTGGTAATGATCAAATTTATAACTCAATTGTTACAATTCATGCATTTATTATAATTTTTTTTATAGTAATA\r
+Gonaspis        TATATTATATATAATTTTTGGTGTTTGATCTGGCATAATTGGGTCTAGATTAAGAATAATTATTCGGACAGAACTTGGTACACCATTACAATTAATTGGTAATGATCAAATTTATAATTCAATTGTTACAACTCATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Liposthenes_gle AATTTTATATTTTATTTTTGGTATATGATCAGGTATATTAGGTTCAGCTTTAAGAATGATTATTCGTATAGAGTTAGGGACTCCCTCTCAATTAATTGGAAATGATCAAATTTATAATACAATTGTTACAGCTCATGCTTTTGTAATAATTTTTTTTATGGTTATA\r
+Liposthenes_ker AATATTATACTTTATATTTGGAATCTGATCTGGAATAATTGGATCAGGATTAAGAATAATTATCCGTATAGAACTAGGATCCCCCGGCCAACTAATTGGAAATGATCAAATCTATAACTCTATCGTTACAGCTCATGCATTTATTATAATTTTTTTTATAGTAATA\r
+Antistrophus    TATATTATACTTTTTATTTGGAATTTGATCTGGATTAATTGGATCAGCTTTAAGTATACTTATTCGAATAGAACTAGGAACCCCTTCTCAATTAATTGGTAATGATCAAATTTATAATTCAGTAGTTACTTCTCATGCTTTTGTAATAATTTTTTTTATAGTAATA\r
+Rhodus          ATTACTTTATTTTTTATTCGGTATATGATCAGGAATAGTTGGAGCAAGATTAAGAGTTATTATCCGTATAGAACTAGGAACCCCCTCTCAACTACTTGAAAATGACCAAGTTTATAATTCAATTGTAACTGCTCATGCATTTATCATAATCTCCTTTATAGTCATA\r
+Hedickiana      TATATTATATTTTTTATTTGGTGCATGATCTGGGACTATTGGATCTGCATTAAGTATACTTATTCGTAGAGAATTAGGGACTCCAAATCAATTTATTGGAAATGATCAAATTTATAATTCAATTGTCACATCTCATGCATTTGTAATAATTTTTTTTATAGTTATA\r
+Neaylax         TATATTATACTTTTTATTTGGGATTTGGTCAGGAATTATTGGATCTGCATTAAGAATAATTATTCGAATAGAATTAGGGTCACCCTCCCCATTAATTGGTAATGACCAAATTTATAATTCAATTGTTACTGCTCATGCATTTGTAATAATTTTTTTTATAGTCATG\r
+Isocolus        AATATTATATTTTTTATTTGGTATTTGATCAGGGATAATTGGGTCTGCTTTGAGAGTAATTATTCGAATAGAGTTAGGGACTCCTGGGCAATTAATTGGAAATGATCAAATTTATAATTCAATTGTTACAGCTCATGCTTTTGTAATAATTTTTTTTATAGTAATA\r
+Aulacidea       AATATTATATTTTTTATTTGGAATTTGATCTGGAATAATTGGATCAGCATTAAGAATAATTATTCGTTTAGAATTAGGGACCTCTGGACAATTAATTGGAGATGATCAAGTTTATAACTCTATTGTTACAGCTCATGCATTCGTAATAATTTTTTTTATAGTTATA\r
+Panteliella     ATTATTATATTTTATATTTGGTATTTGAGCAGGAATAATTGGGCCAGCTTTAAGAATAATTATTCGTATAGAGTTAGGGTTGCCTTCCCAATTAATTGGAAATGATCAAATTTATAATTCTATTGTTACGGCTCACGCTTTTATTATAATTTTTTTTATAGTTATA\r
+Barbotinia      AATATTATATTTTATATTTGGAATCTGATCAGGAATAATTGGGTCAGCTTTAAGAATATTAATTCGAATGGAATTAGGTACTCCAGGTCAATTAATTGGTAATGATCAAATTTACAATTCAATTGTTACTATTCATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Aylax           TATATTATATTTTATATTTGGAATTTGATCTGGAATAATTGGATCTGCTTTAAGTATATTAATTCGAATAGAATTAGGAACACCTAATCAATTAATTGGAAATGATCAAGTTTATAATTCAATTGTTACTACTCATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Iraella         AATAATATATTTTATTTTTGGTATTTGATCAGGAATAATTGGATCAGCCTTAAGAATATTAATTCGAATAGAATTAGGTACTCCAGGTCAATTAATTGGAAATGATCAAATTTATAATTCAATTGTTACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATA\r
+Timaspis        AATATTATATTTTATTTTTGGTATTTGATCTGGAATAATTGGATCAGCTTTAAGAATAATTATTCGTATAGAATTAGGGACTCCTTCACAATTAATTGGTAATGATCAAATTTATAATTCAGTAGTTACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATA\r
+Phanacis_1      TATATTATATTTTGTATTTGGGATTTGATCAGGAATAATTGGGTCTGCTTTAAGTATAATTATTCGGATAGAATTAGGTACACCTTCCCAATTAATTGGGAATGATCAGATTTATAATGCTATTGTTACAGCTCATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Phanacis_2      GGTATTATATTTTATTTTTGGGATTTGATCTGGTATAATTGGAACAGGATTAAGATTAATTATTCGTATAGAATTAGGGTCTCCTTCACAATTAATTGGGAATGATCAGATTTATAACTCAGTTGTTACTGCTCATGCATTTATTATAATTTTTTTTATGGTTATA\r
+Eschatocerus    AATCATATATTTTATTTTAGGAATTTGATCAGGAATTTTAGGGGCATCATTAAGTATACTTATTCGAATAGAATTAGGTACCCCTAATCAATTTATTGGAAATGATCAAATTTATAATTCTATTGTAACAGCTCATGCATTTATCATAATTTTCTTTATAGTTATA\r
+Diplolepis      TGTATTATATTTTATATTTGGTATTTGGTGTGGGATGGTTGGGGCAGCTTTAAGAATAATTATTCGTATTGAGTTAGGAATAACAGGGCAGTTAATTGGTAATGATCAAATTTATAATTCTATTGTTACTTCTCATGCTTTTATTATAATTTTTTTTATAGTTATG\r
+Pediaspis       AATATTATATTTTATTTTTGGAACATGATCTGGAATAATAGGAAGTTCATTAAGAATAATTATTCGAATAGAATTAGGAATACCTGGACAATTAATTAGAAATGATCAAATTTATAATATAATTGTAACTTCTCATGCTTTTATTATAATTTTTTTTATAGTAATA\r
+Plagiotrochus   TATATTATATTTTATATCTGGAATCTGATCAGGATTAATTGGATCAAGATTAAGAATAATTATTCGAATAGAATTAGGAACCCCTTCACAATTAATTGGAAATGATCAACTCTATAACTCAATCGTAACTGCACATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Andricus        AATATTATATTTTATATTTGGTATTTGATCAGGAATAATTGGATCAGGATTGAGAATAATTATTCGAATAGAGTTAGGGATACCTTTACAATTAATTGGAAATGACCAAATTTATAATTCTATTGTTACTGCTCATGCTTTTGTAATAATTTTTTTTATAGTTATA\r
+Neuroterus      AATATTATATTTTATATTTGGAATTTGAGCAGGAATAATTGGATCAGGATTAAGAATAATTATTCGAATAGAATTAGGGATACCTTTACAATTAATTGGAAATGATCAAATTTATAACTCTATTGTTACAGCCCATGCTTTTGTAATAATTTTTTTTATAGTAATA\r
+Biorhiza        TATAATATATTTTATATTTGGAATTTGATCAGGAATAATTGGATCTAGTTTAAGAATAATTATTCGAATAGAATTAGGGACTCCATTACAATTAATTATAAATGATCAAATTTATAATTCAATTGTTACAGCTCATGCTTTTGTAATAATTTTTTTTATAGTTATA\r
+Parnips         AATATTATATTTTATTTTTGGAATTTGATCAGGAATTATTGGGTCAGCATTAAGAATAATTATTCGAATAGAATTAGGGACTCCTGAACAATTAATTGGGAATGACCAAATTTATAATTCTATTGTGACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATA\r
+Paramblynotus   TATCTTATATTTTATTTTTGGAATATGAGCAGGAATAATTGGAGCATCAATAAGAATAATTATTCGTATAGAATTAGGTACACCAAATCAATTAATTAATAATGATCAAATTTATAATTCTATTGTAACTGCTCATGCATTTATTATAATTTTTTTTATAGTTATA\r
+Ibalia          GCTGCTATATTTTATTTTTGGGATTTGATCCGGAATAATTGGATCTAGACTAAGAATAATTATTCGAATAGAATTAGGAGCCCCTTCCCAATTAATTGGGAATGATCAAATTTATAATTCTATTGTAACAATTCATGCTTTTATTATAATTTTTTTTATAGTAATA\r
+\r
+Synergus        CCAATTACAATTGGAGGATTTAGAAATTACCTAATTCCATTAATATTAAGAACTCCTGATATAGCTTTCCCACGACTTAATAATATAAGATTTTGATTATTAATCCCATCTTTAATTTTATTAACATCAAGTATATTTATTGACCAAGGAGCTGGAAGAGGTTGAA\r
+Periclistus     CCTATTATAGTTGGAGGATTTGGTAATTATTTAATTCCTATTATATTAATTACTCCTGATATGGCTTTTCCTCGATTAAATAATATAAGTTATTGACTTTTAATTCCCTCTTTATTATTAATATTATCTACAATATTTATTGATCAGGGTGCAGGAACAGGATGAA\r
+Ceroptres       CCTATTATAGTAGGTGGATTTGGAAATTATATGATTCCTTTAATATTAATTTCTCCTGATATAGCATATCCTCGTTTAAATAATATAAGGTTTTGATTATTAATTCCTTCTTTAATTTTATTGATCATGGGAATATTTATTGATCAAGGGGCGGGGACAGGATGAA\r
+Synophromorpha  CCTATTATAGTTGGTGGATTTGGAAATTATTTAATTCCTTTAATATTATCAGTTCCTGATATAGCTTTTCCACGAATAAATAATATAAGGTATTGACTTTTAATTCCTTCATTATTATTAATAGTATCAAGAATATTTATTGATCAAGGAGCAGGAACAGGATGAA\r
+Xestophanes     CCTATTATAGTAGGAGGATTTGGAAATTATTTAATTCCTTTAATATTATCTGTACCTGATATAGCTTTTCCTCGAATAAATAATATAAGATATTGACTTTTAGTCCCTTCTTTATTATTAATAATATCTAGAATATTTATTGATCAAGGAGCAGGTACAGGATGAA\r
+Diastrophus     CCAATTATAGTAGGAGGATTTGGAAATTATTTAATTCCTTTAATATTATCAGTACCTGATATAGCTTTTCCTCGAATAAATAATATAAGATTTTGACTTTTAGTCCCTTCTTTATTATTAATAATTTCTAGTATATGTGTAGATCAAGGGTCTGGTACAGGTTGAA\r
+Gonaspis        CCTATTATAGTTGGGGGATTTGGAAATTATTTAATTCCTCTTATATTAAGGGTTCCTGATATAGCTTTCCCTCGTATAAATAATATAAGATTTTGGCTTTTAATTCCTTCTTTAATATTAATATTATCTAGAATATATGTTGATCAAGGATCAGGGACAGGATGAA\r
+Liposthenes_gle CCAATTATAGTAGGAGGATTTGGAAATTATTTAATTCCATTAATATTATCAGTACCTGATATAGCTTTCCCTCGTTTAAATAATTTAAGATATTGAATATTAGTCCCTGCATTATTATTATTATCATCAAGAATGTTTATTGATCAAGGGGCGGGTACAGGTTGAA\r
+Liposthenes_ker CCTATTATAGTTGGAGGTTTTGGAAACTATTTAATTCCATTAATAATAACGGCCCCTGATATAGCTTTCCCTCGATTAAATAATATAAGATACTGAATATTAATCCCAGCCTTATTATTATTAATTTCAAGAATATTTATTGATGAAGGTGCTGGAACTGGATGAA\r
+Antistrophus    CCAATTATAGTAGGGGGATTTGGTAATTATTTAATTCCTTTAATATTATCAGCTCCTGATATAGCTTTCCCACGTTTAAATAATATAAGATTTTGATTATTAATTCCTTCTATATTATTAATATTATCAAGAATTTTTATTGATAGAGGAGCAGGGACTGGATGAA\r
+Rhodus          CCAATTATAGTAGGAGGATTTGGTAATTATTTAACTCCTCTAATATTATCCTCACCAGACATAGCTTTCCCTCGATTAAATAATATAAGATTCTGATTATTAATCCCAGCATTATTATTATTATTATCTAGAATACTTATTGATCAAGGGGCTGGAACAGGATGAA\r
+Hedickiana      CCTATTATAGTTGGTGGATTTGGCAATTATTTAATTCCTTTAATAATTTCAGCTCCTGATATAGCTTTCCCTCGATTAAATAATTTAAGATATTGGTTACTTGCCCCAGCTTTATTATTATTATTATCAAATTTATTTATTGATCAGGGGGCTGGGACTGGATGAA\r
+Neaylax         CCTATTATAGTAGGGGGGTTTGGAAATTATTTAATTCCTTTAATATTAACAGCCCCAGATATAGCTTTCCCACGATTAAATAATATAAGATATTGATTACTACCCCCAGCATTATTTTTATTACTTTCTAGTATATTTATTGATCAAGGGGCAGGGACAGGATGAA\r
+Isocolus        CCAATTATAGTTGGAGGATTTGGGAATTATTTAGTTCCTTTAATGTTAACTGCCCCAGATATAGCATTCCCTCGATTAAATAATATAAGATATTGGCTTTTAATCCCTTCTTTATTATTAATAATAACAAGAATATTTATTGACCAAGGAGGGGGTACTGGATGAA\r
+Aulacidea       CCAATTATAGTAGGTGGATTTGGTAATTATTTAATTCCTTTAATATTGACAGCACCTGATATGGCATTTCCACGATTAAATAATATAAGATACTGATTATTACTTCCAGCTTTATTATTAATAATAACTAGGATATTTATTGATCAAGGGGCCGGTACTGGGTGGA\r
+Panteliella     CCAATTATAGTTGGTGGGTTTGTAAATTATTTAGTTCCATTAATGTTATCAGCCCCTGATATAGCTTTCCCTCGTTTAAATAACATAAGATATTGATTATTAATCCCTTCATTATTACTATTGTTATCTAGAATTTTTATTGATCAGAGGGCAGGGACGGGGTGAA\r
+Barbotinia      CCTCTTATATTAGGAGGGTTTGGTAATTATTTAATTCCATTAATATTATCAGCTCCTGATATAGCTTTCCCTCGATTAAATAATATAAGATATTGATTATTAATCCCACCATTATTATTATTATTATCAAGAATATTAGTAGATCAAGGGGCAGGGACAGGATGAA\r
+Aylax           CCTATTATAGTTAGAGGATTTGGTAATTATTTAGTACCTTTAATATTAACAGCTCCTGATATAGCTTTCCCTCGATTAAATAATATAAGATATTGATTATTAATCCCCTCTATATTATTATTATTATCAAGATTATTTATTGATGAAGGGGCAGGGACAGGATGAA\r
+Iraella         CCAATTATAGTTGGAGGATTTGGAAATTATTTAATTCCTTTAATACTAACAGCACCTGACATAGCTTTTCCACGATTAAATAATATAAGATATTGATTATTAATTCCTTCTTTATTATTATTATTATTAAGAATATTTGTTGATCAGGGAGCTGGAACAGGTTGAA\r
+Timaspis        CCAATTATAGTAGGAGGATTTGGTAATTATTTAATTCCTTCAATATTAAGAATTCCCGATATAGCTTTCCCTCGAATAAATAATATAAGTTATTGGTTATTAATCCCTTCTTTATTTTTATTATTATCAGGGATATTTATTGATCAAGGGGCTGGAACAGGATGAA\r
+Phanacis_1      CCAATTATAGTTGGAGGATTTGGGAATTATTTAGTCCCTTTAATATTAAGAGTTCCTGATATAGCTTTCCCTCGAATAAATAATATAAGATATTGATTATTAATCCCAGCTTTATTATTATTATTATCTAGAATAGTAGTTGATCAAGGGGCTGGGACAGGATGAA\r
+Phanacis_2      CCTATTATAGTAGGGGGGTTTGGGAATTATTTAATTCCATTAATATTAAGAATTCCTGATATAGCATTTCCTCGAATAAATAATATAAGATATTGATTATTAATCCCTTCATTAATGTTATTATTATCTAGGATAATTGTTGATCAAGGGGCTGGGACAGGATGAA\r
+Eschatocerus    CCTATTATAATTGGAGGATTTGGTAATTATTTAATTCCTTTAATACTTGGGGTTCCAGATATATGCTTTCCACGATTAAATAATTTAAGATTTTGGTTACTTCTACCTTCTTTAGGTTTATTATTAAGAAGAATGCTTTTAGATTCTGGTGCGGGTACAGGATGAA\r
+Diplolepis      CCTTTAATATTAGGGGGATTTGGTAATTATTTAATTCCATTAATATTATCTTCTCCAGATATATCTTTTCCTCGATTAAATAATATAAGATTTTGATTATTAGTTCCTTCTTTTATTTTGTTAATTATAAGTATATTTATTGATCAAGGAGCAGGTACAGGGTGAA\r
+Pediaspis       CCTATTATATTAGGAGGATTTGGTAATTATTTAATTCCTTTAATATTAATAAGACCAGATATATCTTTTCCTCGATTAAATAATTTAAGATTTTGATTATTAATTCCTTCTTTAATTTTATTAACATCAAGAATATTTATTGATCAAGGAGCTGGAACTGGTTGAA\r
+Plagiotrochus   CCAATTATAGTTGGAGGATTTGGTAATTATTTAATTCCTCTAATATTAATTGCTCCGGATATAGCATTCCCTCGTTTAAATAATATAAGATATTGATTATTAACTCCTGCTCTATTACTATTAATATCAAGAATATTTATTGATCAAGGAGCAGGAACAGGATGAA\r
+Andricus        CCAATTATAGTTGGGGGGTTTGGAAATTATTTAGTTCCATTAATATTAACTGCTCCTGATATAGCTTTTCCTCGATTAAATAATATAAGATATTGACTTTTAATTCCTTCTTTATTTTTATTATTAGCAGGGATATTAGTTGATCAAGGGGCTGGAACAGGATGAA\r
+Neuroterus      CCTATTATAGTAGGAGGGTTTGGTAATTATTTAGTTCCTTTAATATTAGCTGCTCCAGATATAGCTTTTCCTCGATTAAATAACATAAGATATTGATTATTAATCCCTTCATTATTATTATTATTAGCCGGAATATTAGTGGACCAAGGGGCAGGAACAGGATGAA\r
+Biorhiza        CCTATTATAGTTGGAGGATTTGGAAACTATTTAGTGCCTTTAATGTTAGTAATTCCTGATATATCTTTCCCTCGATTAAATAATATAAGATATTGACTTTTAATTCCTTCATTATTTTTATTATTATCTGGTATATTAGTTGATCAGGGAGCTGGAACAGGATGAA\r
+Parnips         CCTATTATAGTAGGAGGGTTTGGAAATTATTTAGTTCCATTAATATTATCTGCCCCTGATATGGCTTTTCCTCGATTAAATAATATAAGATATTGATTATTAATCCCTTCTTTAATTTTATTAATAATAGGTATATTTGTTGATCAAGGAGCTGGGACTGGGTGAA\r
+Paramblynotus   CCAATTATAGTTGGAGGGTTTGGAAATTATTTAATTCCAATTATATTAATTTTACCTGATATATCATATCCACGTTTAAATAATATAAGATATTGATTATTACCCCCTTCTTTATTTTTATTAATTTCAAGAATAATAATTGATCAAGGAGCAGGAACTGGATGAA\r
+Ibalia          CCTATTATAGTAGGGGGATTTGGAAATTATTTAATTCCTTTAATATTAGCAATACCAGATATGGCTTTCCCTCGTTTAAATAATATAAGATTTTGGTTATTAATTCCTGCCCTAATATTTTTAATATCTGGAATATTCATTGATCAGGGAGCAGGGACGGGATGAA\r
+\r
+Synergus        CAGTTTATCCACCTTTATCTTCAAATTTAGGACATCCAGGAATTTCAGTAGATTTAGCTATTTATTCATTACATATATCAGGAATTTCATCAATTTTAGGTTCAATTAATTTTATTACCACAATTTTAAATATACGTCCTAATTTTATAATAATAGATAAAATTTC\r
+Periclistus     CTGTTTATCCTCCTTTATCCTCAAATTTAGGTCATAATACAATTTGTGTAGATTTAATTATTTTTTCATTACATTTGACTGGTATTTCTTCAATTTTAGGAGGGATTAATTTTATCACTACAATTTTAAATATACGACCAAATTTAATATCTATAGATAAAATTAC\r
+Ceroptres       CAGTGTATCCCCCTTTATCTTCTAGGTTAGGGCATTCAGGGTTATCTGTAGATTTAACTATTTATTCATTACATTTAAGAGGAATTTCTTCTATTTTAGGATCCATTAATTTTATTTCTTCTATTATAAATATACGCCCTAAATTAATATTAATAGATAAAATTTC\r
+Synophromorpha  CTGTGTATCCTCCTTTATCTTCAAATTTAGGTCATAATGGAATATCAGTTGATTTAGTAATTTTTTCTTTACATTTAAGAGGTATTTCTTCAATTTTAGGTTCAATTAATATTATTACTACAATTTTAAATATACGACCTTATTTAATATGTATAGATAAAATTAC\r
+Xestophanes     CTATTTATCCTCCTTTATCTTCAAATTTAGGACATAATGGTATTTCAGTTGATTTAGTAATTTTTTCTTTACATTTAAGAGGAATTTCATCAATTATAGGATCAATTAATATTATTACTACAATTTTAAATATACGACCATATTTAATATATATAGATAAAATTAC\r
+Diastrophus     CTGTTTATCCCCCTTTATCTTCAACTTTAGGACATAATGGTATTTCAGTAGATTTAGTAATTTATTCATTACATTTAAGAGGCATTTCATCTATTATAGGGTCAATTAATATTATTACAACAATTTTAAATATACGACCATATTTATTATCTATAGATAAAATTAG\r
+Gonaspis        CGGTTTATCCTCCTTTATCTTCAATTTTGGGTCATAATGGTATTTCTGTTGATTTAGTAATTTATTCTTTACATTTAAGAGGAGTTTCTTCTATTTTAGGATCTATTAATATTATCACAACAATTTTAAATATACGTCCATATTTATTAAGAATAGATAAAATTAG\r
+Liposthenes_gle CAGTATATCCCCCATTGTCATCTAATTTAGGCCATGCAGGGATATCAGTAGATTTAACTATTTATTCTTTACATATAAGAGGAATTTCTTCAATTTTAGGGTCAATTAATTTTATTACAACAATTTTAAATTTACGACCAAATATAGTTAGAATAGATAAAATTTC\r
+Liposthenes_ker CAGTTTACCCACCTTTATCATCTTTATTAAGACATAGAGGAATCTCCGTAGATTTAACAATTTATTCCCTTCATATAAGAGGAATTTCATCAATTTTAGGATCAATTAATTTTATCTCAACTATCTTAAACATACGACCCAATAATTTGTCAATAGATAAAATTTC\r
+Antistrophus    CAATTTACCCCCCACTTTCTTCATTAAATGGTCATTCAGGTATTTCTGTAGATTTAACTATTTATTCATTACATATAAGAGGAATTTCATCAATTTTAGGTTCAATTAATTTTATTACAACAATTTTAAATATACGACCTAATTTAATGTCTATAGATAAAATTAC\r
+Rhodus          CAATTTACCCCCCATTATCTTCAACCATAGGCCATAATAGAATCTCTATAGATTTAGTTATTTACTCTCTTCATATAAGTGGAATTTCCTCTATTTTAAGATCTATCAATTTTATTACAACTATTTTAAATATACGCCCCCCTATAATCAGAATAGATAAATTATC\r
+Hedickiana      CAGTTTATCCTCCATTATCTTCTTCTATTGGACATGAAGGAATTTCAGTAGATTTAATTATTTATGCATTACATTTAAGAGGGATCTCTTCAATTTTAGGGTCAATTAATTTTATTACCACTATTTTAAATATACGACCTGAAAAAGTTTCTATAGATAAAATTTC\r
+Neaylax         CAATTTATCCTCCTTTATCTTCAAGATTAGGCCATATAGGGGTTTCTGTTGATTTAGTGATTTACTCTTTACACTTAAGAGGAGTATCTTCAATTTTAGGGTCAATTAATTTCATTACTACAATTTTAAACATACGCCCAAATATAATTACTATAGATAAAATTTC\r
+Isocolus        CAGTTTACCCCCCTTTATCTTCAAATATTGGGCATTTAGGAGTTTCAGTAGATTTAATTATTTATTCATTACATATAAGAGGGGTTTCTTCAATTTTAGGGTCAATTAATTTTATTACAACTATTTTAAATATGCGACCTAATAATTTATCAATAGATAAAATTTC\r
+Aulacidea       CAGTTTATCCACCCTTATCTTCAAATATAGGTCATTCTGGAATTTCAGTTGATCTTGTTATTTATTCATTACACATAAGAGGTATTTCTTCAATTTTAGGGTCCATTAATTTTATTACCACTATTTTAAATATACGACCAAATATATTATCTATAGATAAGATTTC\r
+Panteliella     CAGTCTACCCTCCATTATCATCAAATTTAGGGCATAGAGGAATATCAGTTGACCTAACAATTTATTCATTACATATAAGAGGGGTATCGTCAATTTTACGATCAATTAATTTTATTACTACAATTTTAAATATGCGTCCTTTATACATATCAATAGATAAAATTTC\r
+Barbotinia      CGGTTTATCCTCCTTTATCTTCAAATATTGGGCATCCAGGAATTTCAGTAGATTTAACAATTTACTCTTTACATTTAACAGGAATTTCATCGATTTTAGGATCAATTAATTTTATTACAACAATTTTAAATATACGACCAGAAATATTAACTATAGATAAGATTTC\r
+Aylax           CAGTTTATCCTCCTTTATCTACAGAAGTTAGACATTCAGGTATATCTGTTGATTTAATTATTTATTCTTTACATTTAAGAGGAATTTCTTCTATTTTAGGTTCTATTAATTTTATTACAACAATTTTAAATATACGTCCAAATATATTAACAATAGATAAAATTCC\r
+Iraella         CAGTTTATCCTCCTTTATCTTCAAATATAGGTCATCCAGGGATCTCTGTAGATCTTACAATTTATTCTTTACATTTAAGAGGGAYTTCTTCAATTTTAGGGTCAATTAACTTTATTACAACTATTTTAAATATACGACCTTATATAGTTACTATAGATAAAATTTC\r
+Timaspis        CTGTATATCCTCCTTTATCTTCAAATATAGGTCATTTAGGTTTATCAGTAGATTTAACTATTTATTCTTTACATATAAGAGGGGTATCTTCAATTTTAGGGTCTATTAATTTTATTACAACAATTTTAAATATACGACCTTTAATAATATCAATAGATAAAATTTC\r
+Phanacis_1      CTGTGTATCCACCTTTATCTTCAAATATTGGTCATTTAGGTATTTCAGTAGATTTAACAATTTATTCATTACATATAAGAGGAATTTCATCAATTTTAGGATCAATTAATTTTATTACTACAATTTTAAATATACGACCTTTAAAAATAATAATAGATAAAGTTAC\r
+Phanacis_2      CTGTTTATCCTCCTTTATCTTCTAATATAGGGCATTTAGGAATATCAGTTGATTTAACTATTTACTCTTTACATATAAGGGGGGTTTCTTCTATTTTAGGATCAATTAATTTTATTACTACTATTTTAAATATACGACCCATAAAAATAACTATAGATAAAATTGC\r
+Eschatocerus    CAGTTTATCCTCCTTTATCTTCTCTTATTGGACATCCTGGAGTATCTGTTGATTTTGCAATTTTTTCTTTACATTTAAGGGGAGCATCCTCTATTTTAGGATCTATTAACTTTATTTCCACAATTATTAATATACGGACAATGAAATTTTCAATAGATAAAATTTC\r
+Diplolepis      CTGTTTATCCTCCATTATCATTAAATATTGGGCATGAAGGGGTTTCTGTTGATTTAGTAATTTTTTCATTACATTTAAGTGGGATTTCATCAATTTTAGGTTCAATTAATTTTATTACTACAATTTTAAATATACGTCCTGTAATAATAAGAATAGAAAAAATTAC\r
+Pediaspis       CTATTTACCCTCCTTTATCTTCAAATATAGGTCATATAGGAATTTCTATGGATTTAATTATTTTTTCTTTACATATAAGTGGAATATCTTCAATTTTAGGTTCAATTAATTTTATTACTACTATTTTAAATATACGTCCATTAAATTTAACTATAGATAAAATTTC\r
+Plagiotrochus   CCATTTACCCCCCATTATCATCCAATTTAGGACATTCAGGAATTTCAGTNGATTTGACTATTTATTCTCTTCATATAAGAGGAATTTCTTCAATTTTAGGATCAATTAATTTCATTACAACAATTTTAAATATACGCCCTTATTTAATATCTATAGATAAAATTCC\r
+Andricus        CTGTTTATCCTCCTTTATCTTCAAATTTAGGACACCCAGGAATTTCTGTTGATTTAACTATTTATTCTTTACATTTAACTGGGATTTCCTCAATTTTAGGTTCAATTAATTTTATTACAACAATTTTAAATATACGACCTAATTTAATAGATATAGATAAAATCCC\r
+Neuroterus      CTGTTTATCCTCCTTTATCCTCAAATTTAGGGCATCCAGGTATCTCTGTAGACTTAACTATTTATTCTTTACATTTAACAGGAATTTCTTCAATTTTAGGTTCAATTAATTTTATTACTACAATTTTAAATATACGTCCTAATTTAATAGAAATAGATAAAATTCC\r
+Biorhiza        CTGTTTACCCTCCTTTATCTTCAAATTTAGGACATTCAGGAATTTCTGTTGATTTAACAATTTATTCTTTACATTTAACTGGAATTTCTTCAATTTTAGGATCAATTAATTTTATTACTACAATTTTAAATATACGATCTAATTTAATAACAATAGATAAAATTCC\r
+Parnips         CTGTTTACCCTCCTTTATCAGCAAATTTAGGTCATCCAGGAGTTTCAGTTGATTTAACTATTTTTTCTTTACATTTAAGTGGAATTTCATCTATTTTAGGATCAATTAATTTTATTTCAACTATTTTAAATATACGACCTAATTATGTATCTATAGATAAAATTTC\r
+Paramblynotus   CTGTTTATCCTCCTCTTTCATCAAATTTAGGTCATAGAGGAATTTCTGTAGATTTAACAATTTTTTCTTTACATTTAAGTGGTGTATCTTCAATTTTAGGATCAATTAATTTTATTACTACAATTTTAAATATACGATTAAATAATATAAGTATAGATAAAATTAC\r
+Ibalia          CAGTTTATCCTCCTTTATCTTCTTATTTAGGCCACCCTAGGATTTCAGTTGATTTAACTATTTTTTCTTTACATTTAAGGGGAGTTTCTTCTATTTTAGGTTCTATTAATTTTATTACAACTATTTTAAATATACGA------ATTATAATAATAGATAAAATTAC\r
+\r
+Synergus        ACTATTTATTTGATCAATTTTACTAACTACAATCTTATTATTATTATCATTACCTGTTCTAGCTGGAGGAATTACAATATTATTATTCGATCGTAATATAAACACATCATTTTTTGACCCTATAGGAGGAGGAGACCCTATCTTATATCAACACTTATTTTGATTT\r
+Periclistus     TTTATTTGTTTGATCTATTTTTTTAACAGTAATTTTATTAGTAGTTTCTCTCCCAGTATTAGCTGGTGGTATTACAATATTATTATTTGATCGAAATATAAATACTTCTTTTTTTGATCCATTAGGAGGTGGAGATCCTATTTTATATCAACATTTATTTTGATTT\r
+Ceroptres       TTTATTTATTTGATCAATTTTATTAACTACTATTTTATTATTATTATCTTTACCTGTTTTAGCTGGAGGAATTACAATATTATTATTTGATCGAAATATAAATACTTCATTTTTTGATCCTATAGGAGGAGGTGACCCAATTTTATATCAACATTTATTTTGATTT\r
+Synophromorpha  TTTATTTATTTGATCTTTTATTTTAACAACAATTTTATTATTATTATCATTACCTGTATTAGCAGGAGGAATTACAATATTATTATTTGATCGAAATATAAATTCTTCTTTTTTTGATCCATTAGGAGGTGGTGATCCTATTCTTTATCAACATTTATTTTGATTT\r
+Xestophanes     TTTATTTATTTGATCTTTATTTTTAACTACAATTTTATTATTATTATCATTACCTGTATTAGCTGGGGGAATTACAATATTATTATTTGATCGAAATATAAATTCTTCTTTTTTTGATCCATTAGGAGGAGGAGACCCTATTCTTTATCAACATTTATTTTGATTT\r
+Diastrophus     TTTATTTACTTGATCTATCTTTTTAACTACTATTTTATTATTATTATCTTTACCAGTGTTAGCCGGAGGAATTACTATATTATTAATAGATCGAAATATAAATTCTTCTTTTTTTGACCCTTTAGGAGGAGGGGATCCTATTCTTTATCAACATTTATTTTGATTT\r
+Gonaspis        GTTATTTATTTGATCTATTTTATTAACAACTATTTTATTATTATTATCTTTACCAGTTTTAGCAGGAGGAATTACTATATTATTAATAGATCGAAATATAAATTCTTCTTTTTTCGATCCGTTAGGTGGAGGAGATCCTATTCTTTATCAACATTTATTTTGATTT\r
+Liposthenes_gle TTTATTTATATGATCAATTTTTTTAACTACTATTTTACTTTTATTATCTTTACCAGTGTTAGCGGGAGGAATTACAATATTATTATTTGACCGAAATTTAAATACTTCGTTTTTTGACCCCTTAGGAGGAGGAGACCCTATTTTATATCAACATTTATTTTGATTT\r
+Liposthenes_ker TTTATTTTCCTGATCAATTTTACTAACGACAACTTTATTATTATTATCATTGCCAGTATTAGCAGGAGGAATTACAATACTTCTTTTTGACCGTAATATAAATACTTCTTTTTTTGACCCTATAGGAGGAGGAGACCCAATTTTATATCAACATCTATTTTGATTC\r
+Antistrophus    ATTATTTTCTTGATCAATTATATTAACAACTATTTTATTATTATTATCTTTACCAGTTTTAGCTGGAGGAATTACAATATTACTCTTTGATCGAAATATAAATACATCTTTTTTTGATCCTTTAGGGGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTT\r
+Rhodus          ATTATTTTTATGGTCCATTTTATTAACTACTATTTTATTATTACTTTCCTTACCCGTCTTAGCTGGTGGAATTACAATATTACTTTTTGATCGAAATTTTAATACCTCCTTTTTTGACCCTATAGGAGGTGGAGACCCAATCTTATTCCAACATTTATTTTGATTC\r
+Hedickiana      ATTATTTTCATGATCTATTTTATTAACAACAATTTTACTTTTACTTTCTTTACCTGTATTAGCAGGAGGTATTACAATATTACTTTTTGATCGTAATTTAAATACATCTTTTTTTGACCCAATAGGAGGGGGGGATCCAATTTTATACCAACATTTATTTTGATTT\r
+Neaylax         TTTATTTCTATGATCAATTTTTTTAACTACAATTTTACTATTACTTTCATTACCTGTATTAGCCGGGGGGATTACAATATTATTATTTGATCGAAACTTAAACACATCTTTCTTTGACCCAATAGGAGGAGGAGACCCTATTTTATTCCAGCATTTATTTTGATTT\r
+Isocolus        TTTATTTATTTGATCAATTTTATTAACAACAATTTTATTATTATTATCTTTACCTGTGTTAGCTGGAGGAATTACTATATTATTATTTGACCGAAATTTAAATACTTCTTTTTTTGACCCTATAGGAGGAGGAGACCCAATTTTATACCAACATTTATTTTGATTT\r
+Aulacidea       ATTATTTATATGGTCAATTTCTTTAACAACAATTTTATTATTATTATCATTGCCTGTATTAGCTGGAGGAATTACAATATTATTATTTGATCGAAATATAAATACTTCATTTTTTGACCCTATAGGAGGAGGAGACCCTGTGTTATATCAACATTTATTTTGATTT\r
+Panteliella     ATTATTCATGTGAACTATTCTATTAACTACTATTTTATTATTATTATCTTTACCTGTTTTAGCTGGAGGAATTACAATATTATTATTTGATCGTAATTTAAATACCTCATTTTTTGATCCTGTAGGCGGGGGAGAGCCAGTATTATACCAACATTTATTTTGATTT\r
+Barbotinia      TTTATTTATTTGATCAATTTTTTTAACAACTATTTTACTATTACTTTCTTTACCTGTTTTAGCTGGAGGAATTACAATATTATTATTTGATCGTAATATAAATACTTCATTTTTTGATCCAATAGGAGGGGGTGACCCAATTTTATATCAACATTTATTTTGATTT\r
+Aylax           TTTATTTATTTGATCTATTTTTTGAACAACAATTTTATTATTATTATCTTTACCAGTTTTAGCTGGGGGAATTACAATATTATTATTTGATCGGAATATAAATACATCTTTTTTTGACCCTATAGGGGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTT\r
+Iraella         TTTATTTATTTGATCAATTTTTTTAACAACAATTTTATTATTATTATCTTTACCAGTATTAGCAGGTGGAATTACAATATTATTATTTGATCGTAATATAAATACTTCATTTTTTGACCCAATAGGAGGAGGAGATCCAGTATTATATCAACATTTATTTTGATTT\r
+Timaspis        TTTATTTGTATGATTTATTTTTTTAACAACTATTTTATTACTATTATCTTTACCTGTTTTAGCAGGAGGGATTACAATATTATTATTTGATCGAAATTTAAATACTTCTTTTTTTGACCCTATAGGAGGAGGAGATCCTGTATTATATCAACATTTATTTTGATTT\r
+Phanacis_1      TTTATTTGTTTGATCAATTTTTTCAACAACTATTTTATTATTATTATCTTTACCAGTTCTTGCTGGAGGTATTACTATATTATTATTTGATCGAAATTTAAATACTTCATTTTTTGACCCTATAGGAGGAGGAGACCCAGTATTATACCAACATTTATTTTGATTT\r
+Phanacis_2      TTTATTTGTTTGATCGATTTTTTTAACAACAATTTTACTATTATTATCTTTACCTGTATTAGCGGGAGGAATTACAATATTATTATTTGATCGAAATTTAAATACATCTTTTTTTGACCCTATAGGAGGGGGGGACCCTGTATTATACCAACATTTATTTTGATTT\r
+Eschatocerus    TTTGTTTGTTTGATCTATTTTATTAACTACTATTTTATTATTATTATCTTTACCTGTATTAGCAGGAGGAATTACAATACTTTTATTTGATCGAAATCTAAATACTTCTTTCTTTGACCCTATTGGAGGTGGGGACCCCATTTTATATCAACATTTATTTTGATTT\r
+Diplolepis      TTTATTTTCTTGATCAATTTTATTAACTACTATTTTATTATTATTGTCTTTACCTGTTTTAGCTGGGGGTATTACTATATTATTATTTGATCATAATTTAAATACTTCTTTCTTTGATCCTATAGGGGGCGGGGATCCAGTTTTATATCAACATTTATTTTGATTT\r
+Pediaspis       ATTATTTACATGATCAATTTTATTAACAACAATTTTATTATTATTATCATTACCTGTTTTAGCTGGAGGAATTACAATATTATTATTTGATCGTAATTTAAATACTACTTTTTTTGATCCTATAGGAGGCGGAGATCCAATTTTATTTCAACATTTATTTTGATTT\r
+Plagiotrochus   TCTTTTTGTATGATCAATTTTTTTAACTACAATTTTATTATTATTATCATTACCAGTATTAGCAGGTGCAATTACTATGTTACTTTTTGATCGAAATATAAATACTTCTTTTTTTGACCCAACTGGAGGAGGAGATCCTATCTTATATCAACATTTATTTTGATTT\r
+Andricus        TTTATTTGTTTGATCAATTTTTTTAACAACTATTTTATTATTATTATCTTTACCTATTTTAGCTGGTGCAATTACTATATTATTATTTGATCGTAATATAAATACTTCATTTTTTGATCCTATAGGAGGAGGGGATCCAATTTTATACCAACATTTATTTTGATTT\r
+Neuroterus      TTTATTTGTTTGATCTATTTTTTTAACTACAATTTTATTACTTTTATCTTTACCAATTTTAGCAGGAGCAATTACAATATTATTATTTGATCGAAATATAAATACCTCATTTTTTGATCCTATAGGAGGGGGGGATCCTATTTTATATCAACATTTATTTTGATTT\r
+Biorhiza        TTTATTTGTATGATCAATTTTTTTAACTACAATTTTATTATTATTATCTTTACCAATTTTAGCCGGAGCAATTACAATATTATTATTTGATCGTAATATAAATACTTCTTTTTTTGACCCTATAGGAGGAGGAGACCCAATTTTATATCAACATTTATTTTGATTT\r
+Parnips         TTTATTTATTTGATCTATTTTATTAACAACTATTTTACTTTTATTGTCATTACCTGTATTGGCTGGAGGGATTACTATATTATTGTTTGATCGGAATTTAAATACTTCATTTTTTGATCCTTTAGGAGGTGGGGACCCTGTTTTATATCAACATTTATTTTGATTT\r
+Paramblynotus   ATTATTTATTTGATCTATTTATTTAACAACAATTTTATTATTATTATCTTTACCAGTTTTAGCAGGAGGAATTACAATATTATTATTTGATCGTAATTTAAATACTTCATTTTTTGATCCAATAGGTGGAGGAGATCCAATTCTTTACCAACATTTATTTTGGTTT\r
+Ibalia          TTTATTTATTTGATCTATTTTATTGACTACAATTTTATTATTATTATCTTTACCTGTATTAGCAGGAGGAATTACAATATTATTGTTTGATCGTAATTTAAATACTTCATTTTTTGACCCCATAGGGGGAGGGGACCCTATTTTATACCAACATTTATTTTGATTT\r
+\r
+Synergus        TTTGGTCACCCCGAAGTATATATTTTAATTTTACCAGGTTTTGGAATAATTTCACATATAATTTACATAGAATCAGGAAAAAAAATAACTTTTGGATCTTTAGGAATAATATATGCAATAATTTCAATTGGAATTTTAGGATTTATTGTATGAGGGCATCATATAT\r
+Periclistus     TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAGTATCTCATATAATTTATACTGAGTGTGGTAAAAAAGGTACTTTTGGATCTTTAGGAATAATATATGCAATAATTTCAATTGGATTATTAGGATTTGTTGTTTGAGGGCATCATATAT\r
+Ceroptres       TTTGGACATCCTGAAGTTTATATTTTAATTTTACCAGGATTTGGAATAATTTCTCATATAATTTATTTAGAAACTGGAAAAAAAATTACTTTTGGATCTTTAGGAATAATTTATGCAATAATTTCTATTGGAATGTTAGGTTTTATTGTATGAGGACATCATATAT\r
+Synophromorpha  TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTGTGTAGAATGTGGAAAAAAAAATACTTTTGGTTCATTAGGAATAATATATGCTATAATTTCTATTGGTATATTAGGATTTATTGTTTGAGGACATCATATAT\r
+Xestophanes     TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCGGGATTTGGTATAATTTCTCATATAATTTTTATAGAATGTGGAAAAAAAAATACTTTTGGTTCTTTAGGAATAATTTATGCTATAATTTCTATTGGAATATTAGGATTTATTGTTTGAGGGCATCATATAT\r
+Diastrophus     TTTGGACACCCTGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTATACAGAATGTGGAAAAAAAATTACTTTTGGTTCTTTAGGAATAATATATGCAATAATTTCTATTGGAATATTAGGATTTATTGTATGAGGACATCATATAT\r
+Gonaspis        TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCAGGATTTGGAATAATTTCTCATATAATTTATACAGAATGTGGAAAAAAAATTACTTTTGGATCTTTAGGTATAATATATGCTATAATTTCTATTGGAATATTAGGATTTATTGTTTGAGGTCATCATATAT\r
+Liposthenes_gle TTTGGTCATCCTGAAGTTTATATTTTAATTTTGCCCGGATTTGGAATAATTTCTCATATAATTTATTTAGAATGTGGGAAAAAAATTACATTTGGGTCTTTAGGTATAATATATGCAATAATTTCAATTGGAATATTAGGATTTATTGTATGGGGTCATCATATAT\r
+Liposthenes_ker TTTGGTCATCCTGAAGTTTATATTTTAATTCTTCCAGGATTTGGAATAGTCTCTCACTTAATTTATTCTGAATGTGGAAAAAAAAACACTTTTGGATCCTTAGGGATAACATATGCTATAATCTCTATTGGATTATTAGGATTTATTGTCTGAGGACATCATATAT\r
+Antistrophus    TTTGGTCACCCAGAAGTTTATATTTTAATTTTACCAGGATTTGGAATAATTTCCCATATAATTTATTCAGAATGTGGTAAAAAAACAACATTTGGTGTATTAGGAATAATTTATGCTTTAATTTCAATTGGTATATTAGGATTTATTGTATGAGGACATCATATAT\r
+Rhodus          TTTGGTCACCCTGAAGTCTATATCTTAATTTTACCTGGATTTGGTATAATCTCTCATATAATTTATATAGAATGTGGAAAACCCACAACCTTTGGTTCATTAGGTATAATATACGCAATAATTTCAATTGGAATATTAGGATTTATCGTATGAGGACATCATATAT\r
+Hedickiana      TTTGGTCACCCAGAAGTTTATATTTTAATTCTTCCAGGATTTGGAATAATTTCTCATATAATTTATTCAGAATGTGGTAAAAAAACAACATTTGGTTCATTAGGGATATTATATGCAATAATTTCTATTGGAATATTAGGTTTTATTGTTTGAGGCCATCATATAT\r
+Neaylax         TTTGGTCATCCAGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTTTTTAGAGTGTGGGAAAAAAACAACATTTGGGTCATTAGGAATAATATACGCCATAATTTCAATTGGAATACTAGGATTTATTGTATGAGGCCATCATATAT\r
+Isocolus        TTTGGTCACCCAGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTATAGTGAGTGTGGGAAAAAAACTACATTTGGATCTTTAGGAATAATATATGCTATAATTTCAATTGGTGTTTTAGGGTTTCTTGTTTGAGGTCATCATATAT\r
+Aulacidea       TTTGGTCATCCTGAGGTTTATATTTTAATTTTACCAGGATTTGGGATAATTTCACATATAATTTATATAGAATGTGGTAAAAGAATTACTTTTGGAGCTTTAGGGATAATATATGCAATAATTTCCATTGGAATATTAGGATTTATTGTTTGAGGCCATCACATAT\r
+Panteliella     TTTTGTCACCCTGAAGTTTATATTCCAATTTTAGCTGGATTTGGGATAGTGTCTCATATAATTTATTTAGAATGTGGGGAAAAAATTACATTTGGGTCTTTAGGAATAATATACGCAATAATTTCAATTGGTATATTAGGTTTTATTGTATGAGGACATCATATAT\r
+Barbotinia      TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCTGGGTTTGGAATAATTTCTCATATAATTTATAGAGAATGTGGAAAAAAAACTACTTTTGGATCATTAGGTATAATATATGCAATAATTTCAATTGGTTTACTAGGATTTATTGTTTGAGGTCATCATATAT\r
+Aylax           TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCAGGATTTGGTATAATTTCTCATATAATTTATAGTGAAAGAGGAAAAAAAACTACTTTTGGATCTTTAGGAATAATTTATGCTATAATTTCAATTGGATTATTAGGATTTATTGTATGAGGGCATCATATAT\r
+Iraella         TTTGGTCATCCTGAAGTATATATTTTAATTTTACCAGGATTTGGGATAATTTCTCATATAATTTATAATGAATGTGGGAAAAAAACTACTTTTGGATCTTTAGGAATAATATATGCAATAATTTCTATTGGAATATTAGGATTTATTGTTTGAGGTCATCATATGT\r
+Timaspis        TTTGGCCATCCAGAAGTTTATATTTTAATTTTACCAGGATTTGGAATAATTTCACATATAATTTACACAGAATGTGGGAAAAAAATTACTTTTGGATCTTTAGGAATAATATATGCAATAATTTCTATTGGAATATTAGGGTTTATTGTATGAGGCCATCATATAT\r
+Phanacis_1      TTTGGTCATCCAGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATCTCTCATATAATTTATAATGAATGTGGTAAAAAAATTACTTTTGGATCATTAGGAATAATATACGCTATAATTTCAATTGGTATATTAGGATTTATTGTATGAGGTCACCATATAT\r
+Phanacis_2      TTTGGGCATCCTGAAGTGTATATTTTAATTCTTCCAGGATTTGGGATAGTGTCTCATATAATTTTTACTGAATGTGGACAAAAAACTACTTTTGGATCATTAGGGATAATATATGCTATAATTTCAATTGGAATATTAGGATTTATTGTTTGAGGTCATCATATAT\r
+Eschatocerus    TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTTTACTGAATGTGGTAAAAAATCTACTTTTGGTTCTTTAGGAATATTATATGCTATAATTTCTATTGGAGCTTTAGGATTTATGGTTTGAGGTCATCATATAT\r
+Diplolepis      TTTGGTCATCCAGAAGTTTATATTTTAATTTTGCCAGGATTTGGTATAATTTCTCATATAATTTATTCTGAATGTGGTAAAAAATTTACTTTTGGTTCATTAGGTATGATATATGCTATAATTTCAATTGGTATATTAGGGTTTATTGTATGAGGACATCATATAT\r
+Pediaspis       TTTGGACACCCTGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTACAAATGAATGTGGAAAAAAAACTACTTTTGGTTCTTTAGGAATAATATATGCTATAATTTCAATTGGTATATTAGGTTTTATTGTATGAGGACATCATATAT\r
+Plagiotrochus   TTTGGTCATCCTGAAGTTTATATTTTAATTTTACCTGGGTTTGGAATAATTTCTCATATAATTTATTTGGAATGTGGAAAAAAAAATACTTTTGGATCATTAGGAATAATATATGCTATAAATTCAATTGGTATATTAGGATTTATTGTATGAGGTCATCATATAT\r
+Andricus        TTTGGTCATCCAGAAGTTTATATTTTAATTTTACCTGCTTTTGGTATAATTTCTCATATAATTTATATAGAATGTGGGAAAAAAAATACTTTTGGTTCATTAGGAATAATATATGCTATAATTTCAATTGGTATATTAGGATTTATTGTTTGGGGTCATCATATAT\r
+Neuroterus      TTTGGGCATCCAGAAGTTTATATTTTAATTTTACCAGCATTTGGTATAATTTCACATATAATTTATATAGAATGTGGAAAAAAAAATACTTTTGGGTCTTTAGGAATAATATATGCAATAATTTCAATTGGTATATTAGGATTTATTGTTTGAGGTCATCATATAT\r
+Biorhiza        TTTGGGCACCCAGAAGTTTATATTTTAATTTTACCTGCTTTTGGAATAGTTTCTCATATAATTTATATAGAATGTGGAAAAAAAAATACTTTTGGATCTTTGGGAATAATATATGCAATAATTTCAATTGGTATATTAGGATTTATTGTTTGAGGACATCATATAT\r
+Parnips         TTTGGTCATCCAGAAGTATATATTTTAATTTTACCAGGATTTGGTATAATTTCCCATATAATTTATACAGAATGTGGAAAAAAAACTACATTTGGATCTTTAGGAATAATATATGCTATAATTTCTATTGGAATATTAGGGTTTATTGTTTGAGGCCATCATATAT\r
+Paramblynotus   TTTGGCCATCCAGAAGTTTACATTTTAATTTTATCAGGATTTGGTATAATTTCTCATATGATTTATACTGAATGTGGGAAAAAAAATACTTTTGGTTCATTAGGAATAATTTATGCAATAATTTCTATTGGTATGTTAGGATTTATTGTTTGAGGTCATCATATAT\r
+Ibalia          TTTGGTCATCCAGAAGTTTATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTATACAGAATGTGGTAAAAAAAGAACTTTTGGGGCATTAAGAATAATATATGCAATAATTTCTATTGGGATATTAGGATTTATCGTATGAGGACATCATATAT\r
+\r
+Synergus        TTACAGTAGGTATAGATGTAGATACTCGAGCTTATTACACATCTGCGACTATAATTATTGCTATCCCAACAGGTATTAAAATTTTTAGTTGATTAGCAACTATATATGGGTCAAAAATTAAATTTAATTTATCTATAATTTGATCTATAGGATTTATTTTTTTATT\r
+Periclistus     TTACTATTGGTATAGATATTGACACGCGAGCTTATTATACTTCTGTAACAATAGTTATTGCTATTCCTACAGGAATAAAAATTTTTAGATGACTAGCAACAATATATGGTTCAAAAATTAATTGTAGGGTTCCTATATTTTGATCATTAGGTTTTATTTTTTTATT\r
+Ceroptres       TTACAGTAGGAATAGATGTAGATACTCGAGCTTATTATACTTCAGCTACTATAATTATTGCAATTCCCACAGGAATCAAAATTTTTAGATGATTGGCTACAATATATGGATCAAAATTAGACATTAATATTTCAATAATATGATCTTTAGGATTTATTTTTTTATT\r
+Synophromorpha  TTACTGTAGGAATAGATATTGATACACGAGCTTATTATACATCTGTAACTATAATTATTGCAATTCCYACGGGAATTAATATTTTTAGATGATTAGCTACAATATATGGATCAAAAATTAATTTTAATTTATCAATTATATGATCATTAGGTTTTATTTTTTTATT\r
+Xestophanes     TTACTGTAGGAATAGATATTGATACACGAGCTTATTATACTTCTGTAACTATAATTATTGCAATTCCTACTGGAATTAAAATTTTTAGATGATTAGCTACAATATATGGATCAAAAATTAATTTTAATTTATCAATTAAATGATCATTAGGATTTATTTTTTTATT\r
+Diastrophus     TTACTGTAGGGATAGATATTGATACACGAGCTTATTATACTTCAGTAACTATAATTATTGCTATTCCAACAGGAATTAAAATTTTTAGATGGTTAGCAACAATATATGGTACAAAAATTAATTTTAATCCTTCAATTATTTGATCATTAGGCTTTATTTTTTTATT\r
+Gonaspis        TTACTGTAGGTATAGATATTGATACTCGAGCTTATTATACGTCAGTAACTATAATTATTGCAATTCCTACAGGGATTAAAATTTTTAGATGATTAGCTACTATATATGGATCAAAAATTAATTTTAATCCCTCAATTATTTGATCATTAGGCTTTATTTTTTTATT\r
+Liposthenes_gle TTACTGTAGGAATAGATGTAGATACACGGGCATACTACACTTCAGCTACAATAATTATTGCAGTCCCTACAGGTATTAAAATTTTTAGATGATTGGCAACAATATATGGGTCAAGAATTAATTTAAATTTATCAATTATATGATCTTTAGGGTTTATTTTTTTATT\r
+Liposthenes_ker TTACTGTAGGAATGGATGTCGACACCCGAGCTTATTATACTTCTGCAACTATAATTATTGCAATTCCACCAGGAATCAAAATTTTTAGATGATTAGCTACAATATATGGATCTAAAATTTACATAAATTTATCAATTTTATGATCCTTAGGATTTATTTTTCTATT\r
+Antistrophus    TTACAGTTGGCATAGATGTAGATACACGAGCCTATTACACATCAGCAACTATAATTATTGCTATTCCTACAGGTATTAAAATTTTTAGTTGATTGGCAACAATATATGGAATAAAGATTAATTATAATTTATCAATAATTTGAGCTTTAGGATTTATCTTTTTATT\r
+Rhodus          TTACTGTAGGAATAGATGTAGACACCCGAGCATATTACACATCCGCTACCATAATTATTGCAATTCCTACTGGAATTAAAATTTTTAGGTGATTAGCTACAATATACGGATCAAAAATTAATTTTAATTTATCCATTATATGATCCTTAGGATTTATTTTTTTATT\r
+Hedickiana      TTACTGTGGGTATAGATGTAGATACACGAGCTTATTACACATCAGCAACTATAATTATTGCAGTTCCTACTGGTATTAAAGTATTTAGTTGATTGGCATCAATATATGGAGCAAAAGTTAATTTTAATTTATCAATTCTTTGATCATTAGGATTTATTTTTTTATT\r
+Neaylax         TTACTGTTGGGATAGATGTTGATACACGTGCATATTATACTTCAGCAACAATAATTATTGCAATTCCTACTGGTATTAAAATTTTTAGATGATTAGCAACTATTTATGGAACAAAAATTAATTTTAATCCATCAATTATTTGATCTTTAGGGTTTATTTTTTTATT\r
+Isocolus        TTACAGTAGGGATAGATGTAGATACACGAGCTTATTATACTTCAGTAACAATAATTATTGCAATCCCTACAAGTATTAAAATTTTTAGATGATTAGCTACTATACATGGTACAAAAATTAATTTTAACCTATCTATTTTATGATCTTTAGGATTTGTATTTTTATT\r
+Aulacidea       TTACTGTAGGGATAGATGTTGATACACGAGCTTATTATACTTCAGCAACGATAGTAATTGCTATCCCTACAGGAATTAAAATTTTTAGGTGACTTGCAACTATATATGGATCTAAAATTAATTTTAATTTATCAATTATATGATCATTAGGTTTTATTTTTTTATT\r
+Panteliella     TTACTGTTGGGATAGATGTAGATACACGAGCTTATTACACTTCAGCCACTATAATTATTGCAATTTCTACAGGAATTATAATTTTTAGATGATTAGCTACTATATATGGATCAAAGATTGATTTTAATTTATCTATATTATGATCTTTAGGATTTATTTTTTTATT\r
+Barbotinia      TTACTGTTGGGATAGATGTAGATACACGAGCTTATTATACATCAGCAACAATGGTAATTGCTATTCCTACAGGAATTAAAATTTTTAGGTGATTAGCAACTATATATGGATCAAAAATTAATTTTAATTTATCAATAATTTGATCATTAGGATTTATTTTTTTATT\r
+Aylax           TTACTGTTGGTATAGATGTAGATACTCGTGCTTATTATACTTCTGCTACAATAGTAATTGCTATCCCCACAGGAATTAAAATTTTTAGATGACTTGCTACTATATATGGATCAAAAATTGATTTTAATTTATCTATAATTTGATCATTAGGATTTATTTTTTTATT\r
+Iraella         TTACTGTAGGAATAGATGTTGATACACGAGCTTATTACACTTCAGCAACAATAGTTATTGCAATTCCTACAGGTATTAAAATTTTTAGTTGATTAGCAACTATATATGGATCAAAAATTGATTTAAATTTATCAATAATTTGATCTTTAGGTTTCATTTTTTTATT\r
+Timaspis        TTACTGTAGGCATAGATGTTGATACTCGAGCTTATTACACTTCTGCAACTATAATTATTGCTATTCCAACAGGTATTAAAATTTTTAGATGATTAGCAACAATATATGGATCAAAATTAAATTTTAGTTTATCTATAATTTGATCTTTAGGTTTTATTTTTTTATT\r
+Phanacis_1      TTACTGTAGGGATAGATGTAGACACCCGAGCTTATTACACATCAGCTACAATAATTATTGCTATCCCTACTGGGATTAAAATTTTTAGTTGGTTAGCAACAATATATGGGGCTAAAGTAGATTTTAATTTATCAATAATATGAGCTTTAGGGTTTATTTTTTTATT\r
+Phanacis_2      TTACTGTTGGAATAGATGTAGATACACGAGCTTATTACACTTCAGCAACAATAGTAATTGCTATCCCAACTGGTATTAAAATTTTTAGATGGTTAGCTACTATATATGGATCAAAAGTAGAATTTAACCCTTCAATTATATGGGCTTTAGGGTTTATTTTTTTATT\r
+Eschatocerus    TTACAGTAGGTATAGATGTTGATACTCGAGCTTATTTTACTTCTGTAACTATAATTATTGCTATTCCTACTGGAATTAAAATTTTTAGATGATTAGCTACTATATATGGATCAAAAATAAAATTTAGATTACCTATATTATGATCTTTAGGATTTGTATTTTTATT\r
+Diplolepis      TTACTGTTGGTATAGATATTGATACACGGGCTTATTATACATCAGTTACTATAATTATTGCTGTTCCTACAGGTATTAAAATTTTTAGGTGATTGGCTACTATATATGGAGCAAAAATTGATTATAATTTGGCTATAATTTGATCATTAGGATTTATTTTTTTATT\r
+Pediaspis       TTACTGTAGGAATAGACATTGATACACGAGCTTATTATACATCAGCTACTATAATTATTGCAGTTCCAACAGGAATTAAAATTTTTAGATGATTAGCAACAATATATGGATCAAAAATTAAATTAAATATAATTATAATTTGATCTTTAGGTTTTATTTTTTTATT\r
+Plagiotrochus   TAACTGTAGGCATAGATATTGATACACGAGCTTATTACACATCTGTAACTATAATTATTGCTATTCCTACAGGAATTAAAATTTTTAGATGATTAGCAACAATATATGGAACTAAAATAAATTTTAACTTATCAATTATATGAGCTCTAGGGTTTATCTTTTTATT\r
+Andricus        TTACTGTAGGTATAGATATTGATACACGAGCTTATTATACATCAGTAACAATAATTATTGCTATTCCTACAGGAATTAAAATTTTTAGGTGGTTAGCAACTATATATGGATCAAAAATTAATTTTAATTTATCAATTATATGATCTTTAGGATTTATTTTTTTATT\r
+Neuroterus      TTACTGTAGGAATAGATATTGACACACGAGCTTATTATACTTCAGTAACAATAATTATTGCGATTCCTACAGGAATTAAAATTTTTAGATGATTAGCTACAATATATGGATCAAAAATTAATTTTAATTTATCAATTATATGAGCTTTAGGGTTTATTTTTTTATT\r
+Biorhiza        TTACTGTAGGGATAGATATTGATACACGAGCTTATTATACTTCAGTTACAATAATTATTGCAATTCCTACAGGTATTAAAATTTTTAGATGATTAGCTACTATATATGGGTCAAAAATTAATTTTAATTTATCTACTATATGAGCTTTAGGATTTATTTTTTTATT\r
+Parnips         TTACGGTAGGTATAGATGTAGATACACGAGCTTATTATACTTCTGCTACTATGATTATTGCAGTTCCTACAGGAATTAAAATTTTTAGATGATTAGCAACAATATATGGATCAAAAATTAAATATAATTTATCAATAATATGAGCTATTGGATTTGTATTTTTATT\r
+Paramblynotus   TTACTGTTGGAATAGATGATGATACCCGTGCCTATTATACTTCTGTAACTATAATTATTGCAATCCCAACTGGTATTAAAATTTTTAGATGATTAGCAACAATATATGGATCAAAAATTTTAATAAATTTATCAATAATTTGATCATTAGGATTTATTTTTTTATT\r
+Ibalia          TTACTGTAGGGATAGATGTAGATACTCGAGCTTATTATACTTCTGTAACTATAATTATTGCTATCCCAACAGGAATTAAAATTTTTAGATGATTAGCTAGGATATATGGGTCTAAAATTAAATTTAATTTATCTATTATTTGATCAATTGGATTTATTTTTTTATT\r
+\r
+Synergus        TTCATTTGGAGGAATAACAGGAATTACTTTAGCAAATTCTTCGATTGATATTATAATACATGATACTTATTATGTAGTAGCCGATCGACATTGCTCTCTGGAAATTCGAAACCGCCAAGTACTACGTAACCATCATTGATGCACCAGGTCATCGTGATTTCATAAA\r
+Periclistus     TTCATTTGGAGGATTAACAGGAATTACATTATCTAATTCTACTATTGATATTATATTACATGATACTTATTATGTAGTTGCNGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Ceroptres       TTCAATAGGAGGAATAACAGGAGTAACTTTATCTAATTCTTCTATTGATATTATTTTGCATGATACTTATTATGTAGTAGCT????????????????????????????????????????????????????????????????????????????????????\r
+Synophromorpha  TTCAATTGGAGGAATAACAGGAGTAACTTTACCTAATTCTTCAATTGATATTATTTTACATGATACTTATTATGTAGTGGCTGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Xestophanes     TTCAATTGGAGGAATAACAGGAGTAACTTTATCTAATTCTTCTATTGATATTATTTTACATGATACTTATTATGTAGTAGCTGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTGACAATCATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Diastrophus     TTCAATTGGGGGAATAACAGGGGTAACTTTAGCTAATTCATCAATTGATATTATTTTACATGATACTTATTATGTAGTGGCTGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTATGTGACTATCATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Gonaspis        TTCAATTGGGGGAATAACAGGAGTAACTTTATCTAATTCATCAATTGATATTATTTTACATGATACTTATTATGTAGTTGCTGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATCAG\r
+Liposthenes_gle TTCTATTGGTGGATTAACAGGTGTGACTCTTTCTAATTCATCGATTGATATTATTTTACATGACACTTATTATGTAGTGGCTTATCGACATTGCTCTGTGGAAATTTGAAACAGCCAAGTACTACGTGACCATCATTGATGCACCAGGACACCGTGATTTCATAAA\r
+Liposthenes_ker TTCTATTGGAGGAATTACTGGTATTACCTTAGCAAATTCTTCTCTAGACATTATCCTTCATGACACTTACTATGTTGTAGCATATTGACATTGCTCTGTGGAAATTTGAAACTGCCAAGTACTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATAAA\r
+Antistrophus    TTCTTTTGGAGGATTAACAGGAATTACTTTATCAAATTCTTCAATTGATATTTCTTTACGTGATACATATTATGTAGTTGCTTATCGACATTGCTCTGTGGAAATTTGAAACTGCCAGGTACTACGTGACCATCATTGATGCTCCAGGACATCGTGATTTCATAAA\r
+Rhodus          TTCTTTAGGAGGATTAACAGGGGTTACTTTAGCAAATTCTTCAATTGACATTATTTTACATGATACTTACTATGTAGTAGCCTATCGACATTGCTCTGTGGAAGTTTGAAACTGCCAAGTACTACGTGACCATAATTGATGCACCAGGACATCGTGATTTCATAAA\r
+Hedickiana      TTCACTTGGAGGAGTGACAGGTGTTACTTTATCTAATTCATCAATTGATATTGTTATACATGATACTTATTATGTTGTTGCATATCGACATTGCTCTGTGGAAGTTTGAAACTGCCAAGTACTACGTGACCATAATTGATGCACCAGGACATCGTGATTTTATAAA\r
+Neaylax         TTCAATTGGGGGGATGACAGGAGTTACACTATCTAATTCTTCAATTGATATTATTATACATGATACTTATTATGTCGTAGCTTATCGACATTGCTCTGTGGAAGTTTGAAACTGCCAAGTACTACGTGACCATAATTGATGCACCAGGACATCGTGATTTCATAAA\r
+Isocolus        TTCATTAGGGGGGATAACAGGAGTAACATTAGCAAATTCATCTATTGACATTATTTTACATGATACTTATTATGTAGTTGCATATCGACATTGCTCTGTGGAAATTTGAAACTGCCAAGTACTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATAAA\r
+Aulacidea       TTCTTTAGGTGGTTTGACAGGAGTCACATTATCAAATTCTTCACTTGATATTATTTTACATGATACTTATTATGTAGTGGCTTATCGACATTGCTCTGTGGAAATTTGAAACTGCCAAGTACTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATAAA\r
+Panteliella     TTCAATTGGAGGATTAACTGGAGTAACTTTATCAAATTCATCAATTGATATTGTTATACATGACACTTATTATGTTGTGGCNTATCGACATTGCTCTGTGGAAATTTGAAACTGCCAAGTACTACGTAACCATCATTGATGCACCAGGGCATCGTGATTTCATAAA\r
+Barbotinia      TTCTCTTGGAGGAATTACAGGAATTACTTTATCTAATTCTTCAATTGATGTTATTTTACATGATACATATTATGTCGTAGCNGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTAACCATCATCGATGTACCAGGACATCGTGATTTCATCAA\r
+Aylax           TTCAATTGGAGGTATTACAGGAGTAACCTTATCAAATTCTTCAATTGATATTGTTTTGCATGATACATATTATGTTGTAGCTGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTAACCATCATCGATGCACCAGGACATCGTGATTTCATCAA\r
+Iraella         TTCAGTTGGGGGAATTACAGGAGTAACTTTATCAAATTCATCTATTGATATTATTTTACATGATACTTATTATGTAGTGGCTGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTAACCATCATCGATGCACCAGGACATCGTGATTTCATCAA\r
+Timaspis        TTCTATAGGAGGATTAACTGGTGTAACATTATCAAATTCATCAATTGATTTAATATTACATGATACTTATTATGTTGTAGCTAATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTGACAATCATTGATGCACCAGGGCATCGTGATTTTATCAA\r
+Phanacis_1      TTCAATAGGGGGATTAACTGGAGTTACTTTATCAAATTCTTCTATTGATTTGATTTTACATGATACTTATTATGTAGTTGCTAATCGACATTGCTCTGTGGAAATTTGAAACTGCCAAGTATTACGTGACAATCATTGATGCACCAGGGCATCGTGATTTTATTAA\r
+Phanacis_2      TTCAGTAGGGGGTTTAACAGGAGTAACTTTGGCTAATTCTTCAATTGATTTAATTATACATGATACATATTATGTAGTGGCTAATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTATGTAACGATCATTGATGCACCAGGCCATCGTGATTTTATTAA\r
+Eschatocerus    TACTCTTGGTGGTCTAACTGGAGTTACTTTATCAAATTCATCAATTGATATTATCTTACATGATACATATTATGTAGTAGCTAATCGATATTGCTCTCTGGAAATTTGAAACGGCGAAATATTATGTTACCATAATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Diplolepis      TTCTTTAGGAGGATTAACAGGAGTTTTATTATCTAATTCATCCATTGATATTATTTTACATGATACATATTATGTTGTTGCNCATTGATATCGCTCTTTGGAAATTCGAAACAGCCAAATATTACGTGACCATCATCGATGCACCAGGACATCGTGATTTTATAAA\r
+Pediaspis       TTCAATTGGAGGAATAACAGGAGTAACTTTATCAAATTCATCAATTGATATTATTTTACATGATACATATTATGTTGTAGCTTATCGACATTGCCCTCTGGAAATTCGAGACAGCCAAGTATTACGTAACCATCATCGATGCACCAGGACATCGTGATTTCATNAA\r
+Plagiotrochus   TTCAATTGGAGGTATAACAGGAGTAACATTAGCAAATTCTTCTATTGATATTATTATACATGATACATATTATGTTGTAGCNGATCGACATTGCTCTCTGGAAATTTGAAACTGCCAAGTATTACGTCACCATCATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Andricus        TTCTATTGGAGGAATAACTGGAGTTACATTAGCTAATTCATCTATTGATATTGTTATACATGATACTTATTATGTTGTTGCNAATCGACATTGCTCTCTGGAAATTTGAAACAGCGAAATATTACGTGACCATCATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Neuroterus      TTCAATTGGAGGAATAACAGGTGTAACATTAGCAAATTCATCAATTGATATTGTTATACATGATACTTATTATGTTGTTGCTAATCGACATCGCTCTCTGGAAATTTGAAACGGCGAAATATTATGTGACCATAATTGATGCACCAGGACATCGTGATTTTATCAA\r
+Biorhiza        TTCTATTGGAGGAATAACTGGTGTAACATTAGCTAATTCATCAATTGATATTATTATACATGATACTTATTATGTTGTTGCTAATCGATATTGCTCTCTGGAAATTTGAAACGGCGAAATATTATGTTACCATAATTGATGCACCAGGACATCGTGATTTCATCAA\r
+Parnips         TTCTATTGGAGGTATGACTGGAGTAACATTATCAAATTCTTCAATTGATATTATTTTACATGATACTTATTATGTAGTTGCTCATTGACATTGCTCTTTGGAAATTCGAAACAGCCAAGTATTACGTTACCATCATCGATGCACCAGGTCATCGTGATTTCATAAA\r
+Paramblynotus   TTCAATAGGTGGAGTTACAGGAATTACTTTATCTAATTCTTCTATTGATGTAATTTTACATGATACTTACTATGTAGTAGCTCATAGACATCGCTCTCTGGAAATTCGAAACAGCCAAGTATTACGTAACCATCATCGATGCACCGGGACATCGTGATTTCATAAA\r
+Ibalia          TTCTTTTGGGGGAATAACTGGAGTTACTTTATCAAACTCTTCTATTGACATTATTCTTCATGATACTTATTATGTAGTAGCNCATCGACATTGCTCTCTGGAAATTTGAAACAGCCAAATATTACGTAACCATTATCGATGCACCAGGACATCGTGATTTCATAAA\r
+\r
+Synergus        AAACATGATTACGGGAACGAGTCAAGCTGATTGTGCAGTGCTGATTGTAGCAGCTGGAATTGGTGAATTCGAAGCTGGAATTTCGAAAAATGGTCAGACTCGTGAACATGCTTTATTGGCTTTCACCCTGGGAGTGAAGCAATTGATTGTGGGAGTCAACAAGATG\r
+Periclistus     AAACATGATCACTGGAACAAGTCAGGCTGACTGTGCAGTGCTGATCGTAGCTGCTGGAATTGGAGAATTTGAAGCTGGAATCTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACCTTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Ceroptres       ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Synophromorpha  AAACATGATCACTGGAACAAGTCAGGCTGACTGTGCTGTGCTGATCGTAGCAGCTGGAATTGGAGAATTTGAAGCCGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCATTATTGGCTTTCACCCTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Xestophanes     AAACATGATCACTGGAACAAGTCAGGCTGACTGTGCTGTGCTGATCGTAGCAGCTGGAATTGGAGAATTTGAAGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Diastrophus     AAACATGATCACTGGAACAAGTCAGGCTGACTGTGCAGTGCTGATCGTAGCTGCTGGAATTGGAGAATTTGAAGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACACTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Gonaspis        AAACATGATCACTGGAACAAGTCAGGCTGACTGTGCAGTGCTGATCGTAGCTGCTGGAATTGGAGAATTTGAAGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACACTGGGAGTTAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Liposthenes_gle AAACATGATCACTGGTACGAGTCAAGCTGATTGTGCTGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCCAAAAATGGTCAAACTCGGGAGCATGCTTTATTGGCTTTCACCCTTGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Liposthenes_ker AAACATGATCACTGGTACGAGTCAAGCTGACTGTGCTGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATATCCAAAAATGGTCAAACTCGAGAACATGCTTTATTGGCTTTCACCCTCGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Antistrophus    AAACATGATCACTGGTACGAGTCAAGCTGATTGTGCTGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCTAAAAATGGTCAAACTCGAGAGCATGCTTTATTGGCTTTCACCCTCGGAGTAAAGCAGTTGATTGTGGGAGTCAATAAGATG\r
+Rhodus          AAACATGATCACTGGTACGAGTCAAGCTGATTGTGCTGTGTTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCCAAAAATGGTCAAACTCGAGAGCATGCTTTATTGGCTTTCACCCTCGGAGTAAAGCAGTTGATTGTGGGAGTCAATAAGATG\r
+Hedickiana      AAACATGATCACTGGTACGAGTCAAGCTGATTGTGCTGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCCAAAAATGGTCAAACTCGAGAGCATGCTTTATTGGCTCTCACCCTTGGAGTAAAGCAGTTGATTGTGGGAGTCAATAAGATG\r
+Neaylax         AAACATGATCACTGGTACGAGTCAAGCTGATTGTGCTGTACTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGGATTTCCAAAAATGGTCAAACTCGGGAGCATGCTTTATTAGCTTTCACCCTCGGTGTAAAGCAGTTGATTGTGGGAGTCAATAAGATG\r
+Isocolus        AAACATGATCACTGGTACTAGTCAAGCTGATTGTGCTGTGCTGATTGTAGCAGCTGGAATTGGGGAATTCGAAGCTGGAATATCCAAAAATGGTCAAACTCGAGAGCATGCTTTATTAGCTTTCACCCTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Aulacidea       GAACATGATTACTGGTACGAGTCAAGCTGATTGCGCTGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCAAAAAATGGTCAAACTCGAGAGCATGCTTTATTGGCTTTCACCCTCGGAGTGAAGCAATTGATTGTCGGAGTCAATAAGATG\r
+Panteliella     AAACATGATCACTGGTACGAGTCAAGCTGATTGTGCTGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCCAAAAATGGTCAAACTCGAGAACATGCTTTATTGGCCTTCACCCTTGGAGTGAAGCAATTGATTGTGGGAGTTAATAAGATG\r
+Barbotinia      AAATATGATCACTGGAACGAGTCAAGCTGATTGTGCAGTGCTGATTGTAGCGGCTGGAATTGGAGAATTCGAAGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAGTTGATTGTAGGGGTCAACAAGATG\r
+Aylax           AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCAGTACTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGTATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTTACTCTAGGAGTGAAGCAATTGATTGTAGGGGTCAACAAGATG\r
+Iraella         AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCAGTGCTGATTGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGTATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTAAAGCAATTGATTGTAGGGGTCAATAAGATG\r
+Timaspis        AAACATGATCACTGGAACAAGTCAAGCTGACTGTGCAGTGCTAATCGTAGCAGCTGGAATTGGAGAATTTGAAGCTGGAATTTCAAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAACTGATTGTGGGTGTCAATAAGATG\r
+Phanacis_1      AAACATGATCACTGGAACAAGTCAAGCCGATTGTGCAGTGCTGATCGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCAAAAAATGGCCAAACTCGAGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAACTGATTGTAGGTGTCAATAAGATG\r
+Phanacis_2      AAACATGATCACTGGAACAAGTCAAGCTGACTGTGCAGTGCTGATCGTAGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCCAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAACTGATTGTGGGTGTCAATAAGACG\r
+Eschatocerus    AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCTGTACTGATAGTAGCAGCTGGAATTGGAGAATTCGAGGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Diplolepis      AAACATGATTACTGGAACAAGTCAAGCTGATTGTGCAGTGTTAATAGTAGCAGCTGGAATAGGAGAATTCGAAGCTGGAATTTCAAAAAATGGCCAAACTCGTGAACATGCTCTACTTGCTTTTACCTTGGGAGTAAAGCAATTGATTGTCGGAGTCAATAAAATG\r
+Pediaspis       AAATATGATTACTGGGACGAGTCAAGCTGATTGTGCAGTTCTGATAGTAGCAGCTGGAATAGGAGAATTCGAAGCTGGAATTTCCAAAAATGGTCAAACTCGTGAACATGCTCTACTGGCCTTCACCTTGGGAGTGAAGCAATTGATCGTTGGAGTCAATAAGATG\r
+Plagiotrochus   AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCAGTGCTGATTGTGGCAGCTGGAATTGGAGAATTCGAAGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTCTCACTCTTGGAGTGAAGCAATTAATTGTAGGAGTTAATAAGATG\r
+Andricus        AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCTGTGCTGATCGTAGCAGCTGGAATTGGAGAATTCGAGGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Neuroterus      AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCTGTACTGATCGTAGCAGCTGGAATTGGAGAATTCGAGGCTGGGATTTCGAAAAATGGTCAAACTCGTGAGCATGCTTTATTGGCTTTCACTCTGGGAGTGAAACAATTGATTGTAGGAGTCAATAAGATG\r
+Biorhiza        AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCTGTACTGATAGTAGCAGCTGGAATTGGAGAATTCGAGGCTGGAATTTCGAAAAATGGTCAAACTCGTGAACATGCTTTATTGGCTTTCACTCTGGGAGTGAAGCAATTGATTGTGGGAGTCAATAAGATG\r
+Parnips         AAACATGATCACTGGAACGAGTCAAGCTGATTGTGCAGTTTTAATAGTAGCAGCAGGAATTGGAGAATTCGAAGCTGGAATTTCAAAGAATGGTCAAACTCGTGAACATGCTCTTTTGGCTTTCACCCTAGGAGTGAAGCAATTGATCGTTGGAGTCAATAAGATG\r
+Paramblynotus   GAACATGATTACTGGAACTAGTCAGGCTGACTGTGCAGTTTTGATAGTAGCTGCAGGAATTGGAGAATTCGAGGCTGGAATTTCAAAGAATGGCCAAACTCGTGAACATGCCCTTTTGGCGTTCACCTTAGGAGTGAAGCAATTGATTGTTGGAGTCAACAAGATG\r
+Ibalia          AAACATGATCACTGGAACAAGTCAAGCTGATTGTGCAGTTTTGATAGTAGCAGCAGGAATTGGAGAATTCGAAGCAGGAATTTCAAAGAATGGTCAAACTCGTGAACATGCTCTTTTAGCTTTCACCCTGGGAGTGAAACAATTGATTGTTGGAGTCAACAAGATG\r
+\r
+Synergus        GATATGACTGATCCACCATATTCTGAGAGTCGATTCGAAGAAATAAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTACAATACCGCTTCAGTTGCATTTGTTCCAATTTCTTCTAGGTCCATTTATATGTGAGATGTACGGAATGTTTGGCTCCCTATTC\r
+Periclistus     GATATGACTGATCCGCCATATTCTGAGACTCGATTTGAAGAAATCAAGAAAGAGGTGTCTTCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTAGCATTTGTTCCAATTTCTTCTTGGTCCATTTATGTGTGAGATCTACGCAATGCTTGGCTCCCTATTC\r
+Ceroptres       ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????TCTTGGACCATTTATATGCGAGATTTACGCAATGCTTGGCTCCCTATTC\r
+Synophromorpha  GATATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAGAAAGAGGTGTCTTCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Xestophanes     GATATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAGAAAGAGGTGTCTTCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Diastrophus     GGCATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAGAAAGAGGTGTCTTCATACATCAAGAAAATTGGTTTCAATACTGCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Gonaspis        GACATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAGAAAGAGGTGTCATCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Liposthenes_gle GATATGACTGATCCACCATACTCTGAGAGTCGATTCGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAAATATACGCAATGCTTGGCTCCCTATTT\r
+Liposthenes_ker GATATGACTGATCCACCATACTCTGAGAGTCGCTTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGCTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGCCCATTTTTATGTGAGATGTACGGAATGTTTGGTTCCCTATTC\r
+Antistrophus    GATATGACTGATCCACCGTACTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAAGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCAGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAGATGTACGCAATGCTTGGCTCCCTATTC\r
+Rhodus          GATATGACTGATCCACCATACTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAGATGTACGCAATGTTTGGCTCCCTATTT\r
+Hedickiana      GATATGATTGATCCACCATACTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAGATGTACGGAATGTTTGGCTCCCTGTTT\r
+Neaylax         GATATGACTGATCCACCATACTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAGATGTACGGAATGTTTGGCTCCCTATTA\r
+Isocolus        GATATGACTGATCCACCATACTCCGACAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCGTTTTTATGTGAGATGTACGCAATGCTTGGCTCCCTATTC\r
+Aulacidea       GATATGACTGATCCACCATACTCTGAGAGCCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCATCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAGATGTACGGAATGTTYGGCTCCCTATTC\r
+Panteliella     GATATGACTGATCCACCATACTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTATAATACTGCGTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTTTATGTGAGATGTACGGAATGTTTGGCTCCCTTTTC\r
+Barbotinia      GATATGACTGATCCTCCATATTCTGAAAGTCGATTTGAAGAAATAAAGAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTATATGTGAGATATATGCAATGCTTGGCTCCCTATTT\r
+Aylax           GATATGACTGATCCTCCATATTCTGAAAGTCGATTTGAAGAAATAAAGAAAGAGGTTTCTTCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTATATGTGAGATGTACGGAATGTTTGGCTCTCTATTT\r
+Iraella         GATATGACTGATCCTCCATATTCTGAAAGTCGATTTGAAGAAATTAAGAAAGAAGTTTCTTCATACATCAAGAAAATTGGTTACAATACTGCTTCGGTCGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Timaspis        GACATGGCTGATCCATCATATTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAAAAAATTGGATACAATACTGCTTCGGTTGCATTTGTACCAATTTCTTCTTGGTCCATTTTTATGTGAGATATATGCAATGCTTGGCTCCCTATTC\r
+Phanacis_1      GACATGACTGATCCACCATATTCTGAAAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAAAAAATTGGATACAATACTGCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Phanacis_2      GACATGACTGACCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAAAAAATTGGATACAATACTGCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Eschatocerus    GATATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATAAAAAAAGAGGTTTCCTCATACATCAAGAAAATTGGTTACAATACTTCTTCGGTTGCATTTGTTCCAATTTCTATTTGGACCACTCTTCTGTCAAATATACGCATTGCTCGGCTCACTTTTT\r
+Diplolepis      GATATGACTGACCCACCATATTCAGAGAGCCGATTTGAAGAAATCAAAAAAGAAGTTTCTTCATACATCAAGAAAATTGGTTACAATACAGCTTCAGTTGCATTTGTTCCCATTTCTNNNNGGTCCATTCTTGTGTGAGATATACGCTTTACTTGGTTCTCTATTT\r
+Pediaspis       GATATGACTGACCCACCATATTCTGAAAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCTTCATACATCAAAAAAATTGGTTACAATACAGCTTCGGTTGCATTTGTTCCCATTTCTGTTTGGGCCATTTATATGTGAGCTGTATGCATTGTTCGGTTCCCTATTC\r
+Plagiotrochus   GATATGACTGATCCGCCATATTCTGAGAGTCGATTTGAAGAAATCAAGAAAGAGGTGTCTTCATACATAAAGAAAATTGGTTACAATACTGCCTCGGTTGCATTTGTTCCAATTTCAACATGGACCTTTTATGTGCGAGATGTACGCAATGTTTGGCTCCCTATTC\r
+Andricus        GATATGACCGATCCACCATATTCTGAAAGTCGTTTTGAAGAAATCAAGAAAGAGGTTTCCTCATACATCAAGAAAATTGGTTACAATACTTCTTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTATGTGTGAGATCTACGCAATGCTTGGCTCCCTATTC\r
+Neuroterus      GATATGACCGATCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTTTCCTCGTACATCAAGAAGATTGGTTACAATACTTCTTCGGTTGCATTTGTTCCAATTTCT?????????????????????????????????????????????????\r
+Biorhiza        GATATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATAAAAAAAGAGGTTTCCTCATACATCAAGAAAATTGGTTACAATACTTCTTCGGTTGCATTTGTTCCAATTTCTTCTTGGTCCATTTATATGTGAGATCTACGCAATGCTTGGCTCCTTATTC\r
+Parnips         GATATGACTGACCCACCATATTCTGAGAGCCGATTTGAGGAAATAAAAAAGGAAGTTTCTTCATACATCAAGAAAATTGGCTACAATACTGTTTCGGTTGCATTTGTTCCCATTTCTATTGGGGCCATTTATGTGTGAAATGTATGGACTAACTGGCTCTCTATTC\r
+Paramblynotus   GACATGACTGATCCACCTTATTCTGAAAGTCGTTTTGAGGAGATCAAGAAAGAGGTTTCCTCATACATCAAGAAGATTGGCTACAATACAGCATCAGTTGCATTTGTACCAATTTCT?????????????????????????????????????????????????\r
+Ibalia          GATATGACTGATCCACCATATTCTGAGAGTCGATTTGAAGAAATCAAAAAAGAGGTATCTTCATACATCAAGAAAATTGGCTACAATACTGCTTCAGTTGCATTTGTTCCCATTTCT?????????????????????????????????????????????????\r
+\r
+Synergus        GGATGTGGCTCTATTTGGACAATGTGTATGATTGCTTTCGACCGATACAACGTTATCGTAAAAGGTTTAGCTGGCAAGCCCTTAACTATCAGTGGTGCAATTCTGCGCATTGCTTTTCTCTGGATCTGGGCAGTAATTTGGACAGTTGCACCAATGATAGGATGGA\r
+Periclistus     GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTCGATCGATACAATGTTATCGTAAAGGGTCTGGCTGGCAAACCGCTATCTATCAGTGGTGCAATTCTGCGCATTGTTGGACTCTGGGTCTGGGCAGTAATTTGGACCATTGCACCAATGATAGGATGGA\r
+Ceroptres       GGATGTGCCTCCATTTGGACGATGTGTATGATTGCTTTCGACCGATACAATGTCATCGTGAAAGGTTTAGCTGGAAAGCCGCTAACTATCAGTGGTGCAATTCTGCGTATTATTGGTCTCTGGGCCTGGGCAATAGTTTGGACCGTTGCCCCAATGTTAGGATGGA\r
+Synophromorpha  ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Xestophanes     ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Diastrophus     ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Gonaspis        ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Liposthenes_gle GGATGCGGCTCCATTTGGACAATGTGTATGATTGCTTTCGATCGATACAATGTTATCGTAAAGGGCTTAGCAGGCAAGCCCTTAACTATCACTGGTGCAATTCTGCGGATTGTTGGTCTCTGGGTTTGGGCAGTTGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Liposthenes_ker GGATGCGGCTCCATTTGGACAATGTGTATGATTGCTTTCGATCGATATAATGTTATCGTAAAAGGCTTAGCAGGCAAGCCCTTAACTATCACTGGTGCAACTCTGCGGATTATTGGTCTCTGGGCTTGGGCAGTCGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Antistrophus    GGATGCGGCTCCATTTGGACAATGTGTATGATTGCTTTCGATCGATACAATGTTATTGTAAAAGGCTTAGCAGGCAAGCCCTTAACTATCACTGGTGCAATTCTGCGGATTGTTGGTCTCTGGGTTTGGGCAGTCGTTTGGACTATTGCACCAATGATAGGATGGA\r
+Rhodus          GGATGCGGCTCCATTTGGACAATGTGTATGATTGCTTTCGATCGATACAATGTTATTGTAAAAGGCTTAGCAGGCAAGCCCTTAACTATCACTGGTGCAGTTCTGCGGATTGTTGGTCTCTGGGTTTGGGCAGTCGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Hedickiana      GGATGCGGCTCCATTTGGACAATGTGTATGATTGCTTTCGATCGATACAATGTTATTGTAAAAGGCTTAGCAGGCAAGCCCTTAACTATCACTGGTGCAATTCTGCGGATTGTTGGTCTATGGGTTTGGGCAGTCGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Neaylax         GGATGCGGCTCCATCTGGACAATGTGTATGATTGCTTTCGATCGATACAATGTTATTGTAAAAGGCTTAGCAGGCAAGACCTTAACTATCACTGGCGCAATTCTGCGGATTGTTGGTCTCTGGGTTTGGGCAGTCGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Isocolus        GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTTGACCGATATAATGTTATCGTAAAAGGTTTAGCTGGCAAGCCCTTGACTATCACTGGTGCAATTCTGCGGATTGTTGGTCTCTGGATTTGGGCAGTCGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Aulacidea       GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTTGACCGATATAATGTTATCGTAAAAGGCTTAGCTGGCAAGCCCTTAACTATCACTGGTGCAATTCTGCGGATTGTTGGTCTCTGGGTTTGGGCAGTTGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Panteliella     GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTCGACCGATACAATGTTATCGTAAAAGGCTTGGCTGGCAAGCCCTTAACTATCACTGGTGCAATTCTGCGGATTGTTGGTCTCTGGGTTTGGGCAGTCATTTGGACCATTGCCCCAATGATAGGATGGA\r
+Barbotinia      GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTCGACCGATACAATGTTATCGTAAAAGGTTTAGCTGGCAAGCCATTAACTATCAGTGGTGCAATTCTGCGTATTGTTTTTCTCTGGGTCTGGGCGGTAGTTTGGACCATTGCACCAATGATAGGATGGA\r
+Aylax           GGATGTGGATCCATTTGGACAATGAGTATGATTGCTTTCGACCGATACAATGTTATCGTAAAAGGTTTAGCTGGCAAGCCATTAACTATCAGTGGTGCAATTCTGCGTATTGNTTTCCTCTGGCTCTGGGCGGTAATTNGGACCATTGCACCAATGATAGGATGGA\r
+Iraella         ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Timaspis        GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTTGATCGATACAATGTTATTGTAAAAGGTTTAGCTGGCAAGCCATTAACTATCAGTGGTGCAATTCTACGCATTGTTGGTCTCTGGGTCTGGGCTGTCATTTGGACCATTGCACCAATGCTAGGATGGA\r
+Phanacis_1      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Phanacis_2      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Eschatocerus    GGCTGTGCTTCAATCTGGACAATGTGTTTGATTGCCTTCGACAGGTACAATGTCATTGTCAAGGGTCTAGCTGGAAAACCTTTGACCATAACCGGTGCAGTCTTGCGTATATTTGCTCTCTGGATCTGGGCATTGATTTGGACAGTTGCACCAATGTTTGGATGGA\r
+Diplolepis      GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTTGATAGGTACAATGTAATAGTGAAAGGTTTGGCTGGGAAGCCCTTAACAATCACCGGTGCAATTATACGCATAATTGGCCTTTGGGTCTGGGCCATTATTTGGACTATTGCGCCAATGTTTGGATGGA\r
+Pediaspis       GGATGTGGCTCCATTTGGACAATGTGTATGATTGCTTTCGACAGATACAACGTAATCGTAAAAGGCTTAGCTGGAAAGCCCTTAACCATAAGCGGTGCAATTATTCGTATAATTGGTCTCTGGGTCTGGGCCGTGATTTGGACCGTTGCACCAATATTTGGATGGA\r
+Plagiotrochus   GGATGCGGCTCCATTTGGACGATGTGTATGATAGCTTTCGACCGATACAATGTTATCGTGAAGGGATTAGCTGGAAAGCCGTTAACTATCAGTGGTGCAATTCTGCGCATTGTTGGACTCTGGGTTTGGGCAGTAATTTGGACAATTGCACCAATGTTAGGATGGA\r
+Andricus        GGATGTGTCTCCATTTGGACAATGTGTATGATTGCTTTTGATCGATACAATGTCATTGTAAAGGGTTTAGCTGGCAAGCCACTAACTATCAGTGGTGCAATTCTGCGCATTGTTGGTCTCTGGGTCTGGGCAATAATTTGGACCATTGCACCAATGTTGGGCTGGA\r
+Neuroterus      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Biorhiza        GGATGTGCCTCCATTTGGACAATGTGTATGATTGCTTTCGACCGATACAATGTCATTGTAAAGGGTTTAGCTGGAAAGCCACTCACTATCAGTGGTGCAATTCTGCGTATTGCTGGTCTCTGGGTATGGGCAGTAATTTGGACCATTGCACCAATGTTGGGCTGGA\r
+Parnips         GGATGTGGGTCCATTTGGACAATGTGCATGATTGCGTTCGACAGATACAACGTAATAGTAAAAGGTTTGGCAGGAAAACCTTTAACCATCAGTGGTGCAATTCTTCGCATAGTTGGTCTCTGGGTCTGGGCCGTTATTTGGACCATTGCACCAATGATAGGATGGA\r
+Paramblynotus   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Ibalia          ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+\r
+Synergus        ATCGGTACGTTCCGGAGGGTAACATGACAGCTTGCGGAACTGACTACCTGACTAAGGATTGGTTATCGAGGTCTTACATCATTGTATACAGCGTCTTCGTATACTTCATGCCACTTTTCCTCATCATATACAGTTACTATTTCATCATTGCTGCTGTATCTGCCCA\r
+Periclistus     ATCGGTATGTTCCTGAAGGCAATTTGACAGCTTGCGGAACTGACTATCTGAGTAAGGATTGGTTGTCGAGGTCTTACATTCTTGTATACAGCGTCTTCGTATACTTCATGCCACTTTTCCTCATCATATACAGTTACTATTTCATCATCGCTGCTGTATCTGCTCA\r
+Ceroptres       ATCGGTACGTTCCCGAAGGCAACATGACAGCTTGTGGAACTGACTATCTGACTAAGGATTGGTTCTCGAGATCTTACATTATTATATATAGCGTCTTCGTATACTTTGCGCCACTTTTCCTCATCATATACAGTTACTATTTCATCATTGCTGCTGTATCTGCTCA\r
+Synophromorpha  ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Xestophanes     ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Diastrophus     ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Gonaspis        ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Liposthenes_gle ATCGGTACGTTCCCGAGGGTAACATGACAGCTTGTGGAACTGATTATCTAACCAAAGATTGGTTCTCAAGGTCTTATATACTTATATACAGTGTCTTTGTATACTTCATGCCACTTTTTCTCATCATATACAGCTACTATTTTATCATTGCTGCTGTATCTGCTCA\r
+Liposthenes_ker ATCGGTACGTTCCCGAGGGTAACATGACAGCTTGTGGAACTGACTATCTAACCAAAGATTGGTTCTCGAGGTCTTATATACTTATATACAGYGTCTTTGTATACTTCATGCCACTTTTTCTCATCATATACAGCTACTATTTTATCATTGCTGCTGTATCTGCTCA\r
+Antistrophus    ATCGGTACGTTCCCGAAGGTAACATGACAGCTTGTGGAACTGACTATCTAACTAAAGATTGGTTCTCGAGGTCTTATATAATTATATACAGTGTCTTCGTATACTTCATGCCACTTTTTCTCATCATATACAGTTACTATTTTATCATTGCTGCTGTATCTGCTCA\r
+Rhodus          ATCGGTACGTTCCCGAAGGCAATATGACAGCTTGTGGAACTGACTATCTAACTAAAGACTGGTTCTCGAGGTCTTATATACTTATATACAGTGTCTTCGTATACTTCATGCCACTTTTTCTCATTATATACAGCTACTATTTTATCATTGCTGCTGTATCTGCTCA\r
+Hedickiana      ATCGGTACGTTCCCGAAGGCAACATGACAGCTTGTGGAACTGACTATCTAACTAAAGACTGGTTCTCGAGGTCTTATATACTTATATACAGTGTCTTCGTATACTTTATGCCACTTTTTCTCATCATATACAGCTACTATTTTATCATTGCTGCTGTATCTGCTCA\r
+Neaylax         ATCGGTACGTTCCCGAAGGCAACATGACAGCTTGTGGAACTGACTATCTAACTAAAGACTGGTTCTCGAGGTCTTATATACTTATATACAGTGTCTTCGTATACTTCATGCCACTTTTTCTCATCATATACAGCTACTATTTTATCATTGCTGCTGTATCTGCTCA\r
+Isocolus        ATCGGTACGTTCCCGAGGGCAACATGACAGCTTGTGGAACTGACTACTTGACTAAGGATTGGTTCTCGAGGTCCTATATACTTATATACAGTGTCTTCGTATATTTCATGCCACTTTTTCTCATCATATACAGCTACTATTTCATCATTGCTGCTGTATCTGCTCA\r
+Aulacidea       ATCGGTATGTTCCCGAGGGTAACATGACAGCTTGTGGAACTGACTATCTAACTAAGGATTGGTTCTCCAGGTCCTTCATACTTGTATACAGTATCTTCGTATACTTCATGCCACTTTTTCTCATCATATACAGCTACTATTTCATCATTGCTGCTGTATCTGCTCA\r
+Panteliella     ATCGGTACGTTCCCGAGGGCAATATGACAGCTTGTGGAACTGACTATCTGAATAAAGATTGGTTCTCGAGGTCTTATATACTTATATACAGTGTCTTTGTATACTTTATGCCACTTTTTCTCATTATATACAGTTACTATTTCATCATTGCTGCTGTATCTGCCCA\r
+Barbotinia      ATCGGTACGTTCCCGAGGGCAACATGACAGCTTGTGGAACTGACTATCTAACTAAGGATTGGTTCTCGAGGTCTTACATTCTTGTATACAGCGTCTTCGTATACTTCATGCCACTTTTCCTCATCATCTACAGTTACTATTTCATCATTGCTGCTGTATCTGCTCA\r
+Aylax           ATCGGTACGTNCCCGAGGGTAACATGACAGCTTGTGGAACTGACTATCTANCTAAGGATTGGTTCTCGAGGT----------------------------------------------------------------------------------------------\r
+Iraella         ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Timaspis        ATCGGTATGTTCCTGAAGGTAACATGACAGCTTGTGGGACTGACTATTTGACTAAGAACTGGTTCTCGAGGTCTTACATCCTTATATACAGCATTTTCGTGTATTTCATGCCACTTTTCCTCATAATATACAGTTACTATTTCATCATTGCTGCTGCATCTGCTCA\r
+Phanacis_1      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Phanacis_2      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Eschatocerus    ATCGGTATGTACCTGAAGGTAATCTGACAGCATGTGGTACTGATTATTTGAGCAAGGACTGGCTCTCAAGATCCTACCTCCTCGTATATGGTTTCTTCGTATACTTCATGCCGCTTTTCCTGATCATCTATAGCTATTATTTTATAATCGCAGCCGTATCTGCCCA\r
+Diplolepis      ATCGGTATGTACCTGAAGGTAACATGACAGCTTGCGGAACTGATTATTTAAGTAAAGACTGGTTCTCGAGGTCTTACATCCTTGTATACAGTATCTTCGTATACTATATGCCGCTTTTCCTTATCATATACAGTTACTATTTTATCATCTCAGCTGTATCTGCTCA\r
+Pediaspis       ATCGGTATGTACCCGAGGGTAACATGACAGCTTGCGGAACTGACTATCTCAGTAAGGACTGGTTTTCGAGGTCTTACATCATTGTTTACAGTATCTTCGTGTACTACATGCCACTTTTCCTCATCATATACAGCTACTACTTTATCATCTCAGCTGTATCTGCTCA\r
+Plagiotrochus   ATCGGTACGTTCCCGAGGGCAACATGACAGCTTGTGGAACTGACTATTTGACTAAGGATTGGTTCTCGAGGTCTTACATACTTGTATATAGCGTCTTTGTATACTTCATGCCACTTTTCCTTATCATATACAGTTACTATTTCATCATTGCTGCTGTAACAGCTCA\r
+Andricus        ATCGGTATGTTCCCGAGGGCAACATGACAGCATGTGGAACTGACTATCTGTCTAAGGATTGGTTCTCGAGGTCTTACATTATTGTATACAGCATCTTTGTATACTTTATGCCACTTTTCCTCATCATATACAGTTACTATTTTATCATTGCTGCTGTAACTGCTCA\r
+Neuroterus      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Biorhiza        ATCGGTATGTTCCTGAGGGCAACATGACAGCATGTGGAACTGACTATCTGTCTAAGGATTGGTTCTCAAGGTCTTACATTCTTGTATACAGCATCTTTGTATACTTTATGCCACTTTTCCTTATAATATACAGTTACTATTTCATCATTGCTGCTGTAACTGCTCA\r
+Parnips         ATCGGTACGTACCCGAAGGTAACTTGACAGCTTGTGGAACTGACTATCTGACACAGGATTGGTTCTCCAAGTCTTATATCCTTGTATACAGTGTTTTCGTATATTTCATGCCACTTTTCCTCATCATATACAGCTATTATTTCATCATCGCAGCTGTATCTGCTCA\r
+Paramblynotus   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+Ibalia          ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+\r
+Synergus        TGAAAAGGCTATGCGTGAACAGGCCAAAAAGATGAATGTAGCTTCTCTACGATCATCTGACAATCAAAATACGAGTGCTGAACATAAACTTGCCAAGGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-ACCCACGAGACCGATAGCGAACAAGTA\r
+Periclistus     CGAAAAAGCAATGCGTGAACAGGCCAAAAAGATGAATGTAGCTTCTCTACGATCATCCGATAATCAAAATACGAGTGCTGAACATAAACTCGCCAAGGTA------------------------------------------------------------AAGGTA\r
+Ceroptres       CGAAAAAGCAATGCGTGAACAGGCCAAAAAGATGAATGTAGCATCGCTACGATCATCCGACAATCAAAATACGAGCGCTGAACATAAACTCGCCAAGGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Synophromorpha  ????????????????????????????????????????????????????????????????????????????????????????????????????CTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Xestophanes     ????????????????????????????????????????????????????????????????????????????????????????????????????------------------------------------------------ACCGATAGCGAACAAGTA\r
+Diastrophus     ????????????????????????????????????????????????????????????????????????????????????????????????????------------------------------------------------ACCGATNGCGAACAAGTA\r
+Gonaspis        ????????????????????????????????????????????????????????????????????????????????????????????????????CTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-GACCACGAGACCGATAGCGAACAAGTA\r
+Liposthenes_gle CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTCCGATCCTCCGACAACCAAAATACGAGTGCTGAACATAAGCTCGCAAAGGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Liposthenes_ker CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGACAACCAAAATACGAGTGCTGAACATAAGCTCGCAAAGGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Antistrophus    CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGATAACCAAAATACGAGTGCTGAACATAAGCTCGCAAAGGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Rhodus          CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGACAACCAAAATACGAGTGCTGAACATAAGCTCGCAAAGGTA---------------------------------------------ACCACTAGCGAN---CAAGTA\r
+Hedickiana      CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGATAACCAAAATACG---------------------------CTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Neaylax         CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGACAACCAAAATACGAGTGCTGAACATAAGCTCGCAAAGGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Isocolus        CGAAAAAGCAATGCGTGAGCAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGACAATCAAAACACGAGTGCTGAACATAAGCTCGCAAAAGTA---------------------------------AATATGACNCACGAGACCGATAGCGAACAAGTA\r
+Aulacidea       CGAAAAAGCAATGCGTGAGCAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCTGACAACCAAAACACGAGTGCTGAACATAAGCTGGCAAAGGTA---------------------------------------------ACAACTGGCGCTG--AAGNTA\r
+Panteliella     CGAAAAAGCAATGCGTGAACAAGCCAAAAAGATGAATGTAGCTTCTCTACGATCCTCCGACAACCAAAATACGAGTGCAGAACATAAGCTCGCAAAGGTT-------------------------------GAGATATCAACCACGAGACCGATAGCGAACAAGTA\r
+Barbotinia      TGAAAAAGCTATGCGTGAACAGGCCAAAAAGAWGAATGTAGCTTCTCTACGATCATCCGACAATCAAAATACGAGTGCTGAACATAAACTCGCCAAGGCA------------------------------------------CACGAGACCGATAGCGAACAAGTA\r
+Aylax           ----------------------------------------------------------------------------------------------------CTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAT-AACCACGAGACCGATAGCGAACAAGTA\r
+Iraella         ????????????????????????????????????????????????????????????????????????????????????????????????????------------------------------------------------------------CAAGTA\r
+Timaspis        CGAAAAAGCAATGCGTGAACAAGCAAAAAAGATGAATGTAGCTTCTCTACGATCGTCCGATAATCAGAATACGAGTGCTGAGCATAAGCTCGCAAAGGTA------------------------------------------------ACCGATAGCGAACAAGTA\r
+Phanacis_1      ????????????????????????????????????????????????????????????????????????????????????????????????????CTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+Phanacis_2      ????????????????????????????????????????????????????????????????????????????????????????????????????-------------------------------------------------CCGATAGCGAACAAGTA\r
+Eschatocerus    TGAGAAAGCCATGCGAGAACAGGCCAAAAAGATGAATGTAGCTTCCCTGAGATCATCAGATAATCAGAATACAAGCACTGAACACAAACTTGCAAAAGTACTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAT-AACCACGAGACCGATAGCGAACAAGTA\r
+Diplolepis      CGAAAAAGCAATGCGCGAACAGGCCAAAAAGATGAACGTAGCTTCTCTACGTTCATCTGACAATGCAAACACAAGTGCTGAGCATAAACTCGCAAAGGTA----------------------------------ATAT-AACCACGAGACCGATAGCGAACAAGTA\r
+Pediaspis       CGAAAAAGCAATGCGTGAACAGGCCAAAAAGATGAACGTAGCTTCTCTACGATCATCAGACAATGCAAATACGAGTGCAGAGCATAAACTCGCAAAAGTA----------------------------------ATAT-AACCACGAGACCGATAGCGAACAAGTA\r
+Plagiotrochus   TGAAAAAGCAATGCGTGAGCAGGCCAAAAAGATGAATGTGGCTTCCTTACGATCATCGGACAATCAAAATACAAGTGCTGAACATAAACTTGCCAAGGTA--------------------------------------GGTAAACCGAACTGGCGCTG--TTGGCG\r
+Andricus        CGAAAAAGCAATGCGCGAACAGGCCAAAAAGATGAACGTGGCTTCCCTACGATCATCTGACAATCAAAATACGAGTGCCGAACACAAGCTCGCTAAGGTT-----------------------------------ATACAACCACGAGACCGATAGCGAACAAGTA\r
+Neuroterus      ????????????????????????????????????????????????????????????????????????????????????????????????????------------------------------------------CACGAGACCGATAGCGAACAAGTA\r
+Biorhiza        CGAAAAAGCAATGCGTGAACAGGCCAAAAAAATGAACGTCGCTTCCCTTCGATCATCCGACAATCAAAATACGAGTGCTGAGCATAAGCTCGCCAAGGTT----------------------------------------------AGACCGATAGCGAACAAGTA\r
+Parnips         CGAAAAAGCTATGCGTGAACAGGCCAAAAAGATGAACGTAGCTTCTCTACGATCATCCGATAATCAAAATTCAAGTGCTGAACATAAGCTCGCGAAGGTA--------------------------------------------------CNATAGCGAACAAGTA\r
+Paramblynotus   ????????????????????????????????????????????????????????????????????????????????????????????????????CTCTAAGTGGGTGGTAAACTCCATCTAAGGCTAAATAC-ACCCACGAGACCGATAGCGAACAAGTA\r
+Ibalia          ????????????????????????????????????????????????????????????????????????????????????????????????????------------------------CTAANGCTAAATAC-AACCACGAGACCGATAGCGAACAAGTA\r
+\r
+Synergus        CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCTAAAAGATCGAATGGGGAGATTCATCGTCAGCGACTTTGGCTTTCGTGTGGTGC-GTGATGCT--CGAGATTTC----GGTCTCGC\r
+Periclistus     CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGACTTTGGCTTTCGTGTGTGTC-GCGATGTT--CGGGGCTTC----GGTCTCGC\r
+Ceroptres       CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCCTTGGCTTTCGTGTGGTTT-GCGATGTT--CGGGGCTTC----GGTCTCGC\r
+Synophromorpha  CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGACTCTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGGCTTC----GGTCTCGC\r
+Xestophanes     CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGACTCTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGACTTT----GGTCTTGC\r
+Diastrophus     CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGACTCTGGCTTGCGTGTGGTTC-GCGATGCT--CGGGACTTC----GGTCTCGC\r
+Gonaspis        CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGACTCTGGCTTGCGTGTGGTTT-GCGATGCT--CGGGGCTTC----GGTCTCGT\r
+Liposthenes_gle CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGAGATTCC----GATCTCGT\r
+Liposthenes_ker CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCACCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGAGACTTC----GGTCTCGC\r
+Antistrophus    CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GTGATGCT--CGAGATTTT----TGTCTCGT\r
+Rhodus          CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGATTC-GCGATGCT--TGAGATTTC----GGTCTCGT\r
+Hedickiana      CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGCT--CGGGATTTC----GGTCTCGT\r
+Neaylax         CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGCT--CGGGATTTC----GGTCTCGT\r
+Isocolus        CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGATTTC----GGTCTCGC\r
+Aulacidea       CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTAT-GCGATGTT--CGGGATTTC----GGTCTCGT\r
+Panteliella     CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGATTTC----GATCTCGT\r
+Barbotinia      CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAACGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGACTTC----GGTCTCGC\r
+Aylax           CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAACGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGTCTTC----GGTCTCGC\r
+Iraella         CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAACGGCTTTGGCTTTCGTGTGGTTC-GCGATGTT--CGGGACTTC----GGTCTCGC\r
+Timaspis        CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGAGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GTGATGTT--CATGACTTC----GGTCTTGT\r
+Phanacis_1      CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GTGATGTT--CAAGACTTC----GGTTTTGC\r
+Phanacis_2      CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GTGATGTT--CGTGACTTT----GGTCTTGC\r
+Eschatocerus    CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGAGGAGATTCATCGTCAATGTTTTTGGCTTTCCTGTGATTTAGTGATGTTT-TATAATCTTTTTAGATTATAT\r
+Diplolepis      CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGGTCGAATGG-GAGACTCATCGTCAATAACTTTGGCTTTCGTGTGATTA-GTGATGTT--CGTAATTTC----GATTACGT\r
+Pediaspis       CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCATTGGCTTTCGTGTGGTTC-ACGATGTTTGCAGGACCCTCGCGGGTCTTGT\r
+Plagiotrochus   C-GTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTAC-GCGATGCGA-TGGGATTTC----GGTCACAT\r
+Andricus        CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-ACGATGTT--CGAGACTTT----GGTCTTG-\r
+Neuroterus      CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-ACGATGTT--CGAGACTTT----GGTCTTG-\r
+Biorhiza        CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTCTGGCTTTCGTGTGGTTC-ACGATGTT--TGAGACTTT----GGTCTTA-\r
+Parnips         CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTC-GCGATGCT--CGTGACTTCT---GGTCACGT\r
+Paramblynotus   CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAATCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTTTGTGATGTT--CGAGACCTC----GGTCCTGT\r
+Ibalia          CCGTGAGGGAAAGTTGAAAAGAACTTTGAAGAGAGAGTTCAAGAGTACGTGAAACCGTTCAGGGGTAAACCTGAGAAACCCAAAAGATCGAATGGGGAGATTCATCGTCAGCGGCTTTGGCTTTCGTGTGGTTTTGTGATGTTT-CGGGATTTC----GGTCTCGT\r
+\r
+Synergus        GG--TACACGTCCACTGCGTT-ATGTCTAGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GCG-GTTGCCTGTTCTATTGCAT---TTAT--GTATATGGAGCAGACCCCCGGTT--ACCTGAC\r
+Periclistus     AG--CACGCGTCCACTGCGGT-ATGTCTAGGGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTTACGACCCGTTAGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTTCGTTGCAC--TTTGT--GCGTACGGAGCAGACCCCCGGTA--ACCTGAC\r
+Ceroptres       GA--CACGCGTCCACTGCGGT-ATGTTCTTGGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGCCTGGTGTG-GTTGCCTGTTTCGTCGCACAATTTATTTGTGCACGGAGCAGACCCCCGGAT--ACCCGAC\r
+Synophromorpha  AG--CACGCGTCCACTGCGGT-ATGTCTAGGGCC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTTACGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGACTGTTTCGTCGCAC--TCTGTGCGTGTACGGAGCAGACCCCCGATC--ACCTGAC\r
+Xestophanes     AG--CACGCGTCCACTGCGGTTATGTCTAGGGAC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTTACGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGACTGTTTCGTCGCAC--TTTGTGCGTGTACGGAGCAGGCCCCCGGTC--ACCTGAC\r
+Diastrophus     AG--CACGCGTCCACTGCGGT-ATGTCTAGGGCC-GTCGGCGTGCACTTCTCCTCTAGTAGGACGTTACGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGCTTTGTCGCAC--TCTGT--GTGTACGGAGTAGACCCCCGGTT--ACCTAAC\r
+Gonaspis        AG--CACGCGTCCACTGCGGT-ATGTCTAGGGCC-GTCGGCGTGCACTTCTCCTCTAGTAGGACGTTACGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTTCGTCACAC--TCTGT--GTGTACGGAGTAGACCCCCGGTT--ACCTAAC\r
+Liposthenes_gle AG--CACACGTCCACTGCGTT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-ATG-GTTGCCTGTTCCGTTGCAT--TT-ATGCGC--ACGGGACAGACCTCCGGTT--ACCTGAC\r
+Liposthenes_ker AG--CACGCGTCCACTGCGTT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGCAT--TT-ATGCGC--ACGGGGCAGACCCCCGGTT--ACCTGAC\r
+Antistrophus    AG--CACATGTCCACTGCGTT-ATGTCTGGAGTC-GTCGGTGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTTCGTCGCAT--TT-ATGCGT--ACGGTTCAGACCCCCGGGTT-TCCTGAC\r
+Rhodus          AG--CACACGTCCACTGCGTTTATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTTTTACGGTCTGG-GTGTGTTGCCTGTTCCGTCGTAT--TTTATACGC--ACGGGGCAGACCCCCGGTT--TCCTGAC\r
+Hedickiana      AG--CACGCGTCCACTGCGTT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGTAT--TT-ATGCGT--ACGGAGCAGACCCCCGG-TA-TCCTGAC\r
+Neaylax         AG--CACGCGTCCACTGCGTT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGTAT--TT-ATGCGC--ACGGAGCAGACCCCCGG-TT-TCCTGAC\r
+Isocolus        AG--CACACGTCCACTGCGTT-ATGTCTGAAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTAGG-TGTTGGTCT--ACGGTCTGG-GTG-GTTGCCTGTACCGTCACAT--TT-ATGCGC--ACGGGACAGACCCCCAGATTTACCTGAC\r
+Aulacidea       AG--CACGCGTCCACTGCGGT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTAG-GTG-GTTGCCTGTTCCGTCACAT--TT-ATGCGT--ACGGTGCAGACCCCTGGCT--ACCTGAC\r
+Panteliella     AG--CACGCGACCACTGCGTT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCTCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTCT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGCAT--TT-ATGCGC--ACGGGGCAGACCCCTGGGT--ACCTGAC\r
+Barbotinia      AG--CACGCGTCCACTGCGGT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGCAT--TTTATGCGT--ACGGAGCAGACCCCTGGTA--ACCCGAC\r
+Aylax           AG--CACGCGTCCACTGCGGT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTTCGTCGCAT--TTTATGCGT--ACGGAGCAGACCCCTGGTA--ACCCGAC\r
+Iraella         AG--CACGCGTCCACTGCGGT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTAG-GTG-GTTGCCTGTTCCGTCACAT--TTTATGCGT--ACGGAGCAGACCCCTGGTA--ACCCGAC\r
+Timaspis        AG--CACACGTCCACTGCGGT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGAACGTCGTGACCCGTTGGA-TGTTGGTTT--ACGGTC-TGGGTG-GTTGCCTGTTCCATTGCAT---TTATGCGC--ATGGAGCATACCCCTGGTT--ACCTGAC\r
+Phanacis_1      AG--CACACGTCCACTGCGGT-ATGTCCAGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGAACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCCTAGGTC-GTTGTCTGTTTCGTCGCAT---TTATGCGC--ACGAAGCATACCCCAGGTT--ACCTGAC\r
+Phanacis_2      AG--CACACGTCCACTGCGGT-ATGTCCGGGGTC-GTCGGCGTGCACTTCTCCCCTAGTAGAACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGTTC-TGGGTG-GTTGCCTGTTCCGTTGTAT---TTATACGT--ACGGAGCATACTCCCGGTT--AACTGAC\r
+Eschatocerus    GATACACACAATCACTGCGGT-ATGTCTAAATTCTGTCGGCGTGCACTTCTCCTCTAGTAGGACGTCGCGACCCGTTAGAATATTGATTT--ACGGCATAAATTTGATTGTTTGTATTAT-ATATA-TTTATTTATATATAATATATATCATAAATTT-GTNTAAT\r
+Diplolepis      GG--CACACTGTCACTGCGGT-ATGTCTGAAGTTTGTCGGCGTGCATTTCTCCCTT-GTAGGACGTCGCGACCCGTTGGG-TGTCGGTTT--ACGGTCTAG-GTG-GTTGACTGTTTTGTCAAAA--TTTTTTTGT--ATAAAGCAGACCCCTGGAT--ACCTGAC\r
+Pediaspis       TT--CACGCGTCCACTGCGTT-ATGTCCGGTGTC-GTCGGCGTGCACTTCTCCTCTAGTAGGACGTCGCGACCCGTTGGG-TGTCGGTTT--ACGGTCCGG-GTG-GTTGCCTGTTCTATCGTAC---TTGTTTACGTATAGAGCAGACCCTCGGTA--ATCTGAC\r
+Plagiotrochus   AG--CACGCGTCCACTGCGTA-ATGTCCGGAGAC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTCT--ACGGTCCGG-GTG-GTTGCCTGTTCCGTCGCAT--TTTATGCGTT-GCGGAGCAGACCCCCGGTA--ACCCGAC\r
+Andricus        CG--CACGCGTCCACTGCGGT-ATGTCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGCAT--TTTATGCGC--ACGGAGCAGACCCCCGTGT--ACCCGAC\r
+Neuroterus      GG--CACGCGTCCACTGCGGT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTCCGTCGCAT--TTTATGCGC--ACGGAGCAGACCCCCGTGT--ACCCGAC\r
+Biorhiza        GG--CACGCGTCCACTGCGGT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGTGACCCGTTGGG-TGTTGGTTT--ACGGTCTGG-GTG-GTTGCCTGTTACGTCGCAT--TTTATGCGC--ACGGAGCAGACCCCCGTGT--ACCCGAC\r
+Parnips         GG--CACACGTCCACTGCGGT-ATGCCCGGAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGCGACCCGTTGGG-TGTCGGTTT--ACGAACTGG-GTG-GTTGCCTGTTCCGTCGCATGAATAATGTGT--ATGGTGCAGACCCCTGGAT--ATCTGAC\r
+Paramblynotus   GA--CACACGATCACTGCGGT-ATGTCTGAAGTC-GTCGGCGTGCACTTCTCCCCTAGTAGGACGTCGCGACCCGTTGGG-TGTCGGTTT--ACGATCTAG-GTG-GTTGCCTGTTCCGTCACACA-TTACTGTGT--ACGGAGTAGACCCCTGGTT--ATCTGAC\r
+Ibalia          AG--CACGCGGCCACTGCGGT-ATGTCTGGAGTC-GTCGGCGTGCACTTCTCCTCTAGTAGGACGTCGCGACCCGTTGGG-TGTCGGTTT--ACGGTCTGG-GTGCGTTGCCTGTTCCCTCGCATT-TACGTGCGC-TTGGGACCAGACCCCCGGTACTAACTGAC\r
+\r
+Synergus        CAACTGCCTGGCGGTACTCGTATGGTA-TCGGGCCGCACTTT----GTGCGTCGGGCCCGTCGCAAGCTAGATCAG-TGTT-TCTCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GACGGTGT-TCTCGGACAGGCTCAT--TATGA\r
+Periclistus     CAACTGCCCGACGGTACTCGTACGGTA-TCGGGCCGCACTTT----GTGCGTCGGGCCCGTCGCAAGCTTGAGCAG-TGTTATCCCGGATGTGCGGACCTAGTGCCGTCACCGGGCCTGGTCAGCTGTTGGTC-GACGGTGT-TCTCGGACTGGCTCAA--AACAA\r
+Ceroptres       CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTTT---TGTGCGTCGGGCCCGTCGCAAGCGAGATCAG-TGTT-ACCCGGATGTGCGGACCTAGTGCCGTCGCCGGGCCTGCTCAGCTGTTGGTC-GGCGGTGT-TCTCGGACTGGCTCAA--AATTA\r
+Synophromorpha  CAACTGCCCGACGGTACTCGTACGGTA-TCGGGCCGCACTTT----GTGCGTCGGGCTCGTCGCAAGCGCGAGCAGGTGTTTATCCGGATGTACGGACCTAGTGCCGTCACCGGGCCTGATCAGCTGTTGGTC-GACGGTGTACCTCGGACTGGCTCAA--AATAA\r
+Xestophanes     CAACTGCCCGACGGTACTCGTACGGTA-TCGGGCCGCACTTT----GTGCGTCGGGCCCGTCGCAAGCGCGAGCAGGTGTTTATCCGGATGTACGGACCTAGTGCCGTCACCGGGCCTGATCAGCTGTTGGTC-GACGGTGT-TCTCGGACTGGCTCAA--AATAA\r
+Diastrophus     CAACTGCCCGGCGGTCCTCGTACGGTA-TCGGGCCGCACTCT----GTGCGTCGGGCCCGTCGCAAGCGCGAGCAG-TGTT-ACCTGGATGTGCGGACCTAGTGCCGTCACCGGGCCTGATCAGCTGTTGGTC-GACGGTGT-TCTCGGACTGGCTCAA-------\r
+Gonaspis        CAACTGCCCGGCGGTCCTCGTACGGTA-TCGGGCCGCACTTT----GTGCGTCGGGCCCGTCGCAAGCGCGAGCAG-TGTT-ACCCGGATGTGCGGACCTAGTGCCGTCACCGGGCCTGATCAGCTGTTGGTC-GACGGTGT-TCTCGGACTGGCTCAA-------\r
+Liposthenes_gle CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTTA---TGTGCGTCGGACTCGCCGCAAGCGAGATCAG-TGTT-ACCCGTAGGTATGGACATAGTGCCGTCCCCGGGCCTGATCAGCTGTTGGTC-GGCGATGT-TCTTAGACAGGCTCA---CCTAA\r
+Liposthenes_ker CAACTGCCCGGCGGTACTCGCATGGTA-TCGGGCCGCACT-A---TGTGCGTCGGGCCCGCCGCAAGCGAGATCAG-TGTT-TCCCGGAGGTGCGGACCTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCAGACAGGCTCA---TCTAA\r
+Antistrophus    CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCATTA----TGTGCGTCGGTCCCGCCGCAAGCGAGATCAG-TGTT-TCCCGGAGGTGCGGACCTAGAGCCGTCCCCGGGCCTGGTCAGCTGTTGGTT-GGCGGTGT-TCTTAGACAGGCTCA---TA-GA\r
+Rhodus          CAACTGCCTGACGGTACTCGCACGGTA-TCGGGCCGCACTA----TGTGCGTCGGGCCCGCCGCAAGCGAGATCAG-TGTT-TCCCGGTGGTACGGACCTAGCGCCGTCACCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCAGACAGGCTCA---TACAA\r
+Hedickiana      CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTA----TGTGCGTCGGGCCCGCCGCAAGCGAGATCAG-TGTT-TCCCGGAGGTACGGACCTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCAGACAGGCTCA---TCCAA\r
+Neaylax         CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTA----TGTGCGTCGGGCCCGCCGCAAGCGAGATCAG-TGTT-TCCCGGAGGTACGGACCTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCAGACAGGCTCA---TCTAA\r
+Isocolus        CAACTGCCTGGCGGTACTCGCACGGTA-TCGGGCCGCACTAA---TGTGCGTCGGGCCCACCGCAAGCGAGATCAG-TGCT-TCCCGGAGGTTCGGACTTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGTGGTGT-TCTCAGACAGGCTCA---TCGAA\r
+Aulacidea       CAACTGCCCGGCGGTACTCGCACGGTA-TTGGGCCGCACTA----TGTGCGTCGGACCCGCCGCAAGCGAGATCAG-TGTTTTCCCGGAGTTACGGAGCTAGTGCCGTTCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCAGACAGGCTCAT--CAAAA\r
+Panteliella     -AACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTA----TGTGCGTCGGGCTCGCCACAAGCGAGATCAG-TGTT-TCCCGGAGGTTCGGACCTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGTT-GGCGATGT-TCTCAGACAGGCTCA---TCAAA\r
+Barbotinia      CAACTGCTCGGCGGTACTCGCACGGTA-TCGAGCCGCACTA----TGTGCGTCGGGCCCGTCGCAAGCGAGATCAG-TGAT-ACCCGGATGTGCGGACCTAGTGCCGTCACCGGGCCTGGTCAGCTGTTGGCC-GACGGTGT-TCTCGGACAGGCTCAT--TC---\r
+Aylax           CAACTGCTCGGCGGTACTCGCACGGTA-TCGAGCCGCACTA----TGTGCGTCGGGCCCGTCGCAAGCGAGATCAG-TGTT-ACCCGGATGTGCGGACTTAGTGCCGTCACCGGGCCTGGTCAGCTGTTGGCC-GACGGTGT-TCTCGGACTGGCTCAT--TT---\r
+Iraella         CAACTGCTCGGCGGTACTCGCACGGTA-TCGAGCCGCACTA----TGTGCGTCGGACCCGTCGCAAGCGAGATCAG-TGTT-ACCCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGCC-GGCGGTGT-TCTCGGACAGGCTCAT--TTTGA\r
+Timaspis        CAACTGCCCGGCGGTACTCACACGGTA-TCGGGCCGCACTTA---CGTGCGTCAGGCCCGTCGCAAGCGAGATCAG-TGTTT-CCCGGAGGTGCGGACCTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GACGGTGT-TCTCTGACAGGCTCAT--TGAAA\r
+Phanacis_1      CAACTGCCCGGCGGTACTCGCACGGTA-TCGAGCCGCA-TTA---TGTGCGTCGGGCCCGTCGCAAGTGAGATCAG-CGTTA-CCCGGAGGTGCGGACCTAGCGCCGTCCCCGGGCCTGATCAGCTGTTGGTC-GGCGGTGT-TCTCTGACAGGCTCAT--C---A\r
+Phanacis_2      CAACTGCCCGGCGGTACTCGTATGGTA-TCGAGCCGCACTTA---TGTGCGTCGGGCCCGTCGCAAGCGAGATCAG-TGTTTACCCGGAGGTGCGGACCTAGCGCCGTCCCCGGGCCTGGTCAGCTGTTGGCC-GTCGGTGT-TCTCTGACAGGCTCAT--T----\r
+Eschatocerus    CAATTGTCTGACGGTACTAATAAGGGTATTGGGCCGCATTTTTAATATGCGTCTAATCCGTTACAAGCTAGAATTAGTGTT-ACTTAGTTTTACGAACCAAGTTTCGTTTCTGAGCCTAATCAGCTGTTGGTTTAGCGGTTAATCTTAGACTGGCTCAAAACATAC\r
+Diplolepis      CGACTGCCCGGCGGTATTTGAACGGTAATCGAGCCGCACATA---AGTGCGTCAGGCCCACTGCAAGCGAGATCAG-TGTTAACCTGGAGGTGCGGACCTAGTGCCGTCCCCAGGCCTGGTCAGCTGTTGGTC-GGTGGTGT-TCTCGGACTGGCTCAT--AATTA\r
+Pediaspis       CGACTGCTCGGCGGTACTCGTAAGGTA-TCGGGCCGCACTTG---TGTGCGTCGGGCCCGCTGCAAGCCGGATCAG-TGTT-ACCCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGATCAGCTGTTGGTC-GGCGGTGT-TCTCGGACTGGCTCAT--CGAAA\r
+Plagiotrochus   CAACTGCCCGGCGGTACTCGCAAGGTA-TCGGGCCGCACAT----TGTGCGTCGGGCCCGTCGCAAGCGAGATCAG-TGTTATCCTGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GACGGTGT-TCTCGGACTGGCTC----TAAAC\r
+Andricus        CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTTA---CGTGCGTCGGGCCCGTCGCAAGCGAGATCA-GTGTT-ACCCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCGGACAGGCTCAT--CCAAA\r
+Neuroterus      CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTTA---CGTGCGTCGGGCCCGCCGCAAGCGAGATCAAGTGTT-TCCCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCGGACAGGCTCAT--CCAAA\r
+Biorhiza        CAACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTTA---CGTGCGTCGGGCCCGTCGCAAGCGAGATCA-GTGTT-ACCCGGAGGTGCGGACCTAGTGCCGTCCCTGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCGGACAGGCTCAT--CCAAA\r
+Parnips         CGACTGCCTGGCGGTACTCGCACGGTA-TCGAGCCGCACTA----CGTGCGTCGGGCCCGCCGCAAGCGAGATCAG-TGAT-ACCCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCGGACTGGCTCAT--CTCAA\r
+Paramblynotus   CGACTGCCCGGCGGTACTCGCACGGTA-TCGAGTCGCACTA----TGTGCGTCCGGCCCGCTGCAAGCGAGATCAG-TGTT-ACCCGGAGGTGCGGACCTGGTGCCGTCCCCGGGCCTGCTCAGCTGTTGGTT-AGCGGTGT-TCTCGGACTGACTCGT--CTCAG\r
+Ibalia          CGACTGCCCGGCGGTACTCGCACGGTA-TCGGGCCGCACTAA---GGTGCGTCGGACCCGCTGCAAGCGAGATCAG-TGAT-ACCCGGAGGTGCGGACCTAGTGCCGTCCCCGGGCCTGGTCAGCTGTTGGTC-GGCGGTGT-TCTCAGACTGGCTCGT--TTGAA\r
+\r
+Synergus        -------------TACCGGTCGGCGACGCTACTGCTTTAGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGATCTTGCGTCGACTAAGGGAGGAT\r
+Periclistus     TTAATA----TGATACCGGTCAGTGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Ceroptres       T----------GTTACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Synophromorpha  ATGA---------TACCGGTCAGTGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAA-CCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Xestophanes     ATGAA--------TACCGGTCAGTGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Diastrophus     -------------TACCGGTCAGTGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCATGCGTCCACTAAGGGAGGAT\r
+Gonaspis        -------------TACCGGTCAGTGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTAAAGGTCGACCATGCGTCGACTAAGGGAGGAT\r
+Liposthenes_gle AAATT-----TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGCAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Liposthenes_ker AA--------TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Antistrophus    AAA-------TGATACCGGTCGACGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Rhodus          AAATG-----ATATACCGGTCGGCGACGCTATTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Hedickiana      AAA-------TGATACCGGTCGACGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Neaylax         AAA-------TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Isocolus        CA--------TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCAAGTCATTGGGACTG--AAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGTGTCGACTG-GGGAGGAT\r
+Aulacidea       TATTA-----TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACAG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Panteliella     AA--------TGATACCGGTCGACGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Barbotinia      ATA-------TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTACGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Aylax           ATA-------TGATACCGGTCAGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Iraella         ATA-------TGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACTG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Timaspis        AAAAT------GATACCGGTCAGCGACGCTATTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTACGCAAGTCATTGGGACTG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Phanacis_1      AAAAT------GATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCAAGTCATTGGGATTG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Phanacis_2      AAAAG------GATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCAAGTCATTGGGACTGG-TAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Eschatocerus    AATTTTTGTATGATACCTGTCAGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCAAGTCATTGGGATTTAATAAAACCTAAAGGCGTAATGAAAGTAAAGGTCGATCTTGTGTCGATTGAGGGAGGAT\r
+Diplolepis      TA----------ATACCGGTCAGCGACGCTATTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACTT--GAAAACCTAAAGGCATAATGAAAGTGAAGGTCGGCCTTGCGTCGACTGAGGGAGGAT\r
+Pediaspis       TGTTGTTATATGATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACTG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGATCTTGCGTCGACTGAGGGAGGAT\r
+Plagiotrochus   AATTG-----AAATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTTCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGAAATGAAAGTGAAGGTCGACCTCGCGTCGACTGAGGGAGGAT\r
+Andricus        AT---------GATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Neuroterus      AT---------GATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Biorhiza        AT---------GATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+Parnips         TTATT-----GAATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACTG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGACCTTGCGTCGACTGAGGGAGGAT\r
+Paramblynotus   TTACT-----GAATACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGACCG--CAAAACCTAAAGGCGTAATGAAAGTGAAGGTCGATTTTGTGTCGACTAAGGGAGGAT\r
+Ibalia          TGAAT-----CATTACCGGTCGGCGACGCTACTGCTTTGGGTACTTTCAGGACCCGTCTTGAAACACGGACCAAGGAGTCTAACATGTGCGCGAGTCATTGGGATCG--CAAAACCTAAAGGCATAATGAAAGTGAAGGTCGACCTTGCGTCGACTAAGGGAGGAT\r
+\r
+Synergus        GGGTT-GTGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTTGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Periclistus     GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Ceroptres       GGGTT-GCGTTACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCTAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Synophromorpha  GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Xestophanes     GGGTTTGCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTAAGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Diastrophus     GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Gonaspis        GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Liposthenes_gle GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Liposthenes_ker GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Antistrophus    GGGTT-GCGTTACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACACATTACGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Rhodus          GGGTT-GTGTCACGATGCAGCTCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Hedickiana      GGGTT-GCATTACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Neaylax         GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Isocolus        GGGCT-GCGTTACGATGCAGCCTCGCACTCCCGGGGCGTCTCGTACTCATTACGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Aulacidea       GGGTT-ACGTTACGATGTAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTATGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Panteliella     GGGTT-GCATCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Barbotinia      GGGTT-ACGTTACGATGTAACCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Aylax           GGGTT-GCGTTACGATGTAACCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Iraella         GGGTT-ACGTTACGATGTAACCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Timaspis        GAGCT-GCGTCACGATGCAGCTCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGGTGGAGGTCCGTAGCGATTCTGACGTG\r
+Phanacis_1      GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Phanacis_2      GGGTT-ATATCACGATGTAGCCCCGCACTCCCGGGGCGTCTCATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Eschatocerus    GGGTT-ACATTACGATGTTTCCTCGCACTCCCGGGGCGTTTTATACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Diplolepis      GGACT-GTATTACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTACGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Pediaspis       GGGTT-GCGTTACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Plagiotrochus   GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGCCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Andricus        GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Neuroterus      GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Biorhiza        GGGTT-GCGTCACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Parnips         GGGTT-GCGTTACGATGCAGCCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAATCCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Paramblynotus   GGGTT-GTGTTACGATGCAATCCCGCACTCCCGGGGCGTCTCGTACTCATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+Ibalia          GGGCT-TCATCACGATGAAGCCCCGCACTCCCGGGGCGTCTCGTACTCAATGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTG\r
+\r
+Synergus        CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Periclistus     CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Ceroptres       CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Synophromorpha  CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Xestophanes     CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Diastrophus     CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Gonaspis        CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Liposthenes_gle CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Liposthenes_ker CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Antistrophus    CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Rhodus          CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Hedickiana      CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Neaylax         CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Isocolus        CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Aulacidea       CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Panteliella     CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Barbotinia      CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Aylax           CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Iraella         CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Timaspis        CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Phanacis_1      CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Phanacis_2      CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Eschatocerus    CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTTGCATTAAGCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Diplolepis      CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGAGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Pediaspis       CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGTGTGA-TTGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Plagiotrochus   CAAATCGATCGTAGGAGCTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGAAGCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Andricus        CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Neuroterus      CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Biorhiza        CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Parnips         CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Paramblynotus   CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+Ibalia          CAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCGCGTGA-GCGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTAT\r
+\r
+Synergus        TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Periclistus     TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Ceroptres       TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Synophromorpha  TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Xestophanes     TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATA--------------------------------------------------\r
+Diastrophus     TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Gonaspis        TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Liposthenes_gle TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Liposthenes_ker TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Antistrophus    TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAAAA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Rhodus          TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Hedickiana      TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCAAGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Neaylax         TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Isocolus        TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Aulacidea       TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Panteliella     TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTNAAGCCAC---------------------------------------\r
+Barbotinia      TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCATTTTT\r
+Aylax           TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCATTTTT\r
+Iraella         TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCATTTTT\r
+Timaspis        TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Phanacis_1      TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Phanacis_2      TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Eschatocerus    TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATTTATGAAGCCATGAGATATAATTGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Diplolepis      TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-TTGAAGCCATGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Pediaspis       TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Plagiotrochus   TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTTT-TCGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Andricus        TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Neuroterus      TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Biorhiza        TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACA-GTGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Parnips         TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-GTGAAGCCATGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Paramblynotus   TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-GTGAAGCCATGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+Ibalia          TCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-ATGAAGCCACGAGATTT---CGGATCAGAGTGCCAAGTGGGCCAATTTT\r
+       ;\r
+End;\r
+\r
+begin mrbayes;\r
+       [This block defines several different character sets that could be used in partitioning these data\r
+     and then defines and enforces a partition called favored]\r
+    outgroup Ibalia;\r
+    charset morphology = 1-166;\r
+    charset molecules = 167-3246;\r
+    charset COI = 167-1244;\r
+    charset COI_1st = 167-1244\3;\r
+    charset COI_2nd = 168-1244\3;\r
+    charset COI_3rd = 169-1244\3;\r
+    charset EF1a = 1245-1611;\r
+    charset EF1a_2nd = 1245-1611\3;\r
+    charset EF1a_3rd = 1246-1611\3;\r
+    charset EF1a_1st = 1247-1611\3;\r
+    charset LWRh = 1612-2092;\r
+    charset LWRh_2nd = 1612-2092\3;\r
+    charset LWRh_3rd = 1613-2092\3;\r
+    charset LWRh_1st = 1614-2092\3;\r
+    charset 28S = 2093-3246;\r
+    charset 28S_Stem = 2160-2267 2361-2401 2489-2528 2539-2565 2577-2647 2671-2760 2768-2827 2848-3194 3220-3246;\r
+    charset 28S_Loop = 2093-2159 2268-2360 2402-2488 2529-2538 2566-2576 2648-2670 2761-2767 2828-2847 3195-3219;\r
+    partition favored= 5: morphology, COI, EF1a, LWRh, 28S;\r
+       \r
+    [The following lines set up a particular model (the one discussed in the MrBayes manual. Uncomment this block\r
+     if you want to set up the model when executing this file instead of specifying it yourself.]\r
+    [\r
+    set partition=favored;\r
+    lset app=(1) rates=gamma;\r
+    lset app=(2,3,4,5) rates=invgamma nst=6;\r
+    unlink revmat=(all) pinvar=(all) shape=(all) statefreq=(all);      \r
+    prset ratepr=variable;\r
+    ]\r
+\r
+end;\r
+\r
diff --git a/examples/finch.nex b/examples/finch.nex
new file mode 100644 (file)
index 0000000..c834426
--- /dev/null
@@ -0,0 +1,222 @@
+#NEXUS \r
+\r
+[ Data from: Jennings, W.B. and Edwards, S.V. Speciational history of Australian grass finches (Poephila) inferred from 30 gene trees. Evolution 59:2033-2047, 2005.\r
+  This data set consists of 30 loci with one allele for each of three ingroup species and one outgroup species. ]\r
+\r
+Begin data;\r
+       Dimensions ntax=4 nchar=16119;\r
+       Format datatype=DNA gap=- missing=? matchchar=. interleave;\r
+       Matrix\r
+\r
+Q097         TTCTTTTTGTCCTTTCACTAGAAAATCTTGGCTTATCTTCAAATACAAAAAAAAAAAGAAAAATTAACAGCATTTGAGTTTCAATACCGAGTATTTAAATAAATTTCAGTGTCACAAAAATACTGAAAAAATTAAAAAAAATTATATCTCTCAATACTGTGACTGAGGGTGTGACCATAATGAATAAAATTTGAACTTGGTCATAAGAACTAATGACTTTTAAGCTGATTTGCCCTTGAGAAAAAGACTGAAACTTAGGATAGCTTTGCCCAAGTGAAAACTCTAACCACAGAATATGCCAAGTTGGAAGGGGCCCATAAGGATCATCAAGCTTAACGCCTGTCTCCACACAGGACCAAGATTCTTTTCTTCAACTCTGTCAGGCTTGCTGCTGGAACCCTTCCCTGGGGAGCCTGTTCCAGTGCCCAACCACCCTCTAGGGGAAGAAACTTTTTCTTATATCCAACCTAAAC\r
+W097         TTCTTTTTGTCCTTTCACTAGAAAATCTTGGCTTATCTTCAAATACAAAAAAAAAAAGAAAAATTAACAGCATTTGAGTTTCAATACCGAGTTTTAAAATAAATTTCAGTGTCACAAAAATACTGAAAAAATTAAAAAAAATTATATCTCTCAATACTGTGACTGAGGGTGTGACCATAATGAATAAAATTTGAACTTGGTCATAAGAACTAATGACTTTTAAGCTGATTTGCCCTTGAGAAAAAGACTGAAACTTAGGATAGCTTTGCCCAAGTGAAAACTCTAACCACAGAATATGCCAAGTTGGAAGGGGCCCATAAGGATCATCAAGCTTAACGCCTGTCTCCACACAGGACCAAGATTCTTTTCTTCAACTCTGTCAGGCTTGCTGCTGGAACCCTTCCCTGGGGAGCCTGTTCCAGTGCCCAACCACCGTCTAGGGGAAGAAACTTTTTCTTATATCCAACCTAAAC\r
+B097         TTCTTTTTGTCCTTTCACTAGAAAATCTTGGCTTATCTTCAAATACAAAAAAAAAAAGAAAAATTAACAGCATTTGAGTTTCAATACCGAGTTTTTAAATAAATTTCAGTGTCACAAAAATACTGAAAAAATTAAAAAAAATTATATCTCTCAATACTGTGACTGAGGGTGTGACCATAATGAATAAAATTTGAACTTGGTCATAAGAACTAATGACTTTTAAGCTGATTTGCCCTTGAGAAAAAGACTGAAACTTAGGATAGCTTTGCCCAAGTGAAAACTCTAACCACAGAATATGCCAAGTTGGAAGGGGCCCATAAGGATCATCAGGCTTAACGCCTGTCTCCACACAGGACCAAGATTCTTTTCTTCAACTCTGTCAGGCTTGCTGCTGGAACCCTTCCCTGGGGAGCCTGTTCCAGTGCCCAACCACCCTCTATGGGAAGAAACTTTTTCTTACATCCAACCTAAAC\r
+O097         GTCTTTTTGTCCTTTCACTAGAAAATCTTGGCTTATCTTCAAATACAAAAAAAAAAAGAAAAATTAACAGCATTTGAGTTTCAATACCAAGTTTTTAAATAAATTTCAGTATCACAAAAATGCTGAAAAAATTAAAAAAAAATATATCTCTCAATACTGTGACTGAGGGTGTGACCATAATGAATAAAATTTGAACTTGGTCATAAGAACTAATGACTTTTAAGCTGATTTGTCCTTGAGAAAAAGACTAAAACTTAGGATAGCTTTGCCCAAGTGAAAACGCTAACTACAGAATATGCCAAGTTGGAAGGGGCCCATAAGGATCATCAAGCTTAACGCCTGTCTCCACACAGGATCAAGATTCTTTTCTTCAACTCTGTCCGGCTTGCTGCTGGGACCCTTCCCTGGGGAGCCTGTTCCAGTGCCCAACCACCCTCTGGGGTAAGAAACTTTTTCTTATATTCAACCTAAAC\r
+\r
+Q097         GCCATTTCATCCCAGCACAAACCTGGGAGCTCCAGCTGTGTCTGGAAAGCTTCGATGGGATCCCACCAGTCTGCAAAGCTTTTGTGTCAGGTATAGAGATTGATGCATCAGCCTTGGGCTCTCAGAAATGCACCTGGTTTGTAGTGAATGTGAGATGTGTAACTGCTTAGTCAAGGACAAACCTTTTTCCTATTCTCCTCTCTGTACTGGCTTTTAAAATGTAGTATTTAGTGAAAAAAAACTCTCAATGATGTGTGTGCTACAAACCAGTTGTCCCAGTCAAAGCTATTTCAATAAGCAGGAAATAATTTCTGTTATAACTTCAATTTTCAAGAACAGATTTTCTTGACTTGATTGCTTAAAATTGTTTGGGTTTATGTGGTGTTTTTTACCATTTGCACCAGTTTAATGTGTACAGCATTTTTTTTTTTTCTGGATTCTTTCTAGAAACTTAACCTACAAAGAGGAAAGACTTTTTTATTGTCTTGAGGTGTGTTCAGAAAAAGTAAAATAGATCTTTTGGAAAAAGACCTGTGATCAGATTTTTGCGAAGCAAAA\r
+W097         GCCATTTCATCCCAGCACAAACCTGGGAGCTCCAGCTGTGTCTGGAAAGCTTCGATGGGATCCCACCAGTCTGCAAAGCTTTTGTGTCAGGTATAGAGATTGATGCATCAGCCTTGGGCTCTCAGAAATGCACCTGGTTTGTAGTGAATGTGAGATGTGTAACTGCTTAGTCAAGGACAAACCTTTTTCCTATTCTCCTCTCTGTACTGGCTTTTAAAATGTAGTATTTAGTGAAAAAAAAGTCTCAATGATGTGTGTGCTACAAACCAGTTGTCCCAGTCAAAGTTATTTCAATAAGCAGGAAATAATTTCTGTTATAACTTCAGTTTTCAAGAACAGATTTTCTTCACTTGATTGCTTAAAATTGTTTGGGTTTATGTGGTGTTTTTTACCATTTGCACCAGTTTAATGTGTACAGCATTTTTTTTTTTTCTGGATTCTTTCTAGAAACTTAACCTACAAAGAGGAAAGACTTTTTTATTGTCTTGAGGTGTGTTCAGAAAAAGTAAAATAGATCTTTTGGAAAAAGACCTGTGATCAGATTTTTGCGAAGCAAAA\r
+B097         GCCATTTCATCCCAGCACAAAGCTGGGAGCTCCAGCTGTGGCTGGAAAGCTTCGATGGGATCCCACCAGTCTGCAAAGCTTTTGTGTCAGGTATAGAGATTGATGCATCAGCCTTGGGCTCTCAGAAATGCACCTGGTTTGTAGTGAATGTGAGATGTGTAACTGCTTAGTCAAGGACAAACCTTTTTCCTATTCTCCTCTCTGTACTGGCTTTTAAAATGTAGTATTTAGTGAAAAAAAACTCTCAATGATGTGTGTGCTACAAACCAGTTGTCCCAGTCAAAGTTATTTCAATAAGCAGGAAATAATTTCTGTTATAACTTCAATTTTCAAGAACAGATTTTCTTGACTTGATTGCTTAAAATTGTTTGGGTTTATGTGGTGTTTTTTACCATTTGCACCAGTTTAATGTGTACAGCATTTTTTTTTTTTCTGGATTCTTTCTAGAAACTTAACCTACAAAGAGGAAAGACTTTTTTATTGTCTTGAGGTGTGTTCAGAAAAAGTAAAATAGATCTTTTGGAAAAAGACCTGTGATCAGATTTTTGCGAAGCAAAA\r
+O097         GCCATTTCATCCCAGCACAAAGCTGGGAGCTCCAGCTGTGGCTGAAAAACTTCGATGGGATCCCACCGGTCTGCAAAGCTTTTGTGTCAGGTATAGAGATTGATGCATCAGCCCTGGGCTCTCAGAAATGCACCTGGTTTGTAGTGAATGTGAGATGTGTAACTGCTTAGTCAAGGACAAACCTTTTTCCTATTCTCCTCTCTATATTGGCTTTTAAAATGCAGTATTTAGTGAAAAAAAAGTCTCAATGATTTGTGTGCTACAAACCAGTTGTCCCAGTCAAAGTTATTTCAATAAGCAGGAAATTATTTCTTTTATAACTTCAATTTTCAAGAACAGATTTTCTTGACTTGATTGCTTAAAATTGTTTGGGTTTATGTGGTGTTTTGTACCATTTGCACCAGTTTAATGTGTACAGCATTTTTTTTTTTTCTGGATTCTTTCTAGGAACTTAACCTACAAAGAGGAAAGACTTTTTTATTGTCTTGAGGTGTGTTCAGAAAAAGTAAAATAGATCTTTTGGAAAAAGACCTGTGATCAGATTTTTGCTAAGCAAAA\r
+\r
+Q097         ACTTCATGCAGGTCTCAGACTGGAATCCCAGATAAAACGGGCACTGCAGGGTAGTTTATTTTGTTCAAATGTAGCGATAGCACAAACCTGGTTATGGGTCACATTCAAGAGGCAGACAGTGAATTAGATGGTGGGGGTTAAAAAATGTTATTGAGGATACTTTTATGAGCGAAAAACCCACTGAACATTACCCAGGGACCTGGGCAGGCCTGTTGGGCGTGTCATGAGTTCCATTCCAAAAGTTTGGCAGAAGAAAACAGGCAATAGGTAGCTTCAGAGAAGCAGCCAGTCATCATTTTCCTCAGGGCATTTGAGCTCCTGGTTCCTCAGGCTGTAGATGAGGGGGTTCAGGGATGGAGGCACCACCGAGTACAGAACTGACACTGCCAGATCTAGGGATGGGGAGGAGAGGGAGGGGGCTTTAGGTAGGCAAAGGCTGCGGTGCAGAGAAACAGGGAGAGCACAGCCAGGTGACGGAGGCAGGTAGAAAAGGCTTTGTGCCGTCTCTGCTCAGAGGGAATCCTCAGCACAGCCCTGAAGATCTCCACATAGGAGAAAACCA\r
+W097         ACTTCATGCAGGTCTCAGACTGGAATCCCAGATAAAACAGGCACTGCAGGGTAGTTTATTTTGTTCAAATGTAGCGACAGGACAAACCTGGTTATGGGTCACATTCAAGAGGCAGACAGTGAATTAGATGGTGGGGGTTAAAAAATGTTATTGAGGATACTTTTATGAGCGAAAAACCCACTGAACATTACCCAGGGACCTGGGCAGGCCTGTTGGGCGTGTCATGAGTTCCATTCCAAAAGTTTGGCAGAAGAAAACAGGCAATAGGTAGCTTCAGAGAAGCAGCCAGTCATCATTTTCCTCAGGGCATTTGAGCTCCTGGTTCCTCAGGCTATAGATGAGGGGGTTCAGGGATGGAGGCACCACCGAGTACAGAACTGACACTGCCAGATCTAGGGATGGGGAGGAGAGGGAGGGGGCTTTAGGTAGGCAAAGGCTGCGGTGCAGAGAAACAGGGAGAGCACAGCCAGGTGACGGAGGCAGGTAGAAAAGGCTTTGTGCCGTCTCTGCTCAGAGGGAATCCTCAGCACAGCCCTGAAGATCTCCACATAGGAGAAAACCA\r
+B097         ACTTCATGCAGGTCTCAGACTGGAATCCCAGATAAAACAGGCACTGCAGGGTAGTTTATTTTGTTCAAATGTAGCGATAGCACAAACCTGGTTATGGGTCACATTCAAGAGGCAGACAGTGAATTAGATGGTGGGGGTTAAAAACTGTTATTGAGGATACTTTTATGAGCGAAAAACCCACTGAACATTACCCAGGGACCTGGGCAGGCCTGTTGGGCGTGTCATGAGTTCCATTCCAAAAGTTTGGCAGAAGAAAACAGGCAATAGGTAGCTTCAGAGAAGCAGCCAGTCATCATTTTCCTCAGGGCATTTGAGCTCCTGGTTTCTCAGGCTGTAGATGAGGGGGTTCAGGGATGGAGGCACCACCAAGTACAGAACTGACACTGCCAGATCTAGGGATGGGGAGGAGAGGGAGGGGGCTTTAGGTAGGCAAAGGCTGTGGTGCAGAGAAACAAGGAAAGCACAGCCAGGTGACGGAGGCAGGTAGAAAAGGCTTTGTCCCGTCTCTGCTCAGAGGGAATCCTCAGCACAGCCCTGAAGATCTCCACATAGGAGAAAACCA\r
+O097         ACTTCATGCAGGCCTCAGACTGGAATCCCAGATAAAACAGGCACTGCAGGGTAGTTTATTTTGTTCAAATGTAGCGATAGTACAAACCTGGTTATGGGTCACATCCAAGAGGCAGACAGTGAATTAGATGGTGGGGGTTAAAAAATATTATTGAGGATACTTTTATGAGCGAAAAACCCACTGAACATTTCCCAGGGACCTGGGCAGGCCTGTTGGGCGTGTCATGAGTTCCATTCCAAAAGTCTGGCAGAAGAAAACAGGAAATAGGTAGCTTCAGAGAAGCAGCCAGTCATCATTTTCCTCAGGGCATTTGAGCTCCTGGTTCCTCAGGCTGTAGATGAGGGGGTTCAGGGCTGGAGGCACCACCGAGTACAGAACTTACACTGCCAGATCCAGGGATGGGAGGAGAGGGAAGGGGGCTTCAGGTAGGCAAAGGCTGCGGTGCAGAGAAACAAGGAGAGCACAGCCAGGTGACGGAGGCAGGTAGAAAAGGCTTTGTGCCATCCCTGCTCAGAGGGAGTCCTCAGCACAGCCCTGAAGATCTCCACATAGGAGAAAACCA\r
+\r
+Q097         TCTTAAAAAATGAAATATTTTAAAAATATTTAAATCAAATCCTCACATTTTATAAAGAGGTCTGTTAAGAAGCACAGCAGTGTACATCATAAACCAAGCCTTCACTTAAATGGATTTCTAGAAAATATCAAAAAGGACTTAGGACTCTTCAAGGAGAATTTATTTGTTTCATGGATATTTTAGATGGGCAAATCCCATAGCCCTGAATAAAACAAAATTCTTACAATTGAGATTGAGAGGAATAACCAGTGATCAAGACTTCTGGAAGCCCTGAAGATGACTGAGAAAATAACTGTTGCCTCAAGGAGCTCATAGCAAAATACAAGGCACCACAAAACCACTGATATGGGGGAAAAGTAGAAATTTCTATCCTTCCTCCCCTCCATGAGGCAAAAAAGGTATGTTTATCATCCCAGGTATCAATGGAGTTTTGGAGCAAGGGAAGAAATGTAACCAGATTTTTGGATGCCAGTCAGGGCCTTTAAGCTCCTTCTCTGGCCGTTCAGGTCACTTTTACCTATGTGAGAGGGGAATAAAGCTCACAGATGTTTGTTTGGGTCCAGCTGGCTGCAGATATCCTGCTCATAGAGATGCAGAGCAGAAATACTTGT\r
+W097         TCTTAAAAAATGAAATATTTAAAAAATATTTCAATCAAATCCTCACATTTTATAAAGAGGTCTGTTAAGAAGCACAGCAGTGTACATCATAAACCAAGCCTTCACTTAAATGGATTTCTAGAAAATATCAAAAAGGACTTAGGACTCTTCAAGGAGAATTTATTTGTTTCATGGATATTTTAGATGGGCAAATCCCATAGCCCTGAATAAAACAAAATTCTTACAATTGAGATTGAGAGGAATAACCAGTGATCAAGACTTCTGGAAGCCCTGAAGATGACTGAGAAAATAACTGTTGCCTCAAGGAGCTCATAGCAAAATACAAGGCACCACAAAACCACTGATATGGGGGAAAAGTAGAAATTTCTATCCTTCCTCCCCTCCATGAGGCAAAAAAGGTATGTTTGTCATCCCAGGTATCAATGGAGTTTTGGAGCAAGGGAAGAAATGTAACCAGATTTTTGGATGCCAGTCAGGGCCTTTAAGCTCCTTCTCTGGCCGTTCAGGTCACTTTTACCTATGTGAGAGGGGAATAAAGCTCACAGATGTTTGTTTGGGTCCAGCTGGCTGCAGATATCCTGCTCATAGAGATGCAGAGCAGAAATACTTGT\r
+B097         TCTTAAAAAATGAAATATTTTAAAAATATTTCAATCAAATCCTCACATTTTATAAAGAGGTCTGTTAAGAAGCACAGCAGTGTACATCATAAACCAAGCCTTCACTTAAATGGATTTCTAGAAAATATCAAAAAGGACTTAGGACTCTTCAAGGAGAATTTATTTGTTTCACGGATATTTTAGATGGGCAAATCCCATAGTCCTGAATAAAACAAAATTCTTACAATTGAGATTGAGAGGAATAACCAGTGATCAAGGCTTCTGGAAGCCCTGAAGATGACTGAGAAAATAACTGTTGCTTCAAGGAGTTCATAGCAAAATACAAGGCACCACAAAACCACTGATATGGGGGAAAAATAGAAATTTCTATCCTTCCTCCCCTCCATGAGGCAAAAAAGGTATGTTTATCATCCCAGGTATCAATGGAGTTTTGGAGCAAGGGAAGAAATGTAACCAGATTTTTGGATGCCAGTCAGGGCCTTTAGGCTCCTTCTCTGGCCATTCAGGTCACTTTTACCTATGTGAGAGGGGAATAAAGCTCACAGATGCTTGCTTGGGTCCAGCTGGCTGCAGATATCCTGCTCATAGAGATGCAGAGCAGAAATACTTGT\r
+O097         TCTCAAAATATGAAATATTTTAAAAATATTTCAATCAAATCCTCACATTTTATAAAGGGGTCTGTTAAGAAGCACAGCAGTTTACATCATAAACCAAGCCTTCACTTAAATGGATTTCTAGAAAATATCAAAAAGGACTTAGGACTCTTCAAGGAGAACTTATTTATTTCATGGATATTTTAGATGGGCAAATCCCATAGCCCTGAATAAAACAAAATTCTTACAATTGAGATTGAGAGGAATAACCAGTGATCAAGACTTCTGTAAGCCATGAAGATGACTGAGAAAATAACTGTTGCCTCAAGGAGCTCATAGCAAAATACAAGGCACCACAAAACCACTGATATGGGGGAAAAGTAGAAATTTCTATCCTTCCTCCCCTCCATGAGGCAAAAAAGGTATGTTTATCATCCCATGTATCAATGGAGTTTTGGAGCAAGGGAAGAAATGTAACCAGATTTTTGGATGCCAGTCAGGGCCTTTAAGCTCCTCCTCTGGCCGTTCAGGTCACTTTTACCTATGTGAGAGGGGAATAAAGCTCACAGATGTTTGTTTGGGTCCAGCTGGCTGCAGATATCCTGCTCATAGAGATGCAAAGCAGAAACACTTGT\r
+\r
+Q097         ATATTCATATATCCTTCATGGTTATGCATACATTCTATTTAAAACAAGAAACTCTGTCTGTTATATGCCAACTGTTTCCTTTAATCCCCATGGCAAGGCCTGAAGAAATTAGCTTCTTCTGACAAGAAAGCCATAAATTCCTCTTCTCTGGAAGATTTAGGCGTTCTGTGATGGTTACGTCAAAGCGAGTCTCTCATTCCTTAAAATAAAAAACAAAACACATAAGGAGTTTCTATTTTAACTACTAAAGCTTCATTTTAACTACAAAACTACATTTACCATGCTATTAAGTTGTTAATA\r
+W097         ATATTCATATATCCTTCATGGTTATGCATACATTCTATTTAAAACAAGAAACTCTGTCTGTTATATGCCAACTGTTTCCTTTAATCCCCATGGCAAGGCCTGAAGAAATTAGCTTCTTCTGACAAGAAAGCCATAAATTCCTCTTCTCTGGAAGATTTAGGCGTTCTGTGATGGTTACGTCAAAGCGAGTCTCTCATTCCTTAAAATAAAAAACAAAACACATAAGGAGTTTCTATTTTAACTACTAAAGCTTCATTTTAACGACTAAACTACATTTACCATGCTATTAAAATGTTAATA\r
+B097         ATATTCATATATCCTTCATGGTTATGCATACATTCTATTTAAAACAAGAAACTCTGTCTGTTATATGCCAACTGTTTCCTTTAATCCCCATGGCAAGGCCCGAAGAAATTAGCTTCTTCTGACAAGAAAACCATAAATTCCTCTTCTCTGGAAGATTTAGGTGTTCTGTGATGGTTACATCAAAGCGAGTCTCTCATTCCTTAAAATAAAAAACAAAACACATATGGAGTTTCTATTTTAACTACTAAAGCTTCATTTTAACTACAAAACTACATTTCCCATGCTATTAAAATGTTAATA\r
+O097         ATATTCATATAGCCTTCATGGTTATGCATACATTCTATTTAAAACAAGAAACTCTGTCTGTTATATGCCAACTGTTTCCTTTAATCCCCATGGCAAGGCCTGAAGAAATTAGCTTCTTCTGACAAGAAAGCCATAAATTCCTCTTCTCTGGAAGATTTAGGTGTTCTGTGATGGTTACCTCAAAGCGAGTCTCTCAGTCCTTAAAATAAAAAACAAAAGACATAAGGAGTTTCTATTTTAACTATTAAAGCTTCATTTTAACTACAAAACTACATTTACCATGCTATTAAAATGTTAATA\r
+\r
+Q097         TGCCAGACCACACACACTCTGGGCTCTGCTGAGTATTTGTGTAAAACTCAATGTATATTCACATCCCTGAAGTCTGGGAGACAACCCAAATTCCTGGGAGAGTGCTACCTTTCCTTCCTGCTGGAAATGGCTGAGAAGTTCCCAGCTTCCCTGGGCTCCCAGCTCCTCCACTCCAGGATATCTGGGTGTGTCCAAAGGGCTGGGATTTTGGGTCTTTTCCTCAGGGAAAGATGCTCCCTCCTCCAAGCAGACTGGGTGTTCTCAGGGAGTATTCCAACGGAGCTGGCAGGGGCAAAGCACAGCTCAGGCAAGAGGAGTTGACTCCCACAGGGTACAGTTCCTCATGGCAGGAGGAGCCATGGTTGGTGAATGTTGAAATGTGTTCTGGGCTCCAGGGAAGCTGAAAATTGTTGGAGAAGCAATTCTTGGGAGATCATAAATCCCAGAATGGTTTGGGTTGGAAGGGACGTGAAAAAACATGTGGTCCCAACCCCCTGCCATGGCAGGGATACCTTCCACTATCCCAGGCTGCTCCAAGCCCTGTCCAACCTGGCCTTGGACACTTCCAGGGATTCAGGGGCAGCCACAGCTTCTCTGGGCACCCTGTGCCAGGGCCTC\r
+W097         TGCCAGACCACACACACTCTGGGCTCTGCTGAGTATTTGTGTAAAACTCAATGTGTATTCACATCCCTGAAGTCTGGGAGACAACCCAAATTCCTGGGAGAGTGCTACCTTTCCTTCCTGCTGGAAATGGCTGAGAAGTTCCCAGCTTCCCTGGGCTCCCAGCTCCTCCACTCCAGGATATCTGGGTGTGTCCAAAGGGCTGGGATTTTGGGTCTTTTCCTCAGGGAAAGATGCTCCCTCCTCCAAGCAGACTGGGTGTTCTCAGGGAGTATTCCAACGGAGCTGGCAGGGGCAAAGCACAGCTCAGGCAAGAGGAGTTGACTCCCACAGGGTACAGGTCCTCATGGCAGGAGGAGCCATGGTTGGTGAATGTTGAAATGTGTTCTGGGCTCCAGGGAAGCTGAAAATTGTTGGAGAAGCAATTCTTGGGAGATCATAAATCCCAGAATGGTTTGGGTTGGAAGGGACGTGAAAAAACATGTGGTCCCAAACCCCTGCCATGGCAGGGATACCTTCCACTACCCCAGGCTGCTCCAAGCCCTGTCCAACCTGGCCTTGGACACTTCCAGGGATTCAGGGGCAGCCACAGCTTCTCTGGGCACCCTGTGCCAGGGCCTC\r
+B097         TGTCAGACCACACACACTCTGGGCTCTGCTGAGTATTTGTGTAAAACTCAATGTATATTCACATCCCTGAAGTCTGGGAGACAACCCAAATTCCTGGGAGAGTGCTACCTTTCCTTCCTGCTGGAAATGGCTGAGAAGTTCCCAGCTTCCCTGGGCTCCCAGCTCCTCCACTCCAGGATATCTGGGTGTGTCCAAAGGGCTGGGATTTTGGGTCTTTTCCTCAGGGAAAGATGCTCCCTCCTCCAAGCAGACTGGGTGTTCTCAGGGAGTATTCCAACGGAGCTGGCAGGGGCAAAGCACAGCTCAGGCAAGAGGAGTTGACTCCCACAGGGTACAGTTCCTCATGGCAGGAGGAGCCATGGTTGGTGAATGTTGAAATGTGTTCTGGGCTCCAGGGAAGCTGAAAATTGTTGGAGAAGCAATTCTTGGGAGATCATAAATCCCAGAATGGTTTGGGTTGGAAGAGACGTGAAAAAACATGTGGTCCCAAACCCCTGCCATGGCAGGGATACCTTCCACTATCCCAGGCTGCTCCAAGCCCTGTCCAACCTGGCCTTGGACACTTCCAGGGATTCAGGGGCAGCCACAGCTTCTCTGGGCACCCTGTGCCAGGGCCTC\r
+O097         TGCCAGACCACACACACTCTGGGCTCTGCTGAGTATTTGTGTAAAACTCAATGTATATTCACATTCCTGAAGTCTGGGAGACAATCCAAATTCCTGGGAGAGTGCTACCTTTCCTTCCTGCTGGAAATGGCTGAGAAGTTCCCAGCTTCCCTGGGCTCCCAGCTCCTCCACTCCAGGATATCTGGGTGTGTCCAAAGGGCTGGGATTTTGGGTCTTTTCCTCAGGGAAAGATACTCCCTCCTCCAAGCAGACTGGGTGTTCTCAGGGAGTATTCCAACGGAGCTGGCAGGGGGAAAGCACAGCTCAGGCAAGAGGAGTTGACTCCCACAGGGTGCAGTTCCTCATGGCAGGAGGAGCCATGATTGGTGAATGTTGAAATGTGTTCTGGGCTCCAGGGAAGCTGAAAATTGTTGGAGAAGCAATTCTTGGGAGATCATAAATCCCAGAATGGTTTGGGTTGGAAGGGACCTGAAAAAACATGTGGTCCCAAACCCCTGCCATGGCAGGGATACCTTCCACTATCTCAGGTGGCTCCAAGCCCTGTCCAGCCTGGCCTTGGACACTTCCAGGGATTCAGGGGCAGCCACAGCTTCTCTGGGCACCCTGTGCCAGGGCCTC\r
+\r
+Q097         GGTAAAGTTAAAACCAGAAAAAGTATGTATTGATACAAAAAAGAGAGCTCATCTATCATTTCACAGCAAAAGATGCATGTCGTATGAGGAATTTAAAACAATAAGAAAAGCTGTTGGTTTTGCTTCTCCAGACTGGGAGAATCAGTGGAGCAGCAACAGAAAGGGAGTTTGGAAGCTGTGACAGGCAATGAGGCACAGCTCAGGTGGGAGTGGGCCCTGCCAAGGCTCTGGCCAACAGCCTTTATCTCACCAGAAACTGAAGTGTTTTGTAAGAGTTCATAAAATACTTCATTACATTTTTGCAGCAACAGATTAATTAGTCTTTAGTCTGAGTTGCCCTTTCACCTGCTGATTTTTTCTACTATTTCTCTGCTCTCCTAAACAGTCTCTCTTTCAGTAACTCCCTGGAGCACATCTCTGGCACCACGTCCTTCCCCACATCATCCCCCCTTCTGTCATCCCCCTGCACAGCCAGGGCCCTGCGAGCACTCCAAATTCAGAGTAAGGCAGGCCCCTTCCAGGAGGCTGAGAGGGGAAAC\r
+W097         GGTAAAGTTAAAACCAGAAAAAGTATGTATTGATACAAAAAAGAGAGCTCATCTATCATTTCACAGCAAAAGATGCATGTCGTATGAGGAATTTAAAACAATAAGAAAAGCTGTTGGTTTTGCTTCTCCAGACTGGGAGAATCAGTGGAGCAGCAACAGAAAGGGAGTTTGGAAGCTGTGACAGGCAATGAGGCACAGCTCAGGTGTGAGTGGGCCCTGCCAAGGCTCTGGCCAACAGCCTTTATCTCACCAGAAACTGAAGTGTTTTGTAAGAGTTCATAAAATACTTCATTACATTTTTGCAGCAACAGATTAATTAGTCTTTAGTCTGAGTTGCCCTTTCACCTGCTGATTTTTTCTACTATTTCTCTGCTCTCCTAAATAGTCTCTCTTTCAGTAACTCCCTGGAGCACATCTCTGGCACCACATCCTTCCCCACATCATCCCCCCTTCTGTCATCCCCCTGCACAGCCAGGGCCCTGCGAGCACTCCAAATTCAGAGTAAGGCAGGCCCCTTCCAGGAGGCTGAGAGGGGAAAC\r
+B097         GGTAAAGTTAAAACCAGAAAAAGTATGTATTGATACAAAAAAGAGAGCTCATCTATCATTTCACAGCAAAAGATGCATGTCATATGAGGAATTTAAAACAATAAGAAAAGCTGTTGGTTTTGCTTCTCCAGACTGGGAGAATCAGTGGAGCAGCAACAGAAAGGGAGTTTGGAAGCTGTGACAGGCAATGAGGCACAGCTCAGGTGGGAGTGGGCCCTGCCAAGGCTCTGGCCAACAGCCTTTATCTCACCAGAAACTGAAGTGTTTTGTAAGAGTTCATAAAATACTTCATTACATTTTTGCAGCAACAGATTAATTAGTCTTTAGTCTGAGTTGCCCTTTCACCTGCTGATTTTTTCTACTATTTCTCTGCTCTCCTAAACAGTCTCTCTTTCAGTAACTCCCTGGAGCACATCTCTGGCACCACGTCCTTCCCCACATCATCCCCCCTGCTGTCATCCCCCTGCACAGCCAGGGCCCTGCGAGCACTCCAAATTCAGAGTAAGGCAGGCCCCTTCCAGGAGGCTGAGAGGGGAAAC\r
+O097         GGTAAAGTTAAAACCAGAAAAAGTATGTATTGATACAAAAAAGAGAGCTCATCTATCATTTCACAGCAAAAGATGCGTGTCATATGATGAATTTAAAACAATAAGAAAAGCTGTTGGTTTTGCTTCTCCAGACTGGGAGAATCGGTGGAGCAGCAACAGAAAGGGAGTTTGGAAGCTGTGACAGGCAATGAGGCACAGCTCAGGTGTGAGTGGGCCCTGCCAAGGCTCTGGCCAACAGCCTTTATCTGACCAGAAACTGAAGTGTTTTGTAAGAGTTCATAAAATACTTCATTACATTTTTGCAGCAACAGATTAATTAGTCTTTAGTCTGAGTTGCCCTTTCACCTGCTGATTTTCTCTACTATTTCTCTGCTCTCCCAAACAGTCTCTCTTTTAGTAACTCCCTGGAGCACATCACTGGCACCACGTCCTTCCCCACATCATCCCCCCTTCTGTCATCCCCCTGCACAGCCAGGGCCCTGCGAGCACTCCAAATTCAGAGTAAGGCAGGCCCCTTCCAGGAGGCTGAGAGGGGAAAC\r
+\r
+Q097         TTGAATTTCAAAATAATTTGGTGTTGGGAAGTATACACGAAGGCATCTCTTCTCACACTTGCTCACATTTTCCTGTCTTTCCAATTAGCACCCTCACGTTCACATTGTTTAAAGAAGATTAGCTTGAGTTTTTGTTCTTTAAATTCTGGTATTTGTCAAAGGTCTTTGGAGCTGGACAGCAAAATCATACTATATGCAGGAAAACATGAAAAATCACCACTATGAATTCTGAGAACCAAATCCTTTTATTAAAAAAAAAAGTATTTGGAAGTCTTGTTTTCTGTTTCCCTGCTTCTAGTGGCACCACCTTGTATAATATTTTCCATAAACAGATCAATTTCCATTTTAATAATGGATTATTTTTTATAACCGTTCCCAGAATGGCAGCTGCTGGTACATTGCTCCACGCTCTCGGTGATTCTGAAGTTCAGCAACTTTAGTTAACTTCCATTGTAAAGATATTAATTTGTTCCTAGGCCAGTGTTGTGCTTGGTGTTTGAGTTCTCCTCCTCCATGTACTCTCCTTCACCCTGATGCACATCTTGCTGTGCATCTGCTCATCTTTATCTGCTCTTTCCATCAGACCCGGTGGTTTCTCTTGCAGCACAGAC\r
+W097         TTGAATTTCAAAATAATTTGGTGTTGGGAAGTATACACGAGGGCATCTCTTCTCACACTTGCGCACATTTTCCTGTCTTTCCAATTAGCACCCTCACGTTCACATTGTTTAGAGAAGATTAGCTTGAGTTTTTGTTCTTTAAATTCTGGTATTTGTCAAAGGTCTTTGGAGCTGGACAGCAAAATCATTGTATATGCAGGAAAACATGAAAAACCACCACTATGAATTCTGAGAACCAAATCCTTTTATTAAAAAAAAAAGTATTTGGAAGTCTTGTTTTCTGTTTCCCTGCTTCTACTGGCACCACCTTGTATAATATTTTCCATAAACAGATCAATTTCCATTTTAATAATAGATTATTTTTTATAACCGTTCCCAGAATGTCGGCTGCTGGTACGTTGCTCCACACTCTCGGTGATTCTGAAGTTCAGCAACTTTAGTTAACTTCCATTGTAAAGATATTAATTTGTTCCTAGGCCAGTGTTGTGCTTGGTGTTTGAGTTCTCCTCCTCCATGTACTCTCCTTCACCCTGATGCACATCTTGCTGTGCATCTGCTCATCTTTATCTGCTCTTTCCATCAGACCCGGTGGTTTCTCTTGCAGCACAGAC\r
+B097         TTGAATTTCAAAATAATTTGGTGTTGGGAAGTATACACGAGGGCATCTCTTCTCATACTTGCGCACATTTTCCTGTCTTTCCAATTAGCACCCTCACGTTCACATTGTTTAAAGAAGATTAGCTTGAGTTTTTGTTCTTTAAATTCTGGTATTTGTCAAAGGTCTTTGGAGCTGGACAGCAAAATCATTGTATATGCAGGAAAACATGAAAAACCACCACTATGAATTCTGAGAACCAAATCCTTTTATTAAAAAAAAAAGTGTTTGGAAGTCTTGTTTTCTGTTTCCCTGCTTCTACTGGCACCACCTTGTATAATATTTTCCATAAACAGATCAATTTCCATTTTAATAATAGATTATTTTTTATAACCGTTCCCAGAATGTCGGCTGCTGGTACGTTGCTCCACACTCTCGGTGATTCTGAAGTTCAGCAACTTTAGTTAACTTCCATTGTAAAGATATTAATTTGTTCCTAGGCCAGTGTTGTGCTTGGTGTTTGAGTTCTCCTCCTCCATGTACCCTCCTTCACCCTGATGCACATCTTGCTGTGCATCTGCTCATCTTTATCTGGTCTTTCCATCAGACCCGGTGGTTTCTCTTGCAGCACAGAC\r
+O097         TTGAATTTCAAAATAATTTGGTGTTGGGAAGTATACACGAAGGCATCTCTTCTCACACTTGTGCACATTTTCCTGCCTTTCCAATTAGCACCCTCACGTTCACATTGTTTAAAGAAGATTAGCTTGAGTTTTTGTTCTTTAAATTCTGGTATTTGTCAAAGGTCTTTGGAGCTGGACAGCAAAATCATTGTATATGCAGGAAAACATGAAAAACCACCACTATGAATTCTGAGAACCAAATCCTTTTATTAAAAAAAAAAGTATTTGGAAGTCTTGTTTTCTGTTTCCCTGCTTCTACTGGCACCACCTTGTATAATATTTTCCATAAACAGATCAATTTCCATTTTAATAATAGATTATTTTTTATAACCATTCCCAGAATGGCGGCTGCTGGTACATTGCTCCACGCTCTCGGTGATTCTGAAGTTCAGCAACTTTAGTTAACTTCCATTGTAAAGATATTAATTTGTTCCTAGGCCAGTGTTGTGCTTGGTGTTTGAGTTCTCCTCCTCCATGTACTCTCCTTCACCTTGATGCACATCTTGCTGTGCATCTGCTCATCTTTATCTGCTCTTTCCATCAGACCCGGTGGTTTCTCTTGCAGCACAGAC\r
+\r
+Q097         CCAGGACTAAATTCTTTATGCTGAGAGGTGACATGCTGTGCAAGTAGTTTTATTGAAATTAATGCAGTTACACCCAGGAAAGAGAGTGCTCAACAGGACTGAGATTGCAGGAATCTGACCAGCAGTGTTTTACACTTAGCTTCCAAATTGCTGTATTGCTGTCACCAGGTTAATCCTCATAACATCTCACTGTGCAAATTTCTAAGGTACTTAAAATACCTTTGTATTAACTGGAAACAGTTTATCAGACACAATTTAGGTCTTTCTTCTGTAATGCATTTTAGAATGAATTTTTAAAACGTGTATTTTTTTGTGCTTGAGTATTCCTGCACACTTCATGCAAATTATTTGCAACTAAAAGGCAGCATGAGATTTATTTTTTTTATGCAATTCATTTTGATTTGTGAGGTGACATGATTTTTTCATCACTAAAACCCATTAAGCAGGGAAATCAATAATATTCTTGGTTCTCGTTCATGTAGGAATTCTTTCCTTATAGATAGCTTTGCTTA\r
+W097         CCAGGACTAAATTCTTTATGCTGAGAGGTGACATGCTGTGCAAGTAGTTTTATTGAAATTAATGCAGTTACACCCAGGAAAGAGAGTGCTCAACAGGACTGAGATTGCAGGAATCTGACCAGCAGTGTTTTACACTTAGCTTCCAAATTGCTGTATTGCTGTCACCAGGTTAATCCTCATAACATCTCACTGTGCAAATTTCTAAGGTACTTAAAATACCTTTGTATTAACTGGAAACAGTTTATCAGACACAATTTAGGTCTTTCTTCTGTAATGCATTTTAGAATGAATTTTTAAAACGTGTATTTTTTTGTGCTTGAGTATTCCTGCACACTTCATGCAAATTATTTGCAACTAAAAGGCAGCATGAGATTTATTTTTTTTATGCAATTCATTTTGATTTGTGAGGTGACATGATTTTTTCATCACTAAAACCCATTAAGCATGGAAATCAATAATATTCTTGGTTCTCGTTCATGTAGGAATTCTTTCCTTATAGATAGCTTTGCTTA\r
+B097         CCAGGACTAAATTCTTTATGCTGAGAGGTGACATGCTGTGCAAGTAGTTTTATTGAAATTAATGCAGTTACACCCAGGAAAGAGAGTGCTCAACAGGACTGGGATTGCAGGAATGTGACCAGCAGTGTTTTACACTTAGCTTCCAAATTGCTGTATTGCTGTCACCAGGTTAATCCTCATAACATCTCACTGTGCAAATTTCTAAGGTACTTAAAATACCTTTGTATTAACTGGAAACAGTTTATCAGACACAATTTAGGTCTTTCTTCTGTAATGCATTTTAGAATGAATTTTTAAAACGTGTATTTTTTTGTGCTTGAGTATTCCTGCACACTTCATGCAAATTATTTGCAACTAAAAGGCAGCATGAGATTTATTTTTTTTATGCAATTCATTTTGATTTGTGAGGTGACATGATTTTTTCATCACTAAAACCCATTAAGCAGGGAAATCAATAATATTCTTGGTTCTCGTTCATGTAGGAATTCTTTCCTTATAGATAGCTTTGCTTA\r
+O097         CCAGGACTAAATTCTTTATGCTGAGAGGTGACATGCTGTGCAAGTAGTTTTATTGAAATTAATGCAGTTACACCCAGGAAAGAGAGTGCTCAACAGGACTGAGATTGCAGGAATCTGACCAGCAGTGTTTTGCACTTAGCTTCCAAATTGCTGTATTGCTGTCACCAGGTTAATCCTCATAACATCTCACTGTGCAAATTTCTAAGGTACTTAAAATACCTTTGTATTAACTGGAAACAGTTTATCAGACACAATTTAGGTCTTTCTTCTGTAATGCATTTTAGAATGAATTTTTAAAATGTGTATTTTTTTGTGCTTGAGTATTCCTGCACACTTCATGCAAATTATTTGCAACTAAAAGGCAGCATGAGATTTATTTTTTTTATGCAATTCATTTTGATTTGTGAGGTGACATGATTTTTTCATCACTAAAACCCATTAAGCAGGGAAATCAATAATATTCTTGGTTCTCGTTCATGCGGGAATTCTTTCCTTATAGATAGTTTTGCTTA\r
+\r
+Q097         TAGTATAGAGATCAAGCAGCTCAGAGCTGAGAGGAGTTTATTTGCACCACCAAGTGCGATTGTGGCTGAATTCTGACTCCAGATGGGCACAGTTTCAGCCCAATGAAACCTCATGGATGCCAACAATTTCCTGCCAGTATAAAAAGTTCACACTTCCAGCGTTCATTTTAATAAAGGCTTCTGGATATACATATTTGTCTCTGAATTGCTAGAGATCCCCATCTCTGAAGAGAAGACATAAAATAAAAATTTAGTACCTCAGTGCAGGAAATAGAGCTTTGAAAGCATGTCCGAGAAGAGTGTTTGTAGCCCAGATTGTTTTAGTTATACAGGAGGACCAAAACTCAGCTATTTGCACAAATCCAAAGTTTTACAATAGAAATGACTGTGTGTGATCAACTAGGAATAACAGGGCGGAGGAGTATCAGCAAAGGAGTTGAAGTGCTCACTGCCAGCCTTGCTAGTGTGCCATCCTGTGCCAAATGCATAATGAACTTCTGGCAATTGAGTGGCCACTCAGTACCAAGATCACGGGCATCTGAGGTTCCTTATTAAACTGTGAATACTCCATATCTGCTGTTTATTATATG\r
+W097         TAGTATAGAGATCAAGCAGCTCAGAGCTGAGAGGAGTTTATTTGCACCACCAAGTGCGATTGTGGCTGAATTCTGACTCCAGATGGGCACAGTTTCAGCCCAATGAAACCTCATGGATGCCAACAATTTCCTGCCAGTATAAAAAGTTCACACTTCCAGCGTTCATTTTAATAAAGGCTTCTGGATATACATATTTGTCTCTGAATTACTAGAGATCCCCATCTCTGAAGAGAAGACATAAAATAAAAATTTAGTACCTCAGTGCAGGAAATAGAGCTTTGAAAGCATGTCCGAGAAGAGTGTTTGTAGCCCAGATTGTTTTAGTTATACAGGAGGACCAAAACTCAGCTATTTGCACAAATCCAAAGTTTTACAATAGAAATGACTGTGTGTGATCAACTAGGAATAACAGGGCGGAGGAGTATCAGCAAAGGAGTTGAAGTGCTCACTGCCAGCCTTGCTAGTGTGCCATCCTGTGCCAAATGCATAATGGACTTCTGGCAATTGAGTGGCCACTCAGTACCAAGATCACGGGCATCTGAGGTTCCTTATTAAACTGTGAATACTCCATATCTGCTGTTTATTATATG\r
+B097         TAGTATAGAGATCAAGCAGCTCAGAGCTGAGAGGAGTTTATTTGCACCACCAAGTGCGATTGTGGCTGAATTCTGACTCCAGATGGGCACAGTTTCAGCCCAATGAAACCTCATGGATGCCAACAATTTCCTGCCAGTATAAAAAGTTCACACTTCCAGCGTTCATTTTAATAAAGGCTTCTGGATATACATATTTGTCTCTGAATTACTAGAGATCCCCATCTCTGAAGAGAAGACATAAAATAAAAATTTAGTACCTCAGTGCAGGAAATAGAGCTTTGAAAGCATGTCCGAGAAGAGTGTTTGTAGCCCAGATTGTTTTAGTTATACAGGAGGACCAAAACTCAGCTATTTGCACAAATCCAAAGTTTTACAATAGAAATGACTGTGTGTGATCAACTAGGAATAACAGGGCGGAGGAGTATCAGCAAAGGAGTTGAAGTGCTCACTGCCAGCCTTGCTAGTGTGCCATCCTGTGCCAAATGCATAATGAACTTCTGGCAATTGAGTGGCCATTCAGTACCAAGATCACGGGCATCTGAGGTTCCTTATTAAACTGTAAATACTCCATATCTGCTGTTTATTATATG\r
+O097         TAGTATAGAGATCAAGCAGCTCAGAGCTGAGAGGAGTTTATTTGCACCACCAAGTGCGATTGTGGCTGAATTCTGACTCCAGATGGGCACAGTTTCAGCCCAATGAAACCTCATGGATGCCAACAATTTCCTGCCAGTATAAAAAGTTCACACTTCCAGTGTTCATTTTAATAAAGGCTTCTGGATATACAGATTTGTCTCTGAATTACTAGAGATCCCCATCTCTGAAGAGAAAACATAAAATAAAAATTTAGTACCTCAGTGCAGGAAATAGAGCTTTGAAAGCATGTCCGAGAAGAGTGTTTGTAGCCCAGATTGTTTTAGTTATACAGGAGGACCAAAACTCAACTATTTGCACAAATCCAAAGTTTTGCAATAGAAATGACTGTGCGTGGTCAACTAGGAATAACAGTGCTGAGGAGTATCAGCAAAGGAGTTGAAATGCTCACTGCCAGCCTTGCTAGTGTGCCATCCTGTGCCAAATGCATAATGAACTTCTGGCAATTCAGTGGCCACTCAGTACCAAGATCACGGGCGTCTGAGTTTCCTTATAAAACTGTGAATACTCCATATCGGCTGTTTATTATACG\r
+\r
+Q097         AGAGTTGCACTTTACACTGATGTCATCGACATAGGCAAGCTCTCCACTCTAGGTCTAAATATTAGTAGTTCAAAAACAACTTTAATATCTAGCATTTAATAGCTAAAGGGACTCTACTTTTTTCTTTCATTTTGCTGTTATTTCTACAACTCTTCCCTCTTCATTCTGAATTACAATACAAATGTCTTGTACCATAATTTCTATGTGAAATTCTAGACCAACTGAAATATATAGGACTTGGATTATTAACATCAAAGGTCTAAAATTTATCTCAGTTTCTATACTTCCTGTGCATTAAGGAGACAAATCCTGCCTTTTCATCTCATCTTTATTAAAATAAAAGAATAACAACCAAAGATGGCAGAGAAGCCATCTCAGCATATGAGAGCATGAACTGGACTACTCTGGAGGAAATTACACTATAAATCTTTATCTACCAATTCAAAGTAATTCACCATTTATTAAATTTGATATAAATGTGGAGAAACTTTCTCATTATTGTCCAGTGTGCCACAGCTACACAACTTGGTCCTTGTGGTTATGA\r
+W097         AGAGTTGCACTTTACACTGATGTCATCGACATAGGCAAGCTCTCCACTCTAGGTCTAAATATTAGTAGTTCAAAAACAACTTTAATATCTAGCATTTAATAGCTAAAGGGACTCTACTTTTTTCTTTCATTTTGCTGTTATTTCTACAACTCTTCCCTCTTCATTCTGAATTACAATACAAATGTCTTGTACCATAATTTCTATGTGAAATTCTAGACCAACTGAAATATATAGGACTTGGATTATTAACATCAAAGGTCTAAAATTTATCTCAGTTTCTATACTTCCTGTGCATTAAGGAGACAAATCCTGCCTTTTCATCTCATCTTTATTAAAATAAAAGAATAACAACCAAAGATGGCAGAGAAGCCATCTCAGCATATGAGAGCATGAACTGGACTACTCTGGAGGAAATTACACTATAAATCTTTATCTACCAATTCAAAGTAATTCACCATTTATTAAATTTGATATAAATGTGGAGAAACTTTCTCATTATTGTCCAGTGTGCCACAGCTACACAACTTGGTCCTTGTGGTTATGA\r
+B097         AGAGTTGCACCTTACACTGATGTCATCGACATAGGCAAGCTCTCCACTCTAGGTCTAAATATTAGTAGTTCAAAAACAACTTTAATATCTAGCATTTAATAGCTAAAGGGACTCTACTTTTTTCTTTCATTTTGCTGTTATTTCTACAACTCTTCCCTCTTCATTCTGAATTACAATACAAATGTCTTGTACTATAATTTCTATGTGAAATTCTAGACCAACTGAAATATATAGGACTTGGATTATTAACATCAAAGGTCTAAAATTTATCTCAGTTTCTATACTTCCTGTGCATTAAGGAGACAAATCCTGCCTTTTCATCTCATCTTTATTAAAATAAAAGAATAACAACCAAAGATGGCAGAGAAGCCATCTCAGCATATGAGAGCATGAACTGGACTACTCTGGAGGAAATTACACTATAAATCTTTATCTACCAATTCAAAGTAATTCACCATTTATTAAATTTGATATAAATGTGGAGAAACTTTCTCATTATTGTCCAGTGTGCCACAGCTACACAACTTGGTCCTTGTGGTTATGA\r
+O097         AGAGTTACACCTTACACTGATGTCATCGACATAAGCAAGCTCTCCACTCTAGGTCTAAATATTAGTAGTTCAAAAACAACTTTAATATCTAGAATTTAATAGCTAAAGGGACTCTACTTTTTTCTTTCATTTTGCTGTTATTTCTACAACTCTTCCCTCTTCATTCTGAATTACAATACAAATGTCTTGTACCAGAATTTCTATGTGAAATTCCAGACCAACTGAAATATATAGGACTTGGATTATTAACATCAAAGGTCTAAAATTTATCTCAGTTTCTATACTTCCTGTGCATTAAGGAGACAAATCCTGCCTTTTCATCTCATCTTTATTAAAATAAAAGAATAACAACCAAAGATGGCAGAGAAGCCATCTCAGCATATGAGAACATGAACTGGACTACTCTGGAGGAAATTACACTATAAATCTTTATCTACCAATTCAAAGTAATTCACCATTTATTAAATTTGATATAAATGTGGAGAAACTTTCTCATTATTGTCCAGTGTGACACATCTACACAACTTGGTCCTTGTGGTTATGA\r
+\r
+Q097         CAAGGTGCTCTCAGGTTGCATCATGCTTCCCACATCAGACTCTTCCCTTGTCCCACAAATCCATAAATAAGTTTTGGACGACAGGGAGAGAAAATCCAATTCCTTGACTGAAATAACAGATTTATCAGATAAAATAAACCAGTACATGAATTCATCCTCAAAGCCCCTTCACCCTCCTCTAACAACATGACAGCAAACTGAGACCAATAGCTCCTCCCCTGATAATCTACAGCAGAGATTGTCCTGGAAAGGAGGACAGGGGTTTTATCAGAGGAAATTAACAGCTCCTGGTCTCTGCTCAGCCCATTAGCATCAGCTGTGCTGTGTTAGTTAGCTGACATGAGTTCATGCCTGGAGTGTTACCTAAAATGTGTATCTATCCGGAGATGAGGTCAAATATATGTAAATATTGGGATGAGTCTCAGCAGAAGAGTGTAAACAAAGTTTTGGCAATTTTTCATACACTCCCCAGGATGAAAACTTCTTTTTTTCACTACTTATATTGTAATTAGGACCAAATATTCAGGGCCAAAATTGCAGCTCACATGGAATGTCATTGTTGCTTTGGTTTAGACCACTTCAAAATAATG\r
+W097         CAAGGTGCTCTCAGGTTGCATCATGCTTCCCACATCAGACTCTTCCCTTGTCCCACAAATCCATAAATAAGTTTTGGAGGACAGGGAGAGAAAATCCAATTCCTTGACTTAAATAACAGATTTATCAGATAAAATAAACCAGTACATGAATTCATCCTCAAAGCCCCTTCACCCTCCTCTAACAACAGGACAGCAAACTGAGACCAATAGCTCCTCCCCTGATAATCTACAGCAGAGATTGTCCTGGAAAGGAGGACAGGGGTTTTATCAGAGGAAATTAACAGCTCCTGGTCTCTGCTCAGCCCATTAGCATCAGCTGTGCTGTGTTAGTTAGCTGACATGAGTTCATGCCTGGAGTGTTACCTAAAATGTGTATCTATCTGGAGATGAGGTCAAATATATATAAATATTGGGATGAGTCTCAGCAGAAGAGTGTAAACAAAGTTTTGGCAAATTTTCATACACTCCCCAGGATGAAAACTTCTTTTTTTTACTCCTTATATTGTAATTAGGACCAAATATTCAGGGCCAAAATTGCAGCTCACATGGAATGTCATTGCTAGTTTGGCTTAGACCACCTCAAAATAATG\r
+B097         CAAGGTGCTCTCAGGTTGCATCATGCTTCCCACATCAGACTCTTCCCTTGTCCCACAAATCCATAAATAAGTTTTGGAGGACAGGGAGAGAAAATCCAATTCCTTGACTTAAATAACAGATTTATCAGATAAAATAAACCAGTACATGAATTCATCCTCAAAGCCCCTTCACCCTCCTCTAACAACAGGACAGCAAACTGAGACCAATAGCTCCTCCCCTGATAATCTACAGCAGAGATTGTCCTGGAAAGGAGGACAGGGGTTTTATCAGAGGAAATTAACAGCTCCTGGTCTCTGCTCAGCCCATTAGCATCAGCTGTGCTGTGTTAGTTAGCTGACATGAGTTCATGCCTGGAGTGTTACCTAAAATGTGTATCTATCTGGAGATGAGGTCAAATATATATAAATATTGGGATGAGTCTCAGCAGAAGAGTGTAAGCAAAGTTTTGGCAAATTTTCATACACTCCCCAGGATGAAAACTTCTTTTTTTTACTCCTTATATTGTAATTAGGACCAAATATTCAGGGCCAAAATTGCAGCTCACATGGAATGTCATTGTTGGTTTGGTTTAGACCACTTCAAAATAATG\r
+O097         CAAGGTGCTCTCAGGTTGCATCATGCTTCCCACATCAGACTCTTCCCTTGTCCCACAAATCCATAAATAAATTTTGGAGGACAGGGAGAGAAAATCCAATTCCTTGATTGCAATAACAGATTTATCAGATAAAATAAACCAGTACATGAATTCATCCTCAAAGCCCCTTCACCCTCCTCTAACAACACGACAGCAAACTGAGACCAATAGCTCCTCCCCTGATAATCTACAGCAGAGATTGTCCTGGAAAGGAGGACAGAGGTTTTATCAGAGGAAATTAACAGCTCCTGGTCTCTGCTCAGCCCATTAGCATCAGCTGTGCTGTGGTAGTTAGCTGACATGAGTTCATGCCTGGAGTGTTACCTAAAATGTGTATATATCCGGAGATTAGGTCAAATATATATAAATATTGGGATGAGTCTCAGCAGAAGAGTGTAAACAAAGTTTTGGCAATTTTTCATACACTCCCCAGGATGAAAACTTCTTTTTTTTACTCCTTATATTGTAATTAGGACCAAATATTCAAGGCCAAAATTGCGGCTCACATGGAATGTCATTGTTGTTTTGGTTTAGACCATTTCAAAATAATG\r
+\r
+Q097         ATAATGTTTATTCCAGATTGCTTTGTGACTCTGACTTAAGGTCCCTGTCACTCTGCAGCTATGGCTGCCAGGAGAGATGAGCCGTGTTAACTCTGTATGTTCTAAAGCAGCAATCAGGCACATATAAAAACTGTACATAAATATGTCAGTTTTACAAAAGGACATAATAACTAGAAGTGAGGATGGAATGCTCCTGAAAAATCAGTATTGGAAAGGCTGAATAAAGGGTTGGGGATAGAGCAGTAGATCACTACACAAATTAGAGGAACATCGTATTTTTGGATGAATACCCTATAGGCTCTCTGCATAAACAAATGAACAAACAGATCAATAAAGAGCTTTATCAAGAGTATAGTTTATAAGCATGACTAATTAAAACATGGGGAAGTCTACCTCAAAGCTACCTCACTATTCCCCCTGCCTGTGCTTCCTTTGATTTTTCCCAGGAGCTCACTCTAGTAACCT\r
+W097         ATAATGTTTATTCCAGATTGCTTTGTGACTCTGACTTAAGGTCCCTGTCACTCTGCAGCTATGGCTGCCAGGAGAGATGAGCCGTGTTAACTCTGTATGTTCTAAAGCAGCAATCAGGCACATATAAAAACTGTACATAAATATGTCAGTTTTACAAAAGGACATAATAACTAGAAGTGAGGATGGAATGCTCCTGAAAAATCAGTATTGGAAAGGCTGAATAAAGGGTTGGGGATAGAGCAGTAGATCACTACACAAATTAGAGGAACATCGTATTTTTGGATGAATACCCTATAGGCTCTCTGCATAAACAAATGAACAAACAGATCAATAAAGAGCTTTATCAAGAGTATAGTTTATAAGCATGACTAATTAAAACATGGGGAAGTCTACCTCAAAGCTACCTCACTATTCCCCCTGCCTGTGCTTCCTTTGATTTTTCCCAGGAGCTCACTCTAGTAACCT\r
+B097         ATAATGCTTATTCCAGATTGCTTTGTGACTCTGACTTAAGGTCCCTGTCACTCTGCAGCTATGGCTGCCAGGAGAGATGAGCCGTGTTAACTCTGTATGTTCTAAAGCAGCAATCAGGCACATATAAAAACTGTACATAAATATGTCAGTTTTACAAAAGGACATAATAACTAGAAGTGAGGATGGAATGCTCCTGAAAAATCAGTATTGGAAAGGCTGAATAAAGGGTTGGGGATAGAGCAGTAGATCACTACACAAATTAGAGGAACATCGTATTTTTGGATGAATACCCTATAGGCTCTCTGCATAAACAAATGAACAAACAGATCAATAAAGAGCTTTATCAAGAGTATAGTTTATAAGCATGACTAATTAAAACATGGGGAAGTCTACCTCAAAGCTACCTCACTATTCCCCCTGCCTGTGCTTCCTTTGATTTTTCCCAGGAGCTCACTCTAGTAACCT\r
+O097         ATAATGTTTATTCCAGATTGCTTTGTGACTCTGACTTAAGGTCCCTGTCACTCTGCAGCTATGGCTGCCAGGAGAGGTGAGCCGTGTTAACTCTGTATGTTCTAAAGCAGCAATCAGGCACATATAAAAACTGTACATAAATATGTCAGTTATACAAAAGGACATAATAACTAGAAGTGAGGATGGAATGCTCCTGAAAAATCAGTATTGGAAAGGCTGAATAAAGGGTTGGGGATAGAGCAGTAGATCACTACACAAATTAGAGGAACATCGTATTTTTGGATGAATACCCTATAGGCTCTCTGCATAAACAAATGAACCAACAGATCAATAAAGAGCTTTATTAAGAGTATAGTTTATAAGCATGACTAATTAAAACATGGGGAAGTCTACCTCAAAGCTACCTCACTATTCCCCCTGCCTGTGCTTCCTTTGATTTTTCCCAGGAGCTCACTCTAGTAACTT\r
+\r
+Q097         CGTGAATCCTCTCTGGAAGACCCATTGACAGGAGAGAGCAGTTGCCTCGTAACTTTACCTGAAAGGCATTAAAATGATACAGTATGTAACTTCAGGATGTCCTTGAATAGGTCCTGTTCCCAGAAGATCCTCACAGGAAGCTATGTACTGTGAATGATGCATCTCAAAATAACCACGAGCTCGAGTTTATTCAGGAGCCATTTTGTGTGTGCAGATCCACAGACACACAGGCACACGTCCCTAAGTACCCACGGTGTGCATGTGTTGTGTGTGTTATTTACACTACATGTAAACAGTACCAACACCAATAGCAACTCAAAGACCTTTTCCTCCAAGTGTTCGGGCACAGAACGCTGGCTGGACTCGGCCGGGGTTCCCTGAGTTGTGTGCTTGCAGGATCAGGCCCTGTGCTAGTATTTAAGAAAATACTTTTTTATTAGTACTGGTTAAGGTTTTTCTATTTTTCACTTTTGCCAAAAATGTTTTGCACTTAAAACGTGACGTGTCTCGTAATGGCAGTGGATCTGTCTGAGAGTCAGCGAGTAGCTCACTTTGACATAAGAATGATCC\r
+W097         CGTGAATCCTCTCTGGAAGACCCATTGACAGGAGAGAGCAGTTGCCTCGTAACTTTACCTGAAAGGCATTAAAATGATACAGTATGTAACTTCAGGATGTCCTTGAATAGGTCCTGTTCCCAGAAGATCCTCACAGGAAGCTATGTACTGTGAATGATGCATCTCAAAATAACCACGAGCTCGAGTTTATTCAGGAGCCATTTTGTGTGTGCAGATCCACAGACACACAGGCACACGTCCCTAAGTACCCACGGTGTGCATGTGTTGTGTGTGTTATTTACACTACATGTAAACAGTACCAACACCAATAGCAACTCAAAGACCTTTTCCTCCAAGTGTTCGGGCACAGAACGCTGGCTGGACTCGGCCGGGGTTCCCTGAGTTGTGTGCTTGCAGGATCAGGCCCTGTGCTAGTATTTAAGAAAATACTTTTTTATTAGTACTGGTTAAGGTTTTTCTATTTTTCACTTTTGCCAAAAATGTTTTGCACTTAAAACGTGACGTGTCTCGTAATGGCAGTGGATCTGTCTGAGAGTCAGCGAGTAGCTCACTTTGACATAAGAATGATCC\r
+B097         CGTGAATCCTCTCTGGAAGACCCATTGACAGGAGAGAGCAGTTGCCTCGTAACTTTACCTGAAAGGCATTAAAATGATACAGTATGTAACTTCAGGATGTCCTTGAATAGGTCCTGTTCCCAGAAGATCCTCACAGGAAGCTATGTACTGTGAATGATGCATCTCAAAATAACCACGAGCTCGAGTTTATTCAGGAGCCATTTTGTGTGTGCAGATCCACAGACACACAGGCACACGTCCCTAAGTACCCACGGTGTGCATGTGTTGTGTGTGTTATTTACACTACATGTAAACAGTACCAACACCAATAGCAACTCAAAGACCTTTTCCTCCAAGTGTTCGGGCACAGAACGCTGGCTGGACTCGGCCGGGGTTCCCTGAGTTGTGTGCTTGCAGGATCAGGCCCTGTGCTAGTATTTAAGAAAATACTTTTTTATTAGTACTGGTTAAGGTTTTTCTATTTTTCACTTTTGCCAAAAATGTTTTGCACTTAAAACGTGACGTGTCTCGTAATGGCAGTGGATCTGTCTGAGAGTCAGCGAGTAGCTCACTTTGACATAAGAATGATCC\r
+O097         CGTGAATCCTCTCTGGAAGACCCATTGACAGGAGAGAGCAGTTGCCTCGTAACTTTACCTGAAAGGCATTAAAATGATACAGTATGTAACTTCAGGATGTCCCTGAATAGGTCCTGTTCCCAGAAGATCCTCACAGGAAGCTATGTACTGTGAATGATGCATCTCAAAATAACCACGAGCTCGAGTTTATTCAGGAGCCATTTTGTGTGTGCAGATCCACAGACACACCGGCACACGTCCCTAAGTACCCACGGTGTGCATGTGTTGTGTGTGTTATTTACACTACATGTAAACAGTACCAACACCAATAGCAACTCAAAGACCTTTTCCTCCAAGTGTTCAGGCACAGAACCCTGGCTGGACTCGGCCGGGGTTCCCTGAGTTGTGTGCTTGCAGGATCAGGCCCTGTGCTAGTATTTAAGAAAATACTTTTTTATTAGTACTGGTTAAGGTTTTTCTATTTTTCACTTTTGCCAAAAATGTTTTGCACTTAAAACGTGACGTGTCTCGTAATGGCAGTGGATCTGTCTGAGAGTCAGCGAGTAACTCCCTTTGACGTAAGAATGATCC\r
+\r
+Q097         TCTTTATCCTTGTTTGCCTTATTTGATGGAAACAATTGCTCTTCTACCTGAAAATATGCAAATTTACAGGATGAATAGGAGGCATTTCATTCCATGCCCAGTTGTTGACAATTCTCAGAAATCACTTCAGAAATTTCAGTATTTTTCTCCTGCCCAGTGTCTGAATAATAGAGGATAAATAAACAGCCAAATGGAGTATATTAAATTTTGACACGTACTGATTAATGTTTCAAGTAGACAAAGAGTTTTGGGGTTTTTTTAAGGCAAAAATTAGTATTTTTCCTCCTGTTGCCTTACTCAGCATAACAATTTCTGGAGGACACTTGTGCAAATGCTCTGTAGTTGGTGCCAATTTCAGACTGCACTGGTGAAGAGTGGGACAAGACAGGAACACCCCTGTGTGTGTGTGTGGAATCATCACTGCTAGCAGCAGTTAGGAAATGGACTGAGCATTTGGTGATGCAGTTTGGCAGGAGTTTTTACAGCAGAAGCAGAATTCTTGCAGTGCTCCTTTGTGCTCTGCCCTCTGCAGTGCTCAGAGCATTGCAGGGCTGAGGGAAGGCACTTCATCCCAGCGTGGAACTGGTGCCTTTTGGGGCTGCCTAAAAACAG\r
+W097         TCTTTATCCTTGTTTGCCTTATTTGGTGGAAACAATTGCTCTTCTACCTGAAAATATGCAAATTTACAGGATGAATAGGAGGCATTTCATTCCATGCCCAGTTGTTGACAATTCTCAGAAATCACTTCAGAAATTTCAGTATTTTTCTCCTGCCCAGTGTCTGAATAATAGAGGATAAATAAACAGCCAAATGGAGTATATTAAATTTTGACACGTACTGATTAATGTTTCAAGCAGACAAAGAGTTTTGGGGTTTTTTTAAGGCAAAAATTAGTATTTTTCCTCCTGTTGCCTTACTCAGCATAACAATTTCTGGAGGACACTTGTGCAAGTGCTCTGTAGTTGGTGCCATTTTCAGACTGCACTGGTGAAGAGTGGGACAAGACAGGAACACCCCTGTGCGTGTGTGTGGAATCATCACTGCTAGCAGCAGTTAGGAAATGGACTGAGCCTTTGGTGATGCAGTTTGGCAGGAGTTTTTACAGCAGAAGCAGAATTCTTGCAGTGCTCCTTTGTGCTCTGCCCTCTGCAGTGCTCAGAGCATTGCAGGGCTGAGGGAAGGCACTTCATCCCAGTGTGGAACTGGTGCCTTTTGGGGCTGCCTAAAAACAG\r
+B097         TCTTTATCCTTGTTTGCCTTATTTGATGGAAACAATTGCTCTTCTACCTGAAAATATGCAAATTTACAGGATGAATAGGAGGCATTTCATTCCATGCCCAGTTGTTGACAATTCTCAGAAATCACTTCAGAAATTTCAGTATTTTTCTCCTGCCCAGTGTCTGAATAATAGAGGATAAATAAACAGCCAAATGGAGTATATTAAATTTTGACATGTACTGATTAATGTTTCAAGCAGACAAAGAGTTTTGGGGTTTTTTTAAGGCAAAAATTAGTATTTTTCCTCCTGTTGCCTTACTCAGCATAACAATTTCTGGAGGACACTTGTGCAAATGCTCTGTAGTTGGTGCCATTTTCAGACTGCACTGGTGAAGAGTGGGACAAGACAGGAACACCCCTGTGTGTGTGTGTGGAATCATCACTGCTAGCAGCAGTTAGGAAATGGACTGAGCCTTTGGCGATGCAGTTTGGCAGGAGTTTTTACAGCAGAAGCAGAATTCTTGCAGTGCTCCTTTGTGCTCTGCCCTCTGCAGTGCTCAGAGCATTGCAGGGGTGAGGGAAGGCACTTCATCCCAGCGTGGAACTGGTGCCTTTTGGGGCTGCCTAAAAACAG\r
+O097         ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+\r
+Q097         CTCCCCAGTCCTGCTGGTGGGGAGTGAGCAAGCAGCTGCGTGGGGCTTGATCCTGGCTATGGCTAAACCATGACAGAGCCACAGACCACATCCTTCCTTTGCCACTGCTGTTTCTTTGTGATAGTCCAATTACCTCTCAGTGTATCCAATATTCCTCAATTTATAATATCAAGAATTTTTCTTATACTCAAAAAGGTAACACTTTTTATTCTTTTATAGGTTGGCTTTAAATGCAGTCATTTTTCACTTGGTAATGTCATGGCAGTGTTCATGCTGCTTTCCTTTCTATTCTTTTTCTCTTCTCCCCCCAGGATGACAAAAACCTTTAACCCACCCTGACTGTGTTGCAATGAGAGTAATTTACTTATTATGGGCTGGTGTTAGGCTTTGTAGCTTGGTGTTGCTTGAGAGGGTGCTCCCAGGGTCTGTGACTCTGAAAGGGCTTCTTTTTGGAGTAAGAGCAATCCTTCATTTTGCAGACTGTCTCAAGGGATGAAAAC\r
+W097         CTCCCCAGTCCTGCTGGTGGGGAGTGAGCAAGCAGCTGCGTGGGGCTTGATCCTGGCTACGGCTAAACCATGACAGAGCCACAGACCACATCCTTCCTTTGCCACTGCTGTTTCTTTGTGATAGTCCAATTACCTCTCAGTGTATCCAATATTCCTCAATTTATAATATCAAGAATTTTTCTTATACTCAAAAAGGTAACACTTTTTATTCTTTTATAGGTTGGCTTTAAATGCAGTCATTTTTCACTTGGTAATGTCATGGCAGTGTTCATGCTGCTTTCCTTTCTATTCTTTTTCTCTTCTCCCCCCAGGATGACAAAAACCTTTAACCCACCCTGACTGTGTTGCAATGAGAGTAATTTACTTATTATGGGCTGGTGTTAGGCTTTGTAGCTTGGTGTTGCTTGAGAGGGTGCTCCCAGGGTCTGTGACTCTGAAAGGGCTTCTTTTAGGAGTAAGAGCAATCCTTCATTTTGCAGACTGTCTCAAGGGATGAAAAC\r
+B097         CTCCCCAGTCCCGCTGGTGGGGAGTGAGCAAGCAGCTGCGTGGGGCTTGATCCTGGCTACGGCTAAACCATGACAGAGCCACAGACCACATCCTTCCTTTGCCACTGCTGTTTCTTTGTGATAGTCCAATTACCTCTCAGTGTATCCAATAGTCCTCAATTTGTAATCTCAATAATTTTTCTTATACTCAAAAAGGTAACACTTTTTATTCTTTTATAGGTTGGCTTTAAATGCAGTCATTTTTCACTTGGTAATGTCATGGCACTGTTCATGCTGCTTTCCTTTCTATTCTTTCTCTCTTCTCCCCCCAGGATGACAAAAACCTTTAACCCACCCTAACTGTGTTGCAATGAGAGTAATTTACCTATTATGGGCTGGTGTTTGTCTTTGTAGCTTGGTGTTGCTTGAGAGGGTACTCCCAGGGCTTGTGACTCTGAAAGGGCTTCTTTTAGGAGTAAGAGCAATCCTTCATTTTGCAGACTGTCTGAAGGGACGAAAAC\r
+O097         CTCCCCAGTCCTGCTGGTGGGGAGTGAGCAGGCAGCTGCGTGGGGCTTGATCCTGGCTACGGCTAAACCATGACAGAGCCACAGACCACATCCTTCCTTTGCCACTGCTGTTTCTTTGTGATAGTCCAATTACCTCTCAGTGTATCCAATAGTCCTCAATTTATAGTCTCAATAATTTTTCTTATACTCAAAAAGGTAACACTTTTTATTCTTTTATAGGTTGGCTTTAAATGCAGTCATTTTTCACTTGGTAATGTCATGGCAGTATTCATGCTGCTTTCCTTTCTATTCTTTCTCTCTTCTCCCCCCAGGATGACAAAAACCTTTAACCCACCCTAACTGTGTTGCAATGAGAGTAATTTACTTACTATGGGCTGGTGTTAGGCTTTGTAGCTTGGTGTTGCTTGAGGGGGTACTCCCAGGGCTTGTGACTCTGAAAGGGCTTCTTTTAGGAGTAAGAGCAATCCTTCATTTTGCAGACTGTCTGAAGGGACGAAAAC\r
+\r
+Q097         AAAGCATAGAGCTTTACAGAAAGGCTGGCAAATATCTCAATTTTTCAGTAGGAGGGTACCTTTTCCAGTAAATAACATGTTCACCTTAAAAATACCTCTACAGAGTTTTTAGTTGAAAAGCTGTGATTCAGAATTAGAAAAGTTGTAGCTGATAATTGGAACAGTTTGTTTTATAAGTTCTGCCCACTGTCAGTTGCCCAGATCGTCTATGTGTAGGACAGCTCCTAGATCGTCCACAGATAAGCCCATGAAAGAGAAGCAGAACACAAGCACCTAAACTGCAAATTCCCACATTAAGGTCTCCAGATAAAACAATGCCAGATTTCAAATTTATGTCTGGCAGTTGGTTTGTTTTTCTCAAAAGTATTAATTTGCATCAGGTGAAGGTAAAAACAGGGACCTGAATCATCTTCTAGCCAGACCAATTAATTATCAATAAAAATGCTGTATGTATTGCATAAGAATTTCATTGATGAAATGTGCAGTGGAGTAAAATCCACTTTCTTTTCTGTAGCGCTGGGGGCTGTTGCCTTTTTACGCAGTAAAATGAGGCTTGGGAAGAGAAAGTGACT\r
+W097         AAAGCATAGAGCTTTACAGAAAGGCTGGCAAATATCTCAATTTTTCAGTAGGAGGGTACCTTTTCCAGTAAATAACATGTTCACCTTAAAAATACCTCTACAGAGTTTTTAGTTGAAAAGCTGTGATTCAGAATTAGAAAAGTTGTAGCTGATAATTGGAACAGTTTGTTTTATAAGTTCTGCCCACTGTCAGTTGCCCAGATCATCTATGTGTAGGACAGCTCCTAGATCGTCCACAGATAAGCCCATGAAAGAGAAGCAGAACACAAGCACCTAAACTGCAAATTCCCACATTAAGGTCTCCAGATAAAACAATGCCAGATTTCAAATTTATGTCTGGCAGTTGGTTTGTTTTTCTCAAAAGTATTAATTTGCATCAGGTGAAGGTAAAAACAGGGACCTGAATCATCTTCTAGCCAGACCAATTAATTATCAATAAAAATGCTGTATGTATTGCATAAGAATTTCATTGATGAGATGTGCAGTGGAGTAAAATCCACTTTCTTTTCTGTAGCGCTGGGGGCTGTTGCCTTTTTACGCAGTAAAATGAGGCTTGGGAAGAGAAAGTGACT\r
+B097         AAAGCATAGAGCTTTACAGAAAGGTTGGCAAATATCTCAATTTTTCAGTAGGAGGGTACCTTTTCCAGTAAATAACATGTTCACCTTAAAAATGCCTCTACAGAGTTTTTAGTTGAAAAGCTGTGATTCAGAATTAGAAAAGTTGTAGCTGATAATTGGAACAGTTTGTTTTAGAAGTTCTGCCCACTGTCAGTTGCCCAGATCGTCTCTGTGTAGGACAGCTCCTAGATCGTCCACAGATAAGCCCATGAAAGAGAAGCAGAACACAAGCACCTAAACTGCAAATTCCCACATTAAGGTTGCCAGATAAAACAATGCCAGATTTCAAATTTATGTCTGGCAGTTGGTTTGTTTTTCTCAAAAGTATTAATTTGCATCAGGTGAAGGTAAAAACAGGGACCTGAATCATCTTCTAGCCAGACCAATTAATTATCAATAAAAATGCCGTATGTATTGCATAAGAATTTCATTGATGAAATGTGCAGTGGAGTAAAATCCACTTTCTTTTCTGTAGCGCTGGGGGCTGTTGCCTTTTTACGCAGTAAAATGAGGCTTGGGAAGAGAAAGTGACT\r
+O097         AAAGCATAGAGCTTTACAGAAAGACTGGCAAAATTCTCAATTTTTCAGTAGGAGGGTACCTTTTCCAGTGAATAACATGTTCACTTTATAAATGCCTCTACAGAGTTTTTAGTTGAAAAGCTGTGATTCAGAATTAGAAAAGTTGTAGCTGATAATTGGAACAGTTTGTTTTAGAAGTTCTGCCCACTGTCAGTTGCCCAGATTGTCTCTGTGTAGGACAGCTCCTAGATGGTCCACAGATAAGCCCATGAAAGAGAAGCAGAACACAAGCACCTAAACTGCAAATTCCCACATTAAGGTCTCCAGATAAAACAATGCCAGATTTCAAATTTATGTCTGGCAGTTGGTTTGTTTTTCTCAAAAGTATTAATTTGCATCAGGTGAAGGTAAAAACAGGGACCTGAATCACCTTCTAGCCAGACCAATTAATTATCAATAAAAATGCAGTATGTATTGCATAAGAATTTAATTGATGAAATGTGCAGTGGAATAAAATCCACTTTCTTTTCTGTAGCGCTGGGGGCTGTTGCCTTTTTACGCAGTAAAATGAGGCTTGGGAAGAGAAAGTGGCT\r
+\r
+Q097         TAGTGATACTAAACAGACTATGTATGTTTTAAAACAAATGTAACTATGTTCCGGTGGATTCCCTGTATAATACTTCCCAGATGTTGGTGGTATAGTTCAAAATCTGGACCTGTGCAGCTGTAGTTACTCTTCTTGACAGTCAGAGTTCCAGTTCTGTATTACTGGCTTTTATAGCAACTGGAGAGAGCCAAGTGGCAGAGCAGTTAACTGTGGATGGATACTGAAAATGTCTGAGAATAGATTAAAACTATCTCCTTTGAAAATGCAGCTGGATGAGGGGAGTAGCTCCAGAGTGAGCTGGCCTGGACTTTGTCTGTGGGTCACTGCTTATACCTGCTCAGAGCACAGAGGATAATTTAGGGTTCAGGCTGGCAGCACGTAGGTTTTGCAGGGAGGGCTGGAGTAAGATTTCTGGTATTTTCTGATCTTCTGTCTGATAGCTGGTGTGTTGAGTTTTTATGCCTCTCCTGCTTGGAAGATGAACTTGGAGTGTAAAAAACTGTTAAGTATAGGGCACTCCACACCACAGCCATCACACTTGTCTGCTTCTCTGCTTTATTGCAGTGAGCAAGTACATGTGTTATTTACAGATA\r
+W097         AAGTGATACTAAACAGACTATGTATGTTTTAAAACAAATGTAACTGTGTTCTGGTGGATTCCCTGTATAATACTTCCCAGATGTTGGTGGTATAGTTCAAAATCTGGACCTGTGCAGCTGTAGTTACTCTTCTTGACAGTCAGAGTTCCAGTTCTGTATTACTGGCTTTTATAGCAACTGGAGAGAGCCAAGTGGCAGAGCAGTTAACTGTGGATGGATACTGAAAATGTCTGAGAATAGATTAAAACTATCTCCTTTGAAAATGCAGCTGGATGAGGGGAGTAGCTCCAGAGTGATCTGGCCTGGACTTTGTCTGTGGGTCACTGCTTATACCTGCTCAGAGCACAGAGGATAATTTAGGGTTCAGGCTGGCAGCATGTAGGTTTTGCAGGGAGGGCTGGAGTAAGATTTCTGGTATTTTCTGATCTTCTGTCTGACAGCTGGTGTGTTGAGTTTTTAAGCCTCTCCTGCTTGGAAGATGAACTTGGAGTGTAAAAAACTGTTAAGTATAGGGCACTCCACACCACAGCCATCACACTTGTCTGCTTCTCTGCTTTATTGCAGTGAGCAAGGACATGTGTTATTTACAGATA\r
+B097         TAGTGATATTAAACAGACTATGTATGTTTTAAAACAAATGTAACTGTGTTCCGGTGGATTCCCTGTATAATACTTCCCAGATGTTGGTGGTATAGTTCAAAATCTGGACCTGTGCAGCTGTAGTTACTCTTCTTGACAGTCAGAGTTCCAGTTCTGTATTACTGGCTTTTATAGCAACTGGAGAGAGCCAAGTGGCAGAGCAGTTAACTGTGGATGGATACTGAAAATGTCTGAGAATAGATTAAAACTATCTCCTTTGAAAATGCAGCTGGATGAGGGGAGTAGCTCCAGAGTGAGCTGGCCTGGACTTTGTCTGTGGGCCACTGCTTATACCTGCTCAGAGCACAGAGGATAATTTAGGGTTCAGGGTGGCAGCACCTAGGTTTTGCAGGGAGGGCTGGAGTAAAATTTCTGGTATTTTCTGATCTCCTGTCTGATAGCTGGTGTGTTGAGTTTTTAAGCCTCTCCTGCTTGGAAGATGAACTTGGAGTGTAAAAAACTGTTAAGTATAGGGCACTTCACACCACAGCCATCACACTTGTCTGCTTCTCTGCTTTATTGCAGTGAGCAAGGACATGTGTTATTTACAGATA\r
+O097         TAGTGATACTAAACAGACTATGTATGTTTTAAAACAAATGTAACTGTGTTCCGGTGGATTCCCTGTATAATACTTCCCAGATGTTGGTGGTATAGTTCAAAATCTGGACCTGTGCAGCTATAGTTACTCTTCTTGACAGTCAGAGTTCCAGTTCTGTATTACTGGCTTTTATAGCAACTGGAGAGAGCCAAGTGGCAGAGCAGTTAACTGTGGATGGATACTGAAAATGTCTGAGAATAGATTAAAACTATCTCCTTTGAAAATGCAGCTGGATGAGGGGAGTAGCTCCAGAGTGAGCTGGCCTGGACTTTGTCTGTGGGTCACTGCTTATACCTGCTCAGAGCACAGAGGATAATTTAGGGTTCAGGCTGGCAGCACCTAGGTTTTGCAGGGAGGGCTGGAGTAAGATTTCTGGTATTTTCTGATCTTCTGTCTGATAGCTGGTGTGTTGAGTTTTTAAGCCTCTCCTGCTTGGAAGATGAACTTGGAGTGTAAAAAACTGTTAAGTATAGGGCACTCCACACCACAGCCATCACACTTGTCTGCTTCTCTGCTTTATTGCAGTGAGCAAGTACATGTGTTATTTACAGATA\r
+\r
+Q097         ATTTCTGATGTTGTTACAGGTTTTACCATGATGGCAAACTCCCTCCAGCATCAGCATCAGAATGTCTTGTACCGTCTACTCTTAATGAAGCACTGCCCACCCAAAACAGGTGAAAGTTTTCCATCCCAGGACAAGGATGGCATCCTGTGACTCAACATCCTTGTACGCTGTAAGTGGTCCAAGTGTGGCTTTCCATGTGAGAGCTGCTGGGTAATCCAAACTCCTAGCTGTGGTAGGAAATGAGCCAGCAGGGATAGCTGAGGCTGAAAAAGATGGGCTGCTTCAAGACACTTCCCAGTGGGACTCTGAAGGGAGCCACTGTCTCTTGCTGAGAAGCAATCCTGTTTCATGAGAGTTGTATTTTGAGCCTTGTGGTTCTTGGCCACATATGAAAATTTCTATATGAAAATTTTGCTGTGAAGCAGAGAGGGTTGGAAAAGTAGGCCCCTCCCTTGTCTTTTGCTAGTCTAGAAATATCATTAGATGTGAAATCACATTCTTAATTTATGCTGGCAGGTGATTAGGGCAGACCCAGCATGAAGTTGCCAATTGCAATATGTGAAAGTTCCTACTAATAATTTGGGTAGGTTTCATTTCTTTAACAACGCTTTGCAACCCATGGGTTATGTGTCTGCCAGACTCCAGCACCT\r
+W097         ATTTCTGATGTTGTTACAGGCTTTACCATGATGGCAAACTCCCTCCAGCATCAGCATCAGAATGTCTTGAACCGTCTACTCTTAATGAAGCACTGCCCACCCAAAACAGGTGAAAGTTTTCCATCCCAGGACAAGGATGGCATCCTGTGACTCAACATCCTTGTATGCTGTAAGTGGTCCAAGTGTGGCTTTCCATGTGAGAGCTGCTGGGTAATCCAAACTCCTAGCTGTGGTAGGAAATGAGCCAGCAGGGACAGCTGAGGCTGAAAAAGATGGGCTGCTTCAAGACACTTCCCAGTGGGACTCTGAAGGGAGCCACTGTCTCTTGCTGAGAAGCAATCCTGTTTCATGAGAGTTGTATTTTGAGCCTTGTGGTTCTTGGCCACATATGAAAATTTCTATATGAAAATTTTGCTGTGAAGCAGAGAGGGTTGGAAAAGTAGGCCCCTCCCTTGTCTTTTGCTAGTCTAGAAATATCATTAGATGTGAAATCACATTCTTAATTTATGCTGGCAGGTGATTAGGGCAGACCCAGCATGAGGCTGCCAATTGCAATATGTGAAAGTTCCTACTAATAATTTGGGTAGGTTTCATTTCTTTAACAACGCATTGCAACCCATGGGTTACGTGTCTGCCAGACTCCAGCACCT\r
+B097         ATTTCTGATGTTGTTACAGGTTTTACCATGATGAAAAACTCCCTCCAGCATCAGCATCAGAATGTCTTGTACCGTCTGCTCTTAATGAAGCACTGCCCACCCAGAACAGGTGAAAGTTTTCCATCCCAGGACAAGGATGGCATCCTGTGACTCAACATCCTTGTATGCTGTAAGTGGTCCAAGTGTGGCTTTCCATGTGAGAGCTGCTGGGTAATCCAGACTCCTAGCTGTGGTAGGAAATGAGCCAGCAGGGATAGCTGAGGCTGAAAAAGATGGGCTGCTTCAAGACACTTCCCAGTGGGACTCTGAAGGGAGCCACTGTCTCTTGCTGAGAAGCAATCCTGTTTCATGAGAGTTGTATTTTGAGCCTTGTGGTTCTTGGCCACATATGAAAATTTCTATATGAAAATTTTGCTGTGAAGCAGAGAGGGTTGGAAAAGTAGGCCCCCCCCTTGTCTTTTGCTAGTCTAGAAATATCATTAGATGTGAAATCACATTCTTAATTTATGCTGGCAGGTGATTAGGGCAGACCCAGCATGAGGCTGCCAATTGCAATATGTGAAAGTTCCTACTAATAATTTGGGTAGGTTTCATTTCTTTAACAACGCATTGCAACCCATGGGTTACGTGTCTGCCAGACTCCAGCACCT\r
+O097         ATTTCTGATGTTGTTACCGGTTTTACCATGATGGCAAATTCCCTCCAGCATCAGCATCAGAATGTCTTGTACCGTCTGCTCTTAATGAAGCACTGCCCACCCAAAACAGGTGAAAGTTTTCCATCCCAGGACAAGGATGACATCCTGTGACTCAACATCCTTGTATGCTGTAAGTGGTCCAAGTGTGGCTTTCCATGTGAGAGCTGCTGGGTAATCCAAACTCCTTGCTGTGGTAGGAAATGAGCCAGCAGGGATAGCTGAGGCTGAAAAAGATGGGCTGCTTCAAGACACTTCCCAGTGGGACTCTGAAGGGAGCCACTGTCTCTTGCTGAGAAGCAATCCTGTTTCATGAGAGTTGTATTTTGAGTCTTGTGGTTCTTGGCCACATATGAAAATTTCTATATGAAAATTTTGCTGTGAAGCAGAGAGGGTTGGAAAAGTAGGCCCCTCCCTTGTCTTTTGCTAGTCTAGAAATATCATTAGATGTGAAATCACATTCTTAATTTATGCTGGCAGGTGATTAGGGCAGACCCAGCATGAGGCTGCCAATTGCAATGTGTGAGAGTTCCTACTAATAACTTGGGTAGGTTTCATTTCTTTAACAACGCATTGCAACCCATGGGTTACGTGTCTGCCAGACTCCAGCACCT\r
+\r
+\r
+Q097         CTGTGTATAGTCCTAAAGTGATAAAAATTACATATGACTAGGACGTCTTTCACCTGCCTCAAAAAGAGCAAAAGGTCAAATTTGATTCTAGATGGTCACATAGGCTTTCAGCCTTGAACATGATGTTTTTCTTAAATGTCAGTGATGACATGAAAGGACAGATACCTAAGTAGCCACTTATTCTTAATTCTACCAGAGGGACAAACAGGATATATTTAATTTAATTGACTGATATTCTCACTTTCAGAAAGTGGAACCAGTTATAGGTTATCCAATTTTCTCTTTTGGACTTGTATCTGACATAATTGTGATAGTGTAACAGAACGAAGTGGCAAAATCCACCCCTTCCATGAAGAAATCTAGAGAAAAAAACCTGGTTAGGGCCTTCTCATTCTCTACAATTACCTGAAAGGAGATTGTGATGAGGTAAATGTTTGTCTCTTCTCCCTAGTTACAAGAGAAGAAATGGCTTCGAGCTGTGCCAGGGGGAATTTAGACTGAATATTAGGAAATCTTTTTTCATGAGAAGGGCTGTCAAGCATTGGTACAGGCTGCCCAGATAATCAATTTATTCACCATCCCTGGATGTATTTCAAATGTGTAGATATGGCACTTAGGGATATGGTCTAGTGATAGACT\r
+W097         CTGTGTATAGTCCTAAAGTGATAAAAATTACATATGACTAGGATGTCTTTCACCTGCCTCAAAAAGAGCAAAAGGTCAAATTTGATTCTAGATGGTCACATAGGCTTTCAGCCTTGAACATGATGTTTTTCTTAAGTGCCAGTGATGACATGAAAGGACAGATACCTAAGTAGCCACTTATTCTTAATTCTACCAGAGGGACAAACAGGATATATTTAATTTAATTGACTGATATTCTCACTTTCAGAAAGTGGAACCAGTTATAGGTTATCCAATTTTCTCTTTTGGACTTGTATCTGACATAATTGTGATAGTGTAACAGAACGAAGTGGCAAAATCTACCCCTTCCATGAAGAAATCTAGAGAAAAAAACCTGGTTAGGGCCTTCTCATTCTCTACAATTACCTGAAAGGAGATTGTGATGAGGTGAATGTTTGTCTCTTCTCCCTAGTTACAAGAGAAGAAATGGCTTCGAGCTGTGCCAGGGGGAATTTAGACTGAATATTAGGAAATTTTTTTTCATGAGAAGGGCTGTCAAGCATTGGTACAGGCTGCCCAGATAATCAATTTATTCACCATCTCTGGATGTATTTCAAATGTGTAGATATGGCGCTTAGGGATATGGTCTAGTGATAGACT\r
+B097         CTGTGTATAGTCCTAAAGTGATAAAAATTACATATGACTAGGATGTCTTTCACCTGCCTCAAAAAGAGCAAAAGGTCAAATTTGATTCTAGATGGTCACATAGGCTTTCAACCTTGAACATGATGTTTTTCTTAAATGTCAGTGATGACATGAAAGGACAGATACCTAAGTAGCCACTTATTCTTAATTCTACCAGAGGGACAAACAGGATATATTTAATTTAATTGACTGATATTCTCACTTTCAGAAAGTGGAACCAGTTATAGGTTATCCAATTTTCTCTTTTGGACTTGTATCTGACATAATTGTGATAGTGCAACAGAACGAAGTGGCAAAATCCACCTCTTCCATGAAGAAATCTAGAGAAAAAAACCTGGTTAGGGCCTTCTCATTCTCTACAATTACCTGAAAGGAGATTGTGATGAGGTGAATGTTTGTCTCTTCTCCCTAGTTACAAGAGAAGAAATGGCTTCGAGCTGTGCCAGGGGGAATTTAGACTGAATATTAGGAAATTTTTTTTCATGAGAAGGGCTGTCAAGCATTGGTACAGGCTGCCCAGATAATCAATTTATTCACCATCCCTGGATGTATTTCAAATGTGTAGATATGGCGCTTAGGGATATGGTCTAGTGATAGACT\r
+O097         CTGTGTATAGTCCTAAAGTGATAAAAATTACATATGACTAGGACGTCTTTCACCTACCTCAAAAAGAGCAAAAGGTCAAATTTGATTCTAGATGGTCACATAGGCTTTCAGCCTTGAACATGATGTTTTTCTTAAATGTCAGTGATGACATGAAAGGACAGATACCTAAGTAGCCACTTATTCTTAATTCTACCAGAGGGACAAACAGGATATATTTAATTTAATTGACTGATATTCTCACTTTCAGAAAGTGGAACCAGTTATAGGTTATCCAATTTTCTCTTTTGGACTTGTATCTGACATAATTGTGATAGTATAACAGAACCAAGTGGCAAAATCCACCCCTTCCATGAAGAAATCTAGAGAAAAAAACCTGATTAGGGCCTTCTCATTCTCTACAATTACCTGAAAGGAGATTGTGATGAGGTGGATGTTTGTCTCTTCTCCCTAGTTACAAGAGAAGAAATGACTTCAGGCTGTGCCAGGGGGAATTTAGACTGAATATTAGGAATTTTTTTTTCATGAGAAGGGCTGTCAAGCATTGGTACAGGCTGCCCAGATAATCAATTTATTCACCATCCCTGGATGTATTTCAAATGTGTAGATGTGGTGCTTAGGGATATGGTCTAGTGATAGACT\r
+\r
+Q097         TTCCTGACCATTCAGTAAGCAAGTCATCTCTGCGCAGGAACCCACACAGTTTAAAAGCAGCATAATTCCCATTTATTCCTTCAAACAATTATTTTAAATTCCTCTTGCAGTGAGAGAACAGCCTTAAAATAGGCTCCATACTTGAACATTAGTTCCAGCAAAGCAGATTCCAGTGAATTGTGAGGCATTTCTGTCACCTGGTGCCAAACCCAGCCACTCTGATGTTAAGATAAAAACATCCTGAATCTGCCCAGCAGGATAAGAAAAACATATTTTGTGTTGCTTACACTCTCACTGGTTCCTTGCCAAAAAGACAGTGTTTTTAAAACTTGTAAACTATTCACTTTTCTAACTTAAGCATTGCAATGTTTTTAACCTTTCCATCGAGTTTCTGGGGATGCTCTGGTGGTCCATGGCAGAGTGTGGACCCTGGCAGTCACCTCTTATTTAAATTATGGGAGAATCCAAAGAAAAGAGATGTTAATGAGGAGGGAACAATCTCTCCAGACACATTGTTCATAGCACATATTGATTTCTAGCATGTCATGGCGAGAATTCATTTATGCTTTTTACATTTTTAACAACCTGGCTATTTTTACTCTCCTCATCCTCTCAA\r
+W097         TTCCTGACCATTCAATGAGCAAGTCATCTCTGTGCAGGAACCCACACAGTTTAAAAGCAGCATAATTCCCATTTATTCCTTCAAACAATTATTTTAAATTCCTCTTGCAGTGAGAGAACAGCCTTAAAATAGGCTCCATACTTGAACATTAGTTCCAGCAAAGCAGATTCCAGTGAATTGTGAGGCATTTCTGTCACCTGGTGCCAAACCCAGCCACTCTGATGTTAAGATAAAAACATCCTGAATCTGCCCAGCAGGATAAGAAAAACATATTTTGTGTTGCTTACACTCTCACTGGTTCCTTGCCAAAAAGACAGTGTTTTTAAAACTTTTAAACTATTCACTTTTCTAACTTAAGCATTGCAATGTTTGTAACATTTCCATCCAGTTTCTGGGGATGCTCTGGTGGTCCATGGCAGAGTGTGAACCCTGGCAGTCACCTCTTATTTAAATTATGGGAGAATCCAAAGAAAAGAGATGTTAATGAGGAGGGAACAATCTCTCCAGACACATTGTTCATAGCACATATTGATTTCTAGCATGTCACGGCGAGAATTCATTTATGCTTTTTACATTTTTAACAACCTGGCTATTTTTACTCTCCTCATCCTCTCAA\r
+B097         TTCCTGACCATTCAGTGAGCAAGTCATCTCTGTGCAGGAACCCACACAGTTTAAAAGCAGCATAATTCCCATTTATTCCTTCAAACAATTATTTTAAATTCCTCTTGCAGTGAGAGAACAGCCTTAAAATAGGCTCCATACTTGAACATTAGTTCCAGCAAAGTAGATTCCAGTGAATTGTGAGGCATTTCTGTCACCTGGTGCCAAACCCAGCCACTCTGATGTTAAGATAAAAACATCCTGAATCTGCCCAGCAGGATAAGGAAAACATATTTTGTGTTGCTTACACTCTCACTGGTTCCTTGCCAAAAAGACAGTGTTTTTAAAACTTGTAAACTATTCACTTTTCTAACTTAAGCATTGCAATGTTTGTAACCTTTCCATCCAGTTTCTGGGGATGCTCTGGTGGTCCATGGCAGAGGCTGGACCCTGGTAGTCACTTCTTATTTAAATTATGGGAGAATCCAAAGAAAAGAGATGTTAATGAGGAGGGAACAATCTCTCCAGACACATTATTCATAGCACATATTGATTTCTAGCATGTCATGGCGAGAATTCATTTATGCTTTTTACATTTTTAACAACCTGGCTATTTTTACTCTCCTCATCCTCTCAA\r
+O097         TTCCTGACCATTCAGTGAGCAAGTAATTCTTGTGCAGGAACCCACACAGTTTAAAAGCAGCATAATTCCCATTTATTCCTTCAAACAATTATTTTAAATTCCTCTTGCAGTGAGAGAACAGCCTTAAAATAGGCTCCATACTTGAACATTAGTTCCAGCAAAGCAGATTCCAGTGAATTGTGAGGCATTTCTGTCACCTGGTGCCAAACCCAGCCACTCTGATGTTAAGATAAAAACATCCTGATTCTGCCCAGCAGGATAAGGAAAACATATTTTGTGTTGTTTACACTCTCATTGGTTCCTTGCCAAAAAGACAGTGTTTTTAAAACTTTTAAACTATTCCCTTTTCTAACTTAAGCATTGCAATGTTTGCAACCTTTCCATCCAGTTTCTGGGGATGCTCTGGTGGTCCATGGCAGAGGCTGGACCCTGGCAGTCACCTCATATTTAAATTATGGGAGAATCCAAAGAAAAGAGATGTTAATGAGGAGGGAACAATCTCTCCAGACACATTGTTCATAGCACATATTGATTTCTAGCATGTCATGGCGAGAATTCATTTATGCTTTTTACATTTTTAACAACCTGGCTATTTTTACTCTCCTCATCCTCTCAA\r
+\r
+Q097         ATATTTACAGAGCTACAGCAGTGATTAATAACAGGAGTTACTTACCAGCTCCCCCCACCCTGAATTTAAAAGTCCATACTTACCAGAAGACATGGCTACAAGCTGTTCACCTTTTAGCTGTGTTTCTGCAGACTCCAGTGCTGCTTCCAGCCTGCTCACTAACATTTGCAGTCACTTTAGACATCCTGTGCTGGGATAGATGCTGCCTGATGTGAGCTTGATCTCACAAAATCACTTAAAAAGAAAAGCCTGGTGAGTACTGCCTTACGCCCAGACCTTTCTGCCTTTGCTCCAGTTTGCCACAATTGCTGTGCTAAAGCGATTCCTCAGGCTGGGGCAGTACTCTAAGAGCAGATTAATTTGTCACTGACTGCAAAGGGAGGCAAGGGGAGAGGAGGAAGAGTTCTCTCCCTGCTCTCAAATCCCCTCTGAGGTCCCCAAACTGCGGCGCTGACACCGGCATGGGGGCACAGCTTCCTCCAGTCAGGCCTACTGTAGTGCCGGCTGCTCCCGGCATGGCAGCTCCCAACTTATCCCTCAAACACAAAAGCATCTGTTCCTCCAAAAGTTTC\r
+W097         ATATTTACAGAGCTACAGCAGTGATTAATAACAGGAGTTACTTACCAGCTCCCCCCACCCTGAATTTAAAAGTCCATACTTACCAGAAGACATGGCTACAAGCTGTTCACCTTTTAGCTGTGTTTCTGCAGACTCCGGTGCTGCTTCCAGCCTGCTCACTAACATTTGCAGTCACTTTAGACATCCTGTGCTGGGATAGATGCTGCCTGATGTGAGCTTGATCTCACAAAATCACTTAAAAACAAAAGCCTGGTGAGTACTGCCTTACGCCCAGACCTTTCTGCCTTTGCTCCAGTTTGCCACAATTGCTGTGCTAAAGCGATTCCTCAGGCTGGGGCAGTACTCTAAGAGCAGATTAATTTGTCACTGACTGCAAAGGGAGGCAAGGGGAGAGGAGGAAGAGTTCTCTCCCTGCTCTCAAATCCCCTCTGAGGTCCCCAAACTGCGGCGCTGACACCGGCATGGGGGCACAGCTTCCTCCAGTCAGGCCTACTGTAGTGCCGGCTGCTCCCGGCATGGCAGCTCCCAACTTATCCCTCAAACACAAAAGCATCTGTTCCTCCAAAAGTTTC\r
+B097         ATATTTACAGAGCTACAGCAGTGATTAATAACAGGAGTTACTTACCAGCTCCCCCCACCCTGAATTTAAAAGTCCATACTTACCAGAAGACATGTCTACAAGCTGTTCACCTTTTAGCTGTGTTTCTGCAGACTCCAGTGCTGCTTCCAGCCTGCTCACTAACATTTGCAGTCACTTTAGACATCCTGTGCTGGGATAGATGCTGCCTGATGTGAGCTTGATCTCACAAAATCACTTAAAAAGAAAAGCCTGGTGAGTACTGCCTTATGCCCAGACCTTTCTGCCTTTGCTCCAGTTTGCCACAATTGCTGTGCTAAAGCGATTCCTCAGGCTGGGGCAGTACTCTAAGAGCAGATTAATTTGTCACTGACTGCAAAGGGAGGCAAGGGGAGAGGAGGAAGAGTTCTCTTCCTGCTCTCAAATCCCCTCTGAGGTCCCCAAACTGCGGCACTGACACCGGCATGGGGGCACAGCTTCCTCCAGTCAGGCCTACTGTAGTGCCGGCTGCTCCCGGCATGGCAGCTCCCAACTTATCCCTCAAACACAAAAGCATCTGTTCCTCCAAAAGTTTC\r
+O097         ATATTTACAGAGCTATAGCAGTGATTAATAACAGGAGTTACTTACCAGCTCCCCCCACCCTGAATTTAAAAGTCCATACTTACCAGAAGACATGGCTACAAGCTGTTCACCTTTTAGCTGTGTTTCTGCAGACTCCAGTGCTGTTTCCAGCCTGCTCACTAACATTTGCAGTCACTTTAGACATCCTGTGCTGGGATAGATGCTGCCTGATGTGAGCTTGATCTCACAAAATCACTTAAAAAGAAAAGCCTGGTGAGTACTGCGTTACGCCCAGACCTTTCTGCCTTTGCTCCAGTTTGCCACAATTGCTGTGCTAAAGCGATTCCTCAGGCTGGGGCAGTACTCTAAGAGCAGATTAATTTGTCACTGACTGCAAAGGGAGGCAAGTGGAGAGGAGGAAGAGTTCTCTCCCTGCTCTCAAATCCCCTCTGAGGTCCCCAGACTGCGGCGCTGACACCGGCATGGGGGCACAGCTTCCTCCAGTCAGGCCTACTGTAGTGCCGGCTGCTCCCGGCATGGCAGCTCCCAACTTATCCCTCAAACACAAAAGCATCTGTTCCTCCAAAAGTTTC\r
+\r
+Q097         CATAGATATATTTGTGTAATTATAGGGTGAGTGATTAATGATGAGGCAACATTAGGAACAGCCCAAATCTTTGTTCCTGTCAGCATATCAGAAAGCTAATACAGAAACTTGTGCAGAAGGACATCAGCAAAGTGAATGAAATACAAAAAAACAGAAGCAGTTTAAAGATATGGCTAAGGAAAAAGAGTAAGACAATAATGAAGAGATTAGAGTACAAATAATCCCAATTGTCATGCAAAGAGGTTGTATCTTTCTTCCATTTAAGTAGAGTAACAAGTTAATTATAAAAATTCAGCTAAATGTCAAGAGGTCACCATGAATAGGAAGACAAAAGCATGAAATCCAATTTAAACCAAATTTTCTTATTGCTAAAAACTGACCCAAAAAAAGGTAACCCTCCCAAAA\r
+W097         CATAGTTATATTTGTGTAATTGTAGGGTGAGTGATTAATGATGAGGCAACATTAGGAACAGCCCAAATCTTTGTTCCTGTCAGCATTTCAGAAAGCTAATACAGAAACTTGTGCAGAAGAACATCAGCAAAGTGAATGAAACACAAAAAAACAGGAGCAGTTTAAAGATATGGCTAAGGAAAAAGAGTAAGACAATAATGAAGAGATTAGAGTACAAATAATCCCAATTGTCATGCAAAGAGGTTGTATCTTTCTTCCATTTAAGGAGAGTAACAAGTTAATTATAAAAATTCAGCTAAATGTCAAGAGGTCACCATGAATAGGAAGACAAAAGCATGAAATCCAATTTAAACCAATTTTTCTTATTGCTAAAAACTGACCCAAAAAAAGGTAACCCTCCCAAAA\r
+B097         CATAGATATATTTGTGTAATTATAGGGTGAGTGATTAATGATGAGGCAACATTAGGAACAGCCCAAATCTTTGTTCCTGTCAGCATATCAGAAAGCTAATACAGAAACTTGTGCAGAAGGACATCAGCAAAGTGAATGAAATACAAAAAAACAGAAGCAGTTTAAAGATATGGCTAAGGAAAAAGAGTAAGACAATAATGAAGAGATTAGAGTACAAATAATCCCAATTGTCATGCAAAGAGGTTGTATCTTTCTTCCATTTAAGTAGAGTAACAAGTTAATTATAAAAATTCAGCTAAATGTCAAGAGGTCACCATGAATAGGAAGACAAAAGCATGAAATCCAATTTAAACCAAATTTTCTTATTGCTAAAAACTGACCCAAAAAAAGGTAACCCTCCCAAAA\r
+O097         CAGACTTATATTTGTGTAATTATAGGGTGAGTGATTAATGATGAGGCAACATTAGGAACAGCCCAAATCTTTGTTCCTGTCAGCATTTCAGAAAGCTAATACAGAAACTTGTGCAGAAGAACATCAGCAAAGTGAATAAAACACAAAAAACCAGGAGCAGTTTAAAGATACGGCTAAGGAAAAAGAGTAAGACAATAATGAAGAGATTAGAGTACAAATAATCCCAATTGTCATGCAAAGAGGTTGTATCTTTCTTCCATTTAAGGAGAGTAACAAGTTAATTATAAAAATTCAGCTAAATGTCAAGAGGTCACCATGAATAGGAAGACAAAAGCATGAAATCCAATTTAAACCAATTTTTCTTATTGCTAAAAACTGACCCAAAAAAAGGTAACCCTCCCAAAA\r
+\r
+Q097         ATCCCATAAAAAACTTCAGCAGCACTCAGTCCAAACCCACTATTTAGGTTTCTTCTTGGGAAAAAAAAGGCAGCAAATTGTGATGATTAATGTGGAAGTCCCAGGGAAAGCAATGGGTATAAAGGGCTCTTCATTTTTGACAGGTGCATTGTGCACTCTGGGCTCCCAGCCAAGACACATTGTCATCAAATGTTAATCAAATCTGCAAATAATATACAAAGTATTAAATTGTGCTTATTCTCAGAGTAATTTGAGACATAAATTTATCAAGCTGTGCTATATGTTAAGGTCCCTTAAAATGAAGAAAATCAGGACTATGAGGCAGATAAAGAGATTGGGACAACAAAGGGCTTTCTGTGAGCCCTGGTTCAGGAGAACTCCTCTCTGTATTTTCCTTCAGAAAAGGTTCTGATGTAACCAAGTAAATCCACAAGTAAAGAGAAGCAGGCTGGGATGAGAAAACATGTGAAACCTCTCTGCAGCTGCACACTTAAAATAGTAATTTCAGTTTTCTGCATGTGGCTGTGCCCTTCCTCACCAGGACTGTGGCTGCAGGTCCCACCCCCCAGCAGTTATTCGCACCTGAGAAAAACATCTGTATTAGCATAAGAAACTCAGTTTTCAGGCAGGAGGACTTTTTGCA\r
+W097         ATCCCATAAAAAACTTCAGCAGCACTCAGTCCAAACCCACTATTTAAGTTTCTTTTTGGGAAAAAAAAGGCAGCAAATTGTGATGATTAATGTGGAAGTCCCAGGGAAAGCAATGGGTATAAAGAGCTCTTCATTTTTGACAGGTGCATTGTGCACTCTGGGCTCCCAGCCAAGACACATTGTCATCAAATGTTAATCAAATCTGCAAATAATATACAAAGTATTAAATTGTGCTTATTCTCAGAGTAATTTGAGACATAAATTTATCAAGCTGTGCTATATGTTAAGGTCCCTTAAAATGAAGAAAATCAGGACTATGAGGCAGATAAAGAGATTGGGACAACAAAGGGCTTTCTGTGAGCCCTGGTTCAGGAGAACTCCTCTCCGTATTTTCCTTCAGAAAAGGTTCTGATGTAAACAAGTAAATCCACAAGTAAAGAGAAGCAGGCTGGGATGAGAAAACATGTGAAACCTCTCTGCAGCTGCACACTCAAAATAGTAATTTCAGTTTTCTGCATGTGGCTGTGCCCTTCCTCACCAGAACTGTGGCTGCAGGTCCCACCCCCCAGCAGTTATTCGCACCTGAGAAAAACATCTGTATTAGCATAAGAAACTCAGTTTTCAGGCAGGAGGACTTTTTGCA\r
+B097         ATCCCATAAAAAACTTCAGCAGCACTCAGTCCAAACCCACTATTTAGGTTTCTTTTTGGGAAAAAAAAGGCAGCAAATTGTGATGATTAATGTGGAAGTCCCAGGGAAAGCAATGGGTATAAAGGGCTCTTCATTTTTGACAGGTGCATTGTGCACTCTGGGCTCCCAGCCAAGACACATTGTCATCAAATGTTAATCAAATCTGCAAATAATATACAAAGTATTAAATTGTGCTTATTCTCAGAGTAATTTGAGACATAAATTTATCAAGCTGTGCTATATGTTAAGGTCCCTTAAAATGAAGAAAATCAGGACTATGAGGCAGATAAAGAGATTGGGACAACAAAGGGCTTTCTGTGAGCCCTGGTTCAGGAGAACTCCTCTCAGTATTTTCCTTCAGAAAAGGTTCTGATGTAAACAAGTAAATCCAAAAGTAAAGAGAAGCAGGCTGGGATGAGAAAACATGTGAAACCTCTCTGCAGCTGCACACTCAAAATAGTAATTTCAGTTTTCTGCATGTGGCTGTGCCCTTCCTCACCAGGACTGTGGCTGCAGGTCCCACCCCCAAGCAGTTATTCGCACCTGAGAAAAACATCTGTATTAGCATAAGAAACTCAGTTTTCAGGCAGGAGGACTTTTTGCA\r
+O097         ATCCCATAAAAAACTTCAGCAGCACTCAGTCCAAACCCACTATTTAGGTTTCTTTTTGGGAAAAAAAAGGCAGCAAATTGTGATGATTAATGTGGAAGTCCCAGGGAAAGCAATGGGTATAAAGGGCTCTTCATTTTTGACAGGTGCATTGTGCACTCTGGGCTCCCAGCCAAGACACATTGTCATCAAATGTTAATCAAATCTGCAAATAATATACAAAGTATTAAATTGTGCTTATTCTCAGAGTAATTTGAGACATAAATTTATCAAGCTGTGCTATATGTTAAGGTCCCTAAAAATGAAGAAAATCAGGACTATGAGGCAGATAAAGAGATTGGGACAACAAAGGGCTTTCTGTGAGCCCTGGTTCAGGAGAACTCCTCTCAGTATTTTCCTTCAGAAAAGGTTCTGATGTAAACAAGTAAATCCACAAGTAAAGAGAAGCAGGCTGGGATGAGAAAACATGTGAAACCTCTCTGCAGCTGCACACTTAAAATAGTAATTTCAGTTTTCTGCATGTGGCTGTGCCCTTCCTCACCAGGACTGTGGCTGCAGGTCCCACCCCCCAGCAGTTATTTGCACCTGAGAAAAACATCTGTATTAGCATAAGAAACTCAGTTTTCAGGCAGGAGGACTTTTTGCA\r
+\r
+Q097         GGATTTCATAGACTCTACTCAGTAGAATACTCTAACATTGGGAATTAACTGGAGTGCTTTTTCTTTTGACCAAGCATATCAAAGTCTGGTTTCAATGTGTAATAAAACCAGAATGATACCTATGGGACAAAGGGCAAGACACATCTTGAACTGGCATGGTGAAATTATCTGTAAGCATGTAGATTGAAAGGAAATAGCTCATACACATCCAATGGGAGAAAAATAATTACGGTGTTCTAGTGTTGGGTTATGAAAACAGAGGCAGGAGAAGCCCTTAGCTGGGCAGGTTGTCAAACCAAAGAAAAAAAAATATCCATTACTTCCAAAATAAAGCTCCTCAGATTATTCTGCTGGTTGCACACAGTGATTATCTCCTGCCTTTGAAATGAGATCTGATTTTGCTCTGGGGTCTGGTGAGTCCAACTCACCTTTAAAGGTCCAACCCCCTCGCA\r
+W097         GGATTTCATAGACTCTACTCAGTAGAATATTCTAACATTGGGAATTAACTGGAGTGCTTTTTCTTTTGACCAAGCAAGTCAAAGTCTGGTTTCAATGTGTAATAAAACCAGAATGATACCTATGGGACAAAGGGCAAGACACATCTTGAACTGGCATGGTGAAATTATCTGTAAGCATGTAGATTGAAAGGAAATAGCTCATACACATCCAATGGGAGAAAAATAATTACAGTGTTCTAGTGTTGGGTTATGAAAACAGAGGCAGGAGAAGCCCTTAGCTGGGCAGGTTGTCAAACCAAAGGAAAAAAAATATCCATTACTTCCAAAATAAAGCTCCTCAGATTATTCTGCTGGTTGCACACAGTGATTATCTCCTGCCTTTGAAATGAGATCTGATTTTGCTCTGGGGTTTGGTGAGTCCAACTCACCTTTAAAGGTCCAACCCCCTCGCA\r
+B097         GGATTTCATAGACTCTACTCAGTAGAATATTCTAACATTGGGAATTAACTGGAGTGCTTTTTCTTTTGACCAAGCATGTCAAAGTCTGATTTCAATGTGTAATAAAACCAGAATGATCCCTATGGGACAAAGGGCAAGACACATCTTGAACTGGCATGGTGAAATTACCTGTAAGCATGTAGATTGAAAGGAAATAGCTCATACACATCCAATGGGAGAAAAATAATTATGGTGTTCTAGTGTTGGGTTATGAAAACAGAGGCAGGTGAAGCCCTTAGCTGGGCAGGCTGTCAAACCAAAGAAAACAAAATATCCATTACTTCCAAAATAAAGCTTCTCAGATTATTCTGCTGGTTGCACACAGTGATTATCTCCTGCCTTTGAAATGAGATCTGATTTTGCTCTGGGGTTTGGTGAGTCCAACTCACCTTTAAAGGTCCAACCCCCTCGCA\r
+O097         ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+\r
+Q097         CATTTCTGCATCTTCTGCTTCTTGCTGAGTTGAGTTATAAAATATTAGAAAAGCCATATTGCACAGCTTTTAGCCACTAATATATATGTGCAATCTTAAATATCAACAGCTTCAGCCATTTTTTGTTAATGTTAGGTCTGGATGTGATTTCTTAACTAAAGACAGCTTCCTTAGCTTACCTCATATCATGGCATCTGGTATCTCTAATTGGAATCATTTTCATAATAACCATGAGCAATATACATTACCATCTAAATATGAAGGCTGACTGCAATACAGACTTGTCTACAGCTTTTTAAGTATCCAGGATCCTGTCCAAAGCCCCTTAGACTCGAGGGAAAGACTCCTGCTGATGTATCTTATTTAAATTAGGTGCAATGTACTAAAAAACTCTCCTAGATTCCATATAGGAAACCAGAAATCTATTCCATAATAGTAATAACAATAATCAGTGTAACTCTGTCAAACCCCTCCAAAGGTGGTGTCCCATTGTGTCACTAAATCAGGCCTAATTTAGTCA\r
+W097         CATTTCTGCATCTTCTGCTTCTTGCTGAGTTGAGTTATAAAATATTAGAAAAGCCATATTGCACAGCTTTTAGCCACTAATATATATGTGCAATCTTAAATATCAACAGCTTCAGCCATTTTTTGTTAATGTTAGGTCTGGATGTGATTTCTTAACTAAAGACAGCTTCCTTAGCTTACCTCATATCATGGCATCTGGTATCTCTAATTGGAATCATTTTCATAATAACCATGAGCAATATACATTACCATCTAAATATGAAGGCTGACTGCAATACAGACTTGTCTACAGCTTTTTAAGTATCCAGGATCCTGTCCAAAGCCCCTTAGACTCGAGGGAAAGACTCCTGCTGATATATCTTATTTAAATTAGGTGCAATGTATTAAAAAACTCTCCTAGATTCCATATAGGAAACCAGAAATCTATTCAATAATAGTAATAACAATAATCAGTGTAACTCTGTCAAACCCCTCCAAAGGTGGTGTCCCATTGTGTCACTAAATCAGGCCTAATTTAGTCA\r
+B097         CATTTCTGCATCTTCTGCTTCTTGCTGAGTTGAGTTATAAAATATTAGAAAAGCCATATTGCACAGCTTTTAGCCACTAATATATATGTGCAATCTTAAATATCAACAGCTTCAGCCATTTTTTGTTAATGTTAGGTCTGGATGTGATTTCTTAACTAAAGACAGCTTCCTTAGCTTACCTCATATCATGGCATCTGGTATCTCTAATTGGAATCATTTTCATAATAACCATGAGCAATATACATTACCATCTAAATATGAAGGCTGACTGCAATACAGACTTGTCTACAGCTTTTTAAGTATCCAGGATCCTGTCCAAAGCCCCTTAGACTCGAGGGAAAGACTCCTGCTGATATATCTTATTTAAATTAGGTGCAACGTACTAAAAAACTCTCCTAGATTCCATATAGGAAACCAGAAATCTATTCAATAATAGTAATAACAATAATCAGTGTAACTCTGTCAAACCCCTCCAAAGGTGGTGTCCCATTGTGTCACTAAATCAGGCCTAATTTAGTCA\r
+O097         CATTTCTGCATCTTCTGCTTCTTGCTGAGTTGAGTTATAAAATATTAGAAAAGCCATATTGCACAGCTTTTAGCCACTAATATATATGCGCAATCTTAAATATCAACAGCTTCAGCCATTTTTTGTTAATGTTAGGTCTGGATGTGATTTCTTAACTAAAGACAGCTTCCTTAGCTTACCTCATATCATGGCATCTGGTATCTCTAATTGGAATCATTTTCATAATAACCATGAGCAATATACATTACCATCTAAATATGAAGGCTGACTGCAATACAGACTTGTCTACAGCTTTTTAAGTATCCAGGATCCTGTCCAAAGCCCCTTAGACTCGAGGGAAAGACTCTTGCTGATATATCTTATTTAAATTAGGTGCAACGTATCAAAAAACTCTCCTAGATTCCATATAGGAAACCAGAAATCTATTCAATAATAGTAATAACAATAATCAGTGTAACTCTGTCTAACCCCTCCAAAGGTGGTGTCCCATTGTGTCACTAAATCAGGTCTAATTTAGTCA\r
+\r
+Q097         TGAATTCTTCTCAGTCTCCATTCGTTTGATAGCTTCCAAAATAAGGGTGGTATATGCCTTAGGTACTATATTTACCACAAGAAGGTCATTCCACAAAGCTGCTGGATCTCTCCATTGATCCAACTCTCGCCATTTGATACTCCTCCTGTTGTCTGTGAGACCAAAGAAACCACTAACATGAACTGGAAGTCCAGTTTTGCTTTCTTCACCTGGAGGCAAAGGCAGAAAACAGAAAGCTCTTCCTGAAAAGTCTGCTACAGCTCCATTTTCCTCCTCGTTAGCTGCTAAAGACATTGCTATTCCAATAGTAGGAACAAATTTCAAGTCATCAGCTAAACAATCCAGTTCTGTGCACATTCCTCGACCACCCACACAATTACACACTAACCAAGATGTTTTCTGTGCGTCCTTAACACTCTCATCTTCTACAACTATATTTACATGGTATGTCACACATGTTATGCTATTGCTTGGAACTCTCTTACAGTACTGATTTATTGCAGTTCCCAGGATTTTGATAGAATTGGGTCTTTCGTGTTTCAAGGCCTTGTTCTCGCTGGCAGTTACTCTAAACACCAGCCTCTCTGTTCCATCAGCTTCCCGAACGTGCAATGAAACATCCTGAACACTCTTCAGGAAAAGCAATAC\r
+W097         TGAATTCTTCTCAGTCTCCATTCGTTTGATAGCTTCCAAAATAAGGGTGGTATATGCCTTAGGTACTATATTTACCACAAGAAGGTCATTCCACAAAGCTGCTGGATCTCTCCATTGATCCAACTCTCGCCATTTGATACTCCTCCTGTTGTCTGTGAGACCAAAGAAACCACTAACATGAACTGGAAGTCCAGTTTTGCTTTCTTCACCTGGAGGCAAAGGCAGAAAACAGAAAGCTCTTCCTGAAAAGTCTGCTACAGCTCCATTTTCCTCCTCGTTAGCTGCTAAAGACATTGCTATTCCAATAGTAGGAACAAATTTCAAGTCATCAGCTAAACAATCCAGTTCTGTGCACATTCCTCGACCACCCACACAATTACACACTAACCAAGATGTTTTCTGTGCGTCCTTAACACTCTCATCTTCTACAACTATATTTACATGGTATGTCACACATGTTATGCTATTGCTTGGAACTCTCTTACAGTACTGATTTATTGCAGTTCCCAGGATTTTGATAGAATTGGGTCTTTCGTGTTTCAAGGCCTTGTTCTCGCTGGCAGTTACTCTAAACACCAGCCTCTCTGTTCCATCAGCTTCCCGAACGTGCAATGAAACATCCTGAACACTCTTCAGGAAAAGCAATAC\r
+B097         TGAATTCTTCTCAGTCTCCATTCGTTTGATAGCTTCCAAAATAAGGGTGGTATATGCCTTAGGTACTATATTTACCACAAGAAGGTCATTCCACAAAGCTGCTGGATCTCTCCATTGATCCAACTCTCGCCATTTGATACTCCTCCTGTTGTCTGTGAGACCAAAGAAACCACTAACATGAACTGGAAGTCCAGTTTTGCTTTCTTCACCTGGAGGCAAAGGCAGAAAACAGAAAGCTCTTCCTGAAAAGTCTGCTACAGCTCCATTTTCCTCCTCGTTAGCTGCTAAAGACATTGCTATTCCAATAGTAGGAACAAATTTCAAGTCATCAGCTAAACAATCCAGTTCTGTGCACATTCCTCGACCACCCACACAATTACACACTAACCAAGATGTTTTCTGTGCATCCTTAACACTCTCATCTTCTACAACTATATTTACATGGTATGTCACACATGTTATGCTATTGCTTGGAACTCTCTTACAGTACTGATTTATTGCAGTTCCCAGGATTTTGATAGAATTGGGTCTTTCGTGTTTCAAGGCCTTGTTCTCGCTGGCAGTTACTCTAAACACCAGCCTCTCTGTTCCATCAGCTTCCCGAACGTGCAATGAAACATCCTGAACACTCTTCAGGAAAAGCAATAC\r
+O097         ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\r
+\r
+Q097         GGTGGCAAGAAAATCTACAAAGCTGTTATTTATTTATTTGTTTGTTTGTTTCCAGCCACCATCCTTGTAATTTTTCCTGTGCCTTAAGAAAAAAATCAGTATTCTTGCTCTGATCTTCTGAGAAGGTTTTCCTCCATTGTTTGATACTCGGTTTTGATTTTGCTCCAGTGACTTCTTGCTTTTGTTTAAAGTTCCAAGTTCTTAAAATCCAGAAAATCGCTTCTTGTTTTCTTCCAGATGTTGATCCAATAGTCAGGTATCTGCAGCTTCTCTTGACCCATCAGGTTGTTATTCTGTGACCCAAATCCCCAAGTCCCTCCCACTCACTGATGGTTTCCAAAATTTTCTGTAACGCTTCTTAAACATTTAAGAAATTATTTATGGAAATATGTTGCAAAAACTTAGTGTGTCTTCATGGTTTTAATGACGAACTCTGCAAATACAGCTTTGCTATGTGAAAAGGCTACTGCTTACAACAACATAGTCCTTGGGTCAGTAATTTCCAATCCCTGAGCAGGTTCGGTGATGAGAAATGCATAAATGTGGGTTTCTGATCCTGTGAGAAGCTGAGTGTTTTGATTCAGCCCATTCTCAAGCTGA\r
+W097         GGTGGCAAGAAAATCTACAAAGCTGTTATTTATTTATTTGTTTGTTTGTTTCTAGCCACCATCCTTGTAATTTTTCCTGTGCCTTAAGAAAAAAATCAGTATTCTTGCTCTGATCTTCTGAGAAGGTTTTCCTCCATTGCTTGATACTCGGTTTTGATTTTGCTCCAGTGACTTCTTGCTTTTGCTTAAAGTTCCAAGTTCTTAAAATCCAGAAAATCGCTTCTTGTTTTCTTCCAGATGTTGATCCAATAGTCAGGTATCTGCAGCTTCTCTTGACCCATCAGGTTGTTATTCTGTGACCCAAATCCCCAAGTCCCTCCCACTCACTGATGGTTTCCAAAATTTTCTGTAATGCTTCTTAAACATTTAAGAAATTATTTATGGAAATATGTTGCAAAAACTTAGTGTGTCTTCATGGTTTTAATGACGAACTCTGCAAATACAGCTTTGCTATGTGAAAAGGCTATTGCTTACAACAACATAGTCCTTGGGTCAGTAATTTCCAATCCCTGAGCAGGTTCGGTGATGAGAAATGCATAAATGTGGGTTTCTGATCCTGTGAGAAGCTGAGTGTTTTGATTCAGCCCATTCTCAAGCTGA\r
+B097         GGTGGCAAGAAAATCTACAAAGCTGTTATTTATTTGTTTGTTTGTTTGTTTCTAGCCACCATCCTTGTAATTTTTCCTGTGCCTTAAGAAAAAAATCAGTATTCTTGCTCTGATCTTCTGAGAAGGTTTTCCTCCATTGCTTGATACTCGGTTTTGATTTTGCTCCAGTGACTTCTTGCTTTTGCTTAAAGTTCCAAGTTCTTAAAATCCAGAAAATCGCTTCTTGTTTTCTTCCAGATGTTGATCCAATAGTCAGGTATCTGCAGCTTCTCTTGACCCATCAGGTTGTTATTCTGTGACCCAAATCCCCAAGTCCCTCCCACTCACTGATGGTTTCCAAAATTTTCTGTAATGCTTCTTAAACATTTAAGAAATTATTTATGGAAATATGTTGCAAAAACTTAGTGTGTCTTCATGGTTTTAATGACGAACTCTGCAAATACAGCTTTGCTATGTGAAAAGGCTATTGCTTACAACAACATAGTCCTTGGGTCAGTAATTTCCAATCCCTGAGCAGGTTCGGTGATGAGAAATGCATAAATGTGGGTTTCTGATCCTGTGAGAAGCTGAGTGTTTTGATTCAGCCCATTCTCAAGCTGA\r
+O097         GGTGGCAAGAAAATCTACAAAGCTGTTATTTATTTATTTGTTTGTTTGTTTCCAGCCACCATCCTTGTAATTTTTCCTGTGCCTTAAGAAAAAAATCAGTATTCTTGCTCTGATCTTCTGAGAAGATTTTCTTCCATTGCTTGATACTCGCTTTTGATTTTGCTCCAGTGACTTCTTGCTTTTGTTTAAAGTTCCAAGTTCTTAAAATCCAGAAAATCTCTTCTTGTTTTCTTCCAGGTGTTGATCCAATAGTCAGGTATCTGCAGCTTCTCTTGACCCATCAGATTGTTATTCTGTGACCCAAATCCCCAAGTCCCTCCCACTCACTGATGGTTTCCAAAATTTTCTGTAACGCTTCTTAAACATTTAAGAAATTATTTATGGAAATATATTGCAAAAACTTAATGTGTCTTCATGGTTTTAATGAGGAACTCTGCAAATACAGCTTTGCTGTGTGAAAAGGTTATTGCTTCCAACAACATAGTCCTTGGGTCAGTAATTTCCAATCCCTGAGCAGGTTCGGTGATGAGAAATGCATAAATGTGGGTTCCTGATCCTGTGAGAAGCTGAGTGTTTTGATTCAGCCCATTCTCAAGCTGA\r
+\r
+Q097         GCTGTAGAGTGCACAGCTCACCCTGGCATTCAGTGCATAGTGAAGGCAATTGCAAAAAACCAGCAGCTGCTCACTCCCAAACACAAGGCGCTGTCTATGTCCTTGCTTCCCGAGCAACTCAACGCAGCCCTTCTTTTCTGCAGCTGCCATCGAGTTCTCTGCATCTCGCAAGCTCAGGGCACGAACAAGAATTCTCCAGGACGTCTGCATTAGGACCAAGTCAAAACCCAGGAAAGTCGTCCTGTAACACCTGCCAGAAGCATGCCAGTGGTGAATTGAAAGGGCAGGCAGCTGCAGCCACCGTCGTCTAGCAGTGCCAAGGCTGCGCACACAAGCCG\r
+W097         GCTGTAGAGTGCACAGCTCATCCTGGCATTCAGTGCACAGTGAAGGCAATTGCAAAAAACCAGCAGCTGCTCACTCCCAAACACAAGGCGCTGTCTATGTCCTTGCTTCCCGAGCAACTCAGCGCAGCCCTTCATTTCTGCAGCTGCCATCGAGTTCTCTGCATCTCAGAAGCTCAGGGCACGAACAAGAATTCTCCAGGACATCTGCATTAGGACCAAGTCAAAACCCAGGAAAGTCGTCCTGGAACACCTGCCAGAAGAATGCCAGTAGTGAATTGAAAGGGCAGGCAGTTGCAGCCACCGTCCTCTAGCAGTGCCAAGGCATCGCACACAAGCCG\r
+B097         GCTGTAGAGTGCACAGCTCATCCTGGCATTCAGTGCACAGTGAAGACAATTGCAAAAAACCAGCAGCTGCTCACTCCCAAACACAAGGCGCTGTCTATGTCCTTGCTTCCCGAGCAACTCAGCGCAGCCCTTCATTTCTGCAGCTGCCATCGAGTTCTCTGCATCTCAGAAGCTCAGGGCACGAACAAGAATTCTCCAGGACGTCTGCATCAGGACCAAGTCAAAACCCAGGAAAGTCGTCCTGGAACACCCGCCAGAAGCATGCCAGTGGTGAATTGAAAGAGCAGGCAGCTGCAGCCACCCTCCTCTAGCAGTGCCAAGGCATCGCACACAAGCCG\r
+O097         GTAGAGGAGTGCACAGCTCCACCTGACATTCAGTGCACAGCGAAGTCAACTGCAAAAAACCAGCAGCTGCTCACTCCCAAACACTAAGCGCTGTTAATGTCCTTGCTTCCTGAGCGACTCAGCACAGCCCTTCTTTTCTGTAGCTGCCATCGATATCTCTGCAACTCGTAAACTCAGGGTACGAACAAGAATTCTCCAGATCGTCTGCATCAGGACCAAGTCGAAACCCAGGAAAGTCGTCCTGGAGCACCTGCCAGAAGCATGCCAGAGGTGAACTGAAAGGGCTGGCAGCTGCAGCCACCGTCCTCTAACAGTACCGAGGCAGCGCACACAAGCCG\r
+\r
+Q097         ATCAAGTGTTCTGACTTTTTGAGATATTGAGCAAGATAAATTAAAAGCAAGGTGATTATGCAAAATATTGCTAGTATTTCCTCTAGTAAGAGTAATGCTTCTTGCAGCAAATGAGGGAATCTGTGAATGTGTCTTGGGATTTTCAAATACCAATTCTAAAGAATGGAGTCTAACTGAAAGGATTTCTCCTGCTTCCTTGTTTTGGCTATTGCTTGA\r
+W097         ATCAAGTGTTCTGACTTTTTGAGATATTGAGCAAGATAAATTAAAAGCAAGGTGATTATGCAAAATATTGCTAGTATTTCCACTAGTAAGAGTAATGCTTCTTGCAGCAAATGAGGGAATCTGTGAATGCGTCTTGGGATTTTCAAATACCAATTCTAAAGAATGGAGTCTAACTGAAAGGATTTCTCCTGCTTCCTTGTTTTGGCTATTGCTTGA\r
+B097         ATCAAGTGTTCTGACTTTTTGAGATATTGAGCAAGATAAATTAAAAGCAAGGTGATTATGCAAAATATTGCTAGTATTTCCACTAGTAAGAGTAATGCTTCTTGCAGCAAATGAGGGAATCTGTGAATGCGTCTTGGGATTTTCAAATACCAATTCTAAAGAATGGAGTCTAACTGAAAGGATTTCTCCTGCTTCCTTGTTTTGGCTATTGCTTGA\r
+O097         ATCAAGTGTTCTGACTTTTTGAGATATTGAGCAAGATAAATTAAAAGCAAGGTGATTATGCAAAATATTGCTAGTATTTCCACTAGTAAGAGTAATGCTTCTTGCAGCAAATGAGGGAATCTGTGAATGTGTCTTGGGATTTTCAAATACCAATTCTAAAGAATGGAGTCTAACTGAAAGGATTTCTCCTGCTTCCTTGTTTTGATTATTGCTTGA\r
+       ;\r
+End;\r
+\r
+begin mrbayes;\r
+    set autoclose=yes nowarn=yes;\r
+\r
+    outgroup 4;\r
+    \r
+    CHARSET  locus097  =  1-473;\r
+       CHARSET  locus098  =  474-1031;\r
+       CHARSET  locus118  =  1032-1593;\r
+       CHARSET  locus119  =  1594-2204;\r
+       CHARSET  locus120  =  2205-2504;\r
+       CHARSET  locus122  =  2505-3122;\r
+       CHARSET  locus130  =  3123-3661;\r
+       CHARSET  locus104  =  3662-4272;\r
+       CHARSET  locus129  =  4273-4784;\r
+       CHARSET  locus143  =  4785-5374;\r
+       \r
+       CHARSET  locus146  =  5375-5918;\r
+       CHARSET  locus111  =  5919-6508;\r
+       CHARSET  locus135  =  6509-6973;\r
+       CHARSET  locus148  =  6974-7543;\r
+       CHARSET  locus182  =  7544-8155;\r
+       CHARSET  locus200  =  8156-8655;\r
+       CHARSET  locus209  =  8656-9227;\r
+       CHARSET  locusB098 =  9228-9820;\r
+       CHARSET  locus184  =  9821-10470;\r
+       CHARSET  locus185  =  10471-11109;\r
+       \r
+       CHARSET  locus186  =  11110-11725;\r
+       CHARSET  locus187  =  11726-12297;\r
+       CHARSET  locus188  =  12298-12702;\r
+       CHARSET  locus192  =  12703-13345;\r
+       CHARSET  locus193  =  13346-13797;\r
+       CHARSET  locus195  =  13798-14317;\r
+       CHARSET  locus198  =  14318-14965;\r
+       CHARSET  locus199  =  14966-15565;\r
+       CHARSET  locusB200 =  15566-15903;\r
+       CHARSET  locus103  =  15904-16119;\r
+\r
+    partition genes = 30: locus097,locus098,locus118,locus119,locus120,locus122,locus130,locus104,\r
+                          locus129,locus143,locus146,locus111,locus135,locus148,locus182,locus200,\r
+                          locus209,locusB098,locus184,locus185,locus186,locus187,locus188,locus192,\r
+                          locus193,locus195,locus198,locus199,locusB200,locus103;\r
+    set partition = genes;\r
+\r
+    speciespartition test = SpQ: 1, SpW: 2, SpB: 3, SpO: 4;\r
+    set speciespartition = test;\r
+    \r
+    unlink topology = (all);\r
+    prset brlenspr = clock:speciestree;\r
+    prset topologypr = speciestree;\r
+    prset popvarpr = variable;\r
+    prset popsizepr = gamma(1,100);\r
+\r
+    [mcmc ngen = 10000000;\r
+     sump;\r
+     sumt;]\r
+\r
+end;\r
+\r
diff --git a/examples/hymfossil.nex b/examples/hymfossil.nex
new file mode 100644 (file)
index 0000000..9dd0d8e
--- /dev/null
@@ -0,0 +1,1371 @@
+#NEXUS
+
+[ Data from: Ronquist F, Klopfstein S, Vilhelmsen L, Schulmeister S, Murray DL, Rasnitsyn AP. 2012. A total-evidence approach to dating with fossils, applied to the early radiation of the Hymenoptera. Systematic Biology 61:973-999. ]
+
+Begin data;
+    Dimensions ntax=114 nchar=5449;
+    Format datatype=mixed(standard:1-353,DNA:354-5449) interleave=yes gap=- missing=?;
+
+    Matrix
+
+[Morphology, Vilhelmsen]
+Orthoptera              ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Paraneoptera            0000001000 0000100-10 0000?110?0 ?1-230??00 00?--0-010 1100000??1 00000?0000 000000000? 1---0?0003 ?000?1-000 ?20010000? 0?00?0--00 ?0??010010 ?000100101 ?0101--0?0 ?0??0001?1 ?010-1-111 011--10101 111100-000 000-020110 000---1?-0 ?00??00100 ---------- ------
+Chrysopidae             0000000000 0?00010010 0000?00000 01-110?100 00?010-000 ?000000??1 011000?0?? -2-00?000? 011000000? ?0-0?1-000 121000000? 0-00?0--00 0010000100 ?000?00000 ?100102000 00??010100 00?0?????? 011--100?? ???1000000 010--?---- ---1--0?0- -----????? 0014010002 -0001-
+Raphidioptera           0000000000 000011?001 ?000?00000 01-210?100 000000-000 10000-0??1 011000???1 -2-00?100? 00--000000 -0-0?1-000 ?2?0000??? 0-00?0--00 001?010100 0000100031 01001010?0 ???0011100 000000???? 011--100?? ??01000000 010-02000- --01--101- ---??00000 0004001002 -0001-
+Coleo_Polyphaga         0010011000 0??011001? ?000?00010 ?1-11???00 00?-----00 111100-001 0000021001 00000?0000 1---1000-3 ?0?0?1-000 0200100000 0?0000--00 0010000010 0100100001 ?001102000 00000001-- ?--------- -11--110?? 000000000? 0????????? ?????????? ??????010? ?????????? ??????
+Coleo_Adephaga          ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Lepid_Micropterigidae   0000001100 0010000-10 0000?11010 1000220000 00?000-00? 0000000001 01?001???? -00000000? 0?????000? ?0???1-001 ?2?0000??? 0?01?0--00 10??111100 1000?00101 00?01--001 0??0010-00 0??0?????? ?11--111?? ???1000000 02-------- ---------- -----00100 001401?010 0?001-
+Lepid_Papilionidae      ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Mecoptera               0000-00000 0010010011 0000?01000 11-3200?00 011000-0?0 0000101??1 0100--1101 00000?1000 00--000003 ?0?0?1-000 ?21000010? 0-00?0--00 10000110?0 ?000100001 0100102001 000?010100 0??0?????? 011--100?? ??01010000 02-------- ---------- -----00000 0004000010 00001-
+Xyela                   0010000100 0010000-00 0010111010 0001010000 0000010110 0001100010 0200000000 0100010000 0100011000 0000000100 0002100000 1000010000 00?0010000 0100100000 0000000100 0011100010 0000000000 1000000000 0000010200 001010000- -000000010 0000011011 0111000011 00001-
+Macroxyela              0010000100 0010000-00 0010011010 01-0010000 00000101?? ?101101010 0200000000 010001000? 0100010000 ?000?00100 0002100??? 1000010000 ?00?010000 ?100000000 00000001?? ????100000 0000000000 1000000000 00000101?0 001010000- --00000000 0000101011 0101000011 000000
+Runaria                 0010000010 0100000-00 002-001000 00010?0010 1110020110 1100100020 0210100100 110001000? 0???0??0?3 2102110??? 000?1??110 101?11?010 0000000000 1100000021 110?1??210 100110?120 1-11001000 1100000100 0000010210 00????0010 0000????0? ?00??01001 ?????????? ??????
+Paremphytus             0010000010 0??0000-00 002-?0100? ?0010??010 11?002?1?? ?100100020 02101001?0 01000?000? 0100?10003 ?102?1?101 ?002100??? 101011?01? ?000000000 ?100000021 ?1001122?? ????101120 1-11001000 1100000100 0000010210 00????0010 000?????0? ??0??01001 ?????????? ??????
+Blasticotoma            0010000010 0?00000-?? ?010?01000 ?00101?010 111002?1?? ?100100020 021010???? 010001000? 0100010003 ?102?1?001 0002100??? 101??1001? ?00?000000 ?10000?021 ?1?01122?? ????101120 1?11001000 1100000100 0000010210 0010100010 0000000?00 0100001001 0101000012 -00001
+Tenthredo               0010000000 0000000-00 0000001000 ?001000010 11100202?? ?100111031 02102001?1 0100000001 0100010001 ?102111001 0002100110 1011?10010 ?00?000000 ?100011001 ?1001012?? ????111121 0-01001000 11000?0100 00000101?0 0010101010 1000110?00 ?10??11001 0102000010 10001-
+Aglaostigma             001000?0?0 0000000-00 ?00000100? ?001000010 12?001?2?? ??001001-1 0???2????? 010000000? ?????????1 2102111??? ????1????? 1????100?? ???????000 ??00011021 ???0101??? ???????120 0-010?1000 1100000100 00000101?0 0010?01010 1010110100 ?10??11001 0?02000?10 10????
+Dolerus                 0010000000 0?00000-00 0000001000 ?001000010 11100202?? ?100111031 02102001?0 0100000001 0100010001 ?102?11001 0002100110 1011110011 ?000000000 ?100000001 ?1?01012?? ????111120 0-0100-100 1100000100 00000101?0 0010101010 1100110?00 ?10??11001 0102000010 10001-
+Selandria               001000?0?0 0000000-00 ?00000100? ?001000010 120012?2?? ??00100031 021020?1?0 0100000001 0???0????3 ?102?11000 ?01?1??1?? 1?1??11011 ????10?000 ??00011001 ???0101??? ????111120 0-01001000 1100000100 00000101?? 00???????? ?????????? ?????11001 ???2????10 ??????
+Strongylogaster         00100????? ?000000-00 0000001??? ?00?00?010 110002?2?? ??0010?031 0???2??1?? 0100000001 010001?003 ?102?1?00? ????1????? 1????100?? ??0????000 ??00?1?001 ???0101??? ???????120 0-01001000 1100000100 00000101?0 0010?01?10 ????????00 ?????11001 0?02000?10 10????
+Monophadnoides          00100???0? ?000000-?0 ?000001??? ?00?00?010 111002?2?? ??00100031 0???2????? 010000000? ?????????3 ?121?1???? ????1????? 1????100?? ??0????000 ??0001?001 ???0101??? ???????120 0-01001000 310?010101 10000101?? 00???????? ?????????? ?????11001 ???2??0?10 10????
+Metallus                00100???0? ?000000-?0 0000001??? ?00?0??010 110012?2?? ??00100031 0???2????? 000000000? ?????????3 ?102?11??? ????1????? 1????100?? ???????000 ??00010001 ???0100??? ???????121 0-11001000 310??10101 10000101?? 00???????? ?????????? ?????11001 ???2??0?10 00????
+Athalia                 0010000000 0010000-01 0000?01000 0001000010 1100020211 1000100031 0210210110 00000?000? 00--0?0001 0102111001 0212100??? 1011110011 0000000000 0100100001 1100101201 0011111121 0-01001000 1100000100 00000101?0 0010101010 1000110100 ?10??11001 0102000010 10001-
+Taxonus                 00100???0? ?000000-00 ?000001??? ?00100?010 111002?2?? ??00111031 02?02001?? 0100000001 0???0????1 ?102?1100? ?00?1????? 1?1??1001? ??0?00?000 ??000??001 ???0101??? ????111120 0-01001000 110?010100 00000101?? 00???????? ?????????? ?????11001 0?02000010 10????
+Hoplocampa              00100???0? ?000000-?1 ?000001??? ?00?0??010 110002?2?? ??0010?031 0???2????? 0?0???0001 ?????????3 ?101?1???? ????1????? 1????110?? ??0????000 ??0000104- ???0101??? ???????120 0-11001000 2100000100 00000101?0 00???????? ?????????0 ?????11001 0?03000010 1?????
+Nematinus               00100???0? ?000000-?1 ?000001??? ?00100?010 110002?2?? ??00100031 0???2????? 0?0000000? ?????????1 ?101?1???? ????1????? 1????110?? ??0????000 ??000?0001 ???0101??? ???????120 0-1101-000 3100000100 00000101?0 00???????? ?????????? ?????11001 0??3000?10 1?????
+Nematus                 0010000000 0??0000-01 0000001000 ?00100?010 11100202?? ?000101031 02102001?0 010000000? 00--0?0001 0101?11001 0002100??? 1011111011 ?00?000000 ?200001001 ?1001012?? ????111120 0-1101-{0,1}00 3100000100 00000101?0 0010101010 1100110?01 ?00??11001 01031?0010 10001-
+Cladius                 00100???0? ?010000-?1 ?000001??? ?00100?010 110012?2?? ??00101031 0???2????? 000000000? ?????????3 ?101?11??? ????1????? 1????110?? ??0????000 ??000?104- ???0101??? ???????120 0-1101-000 2100010100 00000101?0 00????1?10 ?????????0 ?????11001 ???3????10 1?????
+Monoctenus              0010000000 0??0000-00 010000100? ?00100?010 110002?2?? ?100100031 02102001?0 001000000? 0100010001 0101?11001 0002100??0 1011112111 ?00?000000 0100101000 ?1?01012?? ????111120 0-1101-000 21000?0100 00000101?0 001010100-  -010010?00 ?01??11001 0104100010 1?001-
+Gilpinia                0010000000 0110000-00 0100001000 0001000010 1100020211 1100100031 0210200110 00100?0001 0100010002 0101111001 0002100110 1011112111 0000000000 0100110000 1100101211 1011111120 0-1101-000 11000?0100 00000101?0 001010100- -010010100 ?01??11001 0104100010 10001-
+Diprion                 00100???0? ?010000-?0 ?100001??? ?00?00?010 110002?2?? ?100100030 0?102001?? 001000000? 010001?003 ?101?1100? ?0??1????? 10111121?? ?00?000000 ??00?0?000 ?1001012?? ?????11121 0-1101-000 1100000100 00000101?0 ?010?0100- -010010?00 ?01??11001 ???41?0?10 1?????
+Cimbicinae              0010100000 0??0001-00 0001001000 ?00100?010 13000202?? ?1011001-1 1210210110 001000000? 0101030003 ?10111?001 0012100??0 1210112101 0101011010 1100101-3- 1110101211 111?111121 0-11001000 1100010100 0000010200 0010101010 0100110100 ?01??11001 0105000010 11001-
+Abia                    0010000000 0010100-01 0001?01000 0001000010 1300020211 11011001-1 1210210110 00100?000? 0101030003 210111?001 2012100??? 1110012101 ?101011010 1100101-3- 1110101211 1111111121 0-11001000 2100010100 0000010200 0010101010 1100110100 ?01??11001 0105000010 11001-
+Corynis                 00100000?0 0??0010002 0001?01000 ?0010??010 11000102?? ?100100021 0210210??? 00000?100? 1---0?0002 0102?11001 ?212100??? 1010111100 ?00?011010 ?200111-3- ?1101012?? ????111121 0-11001000 21000?0100 0000010200 0010101010 1100110?00 ?00??11001 ???5??0??0 ?1????
+Arge                    0010000000 0000000-00 002-001000 0001000010 1200021211 1100110031 0210210111 0000000001 0100010003 2101101001 0212100110 1211112111 0001000000 111010103- 1110101211 1101111020 0-0101-000 2100010100 00000101?0 0010101010 11010-0001 0000011001 0106000010 00001-
+Sterictiphora           0010000000 0??0000-00 002-?01000 ?00100?010 12000212?? ?100110031 0210200111 000000000? 0100010003 ?101?01001 ?212100??? 1211?1211? ?00?000010 ??10?0103- ?1101012?? ????111121 0-1101-110 21000?0100 00000101?0 0010101010 11010-0?01 ?00??11001 0106?00010 0??00?
+Perga                   0010000000 0?00001-00 0001?01000 ?00210?010 12000212?? ?0011111-0 02102001?1 00000?000? 00--1?0003 2111101001 1212100??? 121111?111 ?00?000010 020010103- ?1101012?0 ??0?111021 0-0101-000 4101010100 10000101?0 0010101010 11010-0101 ?00??10001 0?0???0010 0??01-
+Phylacteophaga          0010000000 0000000-00 0000001000 000110?010 1200021211 10001111-0 0210200111 100000000? 00--1?0003 2102110001 221210011? 1211112111 00?1000010 120010103- 1110101210 0110111021 0-0101-000 4101010100 10000101?0 0010101010 10010-0?01 ?10??10001 ?????????? ??????
+Lophyrotoma             00100???0? ?110000-?0 ?200001??? ?00100?010 220001?2?? ?0001001-1 0?10200??? 000000000? ?????????3 ?201101??? 12??1????? 12111111?? ?0??000010 ??0010003- ?0101012?? ?????11120 0-0101-100 4101010100 10000101?? 0021?01010 10010-0??1 ?00??10001 ?????????? ??????
+Acordulecera            00100????? ???0000-?0 ?000?0???? ?00?0??010 120002?2?? ??001001-1 0???2??1?? 0000000001 1?001??003 2201?1100? ????1????? 1????111?? ???????010 ??00???03- ???0101??? ???????021 0-1101-000 4101110100 10000101?0 00???????? ?????????? ?????10001 0?06??00?2 -??0??
+Decameria               00100???0? ?110000-?0 ?000001??? ?1-230?010 120002?2?? ??001001-1 02102001?1 0000000001 1???1????3 ?20??01001 ?21?1????? 1?1??11111 ????00?010 ??0010?03- ???0101??? ????111121 0-0101-000 3101010100 10000101?? 00???????? ?????????? ?????10001 ?????????? ??????
+Neurotoma               0011000000 0??1010002 0000?2200? ?00101?100 010012?2?? ?101111011 0210?????? 010001000? 01000?0003 ?100?1?100 ?002100??? 1000?1000? ?00?010000 ?100100000 ?0000101?? ????100001 0001000000 1001000000 0000011200 0010111110 0000-11?11 ?00??01011 0?10000?22 -?1001
+Onycholyda              00110???0? ??110100?2 0000?22??? ?00101?100 010002?2?? ??01111011 021000?0?? 0100010000 0???0????3 ?100?10100 ?00?1????? 1?0??10000 ??0?01?000 ??00100000 ???0010??? ????100000 0001000000 1001000000 0000011200 0010111?1? ???0????1? ?0???01011 ?????????? ??????
+Pamphilius              0011000000 0??1010000 0000022000 ?0010{0,1}?000 01100212?? ?101111011 02100000?0 0100010000 0100010003 1100010100 ?002100100 1000010000 ?000010000 ?100100000 ?0000101?0 ????100000 0001000000 1001000000 0000011200 0010110110 0000-11011 0001001011 0110000122 -01001
+Cephalcia               0011000000 0011010001 0000022000 1001010100 0100021210 1101111010 0210000000 011001000? 0100010003 1100010100 0002100??? 1000010000 0000010000 1100100000 1000010110 0011100000 0001000000 1001000000 0000011200 0010110110 0000-11011 0101001011 0110000122 -01001
+Acantholyda             0011000000 0??1010000 0000022000 ?00101?000 010012?2?? ?101111010 021000?0?? 0110010000 0100010003 ?100?10101 ?0?2100??? 1?00?10000 ?00?010000 ?100100000 ?0000101?? ????101000 0001000000 1000000000 0000011200 0010110110 0000-11?11 ?10??01011 0?10000122 -???01
+Megalodontesc           0011100000 0011010002 1200022000 000101?000 0100121211 1001111011 0210000110 010002000? 01000?0001 2100001100 0002100??? 1000012000 0001000010 1100100000 1100110200 1111100021 0101000000 1101010100 00000101?0 0010110110 0000-01011 ?00??01011 0?10000?22 -?1001
+Megalodontessk          00111???0? ?1110100?2 1200?22??? ?00?01?000 010012?2?? ??01111011 ?210?0???? 010002??0? 0???0????? ???0?0110? ?0??1????? 1????12000 ??0????010 ??00?????? ???01?0??? ????100021 0101000000 1101010100 00000101?0 00???????? ?????????? ?????01011 ?????????? ??????
+Cephus                  0011010020 0110011000 1000?01000 0001020000 0000120210 1001111010 0210021100 1101110000 0100010113 1100000110 1001100000 101100--00 0001110100 0200100011 1100120100 1011100021 0001100000 1101000100 00001101?0 0010100010 0000000000 01011011-1 0??3000222 -?0100
+Calameuta               0011010020 0110011000 1000001000 ?00102?000 000012?2?? ?001111010 021002???? 110111000? 01000?0113 ?100?00110 10?2100??? 101100--0? ?00?110100 ?200100011 ?1001201?? ????100021 0001100000 1101000100 00001101?0 0010100010 0000000?00 ?10??011-1 ?????????? ??????
+Hartigia                0011010020 0110011000 ?000001000 ?00102?000 000012?2?? ?001111010 021002?1?? 110111000? 0100010110 ?100?00110 ?0?1100000 10?1?0--0? ?00?110100 ?200100011 ?1001201?? ????100021 0001100000 1101000100 00001101?0 0010100010 0010000000 01011011-1 0??3000222 -?0100
+Syntexis                0011110021 0110011000 0000101000 0011120000 0001021210 1001111010 0200021000 1100120000 0100011010 0100000120 0002100??? 1010011000 0000110100 1100100100 1000110110 0011100121 000110-100 1101000101 10000101?0 0021100011 0000000000 0100001001 1--4011222 -?011-
+Sirex                   0111110020 0110010100 0000?01000 0003120111 00000202?1 1101110020 0200021100 110001101? 0???0??110 ?10001?120 0102100??? 1000010020 0001000100 0100110000 1000102100 0111100101 0101000000 1100010100 00000101?0 0021100011 0000000?00 0101001011 1--?011222 -0011-
+Xeris                   011??????? ?1100101?0 ?000001??? ?00312?111 000002?2?? ??011110?0 0????????? 110001101? ?????????0 ?100?11??? ????1????? 1????100?? ??0????100 ??00???000 ???0102??? ???????100 0101000000 11000?0101 10000101?? 00???????? ?????????0 0??0?01011 ?????????? ??????
+Urocerus                0111110020 0110010100 0000001000 ?00312?111 0000021211 1101111020 0200021100 1100011010 0100020110 0100?1?121 0102100000 1000?10020 0001000100 0100110000 ?0001021?? ????100100 0101000000 1100010100 00000101?0 0021100011 0000000000 0101001011 ?????????? ??????
+Tremex                  0111110020 0??0010100 0000001000 ?00322?111 000002?2?? ?101111020 020002?1?? 1100011010 0???020110 ?200?1?120 ?1?2100000 1000?100?? ?00?00?100 ?100110000 ?0001021?? ????100100 010100-100 1100010100 00000101?0 0021100011 0000000?00 ?10??01011 1--5011222 -0011-
+Xiphydria               0111110001 0110110000 0000001000 0001120010 1100021211 1001110010 0201001100 1100020120 0110012122 010101?121 0002100100 1-00010020 0011000100 0100100100 1110110210 1111101120 0001000000 1001010100 0000010200 0020100011 0000010100 0100101011 1--4011222 -?011-
+Orussus                 1111110001 1110110112 1000101000 0012101110 2100120210 10111101-0 0201021100 1101221220 1---1?2022 021201-121 1002110111 1000010001 0011010010 0201100101 1111101210 0111101121 0-11200011 3101101111 10000101?1 202110000- -000000?01 01001011-1 1--60?13-2 -??01-
+StephanidaeA            1111110001 1??0110102 1000?01101 ?01200?010 210212?2?? ?011110011 021020???? 11012?0220 0101??2022 ?212?1?121 ?0?2110??? 1000?0--?? ?01?01?010 ?20211013- ?1111012?? ????100121 010120-111 4101011111 10112101?1 2020100011 ???0010?01 ?10??011-1 1--60??3-2 -??0??
+StephanidaeB            ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Megalyra                011---0021 0????1?1?? ??00101102 ?012101?10 310212?2?? ?0111111-1 020120?1?0 1101200020 0101??2123 ?20??1?121 ?2?2111111 1000?0--?? ?01?01?010 ??0211?13- ?1111012?? ????112121 011120-111 4101101111 11112101?1 100-10000- -?00010?01 11001?11-1 ?????????? ??????
+Trigonalidae            00111?0021 0??0110102 1000001101 ?00110?110 210212?2?? ?0111111-1 020120???? 1101201221 0101132023 ?201?1?021 2212111111 1000?0--0? ?01?01?010 ?20211?13- ?1111??2?? ????112121 0101200000 4101001111 ???12101?? 20???????? ?????????1 0??1001201 ?????????? ??????
+Chalcidoidea            ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Evanioidea              00110100?1 0??011?102 10001010?? ?01200??10 210212?2?? ?011111010 021020???? 1101201221 0101??2123 220??1?021 ?2?2111??? 1000?0--0? ?01?00?011 ??0211013- ?1?11012?? ????112121 010120-110 4101111111 11112101?1 1010100011 ??00?1??01 ?10??011-1 ?????????? ??????
+Ichneumonidae           00?00????? ?110110102 ?000101??? ?01200?110 110012?2?? ??111111-1 021020???? 1101201211 01??1?2?23 ?202?1?121 ?21?1??1?? 1?0??0--?? ??1?00?011 ??02???13- ???1101??? ????11?121 0111200?00 4101011101 10012101?? 00???????? ?????????? ?????011-1 ?????????? ??????
+Cynipoidea              00110?00?1 0??0110002 1000101002 ?012101010 110212?2?? ?0111111-1 0201?211?0 1101201221 0110032123 2202?1?121 2212110111 1000?0--0? ?01?000011 ?20210013- ?1111012?? ????111121 -11120-011 4101111111 11112101?1 102010000- -?010-0?01 11011011-1 1--??113-2 -??0??
+ApoideaA                00110????? ?11111?1?? ?000002??? ?01100?000 210212?2?? ???1111??? ??01?2???? 1101201?2? 01?11?2?23 -20??1?121 ?21?1????? 1????0--?? ??1?01?011 ??02???13- ???1?????? ????112121 -111200000 4101000110 10002101?? 00???????? ?????????1 0??21011-1 ?????????? ??????
+ApoideaB                ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+ApoideaC                ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Vespidae                00111100?1 011011?112 1000101102 ?011001110 2102121211 1011111011 0210221110 1101211221 0101132123 220011?121 2212110111 100000--01 0011011-10 120211013- 1111101211 1110112121 0101200000 4101010110 10012101?0 000-000011 000000??01 ?00??011-1 1--61013-2 -0001-
+Triassoxyela            0????????? ?????????? ??(1,2)?0????? ????????00 ?????????? ?????00??? ?????????? ??????000? ?????????? ?????????? ?????0???? ?00??10??? ????0???00 ?????????? ?????????? ????????00 0000000000 1????????? ????0?0??? ?????????? ?????????? ?????????? ?????????? ??????
+Asioxyela               ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????10??? ?????????? ?????????? ?????????? ????????00 0000000000 1????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Nigrimonticola          0????????? ????0????? ??10?1???? ????????00 ?????????? ?????????? ?????????? ??????000? ????????0? ?????00??? ????10???? 1????????? ?????????0 ?????????? ?????????? ????????0? 00?0?00000 ?????????0 ????01?2?? ?010???00? ???0?????? ?????????? ?????????? ??????
+Gigantoxyelinae         0????????? ????0????? ??100????? ????????00 ?????????? ?????????? ?????????? ??????000? ??????0?0? ?????00??? ?????00??? 10???11??? ??0?0???00 ?????????? ?????????? ???????000 0000000000 1?0?0?0000 00000?0100 ?0??10???? ???0?????? ?????????? ?????????? ??????
+Spathoxyela             0?1??????? ????0????? ?0100????? ????????00 ?????????? ?????0???? 0????????? ??????000? ??????1?0? ?????00??? ????1?0??? 10???100?? ????????00 ?????????? ?????????? ???????000 0000000000 1?????0?00 000?0?0100 00???????? ???0?????? ?????0?01? ?????????? ??????
+Xyela_mesozoica         0?1??????? ????0????? ??10?????? ????????0? ?????????? ?????????? ?????????? ??????000? ??????1?0? ?????0???? ?????????? ?????10??? ?????????? ?????????? ?????????? ????????00 0000000000 1????????? ????0??1?? ?0???????? ???0?????? ?????????? ?????????? ??????
+Angaridyela             00???????? ????00--?? ??100????? ????????00 ?????????? ?????????? ?????????? ??????000? ??????0??? ?????0000? ?0????0??? 1????100?? ???????000 ?????????? ?????0???? ????100000 0000000000 1?????0?00 000?0?0100 ?0??1????? ???0?????? ?????0?0?? ?????????? ??????
+Xyelotoma               0????????? ????0????? ??10?0???? ????????10 ?????????? ?????????? ????2????? ??????000? ?????????? ?????01??? ?????????? ?2???1???? ?????????? ?????????? ?????????? ???????100 0-0?00???? 1?????0100 ??0?0????? ?????????? ?????????? ?????????? ?????????? ??????
+Undatoma                ?????????? ?????????? ?????????? ????????10 ??100??2?? ?00?11001? ?????????? 01000?000? ??????0?0? ?????1-??? ?????????? 1????11??? ????????00 ?????????? ?????????? ????????21 1001001000 1?????01?0 0???0?0200 ?0???0???? ???0?????? ?????????? ?????????? ??????
+Dahuratoma              0?1??????? ????0????? ??10?????? ????????00 ?????????? ?????????? ?????????? ??????000? ??????0??? ?????????? ?????????? ?0???11??? ?????????? ?????????? ?????????? ????????00 1-01001000 1?010?0100 000?0??100 ?0???????? ???0?????? ?????1?0?? ?????????? ??????
+Mesolyda                0?1??????? ????00--?? ??100????? ????????00 ?????????? ?????????? ?????????? ??????0?0? ?????????? ?????00??? ?????????? ?????????? ?????????? ?????????? ?????????? ????????00 0001000000 1?????0100 00000?010? ?????????? ?????????? ?????????? ?????????? ??????
+Turgidontes             0????????? ????0????? ??1002???? ????????00 ?????????? ?????????? ?????????? ??????000? ?????????? ?????????? ?????????? ?????10??? ????????00 ?????????? ?????????? ????????2? 01010??000 ?????????? ????0?010? ?????????? ?????????? ?????????? ?????????? ??????
+Aulidontes              0????????? ?????????? ?????2???? ????????10 ?????????? ?????????? ?????????? ??????0?0? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ????????21 0001000000 1????????0 0?000?010? 0????????? ?????????? ????????1? ?????????? ??????
+Protosirex              0????????? ????01???? ?01000???? ????????10 ?????????? ?????????? ?????????? ??????000? ?????????? ?????????? ?????????? ?????10??? ????????00 ?????????? ?????????? ????????10 0001000000 1?????0000 000?0?02?? ?0??10??10 ???0?????? ?????0?0?? ?????????? ??????
+Aulisca                 0????????? ?????????? ??00?????? ????????0? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????0 ?????????? ?????????? ???????021 0001000000 ?????????? ????0????? ?0??1??01? ???0?????? ?1???????? ?????????? ??????
+Anaxyela                0????????? ?????????? ??000????? ????????00 ?????????? ?????????? ?????????? ???????00? ??????0??? ?????????? ?????????? ?0???10??? ????1??100 ?????????? ?????????? ????????20 000100-100 1?0?????10 00001?0??? ?0??1????? ???0?????? ?????????? ?????????? ??????
+Syntexyela              0????????? ?????????? ?01000???? ?????????0 ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????10??? ????????00 ?????????? ?????????? ????????20 000100-100 1?????0?10 000?0??2?? ?0??1????? ???0?????? ?????1?0?? ?????????? ??????
+Karatavites             0????????? ????1????? ?000?????? ????????00 ?????????? ?????????? ?????????? ??????0??? ?????????? ?????????? ?????????? 1????0-??? ???????011 ?????????? ?????????? ????????21 0001100000 1?0???0000 00012?0??? ?????????? ?????????? ???????0?? ?????????? ??????
+Stephanogaster          0????????? ?????????? ??000????? ????????00 ?????????? ?????????? ?????????? ????????2? ?????????? ?????????? ?????????? 1?????-??? ????????1? ?????????? ?????????? ????????21 0?01200000 3?????1101 100?0?0??? ?0???????? ???0?????? ?????????? ?????????? ??????
+Leptephialtites         0???0????? ?????????? ??001(0,1)???? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????-??? ?????????? ?????????? ?????????? ????????21 0101200000 3?????01?? ?00???0??? ?0??10???? ???0?????? ?????????? ?????????? ??????
+Cleistogaster           0????????? ????0????? ??000????? ????????10 ?????????? ?????1???? ?????????? 1101??022? ??????2??? ?????01??? ?????????? 1????0--?? ???????011 ???2????3? ?????????? ????????21 0101200000 3?????1101 100?2?02-1 ?02?10?0?? ???0?????? ?1???????? ?????????? ??????
+Sepulca                 ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ????????21 0001000000 1?0?00010? 000?0????? ?0???????? ???0?????? ?????????? ?????????? ??????
+Onochoius               0????????? ?????????? ??10?????? ?????????? ?????????? ?????1???? ?????????? ?????????? ?????????? ?????0???? ?????????? ?????????? ?????????? ?????????? ?????????? ????????21 0001000000 1????????? ????0?0100 ?0??1????? ???0?????? ?????????? ?????????? ??????
+Ghilarella              0????????? ?????????? ?????0???? ????????00 ?????????? ?????????? ?????????? ??????100? ?????????? ?????01??? ?????????? ?????1???? ????????00 ?????????? ?????????? ????????21 000100-100 1????????? 000?(0,1)?0??? ?0???????? ???0?????? ?????????? ?????????? ??????
+Paroryssus              0????????? ?????????? ?????(0,1)???? ????????00 ?????????? ?????????? ?????????? ????????2? ?????????? ?????????? ?????????? ?????1???? ?????????? ?????????? ?????????? ????????21 001120-111 2?0???1111 1?0?0????? ?0???????? ???0?????? ?????????? ?????????? ??????
+Praeoryssus             0????????? ?????????? ?0000????? ?????????? ?????????? ?????1???? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ????????10 ?????????? ?????????? ????????21 0001200011 2??????101 110?0?0??? ?0???????? ???0?????? ?????????? ?????????? ??????
+Mesorussus              11???????? ?????1???? ??020(0,1)???? ?????????? 21???????? ?????1???? ?????????? ?????????? ?????????? ?????????? ?????????? 1????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ??????
+Trematothorax           0???0????? ?????1???? ??00?????? ????????00 ?????????? ?????????? ?????????? 11?1?????? ?????????? ?????????? ?????????? 1????1???? ???????100 ?????????? ?????????? ????????21 0001000000 1?????01?? 100?1?0??? ?01?10???? ?????????? ?????????? ?????????? ??????
+Thoracotrema            0????????? ?????????? ??00?????? ?????????0 ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? 1????????? ?????????0 ?????????? ?????????? ????????21 0001-1-000 1?0???01?? 100???0100 ?0???????? ???0?????? ?????????? ?????????? ??????
+Prosyntexis             00???????? ?????????? ??00?????? ????????00 ???00????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? 1????????? ????????00 ?????????? ?????????? ????????21 000110-100 1?????11?? ?00?1??2-0 ?0??1????? ?????????? ?????????? ?????????? ??????
+Kulbastavia             00???????? ?????????? ??0??0???? ????????00 ?????????? ?????????? ?????????? ??????000? ?????????? ?????????? ?????????? ?????10??? ????????00 ?????????? ?????????? ????????20 000100-100 1?????0010 000?0????? ?0??????11 ???0?????? ?????????? ?????????? ??????
+Brachysyntexis          00???????? ?????????? ?????????? ????????00 ?????????? ?????????? ?????????? ??????000? ?????????? ?????????? ?????????? ?????10??? ?????????0 ?????????? ?????????? ????????20 000100-100 1????????0 000?0????? ?0???????? ?????????? ?????????? ?????????? ??????
+Symphytopterus          00??0????? ????1????? ?0000(0,1)???? ????????00 ?????????? ?????????? ?????????? ???????20? ?????????? ?????????? ?????????? 1????0--?? ????????10 ???2????3? ?????????? ???????121 0101200000 2?????01(0,1)(0,1) 10010?0??? ?0??1????? ???0?????? ?????????? ?????????? ??????
+Eoxyela                 0????????? ????0????? ?-??????????????????????????????????????????????????????000????????????????00????????0?????????11???????????00????????????????????????????0000000000001?????0???00000?01???0?????0?????0????0???????????????????????????
+Liadoxyela              0????????? ?????????? ?010???????????????????????????????0????????????????????000????????????????00????????????????????????????????0????????????????????????????00000010000?1?????????????0?01???????????????????????????0?(0,1)??????????????????
+Abrotoxyela             0????????? ????0????? ?010?(0,1)????????????0?????????????????????????????????????000??????????????????????????0???????????????????????0????????????????????????????0000000000001?????0?00000?0??1???0?????????????????????????(0,1)?1????????????????
+Pseudoxyelocerus        ?????????? ?????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????1010010010001?????????????????????????????????????????????????????????????????
+Palaeathalia            0????????? ?????????? ??00?????????????????????????????????????????????????????????????????????????????????????????????????????????0????????????????????????????201-1?001?????????0100?00?0???????????????????????????????????????????????????
+Ferganolyda             ?????????? ?????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????0000010000001?????????????????????????????????????????????????????????????????
+PamphiliidaeUndesc      ?????????? ?????1?0?? ?????2?????????????????????????????????????????????????????????????????????00????????0???????????????????????0????????????????????????????000001000???1?????????????0??(1,2)???0????????????????????????????????????????????
+Rudisiricius            00???????? ????0????? ?0?0?2????????????0?????????????????????????????????????0??????????????????01????????0???????????????????????0????????????????????????????210?010000001?????0100000?0??(1,2)?????????????????????????????(0,1)??????????????????
+Sogutia                 ?????????? ?????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????0001000???1?????????????0??????0????????????????????????????????????????????
+Xyelula                 00???????? ?????????? ??10?(0,1)?????????????????????????????1????????????????????000????????????????????????????????????10????????????0????????????????????????????2100000000001?????????????0??2???0?????0?????0????????????????????????????????
+Brigittepterus          ?????????? ?????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????2100012000001?????????????0??????0????????????????????????????????????????????
+Grimmaratavites         ?????????? ?????????? ??????????????????0?????????????????????????????????????0?2???????(0,1)????????????????????????????11????????????0????????0???????????????????2100010000001?????????????(1,2)?02???0???0?0?????0????0???????????????????????????
+
+
+[Morphology, new characters, Schulmeister]
+Orthoptera              ???? ?????????? ??????? ?  ?? ??????
+Paraneoptera            ???? ?????????? ??????? ?  ?? ??????
+Chrysopidae             ?000 1????00??? ?00??0- -  -? ??00??
+Raphidioptera           0000 1????00??? 1??000- -  -0 -0????
+Coleo_Polyphaga         2000 0???????0? ???000- -  -? ?0????
+Coleo_Adephaga          ???? ?????????? ??????? ?  ?? ??????
+Lepid_Micropterigidae   0010 1????00??? ?00??0- -  -? ?00???
+Lepid_Papilionidae      ???? ?????????? ??????? ?  ?? ??????
+Mecoptera               0000 1????0000? 100000- -  -0 0000??
+Xyela                   2010 2000000100 0000010 0  00 000000
+Macroxyela              2000 2000000000 0000010 0  00 000000
+Runaria                 2001 2001001101 0??0020 0  0? 0000??
+Paremphytus             200? ?001001101 ??????? ?  ?? ??00??
+Blasticotoma            2001 2001001101 0??002? ?  ?? ??000-
+Tenthredo               2001 200010??00 1000021 1  00 000001
+Aglaostigma             2001 2000101101 1000021 0  00 000001
+Dolerus                 2001 200000??00 1000021 0  00 000011
+Selandria               2001 200020??01 1??0021 1  00 000001
+Strongylogaster         2001 200020??00 1000021 1  00 000001
+Monophadnoides          2001 2000-01101 1000021 1  00 0000?1
+Metallus                2001 2000-01101 100002? ?  ?0 010001
+Athalia                 2001 2000001101 1000020 0  00 0000?1
+Taxonus                 2001 2000001100 1000021 0  00 000001
+Hoplocampa              2001 2000-01101 1000021 1  00 000002
+Nematinus               2001 2000-01101 000002? ?  ?0 000002
+Nematus                 2001 2000-01101 0000021 1  00 0000?2
+Cladius                 2001 2000-01101 0000021 1  00 000002
+Monoctenus              0001 2000-01101 1000021 0  00 000001
+Gilpinia                0001 2000101101 1000021 0  00 0000?1
+Diprion                 0001 2000101101 1000021 0  00 0000?1
+Cimbicinae              2001 2001101101 1000021 0  0? 0000?1
+Abia                    2001 2001-01101 1000021{0,1}00 000001
+Corynis                 2001 2001-01101 1000021 0  00 0000?1
+Arge                    2001 2010-01101 0000020 0  00 000003
+Sterictiphora           2001 2100-01101 0000020 0  00 000002
+Perga                   200- 20?1-???1- 0??0020 0  0? 0?00??
+Phylacteophaga          200- 2000-0111- 1??0020 0  00 0000??
+Lophyrotoma             ?001 2011-0111- 0??0020 0  00 0000??
+Acordulecera            2001 2000-0111- 100002? ?  ?0 0000?2
+Decameria               ?00- 2010-0111- 0??0020 0  00 0000??
+Neurotoma               0001 2001001101 100001? ?  ?? 0?000-
+Onycholyda              0001 2001001101 1000010 0  00 0000?-
+Pamphilius              0001 2001001101 0000010 0  0? 0?000-
+Cephalcia               0001 2000001101 0000010 0  00 00000-
+Acantholyda             0001 2000001101 0??0010 0  00 00000-
+Megalodontesc           0001 2001001101 0000010 0  00 00000-
+Megalodontessk          0001 2001001101 0??0010 0  00 ?0000-
+Cephus                  0001 2000111101 0000021 0  00 01000-
+Calameuta               0001 2000111100 0000021 0  00 0100?-
+Hartigia                0001 2000111100 0000020 0  00 01000-
+Syntexis                0001 2100001101 000000- -  -? 01101-
+Sirex                   0000 1111001101 ?001010 0  1? 00201-
+Xeris                   0000 111100111- 1??110- -  -0 00201-
+Urocerus                0000 1111001111 ?001010 0  10 0020?-
+Tremex                  1000 111100111- 1001110 0  1? 00201-
+Xiphydria               0000 2001001101 1000020 0  00 00000-
+Orussus                 2100 21-0-0111- 111000- -  -0 00010-
+StephanidaeA            0001 2100-0111- 10?200- -  -? 1000?-
+StephanidaeB            ???? ?????????? ??????? ?  ?? ??????
+Megalyra                1000 2?00-2111- 1??100- -  -? 0????-
+Trigonalidae            0001 2000-2111- ???002? ?  ?? 0????-
+Chalcidoidea            ???? ?????????? ??????? ?  ?? ??????
+Evanioidea              1001 2000-0111- 1??000- -  -? 0????-
+Ichneumonidae           0000 2000-0111- 100000- -  -0 1000?-
+Cynipoidea              1000 2001-0111- ???000- -  -0 0?00?-
+ApoideaA                1001 2000-0111- 1000020 0  01 000?0-
+ApoideaB                ???? ?????????? ??????? ?  ?? ??????
+ApoideaC                ???? ?????????? ??????? ?  ?? ??????
+Vespidae                1001 2000-0111- 100000- -  -1 100?0-
+Triassoxyela            ???? ?0000????? ??????? ?  ?? ??????
+Asioxyela               ???? ?0000??1?? ??????? ?  ?? ??????
+Nigrimonticola          000? ?00??????? ??????? ?  ?? ?00???
+Gigantoxyelinae         100? ?000000000 ??????? ?  ?? ?00???
+Spathoxyela             100? ?000000100 ??????? ?  ?? ?00???
+Xyela_mesozoica         200? ?0000??1?? ??????? ?  ?? ?00???
+Angaridyela             000? ?0000001?? ??????? ?  ?? ?00???
+Xyelotoma               20?? ????00?1?? ??????? ?  ?? ?00???
+Undatoma                200? ?0010011?? ??????? ?  ?? ?00???
+Dahuratoma              20?? ?000001101 ??????? ?  ?? ?00???
+Mesolyda                00?? ?000001101 ??????? ?  ?? ?00???
+Turgidontes             (0,1)??? ?00?0????? ??????? ?  ?? ?0????
+Aulidontes              ???? ?00?0?1101 ??????? ?  ?? ??????
+Protosirex              00?? ?001001001 ??????? ?  ?? ??????
+Aulisca                 00?? ?0000????? ????0?? ?  ?? ?00???
+Anaxyela                0??? ?0000?1101 ??????? ?  ?? ??????
+Syntexyela              00?? ?000001101 ??????? ?  ?? ?0????
+Karatavites             00?? ?000001101 ??????? ?  ?? ??????
+Stephanogaster          00?? ?000-0111- ??????? ?  ?? ?00???
+Leptephialtites         00?? ?000-?111- ??????? ?  ?? ?00???
+Cleistogaster           00?? ?000-0111- ??????? ?  ?? ?00???
+Sepulca                 ???? ?00?001100 ??????? ?  ?? ?0????
+Onochoius               20?? ?00?0?1??? ??????? ?  ?? ?00???
+Ghilarella              ???? ?000011100 ??????? ?  ?? ?00???
+Paroryssus              ???? ?000-011?? ??????? ?  ?? ??????
+Praeoryssus             0??? ?00?-??1?? ??????? ?  ?? ??0???
+Mesorussus              200? ?????????? ??????? ?  ?? ??????
+Trematothorax           000? ?000001101 ???00?? ?  ?? ?0????
+Thoracotrema            ??0? ?0000?1101 ??????? ?  ?? ?0????
+Prosyntexis             0?0? ?000101101 ??????? ?  ?? ??????
+Kulbastavia             ???? ?000001101 ??????? ?  ?? ?00???
+Brachysyntexis          00?? ?000001101 ??????? ?  ?? ?00???
+Symphytopterus          00?? ?000-0111- ????0?? ?  ?? ?00???
+Eoxyela                 ???? ?000000?00 0?????? ?  ?? ?000??
+Liadoxyela              0??? ?0000????? ??????? ?  ?? ??????
+Abrotoxyela             ?0?? ?00000??00 ??0?0?? ?  ?? ?000??
+Pseudoxyelocerus        ???? ?0000????? ??????? ?  ?? ??????
+Palaeathalia            20?? ?????0??01 ??????? ?  ?? ??0???
+Ferganolyda             ???? ?0000????? ??????? ?  ?? ??????
+PamphiliidaeUndesc      ???? ????0????? 0?????? ?  ?? ?000??
+Rudisiricius            0??? 2000001101 0?????? ?  ?? ?0????
+Sogutia                 ???? ?00?0????? ??????? ?  ?? ??????
+Xyelula                 20?? ?0000????? ??????? ?  ?? ?000??
+Brigittepterus          ???? ?0000????? ??????? ?  ?? ??????
+Grimmaratavites         ???? 00000????? ??????? ?  ?? ??00??
+
+
+[Morphology, male terminalia, Schulmeister]
+Orthoptera              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Paraneoptera            ???? ----?????? ?????????1 ???0????2? ?????? ?  ??? ?????????? ? ?  ??0????? ???????000 ?? ?  ??????? ???
+Chrysopidae             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Raphidioptera           ???? ----?????? ?????????1 ???0????2? ?????? ?  ??? ???????0?? ? ?  ??0????? ?????????? ?? ?  ??????? ???
+Coleo_Polyphaga         ???? ?????????? ?????????? ???00????? ?????? ?  ??? ???????0?0 ? ?  ??0????? ?????????? ?? 0  0?0???? 0??
+Coleo_Adephaga          ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Lepid_Micropterigidae   ???? ----?????? ?????????1 ???0????2? ?????? ?  ??? ?????????? ? ?  ??0????? ?????????? ?? ?  ??????? ???
+Lepid_Papilionidae      ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Mecoptera               ???? ----?????? ?????????1 ???0????2? ?????? ?  ??? ???????0?0 ? ?  ??0????? ???????0?? ?? 0  0?0???0 010
+Xyela                   0-00 ?000000000 2000000100 0001010000 000100 0  101 0000000100 0 1  00100000 0000000000 00 2  0000010 000
+Macroxyela              0-00 0000000000 2000000100 0000010000 000100 0  101 0000000100 0 1  00100000 0000000000 00 1  0000010 000
+Runaria                 0-00 0000000201 4010020211 0000010000 000101 0  00? 0-?0001010 0 1  00100010 0000000000 00 0  0020010 000
+Paremphytus             0-00 0000000211 1010000211 0000000000 000101 0  000 0-10001010 0 1  10100010 00010000?0 0? 0  0020010 000
+Blasticotoma            ???? ?????????? ?????????1 ???0000000 000100 ?  000 0-?0001010 0 ?  ??1?001? ?000000000 00 0  0?0???0 000
+Tenthredo               2000 2001000101 3000000211 0001000000 000300 0  101 0-?1000000 0 0  00100010 0000000020 00 2  0001020 100
+Aglaostigma             2000 2001000001 3010000211 0001000000 000300 0  211 0-11000000 0 2  ?0100010 0000000010 10 1  0001010 000
+Dolerus                 2000 --11100101 3010000--1 0001000002 000310 0  101 0-?1000000 0 0  10100010 0000000000 00 2  0001020 000
+Selandria               2000 2001200101 1010000211 0001000000 000300 0  100 0-11000000 0 2  00100010 0000000040 00 1  0001020 000
+Strongylogaster         2000 2000000101 1010000211 0001000000 000300 0  110 0-11000000 1 2  00100010 0000000030 00 1  0001020 000
+Monophadnoides          2000 --01100001 3000000211 0001000001 000300 0  111 0-11000000 0 1  00100010 0000000000 2- 2  0001010 000
+Metallus                2000 --11200101 1010000--1 0001000011 000300 0  111 0-110000?0 0 1  10100010 0000000000 2- 1  0001013 000
+Athalia                 2000 2000000101 1000000--1 0001000000 000200 0  201 0-11000000 0 0  00100010 0000000000 00 3  0101010 000
+Taxonus                 2000 2001000101 2000000211 0001000000 000300 1  101 0-11000000 0 2  00100010 0000000000 00 2  0001020 000
+Hoplocampa              2000 2100000101 1010000211 0001020000 000300 0  111 0-11000010 0 1  10100010 0000000000 00 2  0001020 000
+Nematinus               2000 2000000101 1010000211 0001000000 000300 0  110 0-11000011 0 2  00100010 0000000000 00 1  0001021 000
+Nematus                 2000 2000000101 0010000211 0001000000 000300{0,1}110 0-11000001 0{1,2}10100010 0000000000 00{1,2}0001024 000
+Cladius                 2000 2000200201 1000000--1 0001000000 000200 1  101 0-?1000010 0 1  10100010 0000000030 00 1  0001011 000
+Monoctenus              2010 2011000101 1010000--1 0001000000 000300 0  11? 0-11000000 1 2  00110010 0000000000 00 3  0001020 000
+Gilpinia                2010 2001000001 1010032--1 0001000100 000300 1  111 0-11000000 1 3  10110010 0000000020 00 3  0200010 000
+Diprion                 2110 2001000101 101003?--1 0001000100 000300 0  11? 0-11000000 1 0  10110010 0000000020 00 3  0100010 ??0
+Cimbicinae              2110 2001100101 3000002201 0001000000 000200 0  101 0-10000000 0 2  00101010 0000000030 00 2  0000030 000
+Abia                    2110 2001000101 3000000--1 0001000000 000200 0  101 0-10000000 0 2  10111010 0000000000 00{1,3}0000030 000
+Corynis                 2000 2001200101 3000020201 0001000000 000100 0  101 0-?0000100 0 2  00111010 ?000000000 00 3  0001032 ??0
+Arge                    0-00 --11000001 3110010201 0001000011 100100 0  001 0-10100000 0 2  11100010 0000100130 ?? 0  0301010 000
+Sterictiphora           0-00 --01000011 3000010201 0001010001 101100 0  001 0-10100000 0 0  01100010 0000100130 01 0  0001020 000
+Perga                   ??00 ----00000? ?210??0??1 00010-002- --0100 0  101 0-?0000000 0 ?  ?110001? ?000100??? ?? ?  ?3??01? ???
+Phylacteophaga          ??00 ----0000?1 1010010--1 00010-002- --0110 0  ?0? 0-10000000 ? 2  0110001? ?000000000 2- 0  0331010 001
+Lophyrotoma             0-00 ----200001 1200010201 00010-002- --0100 0  101 0-10000000 0 3  01101010 0000100000 01 0  0301010 100
+Acordulecera            1-00 ----000001 3200010201 00010-002- --0100 0  100 0-10000000 0 2  01100010 0000100000 ?? 0  000?010 021
+Decameria               1-00 ----000001 3200010201 00010-002- --0100 0  001 0-10000000 0 2  11100010 0000100000 01 0  0301010 001
+Neurotoma               1-00 ?10?000?00 3020??0100 0000000000 000000 ?  ?00 01?0011000 0 ?  ?010001? ?000000000 00 0  0200010 000
+Onycholyda              1-00 0100000000 3000000100 0000010000 000000 0  101 0110011000 0 3  00100010 0000000000 00 0  0200010 000
+Pamphilius              1-00 ?100000?00 302000?1?0 0000010000 000000 ?  ?00 01?0011000 0 ?  ?010011? ?00000000? 0? 0  0200010 000
+Cephalcia               2-00 0100000100 3020020100 0000010000 000000 0  101 0110011000 0 3  00100110 0000000000 00 0  0200010 000
+Acantholyda             ??0? ??0??00?00 30?00?01?0 0000010000 000000 ?  ?01 01?00?1000 0 ?  ?0100110 0000000000 ?0 0  020?01? 000
+Megalodontesc           1-00 0100000011 3021100100 0000000010 000000 1  101 0110010000 0 4  10110010 0000000040 00 1  0201021 000
+Megalodontessk          ??00 01??000211 3021100??0 0000000010 000000 1  101 01?0010000 0 4  10110010 ?000000??? ?? 1  0201021 ??0
+Cephus                  1-00 2000000201 1020111--- 0010000000 000100 0  000 0-----1000 0 2  0-100110 0000010000 2- 0  0300010 000
+Calameuta               1-00 2001000211 1020111--- 0010000000 000100 0  000 0-----1000 0 2  0-100110 0000010000 2- 0  0300000 000
+Hartigia                1-00 1000100201 1020111--- 0010000000 000100 0  000 0-----0000 0 2  0-100110 0000010000 2- 0  030000? 000
+Syntexis                ???? 001100000? 3000?20--1 0000010000 000100 1  001 0-10001000 0 3  0010001? ?000?00??? ?? ?  0?0???? ???
+Sirex                   1-0? 00?0100000 30200?0000 00?0010000 001100 0  ?0? 01?000?000 0 ?  ?-100?1? ?000?10?0? ?? ?  ?3110?? 000
+Xeris                   1-00 0000100000 3020000000 0010010000 001100 0  10? 0110001000 0 1  0-100111 ?000010000 00 1  0311011 000
+Urocerus                1-00 0000110000 3020020000 0010010000 001100 0  10? 01?0001000 0 1  0-100011 0000010000 00 1  0311010 000
+Tremex                  1-00 0?001000?0 3020000010 0000000000 001100 0  100 01?0001000 0 ?  1-120011 ?000?10??? ?? 1  0310011 001
+Xiphydria               1-00 1000000001 1000010000 0000000000 010100 1  101 0110001000 0 2  00100010 0000000000 00 0  0020010 000
+Orussus                 1-01 100010000? ?000031--- 0000100000 000100 0  101 0-----1000 0 3  00100000 0011000030 ?0 0  0001112 200
+StephanidaeA            1-20 1001100201 1000011--- 0000100000 010000 0  301 0-----1000 0 2  10101001 0001001001 ?? 1  0102000 020
+StephanidaeB            ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Megalyra                ???? ?????????? ??????1--- ?????00?0? 011100 ?  ?0? 0-----?000 0 ?  ??11001? ??00?00??? ?? 0  0102002 020
+Trigonalidae            1-20 200000000? 3000??2--1 ?000020000 010100 1  ?00 0-1-000000 0 ?  1011001? ?00000000? ?? 0  0102010 210
+Chalcidoidea            ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Evanioidea              ???? ???0?????? ?0????1--- ??0?010000 010100 1  ?00 0-----?000 0 ?  ?01?000? ?00000??0? ?? 0  0100010 200
+Ichneumonidae           0-00 1000100211 3000001--- 0100100010 110100 0  000 0-----1000 0 2  00100010 0000000?00 2- 0  0031000 200
+Cynipoidea              ???? ?????????? ??????1--- ?????10000 000100 ?  ?0? 0-----?000 0 ?  0?10011? ?000?00??? ?? 0  ?--1--2 001
+ApoideaA                1-00 2000000201 1000131--- 0000021000 010000 0  300 0-----0000 1 ?  01100010 0100001001 20 0  0201011 211
+ApoideaB                ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+ApoideaC                ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Vespidae                1-00 1010000101 1000031--- 1000011010 010000 1  201 1-----1000 0 0  0?110001 0000001050 20 1  1102011 211
+Triassoxyela            ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Asioxyela               ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Nigrimonticola          ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Gigantoxyelinae         ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Spathoxyela             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Xyela_mesozoica         ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Angaridyela             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Xyelotoma               ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Undatoma                ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Dahuratoma              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Mesolyda                ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Turgidontes             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Aulidontes              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Protosirex              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Aulisca                 ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Anaxyela                ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Syntexyela              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Karatavites             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Stephanogaster          ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Leptephialtites         ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Cleistogaster           ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Sepulca                 ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Onochoius               ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Ghilarella              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Paroryssus              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Praeoryssus             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Mesorussus              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Trematothorax           ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Thoracotrema            ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Prosyntexis             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Kulbastavia             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Brachysyntexis          ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Symphytopterus          ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Eoxyela                 ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Liadoxyela              ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Abrotoxyela             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Pseudoxyelocerus        ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Palaeathalia            ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Ferganolyda             ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+PamphiliidaeUndesc      ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Rudisiricius            ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Sogutia                 ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Xyelula                 ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Brigittepterus          ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+Grimmaratavites         ???? ?????????? ?????????? ?????????? ?????? ?  ??? ?????????? ? ?  ???????? ?????????? ?? ?  ??????? ???
+
+
+[12S 354-559, 203 chars]
+Orthoptera              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Paraneoptera            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Chrysopidae             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Raphidioptera           ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Coleo_Polyphaga         ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Coleo_Adephaga          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Lepid_Micropterigidae   ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Lepid_Papilionidae      ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Mecoptera               ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Xyela                   TCTTTAAACTTAAAGAATTTGGCGGTATTTTAGTCTTTTCAGAGGAACTTGTCCCGTAATC-GATAATCCTCGATA-ATCTTACTT  AATTTGTATACCGCCGTT      TTCAGGTCAAGGTGCAGTT-TATAATTAAG--TGGAGATGAGTTAC  ATAT--TAAAATGAAGGTGGATTTGAAGGT  TTGATTATAGCTCTAAAATATGT
+Macroxyela              TCTTGAAACTTAAAGAATTTGGCGGTGTTTTAGTCTTTTCAGAGGAACCTGTCCTGTAATT-GATATTCCACAATA-ATCTTACTT  AATTTGTATACCGCCGTT      TTCAGGTCAAGGTGCAGTT-AATAATTAAG--AAGAGATGGGTTAC  AAAA--TAAAATGAAGGTGGATTTGAAAGT  TTGATTATAGCTCTAGAACATGT
+Runaria                 TCTTAAAATTCAAGAGATTTGGCGGTATTC-TATCAAATTAGGGGAATTTGCTTATGAATT-GATAATCCGCAAGAAATCTTACTT  AATTTATATGTCGCCGTT      TTCAGGT-AAGATGTAGTT-TATAATAAAG--GTTAAGTGAATTAC  ATAT--ATAATTGAAGGTGGACTTAAAAGT  TTGAATTTAGATCTAGAATATGT
+Paremphytus             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Blasticotoma            TCTTGAAACTCAAGAGATTTGGCGGTACTTTAATCTAATTAGGGGAATTTGTTTATTAAAT-GATGATCCACAAGGCATCTTACTT  AATTTATATGTCGCCGTT      TTCAGGT-AAGATGTAGTT-TATAGTAGAG--TTTAAATGAGTTAC  ATAT--TTAGTTGAAGGTGGACTTAAAAGT  TTGAATATAGTGCTAAAGTATGT
+Tenthredo               TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTCTTTTAAAT-GATAATCCTCAAGATACCTTACTT  AATTTATTTATTGCCGTT      TTCAGGTCTTTATGTAGTT-TATAATAAAG--TTAAGATGAATTAC  ATTT--ATAATTGAAAGTGGACTTAATAGT  TTGAATTAAGAATTAAA-TATGT
+Aglaostigma             TCTTTAAACTTAAAAAAATTGGCGGTGTTTAAGTCTGATTAGGGGAATTTGTCTTTTAAAT-GATATTCCGCAAGATACCTTACTT  AATTTATTTATTGCCGTT      TTCAGGTCTTTATGTAGTT-TATAATAAAG--TTTAGATGAATTAC  AATT--TTTATTGAAAGTGGACTTAGTAGT  TTGAATTTAGAATTAAA-CATGT
+Dolerus                 TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTTTATTAAAT-GATAATCCGCAAGATACCTTACTT  AATTTATTTATTGTCGTT      TTCAGATCATTATGTAGTT-TATATTAAAG--TTTAAATGAATTAC  ATAT--ATAATTTAAAGTGGACTTAATAGT  TTGAATTAAGAATTAAA-TATGT
+Selandria               TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTTTATTAAAT-GATAATCCTCAAGAAACCTTACTT  AATTTATTTATTGCCGTT      TTCAGGTCATTATGTAGTT-AATATTAAAG--TTAAAATGAATTAC  ATAT--TTAATTAAAATTGGACTTAATAGT  TTGAAATTAGAATTAAA-TATG-
+Strongylogaster         TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTGATTAGGGGAATTTGTTTATTAAAT-GATAATCCTCAAGAAACCTTACTT  AACTTATTTATTGCCGTT      TTCAGGTCATTATGTAGTT-TATATTAAAG--TTTAGATGAATTAC  ATAT--TTTATTGAAAGTGGACTTAATAGT  TTGAAATAAGAA-TTAAATATGT
+Monophadnoides          TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAACTTGTCTTTAAAAT-GATAGTCCGCAAGAAACCTTACTT  AATTTATTTATTGCCGTT      TTCAGGTCTTTATGTAGTT-TATATTAAAG--TTAAGATGAGTTAC  ATTT--TTAATTGAAAGTGGACTTAATAGT  TTGAATTAAGAA-TTAAATATGT
+Metallus                TCTTTAAATTTAAAAAAATTGGCGGTATTTAAATCTAATCAGGGGAACTTGTTTTTTAATT-GATAATCCTCAAAGTACCTTACTT  AATTTATTTATTGCCGTT      TTCAGGTCATTATGTAGTT-TATATTAAAG--TTAAAATGAGTTAC  ATAT--ATAATTAAAATTGGACTTGATAGT  TTGAATTAAGAA-TTAAATATGT
+Athalia                 TCTTTAAATTTAAAAAAATTGGCGGTATTTAAAACTAATTAGGGGAACTTGTTTTTTAAAT-GATAATCCGCATGATACCTTACTT  AATTTATTTACTGCCGTT      TTCAGGTCATGGTGTAGTT-TATATTAAAG--TTAAAATGAGTTAC  ATAT--TAAATTAAAGGTGGACTTAATAGT  TTGAATTAAGAATTAAA-TGTGT
+Taxonus                 TCTTTAAATTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTTTATTAAAT-GATAATCCGCAAGAGACCTTACTT  AATTTATTTATTGCCGTT      TTCAGGTCATTATGTAGTT-TATATTAAAG--TTTAAATGAATTAC  ATAT--ATTTTTGAAGGTGGACTTAATAGT  TTGAATTAAGAA-TTAAATATGT
+Hoplocampa              TCTTTAAACTTAAAAAAATTGGCGGTATTTAAAACTAATTAGGGGAACTTGTCTTTTAAAT-GATAATCCGCAAGAAACCTTACTT  AATTTGTTTATTGCCGTT      TTCAGGTCATTATGTAGTT-TATATTAAAG--TTAAGATGAGTTAC  ATAT--AAAATTAAAAGTGGACTTAATAGT  TTGAATTTAGAA-TTAAATATGT
+Nematinus               TCTTTAAACTTAAAAAAATTGGCGGTATTTAACTCTAATTAGGGGAATTTGTCTTTAAAAT-GATAATCCTCAAGAAACCTTACTT  AATTTATTTATTTCCGTT      TTCAGGTCATTATGTAGTT-TATATTAAAG--TTAAGATGAATTAC  ATAT--AAAATTAAAAGTGGACTTAATAGT  TTGAATTTAGAA-TTAAATATGT
+Nematus                 TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTCTTTTAAAT-GATAATCCGCAAGAAACCTTACTT  AATTTGTTTATTGCCGTT      TTCAGGTCATTATGTAGTT-TATATTAAAG--TTAAGATGAATTAC  AAAT--TAAATTGAAAATGGACTTAATAGT  TTGAATTTAGAATTAAA-TATGT
+Cladius                 TCTTTAAACTTAAAAAAATTGGCGGTATTTAAGTCTAATTAGGGGAATTTGTTTTTTAAAT-GATAATCCGCAAGATACCTTACTT  AATTTGTTTATTTCCGTT      TTCAGGTCTATATGCAGTT-TATATTAAAG--TTAAAATGAATTAC  ATAT--TAATTTGAAGGTGGACTTATAAGT  TTGAATAAAGAATTAAA-TATGT
+Monoctenus              ACTTTAAATTTAAAAAAATTGGCGGTATTTAAAACTAATTAGGGGGGTTTGTTTAATAAAC-GATGATCCGCGTGAAATCTTACTT  AATTTATTTATTTTCGTT      TTCAGATCAAGATGTAGTT-TATATTAAAG--TTTAAATGAATTAC  ATAT--TTAATTGAAATTGGACTTAATAGT  TTGAATTTAGAATTAAA-TATGT
+Gilpinia                TCTTTAAAATTAAAAAAATTGGCTGTATTTAATACTAATTAGGGGAATTTGTTTATTAAAC-GATGGTCCGCGATATATCTTACTT  AATTTATTTATTTTCGTT      TTCAGATCAAGATGTAGTT-TATATTAAAG--ATTAAATGAATTAC  AAAT--TTAATTGAAATTGGACTTAATAGT  TTGAATTTAGAA-TTAAATAAGT
+Diprion                 TCTTGAAAATTAAAAAAATTGGCGGTATTTAAAACTAATTAGGGGAATTTGTTTATAAAAC-GATGATCCACGAGGAATCTTACTT  AGCTTATTTATTTTCGTT      TTCAGATCAAGATGTAGCT-TATATTAAAG--TTTAAATGAATTAC  ATAT--TTATTTGAAATTGGACTTAATAGT  TTGAATTTAGAATTAAA-TGTGT
+Cimbicinae              TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTTTTTTAATT-GTTAATACTCAAAAAACCTTACTT  AATTTGTTTATTGTCGTT      TTCAGATCATGATGCAGTT-TATATTAAAG--TTAAAATTAATTAC  AAAT--GTTTTAGAAGGTGGACTTAATAGT  TTGAATTTAGAATTAAA-TATGT
+Abia                    TCTTTAAACTTAAAAAAATTGGAGGTATTTAAATCTAATTAGGGGAATTTGTTTTTTAAAT-GATAATCCACAAGATACCTTACTT  AATTTGTTTATTGTCGTT      TTCAGATCATAGTGCAG-T-AATAATAAAG--TTAAAATGAGTTAC  ATAT--TTTATTAAAAGTGGACTTAATAGT  TTGAATTTAGAATTAAA-TATGT
+Corynis                 TCTTTAAACTTAAAAAAATTGGCGGTATTTAAATCTAATTAGGGGAATTTGTTTTTTAATC-GATGATCCGCGTGATACCTTACTT  AATTAGTTTATTTCCGTT      TTCAGGTCAAGATGCTGTT-TATATTAAAG--TTAAAATGAATTAC  ATAT--TTAATTGAAAGTGGACTTAATAGT  TTGAATTTAGACTTAAA-TATGT
+Arge                    TCTTTAAATTCAAAAAATTTGGCGGTATTT-TATCTAATTAGGGGAACTTGTTTAATGAAT-GATATTCCTCGAGTTACCTTACTT  AATTTATGTATTTCCGTT      TTCAGGTCAAAGTGTAGTT-TATATAAAAG--TTAAAATGAGTTAC  ATTTAATTAATTGAAGGTGGACTTAATAGT  TTGAATAAAGATCTAAAATATGT
+Sterictiphora           TCTTTAAATTCAAAAAAATTGGCGGTATTT-TATCTAATTAGGGGAATTTGTTTTATAAAT-GATAATCCACGAGGAACCTTACTT  AATTTGTGTATTTCCGTT      TTCAGGTCAAAGTGCAGTT-TATGAGTGAG--AAAAAATGAGTTAC  ATAA--ATTAAATAAGGAGGACTTAATAGT  TTGAATTAAGATCTAGAATGTGT
+Perga                   TCTTTAAAATCAAAAAAATTGGCGGTATTT-TATCTAATTAGGGGAATTTGTTTATTAAAT-GATAATCCGCGAGAAATCTTACTT  AATATATGTACTTCCGTT      TTCAGGTCAAAGTGTAGTT-TATAAAAAAG--TTTAAATGAATTAC  ATAT--TTAAATGAAGGTGGACTTAATAGT  TTGAAAAAAGATCTAAAATATGT
+Phylacteophaga          TCTTTAAATTTAAAAAAGTTGGCGGTATTT-TATCTAATTAGGGGAATTTGTTTTTTAAAT-GATGATCCGCGAGAAATCTTACTT  AGTTTATGTATTTCCGTT      TTCAGGTCAAAGTGTAGCT-TATAAAAAAG--TTAAAATGAATTAC  AAAT--TTAAATGAAGGTGGACTTAATAGT  TTGAATATAGGTCTAAAATATGT
+Lophyrotoma             ATTTTAAAATTAAAGAATTTGGCGGTATTT-TTTCTAATTAGGGGAATTTGTCTTTTAAAT-GATAATCCACGAGGAACCTTACTT  AATTTATGTATTTCCGTT      TTCAGGTCAAAGTATAGTT-TATAAAATAG--TAAAGATGAATTAC  ATTT--ATTTTTGAAGGTGGACTTAATAGT  TTGAAAAAGAAT-TAAATTATGT
+Acordulecera            TCTTTAAATCTAAAAAAATTGGCGGTATTT-TATCTAATTAGGGGAATTTGTTTATTAAAT-GATAATCCGCGAGATACCTTACTT  AATTTGTATACTTCCGTT      TTCAGGTCAAAGTGCAGTT-TATTAAAAAG--TATAAATGAATTAC  ATAT--TTAAATGAAGGTGGACTTAATAGT  TTGAAAATAGATCTAAAATATGT
+Decameria               TCTTTAAATTTAAAAAAATTGGCAGTATTT-TATCTTATTAGGGGAATTTGTTTAATAAAT-GATAATCCACGAGAAACCTTACTT  AATTTATGTATTTCCGTT      TTCAGGTCACAATGTAGTT-TATAATAAAG--TTAAAATGAATTAC  ATAT--TTAATTGAAGGTGGACTTAATAGT  TTGAAAGAAGATCTAAAATATGT
+Neurotoma               ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Onycholyda              TCTTTAAATTTAATGAATTTGACGGTATTATAATCTATTTAGAGGAACCTGTATTTTAATT-GATAATCCACGATAAATTTTACTT  AGTTTGTATACCGCCGTT      TTCAGGTCAAGGTGCAGCT-AATAATTAAG--TTAATATGGGTTAC  ATAA--AATTATTAAAGTGGATTTAAAAGT  TTGAATTTAGCTCTATAATATGT
+Pamphilius              TCTTTAAATTTAATGAATTTGGCGGTATTATAATCTAATTAGAGGAACCTGTATTTTAATT-GATAATCCACGATAAATTTTACTT  AGTTTGTATACCGCCGTT      TTCAGGTCAAGGTGCAACT-AATAATTAAG--TTAATATGGGTTAC  ATAA--AATTATTAAAGTGGATTTAAAAGT  TTGAATATAGCTCTATAATATGT
+Cephalcia               TCTTTAAAATTAATAAATTTGGCGGTATTATAATCTAATTAGAGGAACCTGTATTTTAATC-GATAATCCACGATAAATTTTACTT  AATATGTATACCGCCGTT      TTCAGGTCAAGGTGCAGTT-TATAATTAAG--TATATATGGGTTAC  ATTT--AATTATTAAAGTGGATTTAAAAGT  TTGATTATAGCTCTATAATATGT
+Acantholyda             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Megalodontesc           TCTTTAAAGTTAATAATTTTGGCGGTATTATAGTCATTTTAGAGGAACCTGTGTTATAATT-GATGGTCCACAATTTATTCTACTT  AGTTTATATACCGCCGTT      TTCAGGTCAAGGTGTAGTT-TATAGTTAAG--TAAATATGGGTTAC  A-AT--TATTATGAAAATGGATTTAAAAGT  TTGATTTATGCTCTATAATATG-
+Megalodontessk          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Cephus                  TCTTGAAACTTTAAGAATTTGACGGTAATTCATTCAATTTAGAGGAACTTGTTTTTTAATT-GATAATCCACGATATAAATTACCT  TGTTTGTATACCGTCGTT      TTCAGATCAAGGTGCAGCTATTTATTTAGG--TTAAAATGAGTTAC  ATAT--TTAAATTAAGGTGGATTTAAAAGT  TTGAGATTTGTTTTGAATTATGT
+Calameuta               TCTTGAAACTTTAAGAATTTGACGGTAATTCATTCATTTTAGAGGAACTTGTTTTTTAATT-GATATTCCACGATAAAATTTACCT  TGTTTGTATATCGTCGTT      TTCAGATCAAGGTGCAGCTATTTATTTAGG--TTAAAATGAGTTAC  ATTT--TTAAATTAAGGTGGATTTAAAAGT  -----------------------
+Hartigia                TCATGAAACTTAAAGAATTTGACGGTAATTCATTCATATTAGAGGAACTTGTCTTTTAATT-GATAATCCACGATAAAATTTACCT  TATTTATATACCGTCGTT      TTCAGATCAAGGTGTAGTA-TATATTTAGG--TTAAGATGAGTTAC  ATAT--TTTATTGAAAGTGGATTTAAAAGT  TTGATAAA---------------
+Syntexis                TCTCGAAATTTAAAAAATTTGACGGTATTTTAAT-TAATCAGGGGAACTTGTTCATTAAATCGATAGTCCACGATAGAAACTACTT  AGCTTGTATACCGTCGTT      TTCAGATCAAGGTGCAGTT-TATAGTTAAG--ATAGAATGAGTTAC  TTTT--ATTAATGAAGGTGGATTTGAAAGT  TTGATTAATACAATAAAATATGT
+Sirex                   ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Xeris                   ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Urocerus                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Tremex                  ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Xiphydria               ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Orussus                 ACTTAAAATCTAAAGAATTTGACGGTATTTTAATAAAATCAGAGGAACTTGTCATTTAATTCGATAATCCACGATAGAATATACCT  AACTTGTATACCTCCGTT      TTCAGGTCAAGGTGTAGTG-AATAGCAGGGGAGAAAGATGAGTTAC  TTTA--ATTAATGAAAATGGATTTGAAGGT  CTGATTAAAATACTAAAATATGT
+StephanidaeA            TCAATAAATTTAATAGATTTGGCGGTATTTTAAA-TTTTTAGGGGAACTTGTATTATAATT-GATATTCCACGATTGGATTTACTT  AATTTATGTATTGTCGTT      TTCAGATCAAAATGTAGTT-TATATTAAAG-AAAATTATGAGTTAC  ATTT--ATTTTTGAAATTGGATTTAAAAGT  TTGAATAA-TTATTGAAATATGT
+StephanidaeB            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Megalyra                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Trigonalidae            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Chalcidoidea            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Evanioidea              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Ichneumonidae           TCATTAAACTTAAAAAAAATGGCGGTTTTTTATTCTTATTAGAGGAATTTGTTTATTAATTTGATAATCCACGATAGGATGTACTT  AGTTTATATATTGTCGTT      TTCAGATCAAAATGTAGCT--TTTTTAAAG--ATAAAATGAATTAC  ATTT------ATGAAGGTGGATTTAAAAGT  TTGAATAA-GTTTTAAAAAATGT
+Cynipoidea              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+ApoideaA                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+ApoideaB                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+ApoideaC                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Vespidae                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Triassoxyela            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Asioxyela               ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Nigrimonticola          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Gigantoxyelinae         ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Spathoxyela             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Xyela_mesozoica         ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Angaridyela             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Xyelotoma               ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Undatoma                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Dahuratoma              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Mesolyda                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Turgidontes             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Aulidontes              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Protosirex              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Aulisca                 ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Anaxyela                ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Syntexyela              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Karatavites             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Stephanogaster          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Leptephialtites         ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Cleistogaster           ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Sepulca                 ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Onochoius               ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Ghilarella              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Paroryssus              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Praeoryssus             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Mesorussus              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Trematothorax           ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Thoracotrema            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Prosyntexis             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Kulbastavia             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Brachysyntexis          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Symphytopterus          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Eoxyela                 ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Liadoxyela              ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Abrotoxyela             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Pseudoxyelocerus        ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Palaeathalia            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Ferganolyda             ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+PamphiliidaeUndesc      ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Rudisiricius            ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Sogutia                 ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Xyelula                 ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Brigittepterus          ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+Grimmaratavites         ??????????????????????????????????????????????????????????????????????????????????????  ??????????????????      ??????????????????????????????????????????????  ??????????????????????????????  ???????????????????????
+
+
+[16S 560-781, 222 chars]
+Orthoptera              ATAATCATTAGTCTCTTAATTAGGGGCTGGAATGAATGGCTTGACGAGAAATTAACTGTCTC   GAATTTAACTTTTGAGTTAAAAGGCT-TAAATTTTTCTTAAAGACGAGAAGACCCTATAGAGCTT   TTTTGTTGGGGT-GAC-ATGAAGAATAAATAAACTCT   TACCTTAGGGATAACAGCGTAATTGTTTTTGAGAGCTCATATTGACAAAGCAGATTGC
+Paraneoptera            ATAATCATTTGTCTTTTAATTGAGGGCTTGTATGAAAGGTTGGACAAGATATTAACTTTCTT   GAACTTAATTTTTAAGTTAAAAAGCT-TAAATTTTTTTGTTGGACGAGAAGACCCTATAGATCTT   TTTTGTTGGGGT-GAC-TGTAGAATTTTATGAACTTC   TACCTTAGGGATAACAGCGTAATTTCTTTGGAGAGTTCATATTGATAAAGGAGTTTGC
+Chrysopidae             ATAATCATTTGTCTTTTAATTGAAGGCTGGAATGAATGGTTGAATGAAGTATTAACTGTCTC   GAATTTAGCTTTTTAATCAAAAGGTT-TAAATGAAATTAAAAGACGAGAAGACCCTATAGATTTT   TTTGATTGGGGT-GAT-TAAAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTAGAGAGTTCTTATCGATAAAAAAGATTGC
+Raphidioptera           ATAATCATTTGTTTCTTAATTAGGGACTAGTATGAAGGATTGGACGAGATATTTTCTGTCTC   AAATTTTATTTTTTAGTAAAAAAGCT-AAAATTTATTTAAAAGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AGAAAAATTTATAAAACTTT   TACCTTAGGGATAACAGCGTTATTATTTTGGAGAGTTCTAATCAATAAAATAGTTTGC
+Coleo_Polyphaga         ATAATAAATAGTTTTTTGATTGAAAGCTGGAATGAAGGATTGGACGAGAAAATTACTGTCTC   GAATTTAACTTTTTAGTTAAAAGGCT-AAAATTTTTTTAAAAGACGAGAAGACCCTATAGAGTTT   TTTGGTTGGGGT-GAT-TAAAAAATTTGTTAAACTTT   TACCTTAGGGATAACAGCGTAATATATTTTTGAAGTTCTTATTTAAAAATTTGTTTGC
+Coleo_Adephaga          ATAATCATTAGTTTTTTAATTAAAAGCTTGTATGAAAGGCTGGACGAGGTAAAATCTGTCTC   GAATTTAACTTTTAAGTTAAAAGGCT-TAAATAATATTAAAAGACGAGAAGACCCTATAGATCTT   TTTTATTGGGGT-AAT-AGAAAGATTAAATTAATTCT   TACCTTAGGGATAACAGCGTAATTTTTTTAGAGAGTTCATATCGATAAAAAAGTTTGC
+Lepid_Micropterigidae   ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Lepid_Papilionidae      ATAATCATTAGTCTTTTAATTGATGACTGGTATGAAAGATTGGACGAAATATATTCTGTCTC   AAATTTAATTTTTTAGTAAAAAAGCT-AAAATGATTTTAAAAGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGT-GAT-AGAAAAATTAAATTAACTTT   TACCTTAGGGATAACAGCGTAATTTTTCTTTTTAGTTCAAATAGGAAGAAAAGTTTGC
+Mecoptera               ATAATAATTAGTCTTTTAATTGAGGGCTAGAATGAATGATTGAACGAGGTGTTAACTGTCTC   TAATTTAACTTTTGAGTTAAAAGGCT-TAAATATAATTAAAGGACGAGAAGACCCTATAGAACTT   TTTTGTTGGGGT-GAC-AGGAAGATTTATAAAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTGAGAGTTCTTATCGACAAAAAAGATTGC
+Xyela                   ATAATCATTAGTCTTTTAATTGAGGGCTGGAATGAATGATTGAACGAAGTATTAACTGTCTC   GAATTTAATTTTTGAGTTAAAAAGCT-TAAATTTTATTAAAGGACGAGAAGACCCTATAGAGCTT   TTTTATTGGGGT-GAT-AGGAAGATTAAATTAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTGAGAGTTCATATCGACAAAAAGGATTGC
+Macroxyela              ATAATCATTAGTCTTTTAATTAAGGGCTAGAATGAACGATTGGACGAAGTATTAACTGTCTC   GAATTTAATTTTTGAGTTAAAAAGCT-TAAATTTAATTAAAGGACGAGAAGACCCTATAGAGCTT   TTTTATTGGGGT-GAT-AAGAAGATTAAAATAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTGAGAGTTCTTATCGACAAAATAGATTGC
+Runaria                 ATAATCATTAGTCTTTTAATTGAAGACTTGTATGAAGGATTGAATGAAATATATACTGTCTC   GAATTTAATTTTTGAGTTAAAAAGCT-TAAATATTATTAGAGGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGT-GAT-GGGAAAATTTGTTAAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTTTAAAGTTCATATTTGAAGAAAAGATTGC
+Paremphytus             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Blasticotoma            ATAATAATTAGTCTCTTAATTAGAGACTGGAATGAATGATTGAATGTAATATATACTGTCTC   GAATTTAATTTTTGAGTGAAAAAGCT-TAAATTTAATTAAGGGACGAGAAGACCCTATAGAGTTT   TTTGGTTGGGGT-GAT-TGGAAAATTTATTGAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTTGAAAGTTCTTATTGATAAAAGAGATTGC
+Tenthredo               ATAATAATTAGTCTTTTAATTGGGGGCTTGTATGAATGATTGGATGAGATATAAACTGTCTT   TAATTTAATTTTTAAGTTAAAAAGCT-TAAATATTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGC-GAT-GAAAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATCAATAAAAGAGATTGC
+Aglaostigma             ATAATAATTAGTCTTTTAATTGGAGGCTGGAATGAATGATTGGATGAGATATAGTCTGTCTT   TAATTTAATTTTTAAGTCAAAAAGCT-TAAATAATTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-AGAAAAATTAATTAAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTT-AGAGTTCTTATCGATAATAAAGATTGC
+Dolerus                 ATAATAATTTGTCTTTTAATTAAAGGCTGGAATGAAAGATTGAACGAGATATAAACTGTCTT   TAATTTAATATTTAAGTCAAAAAGCT-TAAATTTTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AAAGAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTACTTATCGATATTAAAGATTGC
+Selandria               ATAATAATTTGTCTTTTAATTAAAGACTAGAATGAAAGATTTAACGAAGTAAAAACTGTATC   AAATTTAATTTTTAAGTTAAAAAGCT-TAAATATTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AAAAAAATTAAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTATTTATCAATAAGAAAGATTGC
+Strongylogaster         ATAATAATTTGTCTTTTAATTAAAGGCTGGTATGAAAGATTTGACGAGATAAATTCTGTCTC   TAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-AATAAAATTTAATTAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTACTTATCGATAAAAAAGATTGC
+Monophadnoides          ATAATTAGTCTTGTAATTTGAGGCTGGAATGAACGATTGAATGAGGTAAATACTGTCTTTAT   TAATTTAATTTTTGAGTTAAAAAGCT-CAAATTTTTTTATAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-AGAAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATCGATATAAAAGATTGC
+Metallus                ATAATAATTAGTCTTTTAATTAGAGGCTGGAATGAATGATTTAATGAAATATAATCTGTTTC   AAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGC-GAT-GGGAAAATTTAATTAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AAAGTTCATATTTATAAAAGAGATTGC
+Athalia                 ATAATAATTTGTCTTTTAATTGAAGGCTGGTATGAATGATTTGATGAAGTAAAAACTGTCTC   TAATTTTATTTTTTAGTTAAAAAGCT-AAAATATTATTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGT-GAT-AGGAAAATTAATTAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AAAGTTCTTATTTATAAAAAAGATTGC
+Taxonus                 ATAATAATTAGCCTTTTAATTTGAGGCTGGTATGAATGATTTGATGAAGTATAAACTGTCTC   TAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTATTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-AGAAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AAAGTTCTTATTTATAAGAAAGATTGC
+Hoplocampa              ATAATAATTTGTCTTATAATTTAAGGCTGGAATGAAGGATTGGACGAGGTATAAACTGTCTC   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTATTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-AGAAAAATTTAATTAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATCGATAAAAAAGATTGC
+Nematinus               ATAATAATTTGTCTTTTAATTAAAGGCTGGTATGAAGGATTGAACGAAGTATAAACTGTCTC   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTATTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-TGAAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATCGATAATAAAGATTGC
+Nematus                 ATAATAATTTGTCTTTTAATTAAAGGCTGGAATGAATGATTGGACGAGGTATAATCTGTCTC   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATAAATTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGC-GAT-AGAAAAATTTATTAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATTGATAAAAAAGATTGC
+Cladius                 ATAATAATTTGTCTTTTAATTTAAGGCTGGAATGAATGATTGGTCAAGGTATAAACTGTCTT   GAATTTAATTTTTAAGTCAAAAAGCT-TAAATAAATTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGC-GAT-AGAAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATCAATAAAGAAGATTGC
+Monoctenus              ATAATAATTTGTCTTTTAATTTAGGACTAGAATGAATGATTTAACGAAGTTTAAGCTGTCTT   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTTTTATAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AATAAAATTTTAATAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTT-AAAGTTCTTATTAACATTAAAGATTGC
+Gilpinia                ATAATAATTTGTCCTTTAATTTAGGACTAGAATGAATGATTTGACGAAGTTAAAGCTGTCTT   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTATTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTGTTGGGGT-GAT-AATTAAATTTAATTAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AGAGTTCTTATTAACATTAAAAATTGC
+Diprion                 ATAATAATTTGTCCTCTAATTAAGGACTAGAATGAATGATTTGACGAAGTTAAAACTTTCTC   GAAATTAATTTTTAAGTTAAAAAGCT-TAAATAATATTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGA-GAT-AATTAAATTTAAAAAACTTT   TACCTTAGGGATAACAGCGTTATTTTATTA-AAAGTTCTTATTAACAATAAAAATTGC
+Cimbicinae              ATAATAATTAGTCTTTTAATTGAAGGCTGGCATGAATGATTGGACAAAATATAAACTGTCTT   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AGGAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTT-AGAGTTCTTATCGATTTAAAAGATTGC
+Abia                    ATAATAATTAGTTTTTTAATTGAAGGCTGGAATGAAAGATTGGACAAAATAAAAACTGTCTT   GAAATTAATTTTTAAGTTAAAAAGCT-TAAATTATATTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AAATAAATTTATTTAACTTT   TACCTTAGGGATAACAGCATAATTTTTTTT-AAAGTTCTTATTGGTAAAAAAGATTGT
+Corynis                 ATAATAATTTGTCTTTTAATTAAAGGCTAGAATGAATGATTGGACGAGATAAAATCTGTCTC   GAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AGGAATATTAATAGAACTTT   TACCTTAGGGATAACAGCGTAATTTTTTTT-AGAGTTCTTATCGAAAAAGAAGATTGC
+Arge                    ATAATAATTAGTCTTTTAAATGAAGGCTGGAATGAATGATTGGACGAGGTAGATTCTGTCTC   AAATTTAATTTTTAAGTTAAAAAGCT-TAAATATTATTAAAGGACGAGAAGACCCTATAGAGCTT   TTTTATTGGGGC-GAT-AGGAAAATTTATTTAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTTTAGAGTTCATATTAATAAAAAAGATTGC
+Sterictiphora           ATAATAATTAGTCTTTTAATTGAAGGCTAGTATGAAGGATTGAACGAGATATATACTGTCTC   TAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTATTAAAGGACGAGAAGACCCTATAGAGCTT   TTTTGTTGGGGC-GAC-AGGAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTTTAGAGTTCATATTGATAAAAAAGATTGC
+Perga                   ATAATAATTAGTCTTTTAATTGGAGGCTGGTATGAAGGATTGGACGAGATAAATACTGTCTC   TAATTTAATTTTTAAGTAAAAAAGCT-TAAATTTAATTATAGGACGAGAAGACCCCATAGAGTTT   TTTTATTGGGGC-GAT-AGAAAAATTTAATAAACTTT   TACCTTGGGGATAACAGCGTTATTTTTTTTAGAAGTTCATATTAATAGAAAAGATTGC
+Phylacteophaga          ATAATAATTAGTCTATTAATTGTAGGCTGGTATGAAAGATTGAACGAGGTAAATACTGTCTC   GAATTTAATTTTTGAGTTAAAAAGCT-TAAATTTTATTAGAGGACGAGAAGACCCTATAGAACTT   TTTTATTGGGGC-GAT-AGGAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTTAGAAGTTCATATTAATAAAAAAGATTGC
+Lophyrotoma             ATAATAAATAGTCTTTTAATTGAAGGCTGGTATGAAAGATTGGACGAGATAATTACTGTCTC   GAATTTTATTTTTAAGTTAAAAAGCT-TAAATTTAATTAAAGGACGAGAAGACCCTATAGAGCTT   TTTTATTGGGGC-GAT-AATAAAATTTATTAAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTATTAAGTTCTTATTAATGAAAGAGTTTGC
+Acordulecera            ATAGTAATTAGTCTTTTAATTAAAGGCTGGAATGAAAGATTGAACGAGATAAATTCTGTCTC   AAATTTAATTTTTAAGTTAAAAAGCT-TAAATTTTATTAAAGGACGAGAAGACCCTATAGAACTT   TTTTATTGGGGC-GAT-AAGAAAATTTAAATAACTTT   TACCTTAGGGATAACAGCGTTATTTTTTTT-AAAGTTCATATTAATAAAAAAGATTGC
+Decameria               ATAATAATTTGTTTTTTAAATGAAAACTGGAATGAATGATTGGACGAGAAATTAACTGTCTC   GAATTTAATCTTTAAGTAAAAAAGCT-TAAATTTTATTAAAGGACGAGAAGACCCTATAGAATTT   TTATATTGGGGT-GAT-AGAAAAATTTAAATAATTTT   TTCATTATGAATACAAAGATTATTGATTTT-AAAATTTAGATTAATAGAATAAATTAC
+Neurotoma               ATAATCATTAGTCTTTTAATTAAGGTCTAGTATGAATGATTGAACGAAGTATTAACTGTCTC   AAATTTAATTTTTAAGTTAAAAAGCT-TAAATAATTTTAAAGGACGAGAAGACCCTATAGAACTT   TTTTATTGGGGT-GAT-AAAAAGATTAATTTAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTTAGAGTTCATATTAACAAAATAGATTAC
+Onycholyda              ATAATCATTAGTCTTTTAATTAAGGTCTAGAATGAAGGATTGAACGAAGTAAAATCTGTCTC   AAATTTAATATTTAAGTCAAAAAGCT-TAAATAAATTTAAAAGACGAGAAGACCCTATAGAATTT   TTTTATTGGGGT-GAT-AAAAAGATAAAAGTAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTTAAAGTTCATATTAATAAATTAGATTAC
+Pamphilius              ATAATCATTAGTCTTTTAATTAAGGTCTAGAATGAAGGATTGAACGAAATAAAATCTGTCTC   AAATTTAATATTTAAGTTAAAAAACT-TAAATAAAATTAAAAGACGAGAAGACCCTATAGAATTT   TTTTATTGGGGT-GAT-AAAAAGATAAAAATAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTAAAAGTTCATATTAATAAATTAGATTAC
+Cephalcia               ATAATCATTAGTCTTTTAATTAAAGTCTTGAATGAAGGATTGAACGAAGTATAATCTGTCTC   AAAATTAATTTTTAAGTTAAAAAGCT-TAAATTATTTTAATAGACGAGAAGACCCTATAGAACTT   TTTTGTTGGGGT-GAC-AGGAAAATTAAATAAACTTT   TACCTTAGGGATAACAGCGTAATTATTTTTTAAAGTTCATATTAACAAAATAGATTAC
+Acantholyda             ATAATCACTAGTCTTTTAATTGAAGTCTTGTATGAAAGATTGCACGAAATATAATCTGTCTC   GAAATTAATTTTTAAGTTAAAAAGCT-TAAATTAATTTAAAAGACGAGAAGACCCTATAGAACTT   TTTTGTTGGGGT-GAT-AGGAAAATTTAATAAACTTT   TACCTTAGGGATAACAGCGTAATTATTTTTTAGAGTTCATATTGACAAAATAGATTAC
+Megalodontesc           ATAATCATTAGTCTCTTAATTAGAGTCTTGTATGAAAGATTTGATGAAATATTAACTGTCTC   AAATTTAATTTTTAAGTCAAAAAGCT-TAAATAAATTTAGAGGACGAGAAGACCCTATAGAACTT   TTTCATTGGGAT-GAT-GAATAGATTAATTTAACTCT   TACCTTAGGGATAACAGCGTAATTTTTTTTTAAAGTTCATATTAACAAAAAAGATTGC
+Megalodontessk          ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Cephus                  ATAATCATTAGTTTTTTAATTGAAAGCTTGTATGAATGATTGAATAAAATATTTATTGTCTC   AAATTTAATTTTTAAATTAAAAAGTT-TAAATTTTATTATAGGACGAGAAGACCCTATAGATTTT   TTTTGTTGGGGT-GAC-ATTAAAATTAAATTAACTTT   TACCTTAGGGATAACAGCGTAATTTATTTGGAGAGATCATATTAATAAATAAGTTTGC
+Calameuta               ATAATCATTAGTTTTTTAATTGAAAGCTTGTATGAATGATTGGATAAAATATTAATTGTCTC   AAATTTAATTTTTAAATTAAAAAGTT-TAAATTTAATTAGAGGACGAGAAGACCCTGTAGATTTT   TTTTGTTGGGGT-GAC-ATTAAAATTAAATTAACTTT   TACCTTAGGGATAACAGCGTAATTTATTTGGAGAGATCATATTAATAAATAAGTTTGC
+Hartigia                ATAATCATTAGTTTTTTAATTGAAAGCTTGTATGAACGATTGGATAAGATATTAATTGTCTC   AAATTTAATTTTTAAGTTAAAAAGCT-TAAATATTATTAAAGGACGAGAAGACCCTATAGATTTT   TTTTGTTGGGGT-GAC-ATTAAAATTTAATTAACTTT   TACCTTAGGGATAACAGCGTAATTTATTTGGAGAGATCATATTAATAAATAAGTTTGC
+Syntexis                ATAATCATTAGTTTTTTAATTGAAGGCTGGAATGAATGATTGGACGAGATATTTACTGTCTC   AAATTTATAATTTAATTTAAAATAGT-TAAATGAAATTAAAAGACGAGAAGACCCTATAGA----   -----TTGGGGT-GAT-TTTAGAATTTAAAAAATTTC   TACCTTAGGGATAACAGCGTAATTTTTTTGGAAAGATCATATTTATAAAAAAGTTTGC
+Sirex                   ATAATCAATTGTTTTTTAATTTAAATCTAGAATGAATGGTTTAACGAAATATTAACTGTCTC   GAATTTAAATTTTTAGTAAAAATGCTGAAAATATATTTAAAAGACGAGAAGACCCTATAGAATTT   TTTAATTGGGGA-AAT-TTTAAAA---AAAAATTTTT   TACCTTAGGGATAACAGCATAATTTTTTTTGAAAGTTCAAATTGATAAAAAAGATTAT
+Xeris                   ATAATCAATTGTTTTTTAATTTAAAGCTGGAATGAAAGGTTTAACGAGATATTTACTGTTTC   GAATTTAAATTTTTAGTAAAAATGCTGAAAATATGATTAAAAGACGAGAAGACCCTATAGAATTT   TTTAGTTGGGGA-AAT-TTTAAAAAAAAAAGAAATTT   TACCTTAGGGATAACAGCATAATTTTTTTTGAAAGTTCTCATAGATAAAAAAGATTGT
+Urocerus                ATAATCAATTGTTTTTTAATTAAAAGCTTGAATGAATGGTTGAACGAGATATAAACTGTTTC   GAATTTAAATTTTTAGTAAAAATGCT-AAAATATGATTTAAAGACGAGAAGACCCTATAGAATTT   TTTAATTGGGGC-AAT-TTTAGAA---AAAAAAATTT   TACCTTAGGGATAACAGCATAATTTTTTTTGAAAGTTCAAATTAATAAAAGAGATTGT
+Tremex                  ATAATCAATTGTTTTTTAAATAAAAACTTGAATGAATGGTTTTACGAAATAAATACTGTCTC   GAATTTAAAATTTTTGTAAAAATACA-AAAATTTAAATTATAGACGAGAAGACCCTA-AGAATTT   TTTTATTGGGGA-AATATTTAAAA--ATAAAAAATTT   TACCTTAGGGATAACAGCATAATTTTTTTTGAAAGTTCTTATTAATAAAAAAGATTGT
+Xiphydria               ATAATCATTAGTTTTTTAATTAAAATCTAGAATGAATGATTGAATGAAAAATTATCTGTCTC   AAAATTAATTTTTAAGTAAAAAAGCT-TAAATTTTTTTAAAGGACGAGAAGACCCTATAGAGTTT   TTTTATTGGGGT-GAT-AATAAAATTAAATTAACTTT   TACCTTAGGGATAACAGCATAATAATTTTGGAGAGATCAAATCAATAAAATTTTTTAT
+Orussus                 ATAATCAATAGTTCTTTAATTGGGAACTTGTATGAAGGATTGAACGAGATAGTAACTTTCTA   GAATTTAATTTTTAGATTAAAAAGTC-TAAATTTAATTAAAAGACGATAAGACCCTATAGAATTT   TTTTATTGGGGA-GAT-ATTAAGATTAAAATAACTCT   TACCTTAGGGATAACAGCGTAATTCTTTTTGAAAGTTCATATTAATAAAAGAGTTTGC
+StephanidaeA            ATAATAAATAGTTTATTAAAAGTAAACTTGAATGAAGGATTGAATGAGATATAAACTTTATA   GAATTTATTTATTAATTAAAAAAAAT-TAATTGATTTTAAAAGACAATAAGACCCTTTAGAATTT   TTATGATGGGGC-ATT-AACAAAATTTAATAAAATTT   TACCTAAGGGATAACAGCGTAATTATTTTGGATAGTTCATATTGATAAAATAGTTTGC
+StephanidaeB            ATAATAAATAGTTTATTAAAAATAGACTAGTATGAAAGATTAAATGAAATATTAACTTTATA   GAATTTTTTAATTAATTAAAAAAAAT-TAATTATTTTTAGGGGACGATAAGACCCTTTAAAATTT   TTTTAATGGGGC-ATT-ATTAAAATTTAAATAAATTT   TACTTAAGGGATAACAGCGTAATAAATTTAGATAGATCATATTGATAAATTTGATTGC
+Megalyra                ATAATAAATAGTTTTTTTATTGAAAGCTTGAATGAATGGTTTAATGAAAAAATAACTGTCTA   AAATTTTATATTTAAGTTAAAAAGCT-TAATTTAATTTAAGTGACGAGAAGACCCTATAGAGTTT   TTTGATTGGGGG-GAT-TAATAAATAAATTTAACTTT   TACCTTAGGGATAACAGCATAATTTTTTTAGAGAGATCACATTAATAAAAAAGATTAT
+Trigonalidae            ATAATAATTTGTCCTATAATTAAGGAATTGAATGAATGATTTAATGAAAAAATTATTGTCTC   AAATTTATTTTTTAAGTTAAAAAACT-TAAATAGAATTAAAAGACGAGAAGACCCTATAGAACTT   TTTAATTGGGAG-GAT-TATTAAATTTAATTAACTTT   TACCTTAGGGATAACAGCATAATTTTTTTAAATAGTTCATATTGATAAAAAAGTTTAT
+Chalcidoidea            ATAATAATTTGGCTTTTTATTGAAGTCTGGAATGAATGATTTGATGAAGTAATAACTGTCTC   GAATTTAATT-TTAAGTAAAAATTCT-TAAATTTAATTAAAAGACGAGAAGACCCTATAGAATTT   TTTTTTTGGGGT-AGA-AATAAAATTTAAAGAATTTT   TACCTTAGGGATAACAGCGTAATTTTTTTGGAGAGATCATATTGATAAAGAAAATTGC
+Evanioidea              ATAATAAATAGTTTATTAATTGTGAACTGGAATGAATGATTTAATAAGATATAAACTGTATC   AATTTAAATTTTAAAGTAAAAAAGCT-TAAATGAATTTGGGGGACGAGAAGACCCTATAGATTTT   TTTGGATGGGGA-GAT---------------------   TACCTTAGGGATAACAGCATAATATAATTATTTAGATCTTATAAATAATAGTGATTGT
+Ichneumonidae           AAAATCAATAGTTTTATAATTGAAAGCTGGAATGAAGGATTGAATGAAATATAGACTGTCTC   TTAATTTTCTTTTTAGTTAAAAAGCT-AAAATTTTATTAAAAGACGAGAAGACCCTATAGATTTT   TTTGGTTGGGGC-AAT-TATTAAATTAATTAAATTTT   TACCTTAGGGATAACAGCGTAATTTTTTTGGAGAGATCTTATTAATAAAAAAGTTTGC
+Cynipoidea              ATAATCATTTGTCTTTTAATTAAAGACTAGAATGAAAGATTAAATAAAATATTAACTATATT   AAAATTTATTTTTAAGTAAAAAATCT-TAAATATTATTATTAGACGATAAGACCCTATAGAACTT   TTATATTGGGGG-GAT-AAAAAAATTAAATAAATTTT   TACCTTAGGGATAACAGCATAATTTTTTTAAATAGTTCTTATTGATAAAAAAGATTAT
+ApoideaA                ATAATAAATTGTCTTTTAATTGAAGGCTTGGATGAAAGAATTGACGAAATATAATCTGTCTA   TAATTTAAAATTTTAGTTAAAATACT-AAAATTATTTTAAAAGACGAGAAGACCCTATAGAATTT   TTTAATTGGGAG-GAT-TTTTATATTTAATTAACTTT   TACCTTAGGGATAACAGCGTAATATTTTTGGAGAGATCATATTAAAAAAAATGTTTGC
+ApoideaB                NNNNNNNNNNGTCTTTTAATTGAAGGCTGGGATGAAAGAATTAACGAGATAAAGACTGTCTC   TAAATTAAAATTTTAGTTAAAATGCT-AAAATAAATAAATTAGACGAGAAGACCCTATAGAATTT   TTTTATTGGGAG-GAT-ATTTATAATTAATTATCTAT   TACCTTAGGGATAACAGCGTAATATTTTTTTAAAGATCATATTG??????????????
+ApoideaC                ATAATAAATTGTCTTTTAATTAAAGGCTGGAATGAAAGAATTAATGAAATATATACTGTCTT   GAAATTAAATTTTAAGTAAAAATTCT-TAAATAAATTTATGGGACGATAAGACCCTATAAAATTT   TTT-ATTGGGAG-GAT-AATTAAATTTAATAAACTTT   TACTTTAGGGATAACAGCGTAATATCTTTTTATAGATCATATTAAAAAAGATGATTGC
+Vespidae                ATAATCAATAGTTTTTTAATTGGAAACTGGAATGAAGGAGTGGATGAAATATAGATTGTCTC   GAATTTAAATTAAAAGTAAAAATGCT-TTTATATAGTTATTAGACGAGAAGACCCTATAGAATTT   TTTTATTGGGAG-GAT-ATTTAAATTTGAGTAACTTT   TACCTTAGGGATAACAGCGTAATAGTTTNGGAGAGTTCATATCGATAAAATTGTTAGC
+Triassoxyela            ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Asioxyela               ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Nigrimonticola          ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Gigantoxyelinae         ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Spathoxyela             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Xyela_mesozoica         ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Angaridyela             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Xyelotoma               ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Undatoma                ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Dahuratoma              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Mesolyda                ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Turgidontes             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Aulidontes              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Protosirex              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Aulisca                 ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Anaxyela                ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Syntexyela              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Karatavites             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Stephanogaster          ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Leptephialtites         ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Cleistogaster           ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Sepulca                 ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Onochoius               ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Ghilarella              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Paroryssus              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Praeoryssus             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Mesorussus              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Trematothorax           ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Thoracotrema            ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Prosyntexis             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Kulbastavia             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Brachysyntexis          ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Symphytopterus          ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Eoxyela                 ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Liadoxyela              ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Abrotoxyela             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Pseudoxyelocerus        ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Palaeathalia            ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Ferganolyda             ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+PamphiliidaeUndesc      ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Rudisiricius            ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Sogutia                 ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Xyelula                 ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Brigittepterus          ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+Grimmaratavites         ??????????????????????????????????????????????????????????????   ?????????????????????????????????????????????????????????????????   ?????????????????????????????????????   ??????????????????????????????????????????????????????????
+
+
+[18S 782-1672, 891 char]
+Orthoptera              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGGATTTGTGTCCCACGCTGTTGGTTCACCGCC-CGTCG--GTGTTT-AACTGGCATGTATCGTGGGACGTCCTGCCGGTGGGG   ----------------------CCTACCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGCACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGC--------CCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAA-CCCGAGGTAATGATTAATAGGGACAGGCGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGACCGTCGCAAGACGAAGCGAAGCGAAAGCATTTGCCAAGTATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAATCGATGCCAGCCAGCGATCCGCCGCAGTTCCTCCGATGACTCGGCGGGCAGCCTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTC????????????????????????????????????????????????????????????????????????????????????????????????????????
+Paraneoptera            ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGGATCTGTGTTTCACGCTGACGGTTCACCGTTTTGTCG--GTGTTT-AACTGTCATGT--CGTGGTACGTCCTGCCGGT----   ----------------------CCTGTCGCGGTGCTCTTTACCGAGTGTCGAGGCGGGCCGGCACGTTTACCTTGAACAAATTTGAGTGCTTAAAGCAGGCTAT----GCCGGAAAACTGTGTGCATGGAATAATATAATAGGACCGCGGTTCTATTTTGTTGGTTTTCAGAG-TCTGAGGTAATGATTAATAGGGCCCGGCGGGGGCATTAGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACTGACCTAAGCGAAAGCATTTGCCAAGGATGCTTCCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCCAACGATCCGTCGCAGTTCCTCCGATGACTCGACGGGCAGCTTCCGGGAAACTAAAGCATTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAAGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAATCTCACCAGGCCAGAACACTAGATGGATTGACAGATTGAGAGCTCTTTCTTGATTTAGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCCAGCCTACTAAATAGACGG-------------------------------------------------------------------------CTTCTTAGAGGG
+Chrysopidae             ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTCGAATCTGTGTCCTACACTGTTGGTTCAATGCT-CG-CA--TTGTTT-AACTAGCATGTTATGTGGGACGTCCTACCGGTGGGT   ----------------------CCCGTCGCGGTGCTCTTAATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAGGCAGGCTCA----GCCTGAATATTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACTCCGAGGTAATGATTAATACGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTGATTGATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGACGT---------------------------------------------GGTTTTTACTGCCGGCGTACAAATAATTCTTCTTAGAGGG
+Raphidioptera           ??????????????????????????????????????????????????GTCCCGCGCTGTCGGGTNCACCGC-TC-GC-GGTGTTC-AACTGACATGTTTTGCGGGACGTCCTACCGGTGGGC   ----------------------CCTGTCGCGGTGCTCTTCATTGAGTGTCGAGGTGGGCCGGTACATTNACTTTGAACAAATTAGAGTGCTCAAGGCAAGCTAA----GCCTGAATATTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACTCCGAGGTAATGATTAATACGGACAGATGGGGGCATTCGTATTGCGGCGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTGATTGATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCCAGTGATGCGTCGAAGTTCCTCCGATGACTCGACGTGCAACTTTCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGACGT---------------------------------------------GGTTTTTACTACCGGC????????????????????????
+Coleo_Polyphaga         ????CGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTCGAATTTGTGTCCCGCGCCGTCGGTTCGCCGCT-CG-CG--GCGTTT-AATTGGCGTG--TTGCGGGACGTCATGACGGTGGGC   ----------------------CCCGTCGCGGTGCTCTTCGTTGAGTGTCGAGGCGGGCCGTCACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTAA----GCCTGGATATTGTGTGCATGGAATAATAAAATAGGATCTCGGTTCTATTTTGTTGGTTTTCGGAACTCCGAGGTAATGATTAATAGGAACGGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACTAAAGCGAAAGCATTTGCCAAAAACGCTTTCATTGATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCCAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGTCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTGGCCTACTAAATAGGCGA---------------------------------------------GGTTTTTACTGTCGACGC-TATATAAATCTTCTTAGAGGG
+Coleo_Adephaga          ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCGCGCTGTCGGTTCACCGCC-CG-CG--GTGTTT-AACTGGCACGA-TCGCGGGACGTCCTGCCGGTGGAT   ----------------------CCTGTCGCGGTGCTCTTAATTGAGTGTCGAGGCGGGCCGGCACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTAA----GCCTGAATACTGTGTGCATGGAATAATGGAACAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGATGTAATGATTAATAGGGACGGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTCAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTGACCATAAACGATGCCAGCTAGCGATCCGCCGACGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAACTAGGCGT---------------------------------------------GGTTTTTACTACCGGCGTACAATTGAATCTTCTTAGAGGG
+Lepid_Micropterigidae   ATAGCATATTCTAGAATTGTTGCGGTTAAAAAGCTCGTAGTTGCATTTGTGTGCCGCACTGCCGGTCCATCGCT-CA-CG--CGGTGC-GACTGGCAGGC-TTGCGGGGCATATCGCCGGTGAGC   ----------------------CCTGTCGCGGTGCTCTTCGCTGAGTGTCGAGATGGGCCGGCAATTTTACTTTGAACGAATTAGAGTGCTCAAAGCGGGCTAT----GTTTGGATAAAG-GTGCATGGAATAATGGAATATGATCATGGTTTTATTTTGTTGGTTTTAGAGA--CCAAGATAATGATTAATGGAAGCAACTGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACCACTGCGAAAGCATTTGCCAAAGGTGTTTTCATCAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATTAGATACCGCCCTAGTTCTAACCATAAATGTTGCTGTCTAACGATCCGCCGACGTTACTCTAATGGCTCGGCGGGCAGCTTACGGGAAACCAAAGATTTTGAGCTCCGGGGGGAGTATGGTTGCAAAACTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAAACTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCATGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGTGATTTGTCAGGTTAATTCCGGTAACGAACGAGATTCTAGCCTGCTAAATAGGCGT-------------------------------------------------------------------------CTTCTTAGAGGG
+Lepid_Papilionidae      ATAGCGTATACTAAAATTGTTGCGGTTAAAAAGCTCGTAGTTGCATTTGTGCGCCGCGCTGTCGGTGCACCGCT-TC-CG--CGGTGA-TACTGACACGT-CTGCGGAGCATATCGTCGGTGAGC   ----------------------CCTATCGCGGTGCTCTTCGGTGAGTGTCGAGATGGGCCGACAATTTTACTTTGAACAAATTAGAGTGCTCAAAGCGGGCTCA----GCTTGAATATTTCGTGCATGGAATAATAGAATATGATCTCGGTTCTATTTTGTTGGTTTTCAGAACTCCGAGGTAATGATTAATAGGGATAACTGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGAACATCAGCGAAAGCATTTGCCAAAGGTGTTTTCATCAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATTAGATACCGCCCTAGTTCTAACCGTAAAT-ATGTCATCTAGCGATCCGCCGACGTTACTACTATGGCTCGGCGGGCAGCTTCCGGGAAACCAAAGATTTTGGACTCCGGGGGGAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAATCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTAACAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGGTAACGAACGAGACTCTAGCCTGCTAAATAGGCGT-------------------------------------------------------------------------CTTCTTAGAGGG
+Mecoptera               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATTTGTGTCCCATACTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA--TATGGGACGTCCTATCGGTGGGT   ----------------------CTCATCACGGTGCTCTTAAACGAGTGTCGAGGTGGGCCGATACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTAA----GCCTAAATATTGTGTGCATGGAATAATAGAATAGGACCTCGTTTCTATTTTGTTGGTTTTCGGAATTCCGAGGTAATGATTAATAGGGACAACTGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAATGTGTTTTCATCAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCAAAGTTCCTCCGATGACTTGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACTGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCAGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGT-GAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTGGCCTGCTAAATAGGCGT---------------------------------------------AGTTTTTACTACTGGCGTACAAACAATTCTTCTTAGAGGG
+Xyela                   ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCGCGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGCGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGCTCTTCACGGGGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG 
+Macroxyela              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Runaria                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCGCGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGCGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCCTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGATTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Paremphytus             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Blasticotoma            ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCGCGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGCGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCCTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGATTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Tenthredo               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCTTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGTTAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Aglaostigma             ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCTTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTTGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Dolerus                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Selandria               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTGCCGGTGGGC   GGGCG--GCCCAACT-AATAATCCCGTCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Strongylogaster         ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Monophadnoides          ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCTTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTCCCGGTATCTCGAAGGCCTCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Metallus                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCGCCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCTTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTAGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCAGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Athalia                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGAGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Taxonus                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACTGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Hoplocampa              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCGCCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Nematinus               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Nematus                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Cladius                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCGTCGCT-CG-CG--GCGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTAGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Monoctenus              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCGCTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Gilpinia                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTCT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTCCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Diprion                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTCT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Cimbicinae              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCGTTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTAGTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAACAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Abia                    ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCGCTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAACAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCCTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGCGGTTTTTACTACCGGCGTACAAATTAATCTTCTTAGAGGG
+Corynis                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCGCTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTAGTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Arge                    ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCGCGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGCGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACG??????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sterictiphora           ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGTGGGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Perga                   ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGCCGGTTCACCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-TGTA-TCCCATCGCGGTGCTCTTCACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATCAGAGTGCTTAAAGCAGGCCGTTCTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGCTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAACGCATTTGCCAAAAATGTTTTCCTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTACCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGCGGGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Phylacteophaga          ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-TATA-TCCCATCGCGGTGCTCTTCGCCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCCGTTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGCTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAACGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTACCGGTATCTCGAAGGCCCCTGGC-CTTCC---GGCCGCGGGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Lophyrotoma             ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-TATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCCATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGCTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAACGCATTTGCCAAAAATGTTTTCCTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGTGGGGTTTTTACTACCGGCGTACAAACAAATCTTCTTAGAGGG
+Acordulecera            ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-TATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCCGTTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGCTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCCTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTACCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGCGGGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Decameria               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTC-AACTGGCATGA-TTGTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAGCT-TATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCCAATTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGCTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATAACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTACCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGCGGGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Neurotoma               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Onycholyda              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGACGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Pamphilius              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGACGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG 
+Cephalcia               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Acantholyda             ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTGATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGAACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCCGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGGGTGGTTTTTACTACCGGCGTACAAATAAATCTTCTTAGAGGG
+Megalodontesc           ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATTTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGACATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTCTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCTTTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAACTAGGCGTACTTTCCGGTATCTTGAAGGTCCTCGGC--CTAC--GGGTCGGGCGGTCCTTACTACCGGCGTACAAATAATTCTTCTTAGAGGG
+Megalodontessk          ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cephus                  ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCATCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACCTTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTAATTCATGGTATCTCGAAGGCCCTCGAC--TTC----GGTCGGGCGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Calameuta               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCATCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACCTTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTAATTCATGGTATCTCGAAGGCCCTCGAC--TTC----GGTCGGGCGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Hartigia                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCATCGCT-CG-CG--GTGTTT-AACTGGCATGA-CTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACCTTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTATGGTATCTCGAAGGCCCTCGGC--TTC----GGTCGGGCGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Syntexis                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACGCTGCCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTAACTTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTAATTTATGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGGTGGTTTTTACTACCGACGTAAAAACAAATCTTCTTAGAGGG
+Sirex                   ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGTCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTTTAACTGGCATGA-C-GTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCGACT-AATA-TCCCATCGCGGTGCTCTTCACCGGGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTATCCTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACCTTCTGGTATCTCGAAGGCCCCCGGC-CCTCC---GGCCGGTGGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Xeris                   ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGTCACGCTGTCGGTTCACCGCT-CG-CG--GTGTCT-AACTGGCATGA-C-GTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCGACT-AATA-TCCCATCGCGGTGCTCTTCACCGGGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTATCCTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACCTTCTGGTATCTCGAAGGCCCCCGGC-CTTCC---GGCCGGTGGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Urocerus                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGTCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-C-GTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCGACT-AATA-TCCCATCGCGGTGCTCTTCACCGGGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTATCCTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACCTTCTGGTATCTCGAAGGCCCCCGGC-CTTCC---GGCCGGCGGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Tremex                  ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATTTGTGTGTCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-C-GTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCGACT-AATA-TCCCATCGCGGTGCTCTTCACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTATCCTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACCTTCTGGTATCTCGAAGGCCCCCGGC-CTTCT---GGTCGGTGGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Xiphydria               ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCCCACGCTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGTGGGACGTCCTACCGGTGGGC   GGGCG--GCCCAACT-AATA-TCCCATCGCGGTGCTCTTCATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACCTTCGCCTGAATACTGCGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCTGGTATCTCGAAGGCCCCCGGC--CTC----GGTCGGGTGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Orussus                 ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGTCACGCTGTCGGTTCATCGCT-CG-CG--GTGTTT-A-CTGACATGA-C-GTGGGACGTCCTACCGGTGGGC   AGGCG--GTCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGCCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTGTCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTAACTTATGGTATCTCTAAGGCCCCCGTC-GTTC----TGTCGGGCGGTTCTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+StephanidaeA            ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+StephanidaeB            ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACGCTGTCGGTTCGTCGCT-CG-CG--TCGTTT-AACTTGCAGTT-T-GTGGGACGTCCTACCGGTGGAC   GAGCG--GTCCAAAT-AATA-TCCCATCGCGGTGCTCTTAACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTACCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGACAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCTGGTATCTCGAAGGCCCCCGGC--CTC-----GCCGGGTGGTTTTTACTACCAACGTACAAACCAATCTTCTTAGAGGG
+Megalyra                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACGGTGTCGGTTCACTGCT-CG-CGCGGTGTTT-A-CTTGGCACT-C-GTGGTACGTCCTACCGGTGGGC   GGGCG--GCCCAGCT-AATA-TCCCATCGCGGTGCTCTTTATCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGACAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTCTGGTATCTCGAAGGCCCTCGGC-TTTT----AGTCGGGTGGTTTTTACTACCAACGTACACACAAATCTTCTTAGAGGG
+Trigonalidae            ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACACTGTCGGTTCATCGCT-CG-CG--GTGTTT-AACTGGCATGA-TTGGGGGACGTCCTACCGGTGGGY   GGGCG--GTCCAACT-AATA-TCCCATCGCGGTGCTCTTAAYYGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGRACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAYAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTT???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Chalcidoidea            ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGCCACGCTGTCGGTTCATCGCT-CG-CG--ATGTTT-AACTGACATGA-TTGTGGGACGTCCTACCGGTGGGT   GGGCA--GCCCAGCT-AATA-TCCCATCGCGGTGCTCTTTACCGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCCATGTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTAGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAAC???????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Evanioidea              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCTCACGCTGTCGGTTCGCCGCT-CG-CG--GTGCTC-A-CTGACATGA-C-GTGGTACGTCCTACCGGTGGAC   GGGCG--GTCCAGTT-GCAA-TCCTGTCGCGGTGCTCTTTACTGAGTGTCGAGGCGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTAACTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACC-CATGGTATCTCGAAGGCCCGCGGC--TTC----GGTCGCGTGGTTTTTACTACCGGCGTACAAACAAATCTTCTTAGAGGG
+Ichneumonidae           ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGTCACGATGTTGGTTCACCGCT-CG-CG--GTGTTT-AACTAGCATGC-C-GTGAGACGTCCTACCGGTGGGC   GGGCG--GTCCAACT-AATA-TCCCATCGCGGTGCTCTTCACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTATCTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTATGGTATCTCGAAGGCCCCCGGC--CTA----GGTCGGGCGGTTTTTACTACCGACGTACAAACAAATCTTCTTAGAGGG
+Cynipoidea              ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTCGCACGCTGTCGGTTCGCCGCT-CG-CG--GTGTTT-AACTGACATGC-TCGTGAGACGTCCTACCGGTGGGC   GAGCG--GTCCAACT-AATA-TCCCATCGCGGTGCTCTTAATTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTACCTTTGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAAATCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGAGAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACATTCTGGTATCTTGAAGGCTCCCGGC--TTC----GGCCGGTGGGTTTTTACTACCAACGTACAAATAAATCTTCTTAGAGGG
+ApoideaA                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTAACACAGTGTCGGTTCACCGCT-CG-CG--GTGTTC-AACTGGCATTA-C-GTGTTGCGTCCTACCGGTGGAC   GGGCG--GTCCGACC-AATA-TCCTAGCCCGGTGCTCTTCATTGAGTGTCGAGTTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTATCCTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGTAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCAGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTACTTTATGGTATCTCGAAGGCC-CCGGC--TTCA---CGGTCGGTGGTTTTTACTACCAACGTACTTACAAATCTTCTTAGAGGG
+ApoideaB                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTAACACAGTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATTA-C-GTGTTGCGTCCTACCGGTGGGC   GGGCG--GTCCAACC-AATA-TCCTAACCCGGTGCTCTTGACTGAGTGTCGAGTTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTACTTTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTNNNNNNNNNNNNNNNNNNNTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGGCGTAATTCATGGTATCTCGAAGGCCCTCGGC--TAC----GGTCGGGCGGTTTTTACTACCAACGTACCAACAAATCTTCTTAGAGGG
+ApoideaC                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGTGTGTCACAGTGTCGGTTCACCGCT-CG-CG--GTGTTT-AACTGGCATTA-T-GTGGTACGTCCTACCGGTGGGC   GGGCG--GTCCAACT-AATA-TCCCATCGCGGTGCTCTTTACTGAGTGTCGAGGTGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTCAAAGCAGGCTACCTTCGCCTGAATACTCTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACCCCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGATCGTCGCAAGACGGACAGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCGATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTCTAGCCTGCTAAATAGACGTATCTTATGGTATCTCGAAGGCCCCCGGC--TTC----GGTCGGAGGGTTTTTACTACCAACGTACAAACAAATCTTCTTAGAGGG
+Vespidae                ATAGCGTATATTAAAGTTGTTGCGGTTAAAAAGCTCGTAGTTGAATCTGT-TTTCACACTGTCGGTTCACCGCT-CG-CG--GTGTTT-A-CTGGCATGA-T-GTGGGACGTCCTACCGGTGGAC   GGGCG--GTCCAAAT-AATA-TCCCATCGC-GTGCTCTTCATTGAGTGTCGAGATGGGCCGGTACGTTTACTTTGAACAAATTAGAGTGCTTAAAGCAGGCTAGCCTCGCCTGAATACTGTGTGCATGGAATAATGGAATAGGACCTCGGTTCTATTTTGTTGGTTTTCGGAACACCGAGGTAATGATTAATAGGGACAGATGGGGGCATTCGTATTGCGACGTTAGAGGTGAAATTCTTGGACCGTCGCAAGACGAACGGAAGCGAAAGCATTTGCCAAAAATGTTTTCATTAATCAAGAACGAAAGTTAGAGGTTCGAAGGCGATCAGATACCGCCCTAGTTCTAACCATAAACGATGCCAGCTAGCGATCCGCCGAAGTTCCTCCTATGACTCGGCGGGCAGCTTCCGGGAAACCAAAGCTTTTGGGTTCCGGGGGAAGTATGGTTGCAAAGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGAGCCTGCGGCTTAATTTGACTCAACACGGGAAACCTCACCAGGCCCGGACACCGGAAGGATTGACAGATTGATAGCTCTTTCTTGATTCGGTGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGATAACGAACGAGACTC????????????????????????????????????????????????????????????????????????????????????????????????????????
+Triassoxyela            ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Asioxyela               ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Nigrimonticola          ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Gigantoxyelinae         ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Spathoxyela             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyela_mesozoica         ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Angaridyela             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyelotoma               ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Undatoma                ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Dahuratoma              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mesolyda                ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Turgidontes             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aulidontes              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Protosirex              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aulisca                 ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Anaxyela                ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Syntexyela              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Karatavites             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Stephanogaster          ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Leptephialtites         ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cleistogaster           ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sepulca                 ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Onochoius               ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Ghilarella              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Paroryssus              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Praeoryssus             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mesorussus              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Trematothorax           ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Thoracotrema            ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Prosyntexis             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Kulbastavia             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Brachysyntexis          ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Symphytopterus          ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Eoxyela                 ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Liadoxyela              ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Abrotoxyela             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Pseudoxyelocerus        ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Palaeathalia            ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Ferganolyda             ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+PamphiliidaeUndesc      ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Rudisiricius            ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sogutia                 ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyelula                 ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Brigittepterus          ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Grimmaratavites         ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+
+
+[28S 1673-2224, 552 char]
+Orthoptera              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGTAATGAAAGTGAAGGT-------------------CCGAGGGAGGATGGGC-------------------CCGCCTTCACGGGGCGGCGGCCTCCG-CACTCCGGGGTGAGGCGCACCTAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGCCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAGCTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGTGCTC-   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCCGGCTTGCTTGATAT------------GCTGAAGCCGCGAG--CGAA---------CGAC-------------TCGGATCGGAGT-GCCAAGTGGGCCACTTTT
+Paraneoptera            CCAAGGAGTTTAGCGTGTGCGCGAGTCATTGAG   AAACTCAAAGGCAAAATGAAAGTGAAGGA-------------------CTAAGGGAAGATGGAT-----------------TTCCGCACTCCCGGGGCGTCTCT-ATCT-CATTGCGAGAGGAGGCGCACCTAGAGCGTACACGCTGATACCCGAAAGATGGTGAACTATGCCTGGCCAGGACGAAGCCAGGGGAAACCCTGGTGGAGGTCCGCAGCGATTCTGACGTGCAAATCGATCGTCGGAGCTGGGTTTAGGGGCGAAAGACCAATCGAACCATCTAGTAGCTGGTTCCCTCTGAAGTTTCCCTCAGGATAGCTTGCGCTC-   CGAGTCTCATCCGGTAGAGCGAATGATTAGAGGCCTTGGGGTCGAAACGACCTCAACCTATTCTCAAACTCCAAATAGATGAGAACCCTGGCTTTCTTGAACT-------------ATGAAGCTAGGGG--TT-----------------------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Chrysopidae             CCAAGGAGTCTAGCATGTACGCAAGTCATTGGG   AAACCCAAAGGCGTAATGAAAGTAAAGGT-------------------CCTAGGGAGGATATAT-----------------TGTCGCACTCCCGGGGCGTCTTA-TTCTTCAATAGAATAAGAGTCGCACCTAGAGCGTACACGCTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTC-   TGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTAGCTTGCTTAAAATTACATATTTATGTATGAAGCTACGAG--ATT-----------AAAAAGTTATTTTTAATTGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Raphidioptera           CCAAGGAGTCTAGCATGTGCGCGAGTCACTGAG   AAACTCAAAGGCGAAATGAAAGTGAAAGC-------------------CCGAGGGAAGATCGGT-----------------CCGCGCATTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCTAGAGCGTACACGCTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTC-   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCCGGCTTGCTTGAACT------------AGTGAAGCCGCGAG--ACAAA--------TTA---------------TGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Coleo_Polyphaga         CCAAGGAGTCTAGCATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGG-----------------------AGGATGGGCGGGC-----------------CCTCGCACTCCCGGGGCGTCTCG-CACT-CATCGCGAGGCGAGGCGCACCACGAGCGTACACGCTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGA-CCATCTAGTAGCTGGTTCCTTCCG----------------------------   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Coleo_Adephaga          ???????GTCTAGCATGTGCGCAAGTCATTGGG   AAACCTAAAGGCGTAATGAAAGTGAA-------------------------AGGGAAGAT-------------------------GCATTCCCGGGGCGTCGCG-TACT-TATTGCAAGTTGCGGCGCACCAAGAGCGTACACGCTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGCAGCGATTCTGACGTGCAAATCGATCGCATGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATC???????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Lepid_Micropterigidae   ???????GTCTAGCATGTGCGCGAGCCATTGGG   AAACCCACAGGCGCAATGAAAGTGAA-------------------------GACGATGGT-------------------------GCACTCCCGGGGCGTCTTGTCCGCAATCTGTCGGACTGGGCGCACCGATAGCGTAAATGCTGGTACCCGAAAGATGGTGAACTATGCCTGGTCAGGTTGAAGTCAGGGGAAACTCTGATGGAGGACCGTAGCGATTCTGACGTGCAAATCGATCGTCTGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCATCCGAAGTTTCCCTCAGGATAGCTGGCGCTA-   GCAGTCTCATACGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGGCCTCAACCTATTCTCAAACTTTAAATGGGTGAGAACACCGGCTTGCTCGAATT-------------GTGAAGCCG-GTG---------------------------------CAGATGATAGT-GCCAAGTGGGCCAATTTT
+Lepid_Papilionidae      ???????GTCTAGCATGTGTGCGAGTCATTGAG   AAACTGAAAGGCGTAACGAAAGTGAA-------------------------AGGGAGGAT-------------------------GCACTCCCGAGGCGTCTCGTTTCCAATCTGTGAATGTAGGCGCGCTCTGAGCAGAGATGCTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGTCGAAGTCAGGGGAAACCCTGATGGAGGACCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATC???????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mecoptera               CCAAGGAGTCTAGCATGTGCGCAAGTCATTGGG   AAACCTAAAGGCGTAATGAAAGTAAA-------------------------AGGGAAGAT-------------------------GCATTCCCTGGACGTCTCA-TATT-CATTGCGAATAGAGGCGTACCAAGAGCGTACACGCTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGTCGAAGTCAGGGGAAACCCTGATGGAGGACCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCA----   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTAAATA-------------GTGAAGCCA-GAG--AT-----------TT-----------------GGATCAGAGT-GCCAAGTGGGCCACTTTT
+Xyela                   CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CAGGCC-T-C-GCGCCGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG--TTTAATT----TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Macroxyela              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Runaria                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-T-T-GCGCCGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Paremphytus             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Blasticotoma            CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CA-GCC-T-T-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Tenthredo               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGGAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Aglaostigma             CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGGAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Dolerus                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTAAAGGT-CA-GCC-T-T-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Selandria               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CT-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTACGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Strongylogaster         CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-A-GCGCTGGCCGAGGGAGGATGGGCCGCGTC--ACGATGCGGTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTACGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Monophadnoides          CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGAAATGAAAGTAAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Metallus                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACTATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Athalia                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTAAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGTCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------CT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Taxonus                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACTATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Hoplocampa              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCTAGTGGGCCACTTTT
+Nematinus               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Nematus                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Cladius                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTAAAGGT-CA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Monoctenus              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGTCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Gilpinia                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTAAAGGT-CG-GCC-C-A-GCGCCGACCGAGGGAGGATGGGTCGCGTC--ACGATGCGACCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------CT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Diprion                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTAAAGGT-CA-GCC-C-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------CT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Cimbicinae              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTAAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCTGAACTTGGTATAGCGGCGAAAGACTAATCGAACTATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCTAGTGGGCCACTTTT
+Abia                    CCAAGGAGTCTAACATGCGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGTACG-GCC-A-A-GCGCCTGCCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   AGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------CT----------------CGGATCAGAGT-GCCCAGTGGGCCACTTTT
+Corynis                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTAAAGGT-CA-GCC-T-A-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------CT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Arge                    NNNNNGAGTCTAGCATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CA-ACC-A-C-GCGTTGACCGAGGGAGGATGGGTCGCGTC--GCGGCGCGGTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACC-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Sterictiphora           CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   ATACCTAAAGGCGCAATGAAAGTGAAGGT-CA-ACCCT-C-GCGTTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Perga                   CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTAAATGT-TC-GCCCT-C-GCGCGGACAGAGGGAGGATGGATCGCGTC--ACGATGCGGTCTCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATTCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACC-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Phylacteophaga          CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAATGT-CA-GCC-T-T-GCGCTGACAGAGGGAGGATGGGTCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGGAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATTCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACC-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Lophyrotoma             CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTAAATGT-CG-GTC-A-C-GCGCCGACAGAGGGAGGATGGGCCGCGTC--ACGATACGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATTCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAATC-------------GTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Acordulecera            CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAATGT-CG-GCC-T-T-GAGTCGAGAGAGGGAGGATGAGCCGCGTC--ACGATGCGGCTCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   AGAGTCTCATTCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCATTTTT
+Decameria               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   ACACCTAAAGGCGCAATGAAAGTAAATGT-CG-TCCATTCGACGTCGACAGAGGGAGGATGGGCCGCGTC--TCGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTCG   CGAGTCTCATTCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Neurotoma               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGTCCA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Onycholyda              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGTCCA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Pamphilius              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGTCCA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Cephalcia               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGTACA-GCC-T-C-GCGCTTACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Acantholyda             CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGTCCA-GCC-T-C-GCGCTGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Megalodontesc           CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-TTT-GTGCCGACCGAGGGAGGATGGGTCGCGTC--AAGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-------------TTGAAGCCATGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Megalodontessk          ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cephus                  CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-T-C-GCGCCGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCTCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACGAAAAATTTAAAAATTGAAGCCACGAG--ATA----------TTAT------TGAAA-TACGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Calameuta               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCCAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-T-C-GCGCCGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCTCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACGAAAAATTTAAAAATTGAAGCCACGAG--ATA----------TTAT------TGAAA-TACGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Hartigia                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-T-C-GCGCCGACCGAGGGAGGATGGGTCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACGAAAAATTTAAAAATTGAAGCCACGAG--ATACATATATCATTTATGATACATGAAAATACGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Syntexis                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGT-CG--TC-T-T---GACGACCGAGGGAGGATGGGTCGCGA---A--A-GCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG--------------TGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Sirex                   CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCCAGAGGCGCAATGAAAGTGAAGGC-CGCGTC-T-CGGTCGCGGCCGAGGGAGGATGGG----------------------GCACTCCCGGGGCGTCTCG-GCCT-CATCGCGAGGCGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------------------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Xeris                   CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGC-CGTGTC-T-CGGTCACGGCCGAGGGAGGATGGG----------------------GCACTCCCGGGGCGTCTCG-GTCT-CATCGCGAGGCGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------------------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Urocerus                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGC-CGTGTC-T-CGGTCACGGCCGAGGGAGGATGGG----------------------GCACTCCCGGGGCGTCTCG-GCCT-CATTGCGAGGCGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------------------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Tremex                  CCAAGGAGTCTAACATGTGCGCAAGTCATTGGG   AAGCCCAAAGGCGCAATGAAAGTGAAGGC-CGTGCC-T-CGATCACGGCCGAGGGAGGATGGG----------------------GCACTCCCGGGGCGTCTCG-GCCT-CATTGCGAGGCGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCGCTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT-----------------------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Xiphydria               CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAAGT-CG-GCC-T-C-GCGCCGACCGAGGGAGGATGGGTCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCCGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG--------------TGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCACTTTT
+Orussus                 CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGAAATGAAAGTGAAGGT-CG-GCC-C-A-GCGCCGACCGAGGGAGGATGGACGGCGTC--ACGATGCCGTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------CA----------------TGGATCAGAGT-GCCAAGTGGGCCAATTTT
+StephanidaeA            CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AACCCTAAAGGCGCAATGAAAGTGAAGGT-CG-TCC-T-C-GCGACGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGATGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------TTGAAGCCACGAG--AT----------TCA----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+StephanidaeB            CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CG-TCC-A-C-GCGACGACCGAGGGAGGATGGGCCGCG-C--ATGCTGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Megalyra                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGCT-CG-ACC-T-C-GCGTCGATCGAGGGAGGATGGACCGCGTCTAACGACGC-GTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCACGAGGAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACGTT-----------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Trigonalidae            CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-T-C-GCGCCGACCGAGGGAGGATGGGCCGCGTT--TCGATGCGGCCCCGCACTCCCGGGGCGTCTCG-TTCT-CATCGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Chalcidoidea            CCAAGGAGTCTAACATGTACGCGAGTCATTGGG   AAGCCTAAAGGCGCAATGAAAGTGAAGGT-CG-ACCCT-A-GCGTCGACCGAGGGAGGATGGCTCGCGTC--ACGATGCGAGTCCGCACTCCCGGGGCGTCTCG-TGCT-CATTGCGAGCAGAGGCGCACCTAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATGACTGGCTTGCTTGAACG-------------TTGAAGCCATGTCAGACA----------TTAAAGCGA---------AGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Evanioidea              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCCAAAGGCGCAATGAAAGTGAAGAA-CG-GCC-T-C-GCGCCGTTCGAGGGAGGATGGGTCGCCTGC-ACG--GCGACCCCGCACTCCCGGGGCGTCTCT-ATCT-CATTGCGAGGGGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTCGAACG-------------ATGAAGCCAAGAGAGAG---------CGTT----------------TGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Ichneumonidae           CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCCAAAGGCGCAATGAAAGTGAAGGT-CG-GCC-T-C-GCGCCGACCGAGGGAGGATGGGCCGCGTC--ACGATGCGGTCCCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-------------TTGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Cynipoidea              CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCATAATGAAAGTGAAGGT-CG-ACC-T-T-GCGTCGACTAAGGGAGGATGGGCTTCATC--ACGATGAAGCCTCGCACTCCCGGGGCGTCTCG-TACT-CATTGCGAGTAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACG-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+ApoideaA                CCAAGGAGTCTAACATGTACGCGAGTCATTGGG   AAACCTAAAGGCGTAATGAAAGTGAAAGT-CG-TCC-A-TAGCGTCGACCGAGGGAGGATGGGCCGCGTT--ACGATTCGGCCTCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCTAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAATCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   TGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGTTGCCAAGTGGGCCAATTTT
+ApoideaB                CCAAGGAGTCTAACATGTACGCGAGTCATTGGG   AAACCTAAAGGCGTAATGAAAGTGAAGGT-CG-GCC-T-TGGTGTCGACCGAGGGAGGATGGGCCGCGTT--ACGATTCGGCCTCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCTAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   TGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACT-------------ATGAAGCCACGAG--AT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+ApoideaC                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAACCTAAAGGCGAAATGAAAGTGAAGGT-CG-GCC-T-TAGCGTCGACCTAGGGAGGATGGGCCGCGTT--ATGATGCGGCCTCGCACTCCCGGGGCGTTTCG-TTCT-CATTGCGAGAAGAGGCGCACCTAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAAAC-------------GTGAAGCCACGAG--AT-----------TT----------------TGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Vespidae                CCAAGGAGTCTAACATGTGCGCGAGTCATTGGG   AAGCCTAAAGGCGTAATGAAAGTGAAGGT-CG-ACC-T-C-GCGTCGACCGAGGGAGGATGGGCCGCGTT--AAGACGCGGCTTCGCACTCCCGGGGCGTCTCG-TTCT-CATTGCGAGAAGAGGCGCACCCAGAGCGTACACGTTGGGACCCGAAAGATGGTGAACTATGCCTGGTCAGGACGAAGTCAGGGGAAACCCTGATGGAGGTCCGTAGCGATTCTGACGTGCAAATCGATCGTCGGAACTGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCTCCGAAGTTTCCCTCAGGATAGCTGGCACTCG   CGAGTCTCATCTGGTAAAGCGAATGATTAGAGGCCTTGGGGCCGAAACGACCTCAACCTATTCTCAAACTTTAAATGGGTGAGATCTCTGGCTTGCTTGAACC-------------ATGAAGCCATGAGAGAT-----------TT----------------CGGATCAGAGT-GCCAAGTGGGCCAATTTT
+Triassoxyela            ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Asioxyela               ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Nigrimonticola          ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Gigantoxyelinae         ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Spathoxyela             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyela_mesozoica         ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Angaridyela             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyelotoma               ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Undatoma                ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Dahuratoma              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mesolyda                ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Turgidontes             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aulidontes              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Protosirex              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aulisca                 ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Anaxyela                ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Syntexyela              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Karatavites             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Stephanogaster          ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Leptephialtites         ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cleistogaster           ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sepulca                 ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Onochoius               ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Ghilarella              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Paroryssus              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Praeoryssus             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mesorussus              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Trematothorax           ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Thoracotrema            ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Prosyntexis             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Kulbastavia             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Brachysyntexis          ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Symphytopterus          ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Eoxyela                 ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Liadoxyela              ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Abrotoxyela             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Pseudoxyelocerus        ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Palaeathalia            ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Ferganolyda             ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+PamphiliidaeUndesc      ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Rudisiricius            ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sogutia                 ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyelula                 ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Brigittepterus          ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Grimmaratavites         ?????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+
+
+[COI 2225-3268, 1044 chars]
+Orthoptera              GCTGGAATAGTAGGAACATCAATAAGAATAATTATTCGTGCAGAACTTGGACAACCAGGATCTATAATTGGAGATGATCAAATTTATAATGTTGTTATTACAGCACATGCATTTGTAATAATCTTCTTTATGGTAATACCTATTATAATTGGAGGATTT   GGTAATTGATTAGTTCCACTAATAATTGGTGCACCAGATATAGCCTTTCCACGAATAAATAATATAAGTTTTTGACTTCTACCACCATCATTAACTCTTTTGATTACATCATCTATAGTTGATAGAGGTGCAGGAACAGGATGAACAGTTTACCCACCTCTTGCAAGAGCAATTGCTCATAGAGGAAGATCAGTAGACCTGGCTATCTTTTCATTACATTTAGCTGGTATTTCATCAATTCTAGGAGCAGTTAATTTCATTACAACCACAATCAATATGCGATCGGAAAGAATAACACTGGATCAAACACCACTATTTGTCTGATCAGTAGCAATTACAGCACTTTTATTACTTCTGTCATTACCAGTACTAGCAGGAGCAATTACTATATTATTAACTGATCGAAATTTAAATACATCATTCTTTGATCCAGCTGGAGGTGGAGACCCAATTCTTTATCAACATTTATTTTGATTCTTTGGACATCCTGAAGTT   TACATTATAATTTTACCAGGATTTGGTATTATTTCACACATTGTTTGTCAAGAAAGCGGAAAAATTGAATCATTTGGAACTCTAGGAATAATTTATGCAATATTATCAATT   GGATTAATAGGTTTTATTGTATGAGCACATCATATATTTACAGTAGGTATAGATGTTGATACACGAGCTTACTTTACATCAGCAACAATAATTATTGCAGTACCAACAGGAATTAAAGTATTTAGATGGTTAGCAACTCTTTATGGAACTAAATTTAATTTTAACCCACCATTATTA---TGAGCTCTTGGATTTATTTTCCTATTTACAATTGGTGGATTAACAGGATTAGTTTTAGCAAATTCATCTCTTGATATTGTTCTACACGATACTTATTAT
+Paraneoptera            GCTGGAATAATAGGAACATCCCTTAGATGAATTATTCGAATCGAGTTAGGACAACCTGGATCATTTATTGGAGACGACCAAATTTATAATGTAGTTGTAACAGCCCATGCCTTCGTCATAATTTTCTTTATAGTTATACCCATTATAATTGGAGGCTTT   GGAAACTGACTTGTACCCTTAATAATTGGTGCCCCAGACATAGCATTCCCTCGAATAAATAATATAAGATTTTGACTCCTACCCCCAGCATTAACCCTCCTTCTAGTAAGAAGATTAGTAGAAAGAGGAGCTGGAACAGGATGAACAGTTTACCCTCCCCTATCAAGAAATATCGCACATAGAGGAGCATCAGTAGATATAGCAATTTTCTCATTGCACTTAGCCGGAGTCTCATCAATTCTAGGAGCAGTAAATTTTATCTCTACCATTATTAATATACGCCCCGCAGGTATACGACCTGATCGAATTCCATTATTTGTCTGATCAGTAGGTATTACTGCCCTCTTATTACTTCTAAGACTCCCTGTCCTTGCAGGAGCTATTACAATACTTTTAACAGACCGAAACTTTAACACTTCATTCTTTGATCCAGCTGGAGGAGGAGACCCGATTCTTTATCAACATTTATTTTGATTCTTTGGACACCCTGAAGTA   TACATTCTTATTTTACCAGGATTCGGCTTAATCTCACATATTATCGCAATAGAGACCGGAAAAAATGAAGCTTTTGGGGCACTCGGAATAATTTATGCCATATTAGCCATT   GGCTTATTAGGGTTCATTGTATGGGCACACCACATATTTACTGTAGGTATAGACGTAGACACACGTGCATACTTTACCTCAGCTACTATAATCATTGCTGTACCCACAGGTATTAAAATCTTTAGATGATTAGCCACCCTTCATGGAAGAATAATATTATTCTCACCAAGAATTCTA---TGAGCTCTTGGGTTTGTTTTTCTATTCACTATTGGAGGACTTACTGGAGTCATTCTAGCAAACTCGAGAATTGATATTGTACTTCACGATACATATTAC
+Chrysopidae             ---------------------------------------------------------------------------------------------------------------------------------------------------------------   ---------------------------------------------------------------------------ATATTACCTCCCTCATTAACTTTATTACTTGCTTCTTCTATAGTAGAAAGAGGAGCTGGAACTGGTTGAACAGTTTACCCTCCTTTATCATCAAGAATTGCACATGCTGGAGCTTCTGTTGATTTAGCTATTTTTAGTTTACATCTTGCCGGTATTTCATCAATTTTAGGGGCAGTAAATTTCATTACAACAGTAATTAATATACGATTAAGTTATATAACATTAGATCGTATACCATTATTTGTATGATCAGTAGTAATTACAGCTTTACTATTATTACTTTCATTGCCTGTATTAGCTGGTGCTATTACTATATTATTAACTGATCGTAATTTAAATACTTCATTTTTTGACCCTGCGGGAGGAGGAGACCCAATTTTATATCAACATTTATTTTGATTCTTTGGACATCCTGAAGTA   TATATTTTAATTTTACCAGGATTTGGAATAATTAGTCATATTATTGCTCAAGAAAGTGGAAAAAAGGAAACCTTTGGATCTTTAGGAATAATTTATGCTATATTAGCTATT   GGATTATTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTTGGAATAGATGTTGATACTCGAGCTTACTTTACATCAGCTACAATAATTATTGCAGTTCCTACTGGTATTAAGGTATTTAGTTGATTAGCTACTTTACATGGAACTCAATTTACATATAGTCCAGCTTTATTA---TGAAGTTTAGGATTTGTATTTTTATTTACTGTTGGAGGATTAACTGGAGTTGTATTAGCTAATTCATCAATTGATATTATTCTTCATGATACTTATTAT
+Raphidioptera           TCTGGAATAATTGGAACCTCTTTAAGCTTATTAATTCGATCAGAACTAGGAATACCAGGATCTCTTATTGGAGATGATCAAATCTATAATGTTATTGTTACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTT   GGAAATTGATTAGTCCCTTTAATACTAGGAGCTCCAGACATAGCTTTTCCTCGTTTAAATAATATAAGATTTTGACTACTTCCTCCCTCTATTACTCTCCTCTTAAGAAGAAGAATAAGAGAAAGAGGAGCTGGTACAGGATGAACTGTTTACCCTCCTTTATCAAGAAACATTGCTCACGCTGGAGCATCCGTAGATTTAACTATTTTTAGACTTCACTTAGCAGGTGTATCTTCTATTCTAGGAGCAATTAATTTTATTACTACTACTTTAAACATACGGTCAAAAATATTATCATTAGAACGAATACCTTTATTTGTTTGATCTGTTGCAATCACAGCATTATTATTACTATTATCACTGCCAGTACTAGCTGGTGCTATTACTATACTTTTAACTGACCGAAATTTAAATACTTCTTTTTTTGATCCAGCTGGAGGAGGAGACCCAATTCTATACCAACACCTTTTCTGATTTTTTGGACACCCAGAAGTT   TACATTTTAATTTTACCTGGGTTTGGAATAATTTCTCATATTATTAGACAAGAAAGAGGAAAAAAAGAAACATTTGGATCTTTAGGAATAATTTATGCCATACTATCAATT   GGATTATTAGGATTCGTTGTTTGAGCACACCATATATTCACTATTGGAATAGATGTTGATACTCGAGCCTATTTCACTTCTGCTACAATAATTATCGCCGTTCCCACTGGAATTAAAATTTTTAGTTGATTAGCCACCCTTCATGGATCTCAATTAACTTTTTCACCATCCCTATTA---TGAGCTTTAGGATTTGTATTTTTATTTACCGTAGGAGGTTTAACTGGAGTTATTTTAGCAAATTCTTCTATTGATATCATTCTTCATGACACTTATTAT
+Coleo_Polyphaga         TCGGGATCTTTAGGATTAGCCTTAAGATTATTAATTCGAGCTGAATTAGGAACTCCAGGAACTTTAATTGGTAATGATCAAATTTATAATGTTATTGTTACTGCTCATGCTTTTATCATAATTTTCTTCATAGTTATACCTATTATAATTGGTGGATTT   GGGAATTGATTAGTACCTTTAATACTAGGGGCTCCAGATATAGCATTCCCTCGAATAAATAATATAAGATTTTGATTTCTCCCACCCTCTTTAATATTTTTATTAATAAGAAGAATAGTAGAAAGAGGGGCAGGAACAGGGTGAACTGTTTATCCTCCCCTTTCAGCTAATATTGCTCATAGAGGCCCTTCAGTTGATTTAGCTATTTTTAGACTTCATATAGCAGGGATCTCTTCAATTTTAGGAGCAGTAAACTTTATTTCAACTATTCTCAATATAAAGCCTCCCAGAATAAAGTTTGACCAAATACCTTTATTTGTTTGATCTGTAGGAATTACTGCATTACTATTACTTTTATCTTTACCTGTATTAGCAGGAGCTATTACAATACTTTTATCAGATCGTAATTTAAATACATCATTTTTTGATCCAATAGGGGGTGGGGACCCAATTCTTTATCAACATTTATTCTGATTCTTTGGTCATCCTGAAGTT   TATATTTTAATTCTCCCAGGATTTGGACTTATTTCTCATATTGTTTCTCAAGAAAGAGGAAAAAAGGAAACATTTGGTTGTATTGGAATAATTTATGCTATATTAGCTATT   GGTTTATTAGGATTTGTTGTTTGAGCACATCATATGTTCACAGTTGGAATAGACGTTGATACTCGAGCTTACTTCACATCAGCTACAATAATTATTGCTGTTCCAACAGGAATTAAAATTTTTAGTTGACTAGCAACTCTGCATGGTTCTAAAATTAGATGAACTCCTCAAATACTT---TGAGCAACAGGATTTATTTTTCTATTTACAGTTGGAGGATTAACAGGAGTAATTTTAGCCAAT-CTTCAATTGATATTATTTTACATGAACCTAATTA?
+Coleo_Adephaga          TCGGGGATAGTGGGAACTTCTTTAAGAATACTAATTCGAGCAGAATTAGGAAACCCAGGATCTTTAATTGGAGACGATCAAATTTATAATGTTATTGTAACAGCTCATGCTTTTGTAATAATTTTTTTCATAGTTATACCTATTATAATTGGGGGATTT   GGAAATTGATTAGTGCCACTAATATTAGGGGCCCCAGATATGGCATTCCCTCGAATAAATAATATAAGATTCTGGCTTCTCCCTCCTTCTTTGACTTTACTTCTTATAAGAAGAGTGGTAGAAAAAGGTGCAGGGACAGGATGAACGGTTTACCCTCCCCTATCATCTGGAATTGCCCATAGAGGTGCTTCGGTAGACTTAGCTATTTTTAGATTACATTTAGCTGGTATTTCATCAATTTTAGGAGCAGTAAATTTTATTACAACAATTATTAATATACGATCAATCGGAATAACATTTGACCGAATACCTTTATTTGTATGATCGGTGGGTATCACAGCATTATTACTTTTACTTTCTCTCCCAGTATTAGCTGGAGCTATTACTATACTTTTAACAGACCGAAACTTAAACACATCATTTTTTGACCCAGCTGGAGGAGGTGATCCTATTTTATATCAACATTTATTTTGATTTTTTGGACATCCTGAAGTA   TATATTTTAATTTTACCTGGATTTGGTATAATTTCACATATCATCAGACAAGAAAGAGGAAAAAAAGAAACCTTTGGATCTTTAGGAATAATTTACGCTATATTAGCTATT   GGATTATTAGGATTTGTTGTATGAGCACATCATATATTTACTGTAGGAATAGATGTTGATACTCGAGCTTATTTTACCTCTGCAACAATAATCATTGCAGTACCTACAGGAATTAAAATTTTTTCTTGATTAGCAACTCTTCACGGAACTCAGATTTCTTACAGCCCCTCATTACTT---TGAGCTCTAGGATTTGTGTTTTTATTTACTGTTGGAGGACTAACTGGAGTAGT??????????????????????????????????????????????
+Lepid_Micropterigidae   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Lepid_Papilionidae      GCAAGAATATTAGGAACCTCTTTAAGTTTATTAATTCGAACTGAATTGGGAACTCCAGGTTCTTTAATCGGAGATGATCAAATTTATAATACTATTGTTACAGCTCACGCTTTCATTATAATTTTTTTTATAGTTATACCAATTATAATTGGAGGATTT   GGAAATTGACTAGTACCATTAATATTAGGGGCCCCTGATATAGCTTTCCCCCGAATAAATAATATAAGATTTTGACTTTTACCCCCTTCCTTAACTCTTTTAATTTCAAGAATAATTGTTGAAAATGGAGCTGGAACTGGATGAACTGTTTATCCCCCCCTTTCCTCAAATATTGCCCATGGAAGAAGATCAGTAGATTTAGTTATTTTCTCGCTTCACTTAGCGGGAATTTCCTCAATTTTAGGAGCAATTAATTTTATTACCACAATTATTAATATACGAATTAATAATATATCTTTTGATCAAATACCTTTATTTGTATGAGCTGTAGGAATTACAGCCTTATTACTACTTCTTTCTCTACCTGTTTTAGCCGGAGCTATTACTATATTATTAACAGATCGAAATTTAAATACATCATTTTTTGACCCTGCGGGAGGAGGAGATCCTATTTTATACCAACATTTATTTTGATTTTTTGGCCATCCAGAAGTT   TATATTTTAATTTTACCAGGATTTGGTATAATTTCACATATTATTTCTCAAGAAAGAGGAAAAAAAGAAACATTCGGATGTTTAGGTATAATTTATGCTATGATAGCAATT   GGATTATTAGGATTTATTGTATGAGCACATCACATATTTACAGTAGGAATAGATACAGATACTCGAGCCTATTTTACTTCAGCAACAATAATTATTGCAGTTCCTACAGGAATTAAAATTTTTAGTTGATTAGCCACTCTTCATGGAACTCAAATTAACTATAGACCTTCAATTTTA---TGAAGTTTAGGATTTGTATTTCTCTTTACAGTTGGGGGATTAACAGGAGTAATTTTAGCTAATTCTTCTATTGATGTCACTTTACATGATACTTATTAT
+Mecoptera               TCTGGTATAGTCGGAACTTCTCTAAGATTACTTATTCGAGCAGAATTAGGTCAACCAGGAGCCTTAATTGGAGACGATCAAATTTTTAATGTAATTGTCACTGCTCATGCTTTCGTAATAATTTTTTTTATAGTTATGCCAATTTTAATTGGAGGATTT   GGAAATTGATTAGTTCCATTAATATTAGGAGCTCCCGATATAGCATTCCCTCGAATAAATAATATAAGATTTTGGTTATTACCTCCTTCTTTAACTTTACTACTCACTAGCTCATTAGTCGAAAATGGAGCTGGGACTGGTTGAACAGTGTACCCTCCGTTATCGTCTACCATTGCTCATGCCGGAGCTTCAGTTGATTTAGCAATTTTTTCATTACATTTAGCTGGAATTTCTTCTATTTTAGGGGCAGTAAATTTTATTACAACAGTAATTAATATACGATCAACAGGTATAACTCTTGATCGAATACCATTATTTGTTTGATCTGTAGCTATTACTGCTTTATTATTATTGTTATCTTTACCAGTTTTAGCTGGGGCTATTACAATACTTCTTACGGATCGAAATTTAAATACATCATTTTTTGATCCTGCGGGAGGAGGAGATCCTATTTTATATCAACATTTATTTTGATTTTTTGGTCATCCTGAAGTA   TATATTTTAATTCTACCAGGATTCGGAATAATTTCTCATATTATTTCACAAGAATCAGGTAAAAAGGAAACATTTGGAACTCTTGGAATAATTTATGCTATATTAGCAATT   GGACTTTTAGGATTTGTTGTTTGAGCTCATCATATATTTACAGTTGGGATAGATGTTGATACTCGAGCTTATTTTACTTCAGCTACAATAATTATTGCTGTTCCAACAGGAATTAAAATTTTTAGTTGATTAGCTACCTTACACGGATCCCAATTTACTTATAGCCCATCATTACTT---TGAGCTCTTGGATTTGTATTTTTATTCACAGTTGGAGGTTTAACAGGTGTTGTATTAGCAAATTCTTCTTTAGATATTATTTTACATGATACTTATTAT
+Xyela                   TCAGGAATAGTAGGAACATCATTAAGAATACTAATCCGAGCTGAATTAGGAACTCCTGGAACATTAATTGGAAATGATCAAATTTATAATGTTATTGTTACAGCTCATGCATTTGTTATAATTTTTTTTATAGTAATACCAATTATAATCGGGGGATTT   GGAAACTGACTAGTTCCATTAATATTAGGGGCTCCAGATATAGCATTTCCACGATTAAATAATATAAGTTTTTGATTATTACCTCCTTCATTAACTCTATTATTAGCAAGAAGAATTGTTGATACAGGAGCAGGTACTGGATGAACTGTATATCCACCTCTATCTAGAGGTATAGCTCATGCAGGAGCCTCTGTTGATTTAGCTATCTTTTCCTTACATTTAGCTGGAATTTCTTCTATTCTAGGAGCTATTAATTTTATTACAACAATTATTAATATACGAACAACGGGTATAAACTTTGATCGTATCCCATTATTTGTATGAGCTGTTGGAATTACAGCTTTATTATTACTATTATCACTTCCCGTATTAGCTGGGGCTATCACAATACTACTAACAGATCGTAATTTAAATACATCTTTCTTTGACCCAGCTGGAGGAGGAGACCCAATTTTATATCAACATTTATTTTGATTTTTTGGACACCCTGAAGTT   TATATTTTAATTTTACCGGCCTTTGGAATAATTTCTCATATTGTTTCTCAAGAAAGAGGTAAAAAGGAAGCATTTGGAACTCTAGGTATAATTTATGCTATATTATCAATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Macroxyela              TCAGGAATAGTTGGAACTTCATTAAGTATATTAATTCGTGCAGAACTAGGAACCCCAGGGTCTCTAATTGGAAATGATCAAATTTACAATGTAATTGTAACTGCTCATGCATTTATTATAATTTTTTTCATAGTTATACCTATTATAATCGGAGGATTT   GGAAACTGATTAGTTCCTCTAATATTAGGAGCCCCTGATATAGCATTTCCCCGAATAAATAATATAAGATTTTGACTATTACCCCCAGCTCTAACTTTATTACTAGCCAGAAGAATTGTAGGGTCAGGAGCTGGTACAGGATGAACAGTTTATCCACCACTTTCAAGTAATACAGGACATGCAGGAGCTTCCGTTGATCTAGCAATTTTTTCTTTGCACTTAGCTGGAATTTCCTCAATTTTAGGAGCAGTAAACTTTATTACTACTATTATCAATATACGATCAACAGGTATTAAATTTGATCGAATACCCTTATTTGTATGATCTGTAGGAATTACAGCTTTATTATTATTATTATCACTACCTGTATTAGCTGGAGCTATTACTATATTATTAACTGATCGTAATTTAAATACATCATTTTTTGATCCTGCAGGAGGAGGAGACCCTATTTTATATCAACATTTATTTTGATTTTTTGGACACCCAGAAGTT   TATATTTTAATTTTGCCAGGATTCGGTATAATTTCACATATTATTTCTGAAGAAAGAGGAAAAAAAGAAACATTTGGATCTTTAGGTATAATTTACGCTATACTAACAATT   GGATTATTAGGATTTGTTGTTTGAGCTCACCACATATTTACTGTTGGAATAGATGTTGATACACGTGCATATTTTACCTCTGCTACCATAATTATTGCTGTACCTACAGGAATTAAAATCTTCAGATGATTAGCCACATTACATGGAACAAAATTATCTTACAGACCTTCATTATTG---TGAGCACTAGGATTTGTATTTTTATTTACTATAGGAGGACTAACTGGAGTTGTTCTAGCTAACTCATCTATTGATATTGTTCTTCATGACACATACTAC
+Runaria                 TCTGGCATAATTGGTACTTCCTTTAGTGTATTAATCCGATTAGAACTAAGAACACCTACTAGATTTTTAGGAAGAGATCAAACTTATAATACTTTAGTAACCTCTCATGCATTCTTAATGATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTC   GGTAATTGATTAGTACCCTTAATAATCTCTGCCCCTGACATAGCCTTCCCTCGAATAAATAATTCAAGATTTTGATTATTGCCCCCCTCTCTTATTTTATTAACTTCAAGAAGATTTATTGATCTAGGATCTGGTACAGGATGAACAATTTACCCCCCTCTATCAAGAAATTTAGGACATGCTAGATCATCTATAGACTTAACAATTTTTTCCTTACATCTAGCTGGAATTTCATCAATTATAGGTGCTATTAACTTTATTTCAACAACTATTAATATACGAAATAAAGGAATAACATCTGAACGACTTACATTATTCACATGATCTGTAGCAATTACTGCATTATTGTTAATACTATCATTACCTGTATTAGCAGGAGCCATCACAATATTACTGACAGACCGAAATTTAAATACATCATTTTTCGACCCTTCTGGGGGTGGAGACCCGATTCTATTCCAACACTTATTTTGATTCTTTGGACACCCTGAAGTA   TACATTTTAATTTTACCTGGATTTGGAATTATTTCCCATATTATTTATCAAGAAGCAGGAAAAAAAGAAACATTTGGAACTTTAGGAATAATCTATGCTATATTAACAATT   GGCATTCTAGGATTTGTTGTTTGAGCTCATCATATATTTACAGTAGGAATAGATGTTGATACTCGAGCATACTTTACAGCCGCTACAATAATTATTGCCGTTCCCACTGGAATTAAAATTTTTAGATGATTAGCAACAATCCACGGAACCCAACTAATTTATACCCCTTCAATTTTA---TGAACACTAGGATTTATTTTTCTATTTACTTTAGGAGGACTAACAGGTATTATATTATCTAACTCATCATTAGATATTATTTTACATGATACATATTAT
+Paremphytus             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Blasticotoma            TCAGGAATAATTGGGACCTCATTCAGAATCCTTATTCGATTAGAATTAAGAACTCCTAACAGTCTTCTAAGTAATGACCAAACATACAACACTCTAGTAACCTCTCATGCCTTCTTAATAATTTTCTTCATAGTTATACCAATCATAATTGGAGGGTTC   GGAAATTGACTAATCCCCCTCATAATTTCAGCCCCTGATATAGCTTTTCCTCGTATAAACAACTCTAGATTCTGACTTCTACCCCCTTCTCTAATTCTACTAACTTCAAGAAACTTTATTGACTTAGGAACAGGAACAGGATGAACTATCTACCCTCCTCTATCAAGAAACTTAGGTCATGCAAGATCTTCAATAGACCTAACTATTTATTCCCTACATATAGCAGGTATTTCCTCAATTATAGGAGCTATTAATTTTATCTCTACAACAATTAACATACGAAATAAAGGAATATCCTCTGAACGACTAACCTTATTCACTTGATCAGTATCAATCACAGCACTACTTTTAATATTATCATTACCCGTTCTAGCAGGGGCTATCACAATATTATTAACAGACCGAAACTTAAACACATCATTTTTTGACCCAGCTGGAGGAGGAGACCCCATCCTATTCCAACACCTATTTTGATTTTTTGGGCACCCAGAAGTT   TATATTTTAATCTTACCAGGATTCGGAATTATTTCACATATCATTTATCAAGAAGCAGGGAAAAAAGAAACATTTGGAACTTTAGGAATAATCTATGCTATAATAACCATC   GGAATCCTAGGATTTATTGTCTGAGCCCACCATATATTTACAGTAGGAATAGATGTAGATACCCGAGCATACTTCACAGCAGCCACTATGATTATCGCTATCCCTACAGGAATCAAAATTTTTAGATGATTAGCTACTCTTCATGGAACTCAACTAATATACTCCCCCCCAATCCTA---TGAACTTTAGGATTTATCTTCTTATTCACCTTAGGAGGATTGACAGGAATTATATTATCCAATTCATCTCTAGACATTATTCTACACGATACTTACTAT
+Tenthredo               TCAGGTATATTAGGATTATCTTTCAGAATATTAATTCGAACAGAATTAGGAATACCAGGATCAATAATTGGTGATGATCAAATTTATAATGTTATTGTAACATCACATGCTTTTCTTATAATTTTTTTTATAGTTATACCAATCATAATTGGAGGATTT   GGAAACTGATTAATTCCTTTAATATTAGGAGCTCCTGATATAGCATTTCCTCGATTAAATAATATAAGATTTTGATTTTTACCACCATCAATCACTCTTCTTCTATCAAGAAGAATAGTAAATTCAGGTTCAGGAACAGGATGAACAGTATACCCACCCCTATCTAATAACATATCACATGCAGGAGCATCTGTAGATTTAACAATTTTTTCTTTACACTTAGCAGGAATTTCATCAATTTTAGGAGCAATTAACTTTATTTCTACTATAATTAATATACGAGTAAAAGGAATAAAATTTGAACGAATACCTTTATTTATTTGAGCAGTATCATTAACAGCATTATTATTATTATTATCATTACCAGTATTAGCTGGTGCAATTACTATACTATTAACTGATCGAAACTTAAATACTTCATTCTTTGACCCTTCAGGAGGAGGAGATCCAATTTTATACCAACATCTATTTTGATTCTTTGGACATCCTGAAGTA   TATATTTTAATTATCCCAGCATTTGGAATAATTTCTCATATTATTTCTCAAGAATCAGGAAAAAAAGAAACATTTGGAACATTAGGAATAATTTATGCAATAATAACTATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aglaostigma             TCAGGAATACTAGGTTTGTCTTTTAGAATACTTATTCGAATAGAACTAGGAATACCAGGTTCAATAATTGGAGATGATCAAATTTATAATGTAATTGTAACATCACATGCATTTTTAATAATTTTTTTCATAGTTATACCAATTATAATCGGAGGATTT   GGAAATTGACTAATCCCTTTAATATTAGGGGCCCCTGATATAGCATTTCCACGATTAAATAATATAAGATTTTGATTTTTACCCCCATCAATCACTTTACTTTTATCAAGAAGAATAGTTAATTCAGGATCAGGAACTGGATGAACAGTATACCCTCCCTTATCTAATAGAATCTCACATGCAGGAGCTTCTGTAGATATAACTATTTTTTCTCTTCATTTAGCTGGAATTTCCTCAATTCTAGGAGCCATTAATTTTATCTCAACAATAATTAATATACAAGTAAAAGGAATAAAATTTGAACGTATACCTTTATTCATTTGAGCTGTATCATTAACAGCTTTATTACTACTTTTATCACTTCCTGTATTAGCAGGAGCTATCACTATATTATTAACAGATCGAAATCTTAATACATCATTTTTTGACCCTTCGGGGGGAGGTGACCCCATCCTTTACCAACATTTATTTTGATTCTTTGGACACCCAGAAGTT   TATATTTTAATTATTCCCGCTTTTGGAATAATTTCACACATTATTTCTCAAGAATCAGGGAAAAAAGAAACTTTTGGGACAGTAGGAAT??????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Dolerus                 TCTGGTATATTAGGATTATCATTTAGAATATTAATTCGAACTGAATTAAGAATACCAGGTTCTATTATTAATGATAATCAATTATATAATGTTATTGTAACTTCACATGCATTTTTAATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTT   GGAAATTGATTAGTTCCTATAATATTAGGAGCCCCTGATATAGCATTTCCTCGATTAAATAATATAAGATTTTGATTTTTACCTCCATCTATTATATTATTACTATCCAGAAGATTAGTAAATTCAGGTTCAGGAACCGGATGAACAATTTATCCTCCATTATCTAGAAGAATTTTTCATGCTGGAGCATCAGTAGATATAACAATTTTTTCTCTTCATTTAGCAGGAATTTCTTCAATTTTAGGAGCTATTAATTTTATTTCAACAATAATTAATATAAAAATTAAAGGAATAAATTTTGAACGTATACCTTTATTTGTATGAGCAGTATTATTAACTACTTTACTTTTATTATTATCATTACCTGTTTTAGCAGGTGCAATTACTATATTATTAACTGATCGAAATTTAAATACATCATTTTTTGATCCTTCAGGAGGAGGAGATCCAGTTTTATATCAACATTTATTTTGATTTTTTGGTCATCCAGAAGTA   TATATTTTAATTATTCCTGCATTTGGAATAATTTCTCATATTATTTCACAAGATTCAGGAAAAAAAGAAACATTTGGAACTTTAGGAATAATTTATGCAATAATAACAATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Selandria               TCAGGAATATTAGGAATATCTTTTAGAATATTAATTCGAATAGAATTAGGAATACCAGGATCTTTAATTGGTAATGATCAAATTTATAATGTTATTGTTACTTCACATGCTTTTTTAATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTT   GGAAATTGACTAATCCCTCTAATATTAGGAGCACCAGACATAGCTTTTCCTCGATTAAATAATATAAGATTTTGATTTTTACCACCTTCATTAATCTTATTATTAACTAGAAGGTTAGTAAATTCAGGATCAGGTACAGGATGAACAGTATATCCACCTTTATCAAGAACAATTTCACATGCAGGATCTTCAGTTGATATAACAATTTTTTCTTTACATTTAGCTGGAATTTCATCAATTCTTGGGGCAATTAATTTTATTTCAACAATAATTAATATACGAATTATAAGAATAAAAATTGAACAAATACCTTTATTTATTTGAGCAGTTTCTATTACAGCCCTATTACTTTTATTATCACTACCAGTTTTAGCAGGAGCTATTACAATACTATTAACAGATCGAAATTTAAATACATCATTTTTTGATCCATCTGGAGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTTTTTGGACATCCAGAAGTT   TATATTCTTATTATTCCCGCATTTGGAATAATTTCTCATATTATTTCTCAAGAATCAGGTAAAAAAGAAACATTTGGAACATTAGGAATAATTTATGCTATAATAGCAATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Strongylogaster         TCAGGTATATTAGGTTTATCATTTAGAATACTAATTCGTACAGAATTAAGAATACCTGGATCAATAATTGGAAATGATCAAATTTATAATGTAATTGTTACATCTCACGCATTCTTAATAATTTTTTTTATAGTTATACCAATTATAATTGGAGGTTTT   GGAAATTGATTAATTCCTTTAATATTAGGAGCCCCAGATATAGCATTTCCCCGACTCAATAATATAAGATTTTGATTTTTACCCCCTTCATTAATTTTAATTCTTTTTAGAAGTATAATTAATTCAGGTTCAGGAACAGGATGAACAGTATACCCACCTTTATCAAGAAGAATTTCACATGCTGGAGCATCAGTAGATATAACTATTTTTTCATTACATCTTGCTGGAATTTCTTCAATTTTAGGAGCAATTAATTTTATTTCTACTATAATTAATATACGAATTAAAGGAATAAAGTTTGAACGAATACCTCTCTTTATTTGAGCAGTTTCACTTACAGCTCTATTACTTTTATTATCTTTACCAGTATTAGCAGGTGCAATTACTATATTACTTACAGACCGAAATTTAAATACTTCATTTTTCGATCCTTCAGGAGGAGGAGATCCAATCTTATATCAACATTTATTTTGATTTTTTGGACATCCTGAAGTA   TATATTTTAATTATCCCAGCATTTGGAATAATTTCTCATATTATTTCTCAAGAATCTGGAAAAAAAGAAACATTTGGAACTTTAGGAATAATTTATGCTATATTAACTATT   GGTTTATTAGGATTCGTAGTATGAGCTCATCATATATTTACTATTGGAATAGATGTTGATACACGAGCATATTTTACTGCAGCTACTATAATTATTGCTATTCCCACAGGAATTAAAATTTTTAGATGATTAGCTACAATTAATGGATCAAAATTAATTTTTAATCCATCAATACTT---TGAACTCTAGGTTTCGTATTTTTATTTACAATAGGAGGTTTAACAGGTATTATATTAGCTAATTCATCAATTGAT------------------------
+Monophadnoides          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Metallus                TCAGGAATATTAGGTTTATCTTTTAGAATATTAATCCGAACAGAATTAAGCATACCTGGCTCATTAATTGGTGATGATCAAATTTATAATATAATTGTTACATCTCATGCATTTTTAATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTC   GGAAACTGATTAATTCCACTAATGTTAGGAGCCCCTGATATAGCATTTCCACGATTAAACAACATAAGATTTTGATTCTTACCCCCTTCAATCTTATTTTTATTATCAAGAAGAATGGTAAATTCAGGAACAGGAACAGGTTGAACTGTTTATCCCCCTTTATCAAATAGAATATCTCATGCTGGAGCATCTGTTGATTTAACAATTTTCTCTTTACATTTAGCAGGAATTTCATCAATTTTAGGAGCTATTAATTTTATTTCAACCGTAATCAATATACGAATTATCGGAATAAATTTAGAACGAATACCTTTATTTATTTGAGCAGTAGTACTAACAGCATTATTATTATTATTATCTTTACCAGTACTAGCTGGAGCTATTACTATATTATTAACAGATCGAAATTTAAATACATCATTCTTTGACCCTTCAGGTGGAGGAGATCCAATTCTTTACCAACATTTATTCTGATTTTTTGGCCACCCAGAAGTT   TACATTTTAATTATTCCAGCTTTCGGAATAATTTCACATATTATTTCTCAAGAATCAGGAAAAAAAGAAACATTTGGAACAATTGGAATAATTTATGCAATATTAACAATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Athalia                 TCAGGAATAATTGGATTATCAATAAGAATAATCATTCGAAGAGAATTAAGTTCAAGAAATTCTTTTATTAAAAATGATCAAATTTATAATACTATTGTTACATCACATGCTTTTCTAATAATTTTTTTTATAGTAATACCCATTATAATTGGTGGATTT   GGTAATTGATTAATTCCATTAATATTAGGAGCTCCTGATATAGCCTTCCCTCGAATAAATAATATAAGATTTTGATTCTTACCACCATCATTAATTTTATTATTATCTAGAAGATTAATTAATACTGGTTCAGGAACAGGATGAACAGTTTACCCACCACTTTCTAGAAATGCCTCTCATGCAGGAGCATCCGTTGATTTAACAATTTTCTCTTTACATTTAGCAGGAATTTCATCTATTCTAGGAGCAATTAATTTTATTTCAACTATTTTTAATATACGAATAAATGGAATAACAAACGAACGAATAAGATTATTTTCATGATCAGTATTATTAACAGCTATTTTATTACTTTTATCATTACCTGTTTTAGCAGGAGCAATTACAATATTATTAACTGACCGAAACTTAAATACATCATTTTTTGATCCTTCTGGAGGAGGTGATCCTATTTTATACCAACATTTATTTTGATTTTTTGGACATCCTGAAGTT   TACATTTTAATTTTACCAGCATTTGGAATAATTTCTCATATTATTTCWCAAGAATCAGGAAAAAAAGAAACTTTTGGAACACTAGGAATAATTTATGCAATATCAAGAATT   GGATTATTAGGTTTTATTGTTTGAGCTCATCATATATTTACAGTTGGAATAGATGTAGATACTCGAGCCTACTTTACAGCAGCAACAATAATTATTGCAATTCCAACAGGAATTAAAATTTTTAGATGAATAGCAACTATATATGGTAATAAAATATTTTTTACACCATCTATATTA---TGAACATTAGGATTTATTTTTCTCTTTACTTTAGGAGGATTGACAGGAATTATTTTATCAAATTCATCAATTGATATTATTTTACATGACACATATTAT
+Taxonus                 TCAGGAATAATTGGAATATCATTTAGAATATTAATTCGAATAGAACTAGGAAGTCCTGGAGCAGTAATTGGAAATGATCAAATTTACAATGTAATTGTTACTTCTCATGCTTTTTTAATAATTTTTTTTATAGTAATACCAGTAATAATTGGTGGATTT   GGAAATTGATTAATTCCTTTAATATTAGGAGCCCCTGATATAGCATTTCCACGATTAAATAATATAAGATTTTGATTTTTACCCCCATCAATTATTTTATTATTATCAAGAAGAATGGTAAATTCAGGTTCAGGGACTGGTTGAACTGTTTATCCACCTCTCTCAAGAAGAATTTCACACGCTGGACCATCTGTAGATTTAACTATTTTTTCCCTTCATTTAGCAGGAGTTTCATCAATTTTAGGTGCAATAAACTTTATTTCAACAGTAATTAATATAAGAGTTAAAGGAATAGATTCAGAACGAATACCTTTATTTATTTGAGCTGTTTCTTTAACTGCTTTATTATTATTATTATCTTTACCTGTATTAGCTGGAGCTATTACTATATTATTAACAGATCGAAATTTAAATACAACTTTTTTTGATCCTTCAGGAGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTTTTTGGACACCCTGAAGTT   TATATTTTAATTATTCCAGCATTCGGAGTAATCTCTCATATTATATCTCAAGAATCAGGAAAAAAAGAAACATTTGGAACACTTGGAATAATTTATGCTATATTAACTATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Hoplocampa              TCTGGAATACTAGGGTTATCATTTAGAATACTAATTCGAACTGAATTAGGAATACCAGGATCAATAATTGGTAATGATCAAATCTATAATGTAATTGTAACATCACATGCTTTTTTAATAATTTTTTTTATAGTTATACCTATTATAATCGGAGGGTTT   GGAAATTGATTAGTACCTTTAATACTAGGAGCCCCAGATATAGCTTTCCCCCGATTAAATAACATAAGATTTTGATTTTTACCTCCTTCATTAATTTTACTTTTATCAAGAAGAATAGTAAATTCTGGGTCAGGAACAGGATGAACAGTATACCCTCCCTTATCCAGAAGAATTTCACATGCAGGTGCATCAGTTGATTTAACTATTTTCTCTTTACATTTAGCAGGAATTTCATCAATTCTAGGGGCAATTAATTTTATTTCTACAATAATTAATATACGAACTAAAGGAATAAAATTTGAACGTATACCTTTATTTATTTGAGCAGTTTCCCTAACTGCTTTATTATTATTATTATCATTACCAGTATTAGCAGGAGCTATTACTATATTATTAACTGACCGTAACTTAAATACATCATTTTTTGACCCTGCAGGAGGAGGTGACCCTATTTTATACCAACACTTATTTTGATTTTTTGGACACCCTGAAGTC   TATATTTTAATTATTCCTGCCTTTGGAATAATCTCTCATATTATTTCACAAGAAGCAGGGAAAAAAGAAACATTCGGAACTCTAGGTATAATTTATGCTATAATAACTATT   GGACTCTTAGGTTTTGTAGTTTGAGCTCACCATATATTTACTGTAGGTATAGATGTTGATACACGAGCTTATTTTACTGCAGCAACAATAATTATTGCAATTCCAACAGGAATTAAAATTTTTAGATGATTAGCAACTCTTTATGGATCAAAAATTATTTTTAATCCATCAATACTA---TGAACACTAGGATTTGTATTTTTATTTACCTCAGGGGGATTAACTGGAATTATTTTATCAAACTCATCTGTTGAC------------------------
+Nematinus               ---------------------------------------------------------------------------------------------------------------------------------------------------------------   ------------------------------------------------CCACGTCTTAATAATATAAGATTTTGATTTTTACCTCCTTCATTAATTTTATTACTTTCAAGAAGAATAGTAAATTCAGGTTCAGGAACAGGATGAACTGTATATCCACCATTATCTAGGAGAATATCTCACGCAGGTGCATCAGTTGATATAACAATTTTTTCTTTACATCTTGCAGGAATCTCATCAATTTTAGGAGCTATCAATTTTATTTCTACTATAATTAATATACGAATTAAAGGAATAAGATTTGAACAAATACCTTTATTTATTTGAGCTGTAACATTAACTGCTTTATTATTACTTTTATCTTTACCAGTATTAGCAGGAGCTATTACAATATTATTAACTGATCGTAATTTAAATACATCATTTTTTGATCCTTCAGGAGGAGGAGATCCAATCCTTTATCAACATCTATTTTGATTTTTTGGTCATCCAGAAGTT   TATATTCTAATTATTCCCGCATTTGGAATAATTTCTCATATTATTTCTCAAGAATCAGGTAAAAAAGAAACTTTTGGAACACTAGGAATAATTTATGCTATAATAACTATT   GGATTATTAGGATTTGTAGTATGAGCTCATCATATATTTACTATTGGAATAGATGTTGATACACGAGCTTATTTCACAGCAGCCACAATAATTATTGCCATCCCAACAGGAATCAAAATTTTTAGTTGATTAGCTACAATTTATGGATCTCAAGTTATTTTCAATCCTTCAATAATA---TGAACTTTAGGATTTGTATTTTTATTTACTTCAGGAGGACTAACAGGAATTATTTTATCAAATTCATCAATTGAT------------------------
+Nematus                 TCTGGGATATTAGGATTATCATTTAGAATACTAATTCGAACAGAATTAGGAATACCAGGATCAATAATTGGAGATGATCAAATTTACAATGTAATTGTAACATCTCATGCATTTTTAATAATTTTTTTTATAGTTATACCAATTATAATTGGAGGATTT   GGAAACTGATTAGTTCCATTAATATTAGGAGCTCCTGATATAGCATTTCCACGATTGAATAATATAAGATTTTGATTTTTACCACCTTCACTAATCCTACTCCTTTCAAGAAGAATAGTAAATTCAGGATCAGGAACAGGATGAACTGTTTATCCACCCTTATCAAGAAGAATTTCTCATTCAGGTGCATCAGTTGATATAACTATTTTTTCATTACATTTAGCAGGAATTTCATCTATTTTAGGAGCAATTAATTTCATTTCTACAGTAATTAATATAAAACTAAAAAGAATAAGATTTGAACAAATACCTCTATTTATTTGAGCAGTAACTTTAACTGCACTTCTACTTCTTTTATCTCTTCCAGTATTAGCAGGAGCTATTACAATACTTCTTACAGATCGAAACTTAAATACATCATTTTTTGATCCTTCAGGAGGAGGAGATCCAATTTTATACCAACATTTATTTTGATTTTTTGGACATCCAGAAGTT   TATATTTTAATTATTCCAGCATTTGGAATAATTTCTCATATTATTTCACAAGATTCAGGAAAGAAAGAAACGTTTGGTACNNNAGGNNNNNTTTATGCTATAATNNCAATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cladius                 TCAGGAATATTAGGACTCTCATTTAGAATACTTATTCGAACAGAACTAGGAATACCAGGATCCTTAATTGGAGATGATCAAATTTATAATGTAATTGTAACTTCACACGCATTTTTAATAATTTTCTTTATAGTAATACCTATTATAATTGGAGGATTT   GGAAACTGACTAGTACCTTTAATATTAGGAGCCCCCGATATAGCATTTCCTCGATTAAATAATATAAGATTTTGATTTTTACCACCATCACTAATTCTATTACTTTCAAGAAGAATAGTAAATTCAGGTTCTGGAACAGGTTGAACAGTTTATCCTCCTTTATCAAGAAGAATTTCACATGCAGGGGCATCAGTAGATCTTACCATTTTCTCTCTTCATTTAGCAGGAATTTCATCAATTCTTGGAGCAATTAATTTCATTTCAACAATAATTAATATAAAAGTAAAAGGAATAAGATTTGAACGAATACCTCTATTTGTTTGAGCAGTATCATTAACAGCTTTATTACTTCTTCTTTCACTACCTGTACTAGCCGGAGCAATTACTATACTTCTCACAGATCGAAACTTAAATACATCATTTTTTGACCCATCAGGAGGAGGAGACCCAATTTTATACCAACACTT????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Monoctenus              TCAGGGATATTAGGATTATCATCAAGAATAATTATTCGGATAGAATTAGGAATACCAGGTTCATTAATTGGAGATGATCAAATTTATAATGTAATTGTAACTTCACATGCATTTTTAATAATTTTTTTTTTAGTTATACCTATTATAATTGGGGGGTTT   GGTAATTGGTTAGTTCCTCTTATATTAGGAGCTCCAGATATAGCTTTCCCACGGATAAATAATATAAGATTTTGATTTTTACCTCCATCTTTAATTTTAATAATTACAAGAATAATAGTAGAATCAGGATCAGGAACGGGGTGAACAGTTTATCCCCCGTTATCTAGAAGATTGGGACATTCTGGTAGATCTGTAGATTTAACTATTTTTTCACTTCATTTAGCAGGAATTTCTTCTATTTTAGGGGCTATTAATTTTATTTCAACAATAATTAATATACGAATAAATGGTATAAATTTTGATCAACTTTCTCTTTTTGTATGATCAGTTAAAATTACAGCAATTTTATTATTATTATCTTTACCTGTTTTAGCTGGCGCTATTACTATATTACTTACAGATCGAAATTTAAATACAACATTTTTTGATCCTGCTGGAGGAGGGGACCCAATTTTATATCAACATTTATTTTGATTTTTTGGGCATCCGGAGGTT   TATATTTTAATTTTACCTGCTTTTGGTATAATTTCTCATATTATTTCTCAAGAATCAGGTAAAAAGGAAACATTTGGAACATTGGGGATAATTTATGCAATAATAACTATT   GGATTATTAGGATTTATTGTATGGGCACATCATATATTTACTGTAGGAATAGATGTTGATACTCGAGCATATTTTACAGCGGCAACTATAATTATTGCAATTCCTACGGGGATTAAAATTTTTAGATGATTAGCTACATTATATGGATCAAATATAAAATTTAATTCTGTTACATTA---TGAGCATTAGGTTTTATTTTTTTATTTACAATAGGGGGATTAACTGGTATTATATTATCAAATTCTTCTATTGATATTATTTTACATGATACATATTAT
+Gilpinia                TCAGGAATATTAGGATTATCATCAAGAATAATTATTCGAACAGAATTAGGAATACCTGGATCATTTATTGGTGATGATCAAATTTATAATATAATTGTTACATCTCATGCATTTTTAATAATTTTTTTTATAGTAATACCTATTATAATTGGAGGATTT   GGAAATTGACTAGTACCTTTAATATTAGGAGCCCCAGACATAGCTTTTCCTCGAATAAATAACATAAGATTTTGACTTCTACCACCTTCATTAATTTTATTAATATCAAGAAGATTAGTTGATTCAGGAACTGGAACAGGATGAACTGTATACCCACCTCTATCAAGAAATTTAGGTCATTCAGGACCATCAGTAGATTATACAATTTTTTCACTTCATATAGCAGGAATTTCATCTATTTTAGGAGCAATTAATTTTATTTCTACAATAATTAATATACGACCAAAAAGAATAAATTTTGAACAAATACCATTATTTGTGTGATCAGTTAAATTAACTGCTATTCTTTTATTATTATCACTACCAGTATTAGCTGGGGCTATTACTATATTATTAACAGATCGAAATATAAATACAAGATTTTTTGATCCATCAGGTGGGGGTGATCCAATTCTTTATCAACATCTATTTTGATTTTTTGGTCATCCAGAAGTA   TATATTTTAATTCTTCCAGCATTTGGAATAATTTCACATATCATTTCACAAAAATCAGGAAAAAAAGAAACCTTTGGAACATTAGGAATAATTTATGCTATAATAACAATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Diprion                 TCTGGAATACTAGGATTATCATCGAGAATGATCATTCGGATAGAGTTAGGTACCCCAGGATCATTTATTGGTGACGATCAAATTTATAATATAATTGTTACATCTCACGCATTTTTAATAATTTTTTTTATAGTAATACCTATTATAATTGGAGGATTT   GGAAACTGATTAGTACCCTTAATATTAGGAGCACCAGATATAGCATTTCCTCGAATAAATAATATAAGATTTTGACTTTTACCTCCTTCATTAATTATACTTTTATCAAGAAGAATTGTTGATTCAGGAACAGGAACAGGATGAACAATCTATCCTCCTTTATCAAGAAATTTAGGTCATTCAGGACCATCAACTGATTATACAATTTTTTCTTTACATATAGCAGGGATTTCATCTATTATAGGAGCAATTAATTTTATTTCTACTATATTAAATATACATTTAAAAGGAATAAAATTAGACCAATTAACTCTTTTTATTTGAGCAGTTAAATTAACAGCTATTCTATTATTACTTTCTTTACCAGTTTTAGCAGGAGCTATTACAATACTTTTAAGAGATCGAAATTTAAATACAACATTTTTTGATCCTTCAGGTGGTGGTGATCCAATTTTATATCAACATTTATTTTGATTCTTTGGACATCCAGAAGTT   TATATTTTAATTTTACCAGCATTTGGAATAATTTCACATATTATTTCTCAAAGATCAGGTAAAAAAGAAACTTTCGGAACTTTAGGAATAATTTATGCAATAATAACAATT   GGAGTACTAGGATTTGTAGTATGAGCACATCATATATTTACTGTAGGAATAGATGTTGACACACGAGCATATTTTACAGCTGCAACTATAGTAATTGCGATTCCAACAGGAATTAAAATTTTTAGATGAATAGCAACTCTTTATGGATCAAGAATTAATTTTAAACCTTCACTAATA---TGAACTTTAGGATTCATTTTTCTATTTACTATAGGAGGATTAACTGGAATTATACTATCTAATTCATCAATTGATATTATTCTTCATGATACATATTAT
+Cimbicinae              TCAGGAATATTAGGTTTATCATTTAGAATAATTATTCGAACTGAATTAGGTACACCAGGATCTTTAATTGGAAATGATCAAATTTATAATGTTGTAGTTACTTCTCATGCATTTTTAATAATTTTCTTTATAGTAATACCTATTATAATTGGAGGATTT   GGAAATTGATTAATTCCTCTAATATTAGGGGCTCCTGACATAGCATTCCCACGTTTAAATAACATAAGATTTTGATTACTTCCCCCATCAATCATTTTTCTACTTTCTAGAAGAATTGTAAATTCAGGAAGAGGAACAGGATGAACAGTTTATCCTCCTCTTTCAAGAAATTTAGGACATGCAGGTGCTTCAGTTGATTTAACTATTTTCTCACTTCATTTAGCAGGAATCTCTTCAATTCTTGGAGCAATTAATTTTATTTCAACAATAATTAATATAAAAATCAAAACTATAAATTATGATCAACTACCCCTTTTTGTTTGAGCAACTTCATTAACTACATTATTACTTTTATTATCATTACCAGTATTAGCTGGAGCGATCACTATACTATTAACAGATCGAAATTTAAATACATCATTTTTTGATCCTGCAGGAGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTTTTTGGACATCCAGAAGTT   TATATTTTAATTTTACCAGGATTTGGGGTAATTTCCCATATTATCTCTCAAGAATCAGGAAAAAAAGAAACATTTGGAACTCTAGGTATAATTTATGCTATAATAGCAATT   GGATTATTAGGATTTGTAGTTTGAGCCCATCATATATTTACTATTGGAATAGACGTTGATACACGAGCATACTTTACAGCAGTAACAATAATTATTGCTATTCCTACTGGAATTAAAATTTTTAGTTGACTAGCAACTATATATGGATCTAAAATTAATTCTAATCCATCTACATTA---TGAACTTTAGGATTTGTATTCTTATTTACATTAGGAGGACTTACAGGAATCATATTATCAAATTCATCTGTAGATATTATTCTTCATGATACATATTAT
+Abia                    TCAGGAATAATTGGAATATCTTTTAGTATAATTATTCGAACAGAATTAGGAACAGCAGGATCATTAATTGGAGATGACCAAATTTATAATGTTGTAGTAACATCTCATGCATTTTTAATAATCTTCTTTATAGTAATACCTATTATAATTGGAGGATTC   GGAAATTGACTTGTACCACTAATATTAGGAGCTCCAGATATAGCTTTTCCACGATTAAATAATATAAGATTTTGACTATTACCACCATCAATTATTTTACTATTATCAAGAAGAATTGTAAATTCAGGTAGAGGAACAGGATGAACAGTTTATCCTCCTTTATCAAGAAGATTAGGACATGCAGGACCATCTGTTGATTTAACTATTTTTTCATTACATTTAGCAGGTATTTCTTCTATTTTAGGGGCTGTAAATTTTATTTCAACTACAATTAATATAAAAATTAACTCAATAAAATATGATCAATTATCATTATTTATTTGAGCAACAGTTTTAACTACTATTTTACTATTATTATCTTTACCAGTATTAGCAGGAGCAATTACTATATTATTAACTGATCGTAATTTAAATACTTCATTTTTTGATCCTGCAGGAGGAGGAGATCCTATTTTATACCAACACTTATTTTGATTTTTTGGTCATCCAGAAGTT   TATATTCTAATTTTACCTGGATTTGGTGTAATTTCTCATATTATTGCTCAAGAATCAGGTAAAAAAGAATCATTCGGAGCTCTTAGAATAATTTATGCTATATCAGCTATT   GGAATTTTAGGATTTGTAGTATGAGCCCATCATATATTTACTATTGGTATAGATATTGATACACGAGCTTATTTTACAGCAGTAACCATAATTATTGCTATTCCTACAGGAATTAAAATTTTTAGATGAGTAGCAACTTTACATGGATCTAAAATAAAATTTACTCCATCAATACTA---TGAACATTAGGATTTGTATTTTTATTTACCAGAGGAGGATTAACAGGAATTATACTAGCAAATTCATCAATTGATATTATTTTACATGATACTTATTAT
+Corynis                 TCAGGTATATTAGGTTTATCATTTAGTATATTAATTCGTAGAGAATTAGGTACACCAAATTCTTTAATTGGAGATGATCAAATCTATAATACAGTAGTAACTTCTCATGCATTTTTAATAATTTTTTTTATAGTAATACCAGTAATAATTGGAGGATTT   GGAAACTGATTAATTCCTTTAATACTAGGAGCACCAGATATAGCATTTCCTCGTTTAAATAATATAAGATTTTGATTATTACCTCCATCATTATTAATATTATTAATAAGAAGAATTATTGATTCAGGAGCAGGAACTGGATGAACAATTTATCCACCATTATCAAGAAATTTAGCTCATGCAGGAGCTTCTGTAGATATAACAATTTTCTCGCTACATATAGCAGGAATCTCTTCAATTTTAGGAGCTATTAATTTTATTTCTACTATTATAAATATAAAAATTAATGGAATAAAATTTGATCAATTACCTTTATTTGTTTGAGCCGTAATTTTAACTACTATTTTATTATTATTATCATTACCTGTTTTAGCAGGAGCTATTACAATATTATTAACAGATCGAAATTTAAATACATCATTTTTTGATCCATCAGGAGGAGGAGATCCAATCTTATATCAACATTTATTCTGATTTTTTGGCCACCCAGAAGTG   TATATTTTAATTTTACCGGCATTTGGTGTTATTTCTCATATTATTTCTAACGAATCAGGAAAAAAAGAAACATTTGGAACATTAGGTATAATTTATGCTATATTATCAATT   GGTTTATTAGGTTTTGTAGTTTGAGCTCATCATATATTTACTGTTGGTATAGATGTTGATACACGAGCATATTTTACTGCAGTAACAATAATAATTGCAATTCCTACAGGAATTAAAATTTTTAGATGATTAGCAACTCTATTCGGAACAATTATAAAATCAATTCCTTCAATATTA---TGAACAATAGGATTTGTATTCTTATTTACAATAGGAGGATTAACAGGTATCATTTTATCTAATTCATCAATTGATGTAATTTTACATGATACATATTAT
+Arge                    GCAGGAATAATAGGACTTTCATTTAGAATAATTATTCGTACAGAATTAAGTTCAGTAGGGTCATTAATTAAAGATGATCAAATTTATAATACAATTGTCACATCACATGCATTTTTAATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTT   GGAAATTGATTAATTCCATTAATATTAGGGGCTCCTGATATAGCATTTCCACGATTAAATAATATAAGATTTTGATTTTTACCTCCTTCATTAATTCTTTTAACAATTAGAAGATTTGTTGATTCAGGAACTGGTACAGGTTGAACAGTTTATCCCCCCTTATCAAGTAATATTTCTCATTCAGGTTCATCTGTAGATTTAACTATTTTCTCCTTACATTTAGCAGGAATTTCATCAATTTTAGGAGCTATTAATTTTATTTCTACAATTATTAATATAAAAATTTTAGGAATATCTTTTGATAAAATACCATTATTTATTTGATCAGTTAAAATTACAGCAATTTTATTACTTCTTTCATTACCTGTATTAGCAGGAGCTATTACAATATTATTAACAGATCGTAATTTAAATACTTCATTTTTTGACCCTTCAGGTGGAGGAGACCCTATTTTATACCAACATTTATTTTGATTTTTTGGACACCCTGAAGTT   TATATTTTAATTCTCCCCGCATTTGGAATTATTTCACATATTATTTCACAAGAATCTGGTAAAAAAGAAACATTTGGAGTTTTAGGTATAATTTATGCTATATTAACAATT   GGAATTTTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTAGGTATAGATGTTGATACACGAGCTTATTTTACTGCTGCTACTATAATTATTGCAGTTCCTACAGGTATTAAAATTTTTAGTTGAATAGCTACAATTCATGGATCAAAAATTATTTATTCTCCAACTATATTA---TGAACTTTAGGATTYATTYTCTTATTTACATTAGKAGGATTAACAGGKATTATTTTATCWMATTCATCAATTGATATTATTTTACATGATACATA?TAT
+Sterictiphora           TCAGGAATAATAGGACTATCATTCAGAATAATTATCCGGACAGAATTAAGTTCAGTAGGATCACTTATTGGAGATGACCAAATCTACAATGTATTAGTAACATCTCATGCATTTTTAATAATTTTTTTTATAGTAATACCAATTATAATTGGAGGATTT   GGAAACTGATTAATTCCTTTAATATTAGGGGCACCTGACATAGCTTTCCCCCGACTTAATAATATAAGATTTTGACTACTCCCCCCTTCATTAATATTATTAACAATTAGTAGATTTACTGATTCAGGAGCAGGTACAGGATGAACAGTATACCCTCCTTTATCAAGTAATATTGCTCACGCAGGAAGATCAGTAGACTTAACAATTTTTTCTTTACATTTAGCAGGAATCTCATCAATTCTAGGGGCAGTAAATTTTATTTCAACAGTAATTAATATACGATCATTAGGAATATCATTTGATAAAATACCTTTATTTATTTGAGCAGTAGCAATCACAGCTTTATTATTATTAATTTCCTTACCTGTATTAGCAGGAGCAATTACAATACTATTAACAGACCGAAACCTAAACACTTCTTTCTTTGACCCTTCAGGAGGAGGGGACCCTGTACTTTACCAACACTTATTCTGATTTTTTGGCCACCCAGAAGTT   TATATTCTTATTTTACCAGCCTTTGGTATTATTTCTCATATTATTTCACAAGAATCAGGAAAAAAAGAAACATTCGGAACTTTAGGTATAATTTATGCAATAACAGCTATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Perga                   TCAGGAATAATTGGATTATCATTCAGAATAATTATTCGAACAGAAATAATAACAACAGGATCTTTTATTGGAGATGATCAAATCTATAATGTAATTGTCACATCTCATGCATTTTTAATAATTTTTTTTATAGTTATACCTATTATAATAGGAGGATTT   GGAAATTGATTATTACCTTTAATATTAGGAGCTCCTGATATGGCATTTCCTCGACTTAATAATTTAAGATTTTGACTACTACCCCCCTCATTAATCCTACTAACATTTAGTAGATTTATTAACTCAGGATCTGGAACAGGATGAACTGTCTATCCTCCCCTTTCAAGTAATATTGCCCATGCTGGAACTTCTGTTGATATAACTATTTTTTCATTACATATAGCAGGAATTTCATCAATTCTAGGAGCTATTAATTTTGTATCAACTATAATTAATATACGAGCATCAGAAATAAGACTAGATAAAATACCTTTATTTATTTGAGCTATTACTATTACCGCTATTTTATTAATTATCTCTTTACCAGTTTTAGCAGGAGCTATCACTATATTACTTACAGATCGAAACTTAAATACATCATTTTTTGACCCATCAGGAGGAGGAGATCCAATTTTATACCAACACTTATTTTGATTCTTTGGACATCCAGAAGTA   TATATTTTAATTTTACCTGCTTTTGGTATTATCTCTCATACAATCTCTCAAGAATCTGGTAAAAAAGAAACTTTCGGAACTTTAGGAATAATTTATGCAATATCAGCCATT   GGCCTACTTGGATTTATTGTATGAGCTCATCATATATTTACTGTAGGAATAGATGTAGATACTCGAGCTTATTTTACTGCTGCAACAATAATTATTGCTGTACCCACAGGAATTAAAATTTTTAGATGACTTGCAACAATTCACGGATCAAAAATCTCCTACACTCCTAATATAATA---TGAACCCTAGGATTTGTTTTTTTATTCACTATAGGAGGATTAACTGGAATTATACTCTCTAACTCATCAATTGATATCATTATACACGATACATATTAT
+Phylacteophaga          TCAGGAATAATTGGATTATCTTTCAGAATAATTATTCGAACTGAACTTAATACATCAGGATCATTTATTGGAGATGATCAAACATATAATGTTATAGTGACATCTCATGCATTTTTAATAATTTTCTTTATAGTAATACCAGTAATAATAGGAGGATTT   GGAAATTGATTAGTACCCTTAATATTAGGAGCACCAGATATAGCTTTTCCACGATTAAATAACCTTAGATTTTGATTACTACCCCCATCCCTAATCTTACTAACAATAAGAAATTTAATTGATTCAGGATCAGGGACAGGATGAACAGTTTATCCACCTCTTTCAAGTAATATCGCTCATGCAGGATGTTCTGTAGACATAACAATTTTTTCTCTTCATATAGCAGGTATTTCTTCCATTCTTGGAGCAATTAACTTTATCTCAACTATAATTAATATACGAGCTTCTAATATAAGACTAGATAAATTATCATTATTAATTTGAGCAATTACAATTACAGCAATTTTACTAGTTATTTCTCTTCCAGTACTAGCTGGTGCAATTACTATACTTTTAACAGATCGAAACCTAAATACATCATTCTTCGACCCATCAGGAGGAGGAGATCCTATTTTATATCAACATTTATTTTGATTCTTTGGACATCCCGAAGTA   TATATTCTTATTCTACCAGCATTTGGAATTATTTCACATATTATTTCTCAAGAATCTGGAAAAAAAGAAACTTTTGGAACATTAGGAATAATTTATGCAATATCAGCTATC   GGATTGCTAGGATTTATTGTATGAGCCCATCACATATTTACTATTGGAATAGATGTTGATACTCGAGCATATTTTACTGCAGCAACAATAATTATTGCTGTTCCTACAGGAATCAAAATTTTTAGATGATTAGCAACTATTCACGGATCAAAAATAATTTATACACCTAATATACTT---TGAACATTGGGATTTGTATTTCTTTTCACTATAGGAGGACTAACAGGAATTATTTTATCTAACTCTTCTATTGATATTATTATACATGACACATACTAC
+Lophyrotoma             TCAGGAATATTAGGGTTATCTTTTAGAATAATTATTCGAACAGAATTAATAACACTAGGAACATTTATTGGTAATGATCAAATTTATAATGTTCTTGTAACATCTCATGCATTTTTAATAATTTTTTTTATAGTTATACCAATTATAATAGGAGGGTTT   GGAAATTGATTACTACCATTAATACTTGGTGCACCAGACATAGCATTTCCTCGTTTAAATAATTTAAGATTTTGACTTTTACCCCCTTCATTAATTTTACTGTTAATAAGAAGATTAATTGARTCAGGAAGAGGGACAGGATGAACTGTTTACCCACCATTATCAAGAAATTTATCTCATTCAGGGTCATCTGTAGATTTAACAATTTTTTCATTACATATGGCAGGAGTATCATCAATTTTAGGAGCAATCAATTTTGTTTCTACAGTAATTAATATACGAACTAAAGGAATACAATTAAGTATAATATCATTAATAATTTGAGCTATTACAATTACAGCTATTTTATTAATTATTTCATTACCAGTTTTAGCAGGAGCTATTACTATACTTTTAACTGACCGAAATTTAAATACATCATTTTTTGATCCTTCAGGAGGAGGAGATCCTATTCTTTATCAACATTTATTTTGATTTTTTGGTCACCCTGAAGTT   TATATTTTAATTTTACCAGCATTTGGTATTATTTCCCATATTATTTCTCAAGARTCAGGTAAAAAAGAAACTTTTGGTACTTTAGGAATAATTTATGCAATATCTTCTATT   GGTTTATTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTAGGTATAGATGTTGATACACGAGCTTATTTTACAGCAGCCACTATAATTATTGCTATTCCTACAGGGATTAAAATTTTTAGATGACTAGCAACAATTCATGGAACAAAATTAATTTATTCACCAAATATATTA---TGAACTCTAGGATTTGTTTTTTTATTTACTATAGGAGGACTTACTGGAATTATTTTATCAAATTCATCAATTGATATTATTTTACATGATACTTATTAT
+Acordulecera            TCGGGAATAATTGGACTATCATTTAGTATAATTATCCGAACAGAGCTTAGAACTACAGGATCATTTATCGGTAATGATCAAATTTATAATGTAATTGTAACATCTCATGCATTTTTAATAATTTTTTTTATAGTTATACCAGTTATAATAGGAGGATTT   GGAAACTGATTAATTCCACTAATATTAGGAGCTCCTGATATAGCTTTCCCACGAATAAATAATTTAAGATTTTGACTTCTTCCTCCCTCACTAATTTTATTAACATTTAGAAGTTTTATTGATTCAGGATCAGGAACAGGATGAACAGTTTACCCTCCTTTATCAAGAAATATTGCTCATGCAGGAACATCCGTAGATATAACTATTTTTTCCCTTCATATAGCAGGAATTTCTTCAATTTTAGGGGCAATTAATTTTATTTCAACCATAATTAATATACGAACACCCGGAATAAGATTCGATAAAATACCATTATTAATTTGAGCAGTTATAATTACAGCTATCCTTCTAGTTATCTCTTTACCCGTTCTAGCTGGAGCTATTACTATATTATTAACAGATCGAAATCTAAATACCTCATTTTTTGATCCTTCAGGGGGGGGGGACCCTATTCTATACCAACACTTATTCTGATTTTTTGGACACCCAGAAGTT   TATATTTTAATTCTCCCCGCTTTTGGTATTATTTCTCATATTATTTCTCAAGAATCAGGTAAAAAGGAAACTTTTGGGACATTAGGAATAATTTATGCTATATCAGCTATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Decameria               TCAGGTATACTTGGATTATCATTTAGAATAATTATTCGTTCTCAATTAAGAACTTCTGGCACACTAATTTCAAATGACCAAATTTATAATGTTATTGTAACATCACATGCATTTTTAATAATTTTTTTTATAGTAATACCAATCATAATAGGAGGATTT   GGAAATTGATTAATTCCTTTAATAATTGGGGCCCCTGATATAGCTTTTCCTCGAATAAATAATTTAAGATTTTGGTTTTTACCTCCTTCTCTAATCCTTTTATTGATAAGTAGAATAACAGATTCTGGATCTGGAACAGGTTGAACTGTGTATCCACCATTATCCAACAATATTGCCCATGCAGGAGCATCTGTTGACATAACTATCTTCTCTTTGCATATAGCAGGTATTTCATCAATTCTTGGAGCTATTAATTTTGTATCAACTATAATTAATATACGAACTTCAGAAATAAATATAGATAAGCTTCCTCTTTTTATTTGATCAATTACAGTAACTGCCATTTTATTAATTATTTCTTTACCTGTATTAGCCGGGGCAATCACTATACTACTTACTGATCGTAATTTAAATACATCATTTTTTGATCCTTCAGGAGGAGGGGACCCTATTTTATACCAACATTTATTCTGATTTTTTGGCCACCCAGAAGTT   TACATTTTAATCTTACCAGCATTTGGAATTATTTCTCATGTAATTTCTCAAGAATCTGGAAAAAAAGAAACATTTGGATCTCTAGGAATAATTTATGCTATAATAGCTATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Neurotoma               -------------------------------------------------------------------------ATGATCAAATTTATAATGTAATTGTTACTGCCCATGCATTTTTAATAATTTTCTTTATAGTTATACCTATAATAATTGGGGGATTC   GGAAACTGATTAGTTCCTTTAATATTAGGAGCCCCTGATATAGCATTCCCACGAATAAATAATATAAGATTTTGACTCCTACCTCCTTCCTTAGTTTTATTACTAACTAGAAGAATTATAAATAAAGGAACGGGAACTGGTTGAACAGTTTACCCCCCTTTATCATCAATCTTATCTCATAGAGGTTCATCTGTAGATTTCGCAATTTTTTCATTACATATAGCTGGAATCTCTTCTATTATAGGAGCTATTAATTTTATTTCAACAATTATAAACATAAAAATTCCAGGATTAAGTCTTGATCAATTATCATTATTTACTTGATCAGTTCTAAATACTGCAATCTTACTATTACTATCATTACCAGTATTAGCAGGAGCCATTACTATATTATTAACAGATCGTAATTTAAATACTTCATTTTTTGACCCTGCAGKAGGAGGAGAYCCTGTTCTTTATCANCATTTATTTTGATTTTTTGGACACCCAGAAGTA   TATATTCNNATCNTANNNNNNTTNNGAATAATTTCTCATATAATTTTCCATGAATCAGGAAAAAAAGAAACTTTCGGAACATTAGGAATAATCTACGCAATAATTTCTATT   GGAATTCTTGGATTTGTTGTTT-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Onycholyda              TCAGGAATATTAGGAACTTCAATAAGAATATTAATTCGAATAGAATTAGGRACTCCAGGATCTTTAATTGGRGATGATCAAATTTATAATGTTATTGTCACAGCTCATGCATTTTTAATAATTTTTTTTATAGTTATACCAATAATAATTGGAGGATTT   GGAAATTGACTTGTTCCATTAATATTAGGAGCTCCTGATATAGCATTTCCTCGAATAAAYAATATAAGATTTTGATTATTACCACCTTCATTAATTTTTTTAATTTCTAGAAGAATTATAAATAAAGGAGCAGGTACAGGATGAACAGTTTATCCTCCTTTATCTTCAAATTTAACTCATACTGGTTCATCAGTAGATTTTGCAATTTTTTCCTTACATATRGCTGGWATTTCTTCAATTATAGGAGCAATTAATTTTATTTCAACAATTTTAAATATACGAATTTCAGGATTATTTATAGATCAAATATCATTATTTATTTGATCAGTATTTATTACRGCTTTTTTATTATTATTATCATTACCTGTATTAGCAGGTGCAATTACAATATTATTAACAGACCGTAATTTAAATACTTCATTTTTTGATCCAGCAGGAGGGGGTGATCCAGTTTTATAYCAACATTTATTTTGRTTTTTTGGTCACCCTGAAGTT   TATATTTTAATTTTACCTGGATTTGGAATAATTTCTCATATAATTTTTCATGAATCTGGTAAAAAGGAAACATTTGGTACATTAGGAATAATTTATGCAATAATTTCTATT   GGAATTTTAGGATTTATTGTATGAGCTCATCATATATTTACAGTTGGAATAGATGTTGATACTCGAGCTTATTTTACATCTGCTACTTTAATTATTGCTGTTCCTACAGGAATTAAAGTTTTTAGATGAATAGCAACTATACATGGAATAAAATTTAATTTAAATCCTTCTATATTA---TGAGCTTCAGGTTTTGTATTTTTATTTACAGTTGGGGGATTAACTGGTGTAGTATTAGCAAATTCATCTATTGATATTATTTTACATGATACATATTAT
+Pamphilius              TCAGGGATATTAGGTACTTCAATAAGAATATTAATTCGAATAGAATTAGGAACCCCAGGATCTTTAATTGGAGATGATCAAATTTATAATGTTATTGTTACTGCTCATGCATTTTTAATGATTTTTTTTATAGTTATACCAATAATAATTGGAGGATTT   GGAAATTGATTAGTTCCATTAATATTAGGAGCTCCAGATATAGCTTTTCCTCGAATAAATAATATAAGATTTTGATTACTTCCTCCTTCATTAATTTTTTTAATTTCTAGAAGAATTATAAATAAGGGTGCAGGTACAGGTTGAACAGTTTATCCACCTTTATCTTCAAATTTATCTCATACTGGATCATCAGTTGATTTTGCAATTTTTTCTTTACATATAGCAGGAATTTCTTCAATTATAGGAGCAATTAATTTTATTTCAACAATTTTAAATATGCGAATTTCAGGTTTAATAATAGATCAAATATCATTATTTATTTGATCGGTATTTATTACAGCTTTTTTATTATTATTATCATTACCAGTTTTAGCCGGGGCAATTACTATACTATTAACAGATCGAAATTTAAATACTTCATTTTTTGATCCAGCTGGAGGAGGAGATCCTGTTTTATACCAACATTTATTTTGATTTTTTGGTCACCCAGAAGTT   TATATTTTAATTTTACCTGGATTTGGGATAATTTCACATATAATTTTTAATGAATCGGGAAAAAAGGAAACATTTGGAACATTAGGAATAATTTATGCTATAATTTCTATT   GGAATTTTAGGTTTTATTGTATGAGCTCATCATATATTTACTATTGGAATAGATGTTGATACTCGAGCATATTTTACTTCTGCTACATTAATTATTGCTGTTCCTACAGGAATTAAAGTATTTAGATGAATAGCTACTATGCACGGAATAAAATTTAATTTAAATCCTTCTATATTA---TGAGCTTCAGGTTTTGTTTTTTTATTTACTGTTGGTGGTTTAACTGGAGTAGTATTAGCTAATTCTTCAATTGATATTATTCTTCATGATACATATTAN
+Cephalcia               TCAGGGATATTAGGGCTTTCAATAAGAATATTAATTCGATTAGAATTAGGGACTCCTGGTTCATTAATTGGTGATGATCAGATTTATAATGTTATTGTAACAGCACATGCATTTTTAATAATTTTTTTTATAGTTATACCAATAATAATTGGAGGATTT   GGAAATTGATTAGTCCCTTTAATATTGGGAGCCCCTGATATAGCATTTCCTCGGATAAATAATATAAGATTTTGATTATTACCCCCTTCTTTAATTATATTATTAATTAGAAGAATTATAAATAAAGGAGCAGGAACTGGATGAACAGTTTATCCACCTCTTTCTTCTAATTTAACTCATACTGGATCATCAGTAGATTTTGCTATTTTTTCTTTACATATAGCTGGGATTTCATCAATTATAGGGGCYATTAATTTTATTTCTACAGTAATTAATATACGTACATCTGGTATAYTATTTGATCAAATATCTTTATTTATTTGATCAGTAGTAATTACTGCTTTATTATTACTTTTATCATTACCAGTYTTAGCAGGAGCTATTACTATATTATTAACAGACCGAAACTTAAATACATCTTTTTTTGATCCAGCAGGYGGGGGTGATCCTGTTTTATATCAACATTTATTTTGATTTTTTGGTCATCCTGAAGTT   TATATTTTAATTTTACCTGGTTTTGGATTAATTTCCCATATTATTTTTCATGAATCAAAAAAAAAAGAAACTTTTGGAACTTTAGGTATAATTTATGCAATAATTTCTATT   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Acantholyda             TCAGGAATATTAGGATTATCAATAAGAATATTAATTCGACTAGAATTAGGAACCCCAGGTTCATTAATTGGTAATGATCAAATTTATAATACAATTGTTACAGCACATGCATTCTTAATAATTTTCTTTATAGTAATACCAATAATGATTGGAGGTTTT   GGAAATTGATTAGTTCCACTAATATTAGGAGCCCCAGATATAGCTTTTCCTCGAATAAATAATATAAGATTTTGATTATTACCCCCATCATTAATTATATTATTAACCAGAAGAATTATAAATAAAGGGGCAGGAACAGGATGGACAGTTTATCCCCCACTTTCTTCTAATCTAACTCATATAGGATCATCAGTAGATTTTGCTATTTTCTCCTTACATATAGCAGGAATTTCATCAATTATAGGAGCTATTAATTTCATTTCTACAGTAATTAATATACGAATTTATGGAATATCATTTGATCAAATATCTTTATTTATTTGATCAGTAGTTATTACTGCTTTATTACTATTATTATCATTACCAGTTTTAGCTGGAGCTATTACTATATTATTAACTGATCGAAATTTAAATACTTCATTTTTTGATCCGGCTGGAGGAGGGGATCCTGTATTATATCAACATCTATTTTGATTTTTTGGGCATCCAGAAGTA   TATATTTTAATTTTACCAGGATTTGGTTTAATTTCACATATAATTTTCCATGAATCAAAAAAAAAAGAAACATTTGGAACATTAGGTATAATTTATGCCATAATTTCTATT   GGTATTCTAGGATTTGTAGTTTGAGCTCATCATATATTTACTATTGGAATAGACGTAGATACTCGAGCATATTTTACATCTGCTACTATAATTATTGCAGTACCTACTGGAATTAAAGTATTTAGATGATTAGCTACTATACATGGAATAAAATTTTCTTCTACCCCTTCATTTCTA---TGATCATTAGGATTTGTATTCCTTTTTACTGTGGGAGGATTAACAGGAGTAATTTTAGCTAATTCATCAATTGATATTATAATACATGATACATATTAT
+Megalodontesc           TCAGGACTTATTGGAACATCTATAAGAATATTAATTCGAATAGAACTTAGAGCCCCAGGATCATTAATTGGAAATGACCAAATCTATAATGTTATTGTTACAGCCCATGCTTTTGTAATAATTTTTTTTATAGTTATACCTTTAATAATTGGAGGATTT   GGAAATTGATTAATTCCTCTAATACTAGGAGCCCCAGATATAGCTTTTCCCCGATTAAATAATTTAAGATTTTGATTACTTCCTCCTTCTTTAATATTTCTAATTTCTAGAAGAATAATAAATAAAGGAGTAGGAACAGGATGAACTGTATATCCCCCATTATCTTCTAATATTTCTCATTCTGGACCTGCTATTGATTTTGCAATTTTTTCTTTACATATTGCAGGAATCTCTTCAATCTTAGGGGCTATAAATTTCATTACTACTATTATTAATATACGTAGATGAGGATTTAAATTAGATAAAATTTCTTTATTTATCTGATCAGTAGGTCTAACCGCCCTTCTCCTGCTCTTATCATTACCTGTATTAGCAGGAGCTATTACTATACTTCTTACTGATCGAAATTTAAATACTTCATTTTTTGACCCAGCAGGGGGTGGTGACCCAATTCTTTATCAACACTTATTTTGATTTTTTGGTCATCCTGAAGTT   TATATTTTAATTCTCCCAGGATTTGGTATAATTTCTCATATCATTTATCAAGAAAGATTTAAAAAAGAATCATTTGGTTCTTTAGGAATAATTTTTGCCATAATTTCTATT   GGATTATTAGGATTTATTGTATGAGCTCATCATATATTTACTGTAGGTATAGATATTGATACACGAGCTTACTTTACATCAGCAACAATAATTATTGCTATTCCTACAGGAATTAAAGTATTTAGATGAATTGCCACATTCCACGGAAACAAATTTTATTTTTCTCCAACTATCCTA---TGAAGATTAGGATTTATTTTTTTATTTACTATTGGTGGATTAACTGGAATTATTTTATCTAATTCTTCTATAGATATTATCTTACATGATTCATATTAT
+Megalodontessk          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cephus                  GCAGGAATACTAGGAACATCCCTAAGATTAATTATCCGAGCTGAATTAGGTACTCCAGGCCCTTTAATCAATAATGACCAAATTTATAATTCAATTGTAACTGCTCATGCTTTTATTATAATTTTTTTTATAATTATACCAGTTATAATTGGTGGGTTT   GGAAACTGATTAATTCCTCTAATATTAGGAGCTCCTGATATAGCATTCCCCCGAATAAATAATATAAGATTTTGATTACTACCACCCTCATTAACATTATTATTAATTAGAAGATTAACTAATCAAGGAGTAGGAACAGGATGAACAGTATACCCCCCCTTATCAAACAATCTTTACCATAGAGGGCCAGCAGTTGACCTAGCTATTTTTTCCTTACATTTAGCAGGAATATCATCAATCATAGGTGCTATTAACTTCATTTCTACAATTATTAATATGCGACCGGTTGGATTAAAATTAGACCAAATATCTTTATTTAGATGAGCTGTAGGAATTACAGCAATCTTACTACTATTATCACTACCTGTATTAGCTGGTGCAATTACTATACTATTAACAGATCGAAACTTAAACACAACATTCTTTGACCCTGCTGGTGGAGGAGATCCTATTTTATATCAACATTTATTTTGATTTTTTGGGCACCCAGAAGTT   TATATTTTAATTTTACCTGGATTTGGTATAATTTCTCATATAATTTTTTCAGAAACTGGTAAAAAAGAAACATTTGGAATATTAGGAATAATTTATGCAATAACAGCAATT   GGGATTTTAGGTTTTGTTGTATGAGCTCACCATATATTCACAGTTGGAATAGACGTAGATACACGAGCTTACTTTACATCTGCAACATTAATTATTGCAGTACCTACTGGAATTAAAGTATTTAGATGATTAGCAACTTTACATGGATTTAAATTTAATAACTCTCCAACAATATTA---TGATCAATTGGATTTATTTTCTTATTTACCCTTGGTGGATTAACAGGAATTACTTTAGCCAATTCATCTATTGATATTATCTTACATGACACATATTAT
+Calameuta               GCAGGAATACTTGGAACTTCCTTAAGATTAATTATTCGAGCAGAATTGGGAACACCAGGACCATTAATTAATAACGATCAAATTTATAATTCAATTGTAACAGCTCATGCATTTATTATAATTTTCTTCATAATTATGCCTATTATAATTGGAGGATTT   GGAAATTGACTAATTCCATTAATATTAGGAGCCCCAGATATAGCTTTTCCCCGAATAAATAATATAAGATTTTGATTATTACCCCCCTCACTTACTCTCCTTTTAATCAGAAGATTAATTAATCAAGGTGCTGGAACAGGGTGAACTGTATACCCCCCCTTATCTAATAATCTATACCATAGAGGACCTTCAGTAGATTTAGCTATTTTTTCTCTTCATTTAGCTGGAATATCTTCAATTATAGGAGCTATTAATTTTATTTCAACAATTATTAATATACGACCTATAGGCCTATCAATTGACCAAATATCTTTATTTACATGAGCAGTTGGAATTACAGCAATTCTCCTACTTTTATCTCTTCCTGTTTTAGCAGGAGCTATCACCATACTTCTAACAGATCGAAATTTAAATACTACATTTTTTGATCCTGCAGGAGGGGGAGACCCTATTTTATATCAACACTTATTTTGATTCTTTGGCCATCCCGAAGTA   TATATTCTAATTTTACCAGGATTTGGAATAATTTCTCATATAATTTTTTCTGAAACAGGAAAAAAAGAAACATTTGGAATATTAGGTATAATTTATGCAATATCTGCTATT   GGAATTTTAGGATTTGTAGTATGAGCCCATCATATATTTACTGTAGGAATAGATGTAGATACCCGGGCATATTTCACATCCGCAACATTAATTATTGCTGTACCTACGGGAATTAAAGTATTTAGATGATTAGCAACATTACATGGATTTAAATTCAATAACTCTCCAACAATATGA---TGATCTATTGGATTTATTTTTTTATTTACATTAGGTGGATTAACAGGAATCACACTAGCCAATTCATCAATTGATATTATTCTTCACGATACATACTAT
+Hartigia                GCAGGAATACTAGGAACTTCTCTTAGTATAATTATTCGAACAGAACTAGGAAACCCTGGACCACTTATTAATAATGATCAAATTTATAATTCTATCGTAACTGCTCACGCTTTTATTATAATTTTTTTTATAATTATACCTATTATAATTGGGGGGTTT   GGAAATTGATTAGTGCCTTTAATACTAGGAGCTCCTGATATAGCATTCCCTCGATTAAATAATATAAGATTTTGACTCCTTCCCCCATCATTAACTTTATTATTATCAAGTAATTTAATTAATAATGGAGTTGGAACAGGATGAACTGTTTACCCTCCTTTATCAAGAAATTTATATCATTCAGGCCCTTCTGTTGATTTAGCTATTTTTGCACTTCACTTAGCAGGAATATCTTCGATTCTTGGTGCTATTAATTTTATTTCAACTATTATTAATATGCGCCCTGTAGGTTTATACCTAGATCAAATATCATTATTTACATGAGCTGTAGGAATTACAGCAATTTTACTCTTATTATCACTACCTGTTTTAGCCGGAGCCATTACTATACTTTTAACAGATCGAAACTTAAATACATCCTTTTTTGACCCTAGAGGGGGAGGAGATCCTATTTTATTCCAACATTTATTCTGATTTTTTGGTCACCCTGAAGTA   TACATTTTAATTTTACCAGGATTCGGAATAATCTCTCATATAATTTTTTCAGAAACAGGAAAAAAAGAGACTTTTGGAATACTTGGTATAATTTATGCAATATCTGCTATT   GGTGTCCTAGGTTTTGTTGTATGGGCTCACCATATATTTACAGTAGGAATAGACGTAGATACACGAGCTTATTTTACATCAGCAACCTTAATTATTGCTGTTCCAACGGGTATTAAAGTATTCAGATGATTAGCCACTCTCCATGGATTTAAATTTAATAATTCCCCTACAATACATTGATCAATTGGATTTATTTTTCTATTTACATTAGGAGGTCTAACAGGAGTAACCTTAGCAAATTCATCAATTGATATTATTCTTCATGATACATATTTAGTA
+Syntexis                TGTGGATTTATTGGATCATCACTAAGAATTCTAATTCGAACAGAACTAGGGACCCCAAAAAGACTCTTTATAAATGATCAGCTTTATAACTCTTTTGTTACAGCTCATGCTTTTATCATAATCTTCTTTATAGTAATACCTATTATAATTGGTGGTTTT   GGAAATTGATTAATTCCCTTAATGATTGGAGCCCCTGATATAGCATTTCCCCGAATAAATAATTTAAGATTCTGACTCCTTATTCCCTCAATCTCACTCTTATCATTCAGTCTTCTAGTAGGGACAGGAACAGGGACAGGATGAACAGTCTACCCCCCTCTATCCAGAAATTTATTTCACTCTTCTATATCAGTAGATATATCAATTTTCTCTCTTCATTTAGCAGGAATATCCTCAATTATAGGGGCAATTAATTTCATCTCAACTATCTACAATATACGACCCTTTTCTCTTCAATTTGATCAAATTCCTTTATTTTCATGAGCTGTTTTACTTACTGCTATTCTTCTTCTTCTCTCTCTCCCCGTTCTTGCTGGGGCAATTACCATACTACTAACTGATCGAAATTTAAATACTTCATTTTTTGACCCATCAGGAGGAGGGGATCCAATCCTTTATCAACATCTTTTTTGATTCTTTGGGCACCCTGAAGTC   TATATTCTTATTCTACCTGGATTTGGAATAATCTCTCATATAATTTCCCAAGAAAGAGGAAAAAAAGAAACATTTGGTTCAATGGGAATAATTTACGCAATAATTTCAATT   GGTTTCCTAGGTTTTATTGTTTGAGCACACCACATATACACTATTGGAATAGATGTCGATACTCGAGCTTATTTCACTTCTGCAACTATAATTATTGCAATTCCTACAGGAATTAAAATTTTTAGATGACTTGCAACATTCCACGGATCTAAATTCTATTTTTCTCCTAATCTAATT---TGAATTTTAGGATTTATTTTTCTTTTTACTTTAGGAGGATTAACTGGCGTAATTCTAGCTAATTCATCAATTGATATAATTTTACATGATTCATATTAT
+Sirex                   GCAGGAATWATTGGATCCTCTATAAGAATTATTATTCGAACAGAATTAATATCTTCTAATCCTTTTATTACTAATGATCATTTATTTAATTCAATTATCACAAGTCATGGATTAATTATAATTTTCTTCATAATTATACCAATTATAATAGGAGGATTT   GGAAATTGATTACTCCCTTTAATTTTAAATTCACCTGATATAGCTTTTCCTCGAATAAATAATTTTAGATTCTGACTCCTTCCTCCTGCTTTATTACTTTTATTATTAAGAATACTAACTAGTTTAGGTCCAGGAACTGGTTGAACTCTTTATCCTCCTCTTTCTTCTTTTCCTTCTCACTCAAATATATCTGTTGATTTAAGAATTTTATCTATACATTTAGCAGGAATTTCATCAATTTTAGGATCAATTAATTTTATTTCAACTTTTATTAATATACATTGCTCTTCATTAAATATAGAACATTTACCTTTATTTACATGATCTATTAATATTACCGCAATCTTACTAGTAATTTCATTACCTGTTCTTGCTGGAGCAATCACTATACTTTTAACAGATCGAAATTTTAATACAACTTTTTTTGATCCTGCTGGAGGAGGAGATCCTATTTTATTTCAACATTTATTTTGATTTTTTGGTCANNNNNNNNNN   NNNNNNNNNNNNNNNCCAGGATTTGGAATAATTTCTCATTTAATTATTAATGAAAGAAGAAAAAAAGAAACTTTTGGTACATTAAGTATAATTTACGCAATTATTTCAATT   GGTCTACTAGGATTTATTGTATGAGCTCATCATATATTTACTGTTGGTTTAGATATTGATACTCGTGCTTACTTTACATCAGCTACAATAATTATTGCTATTCCAACAGGAATTAAAATTTTTAGATGAATTGCAACTCTTTATGGTTCCCCCCTAAAAATTACTCCAATTTCTTTA---TGAGTAATAGGATTCATTTTCCTTTTTACCATTGGAGGACTCTCAGGAATTATACTTTCAAACTCCTCTCTTGATGTAATACTTCATGATTCATACTAT
+Xeris                   GCCGGAATTATTGGAGCTTCAATAAGAATAATTATTCGAATAGAATTAATATCCCCCCACCCATTTATTTTTAATGATCATCTATTTAATTCAGTCATTACCTCTCATGGACTTTTAATAATTTTCTTTATAATCATACCTATCATAATAGGTGGATTT   GGAAACTGACTATTTCCAATAATACTAAATTCACCTGACATAGCTTTTCCACGAATAAATAATTTTAGTTTTTGACTCCTCCCCCCTTCACTCCTTTTCCTTCTACTTAGAATAACTTCAGGAATAGGACCTGGTACAGGATGAACTTTATACCCCCCCCTATCTTCTTTTCCATCCCACTCTAATCTTTCAGTAGACTTCACTATTCTTTCTATACACCTTGCAGGTATCTCCTCAATTCTTGGATCAATTAATTTCATCTCAACTTTTATTAATATACATCCCCATTCATTAAATTCTGAACACATACCTCTCTTACCATGATCAATTAATGTCACAGCCATCCTACTTATTATTTCTCTACCTGTTCTTGCAGGTGCTATTACCATATTATTAACTGATCGAAATTTTAATACTACATTCTTTGACCCAGCTGGAGGAGGAGATCCAATTTTATTTCAACATTTATTTTGATTTTTCGGACACCCTGAAGTT   TATATTTTAATTCTACCAGGATTTGGAATAATCTCCCATTTAATTATCAATGAAAGAAGAAAAAAAGAAACATTTGGTGCATTAAGAATAATTTATGCAATCTTATCTATT   GGTCTTTTAGGATTTATTGTATGAGCCCATCACATATTTACTGTAGGTTTAGATGTAGATACTCGTGCATACTTTACTTCAGCAACAATAATTATTGCTATCCCCACAGGAATTAAAATCTTTAGATGAATTGCAACTATTTATTGTTCCCCCACAAAAATAACCCCAATTATCCTA---TGAACTTTAGGTTTTATTTTCCTATTTACTATAGGAGGTCTTTCAGGAATTATATTATCAAATTCATCTTTAGATGTAATTCTTCATGACTCCTATTAT
+Urocerus                GCAGGAATTATTGGTTCATCAATAAGAATAATTATTCGTATTGAACTAATATCTCCTCAACCCTTTTTTATCAATGATCACCTTTTTAATTCAATTATTACTGCTCATGGACTATTAATAATTTTTTTCATAATTATACCTATTATAATAGGAGGATTT   GGAAATTGATTAATTCCCCTATCTATAAATTCTCCTGATATAGCATTTCCTCGAATAAATAATTTAAGATTTTGACTCCTTCCACCTGCTTTATTTATTCTATTACTTAGAATACTTACAGGATTTGGACCAGGGACAGGATGAACTTTTTATCCCCCTCTATCCTCCTTTCCCTCTCATTCCAGTCTTGCAATTGATTTAAGTATTCTTTCTATACACTTAGCTGGACTATCTTCAATTATAGGATCAATTAATTTTATTACAACTTTTATTAATATACATTGTTCTTCATTAAACTTTGAACATCTATCTTTATTTTCATGATCAATTAATATTACTGCAATTCTTTTAATTATCTCCCTTCCTGTTCTAGCAGGAACAATCACTATACTTTTTACTGATCGAAATTTTAATTCAACATTTTTTGATCCTTCTGGAGGGGGAGACCCTATTTTATTTCAACATTTATTTTGATTCTTTGGTCATCCTGAAGTT   TATATTTTAATTTTACCCGGATTTGGAATAATCTCTCATTTAATTATTAATGAAAGAGGAAAAAAAGAAACTTTTGGTGCTTTAAGAATAATTTATGCTATTATTTCAATT   GGTCTCCTTGGATTTATTGTCTGAGCCCATCATATATTTACTGTAGGATTAGATATTGATACACGAGCCTACTTTACAGCTGCGACAATAATTATTGCAATTCCTACAGGAATTAAAATTTTTAGATGAATTGCAACTTTATACTCTTCACCATTAAAAATTTCCCCTATTTCTTTA---TGATCTGTTGGATTTATTTTTCTCTTTACAATTGGTGGTCTCTCAGGAATTATACTTTCTAACTCATCTCTAGATATTATTCTACATGATTCTTATTAT
+Tremex                  GCAGGAATTATTGGATCTTCCTTAAGTATAATTATTCGATTAGAATTAATAAATTCAATACCTTTTCTTTATAATGAACAATTATTTAACTCTATCATTACTGCTCATGGGATTTTAATAATTTTTTTTATAATTATACCCATAATAATAGGAGGATTT   GGAAATTGACTTTTACCTATGTTCTTAAATTGTCCTGATATAGCTTTTCCTCGAATAAATAATTTTAGATTCTGACTACTCCCTCCTTCTATTTCTCTTTTACTCTTAGCTATATTATCTAGGTCAGGTCCAGGTACTGGATGAACTCTTTACCCTCCTTTGTCTTCAATTCCAGCACATAGAAATTTTTGTGTAGATTTAAGAATTTTATCTATACATTTAGCAGGAATTTCCTCTATTTTAAGATCAATTAATTTTATTACAACATTCACAAATATATATATTTACTCATTAAATATAGAAAATATTCCCTTGTTTTCTTGATCGGTAATAATTACTGCAATCCTTCTAATTATCTCTTTACCAGTTCTTGCTGGGGCCATTACAATACTTTTAACAGATCGAAACTTTAATACTTCATTTTTTGACCCTGCTGGAGGAGGAGATCCAATCCTCTTTCAACATTTATTTTGATTTTTCGGACATCCTGAAGTA   TATATTTTAATTCTCCCAGGATTTGGAATAATTTCTCATTTAATTATCCAAGAAAGAGGAAAAAAAGAAACTTTTGGTACTTTAAGAATAATTTATGCTATTACCACAATT   GGTTTACTTGGTTTTATTGTATGAGCTCACCATATATTTACAGTAGGATTAGATATTGATACTCGAGCTTATTTTACTTCAGCAACAATAATTATTGCCATTCCTACTGGAATTAAAATTTTTAGATGACTTGCTACATTATATAGGGTCCCTTTAAAAATTACTCCGATTTCCTTA---TGAATTATTGGTTTTATTTTCTTGTTTACTATTGGAGGACTTTCTGGAATCATACTTTCAAATTCAGCTCTTGATACAATACTTCATGATTCCTATTAT
+Xiphydria               TCAGGAATAATAGGAACATCCTTAAGAATTTTAATTCGAAATGAATTAGGATCTCCAAGATCTATAATTAATAATGATCAAATTTATAACTCAATTGTTACTGCACATGCATTTATTATAATTTTTTTTATAGCTATACCTATTATAATAGGAGGATTT   GGAAACTGATTAGTTCCACTAATATTAGGAGCTCCTGATATAGCTTTTCCACGAATAAATAATATAAGATTCTGATTATTACCACCTTCTTTAATTTTATTAATTTCAAGAAATTTATCAAATTCAGGTGTGGGGTGTGGTTGAACAATGTATCCTCCTTTATCTTCAAATTTAAGACATCTAGGACCAGCAATAGATTTAACAATTTTTTCACTTCATATTGCAGGAATTTCTTCAATTATAGGAGCTATTAATTTTATCTCTACTATTATTAATATACGACCCATAAAAATTTCATTTGATCGTATTCCTTTATTTTGTTGATCAATTATAATTACTGCAATTCTTTTACTTCTTTCTCTTCCTGTACTAGCAGGATCAATTACTATATTATTAACTGATCGAAATTTAAATACATCATTTTTTGATCCTGCAGGAGGAGGGGATCCAATTCTTTTTCAACATTTATTTTGATTTTTTGGTCATCCAGAAGTT   TATATTTTAATTTTACCCGGATTTGGTATAATTTCTCATATAATTTCTCAAGAAAGAGGTAAAAAAGAAACTTTTAGATCTTTAGGAATAATTTATGCTATATTAACTATT   GGATTTTTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTAGGAATAGATGTTGATACCCGAGCTTATTTTACTTCAGCAACATTAATTATTGCTATTCCCACTGGGATCAAAGTTTTTAGATGATTAGCTACATTAAATGGAACAAAAATTAAATTTTCTCCATTAATAATG---TGAAGCTTAGGTTTTATTTTTCTTTTTACTATAGGTGGTTTAACAGGTATTATTCTATCTAATTCTTCAATTGATATTATCTTACATGATACATATTAT
+Orussus                 GCTGGTATAGTTGGATCTTCTTTAAGTATAATTATTCGTATAGAATTAGGTACCCCTGGTCCTCTTATTGGTAATGATCAAATTTATAATTCTATTGTAACCTCTCATGCATTTGTTATAATTTTTTTTATAGTTATACCAATTCTTATTGGAGGATTT   GGTAATTGATTAATTCCTCTTATACTAGGAGCTCCAGATATAGCATTTCCCCGAATAAATAATATAAGTTTCTGACTTCTTCCTCCTGCTCTTATTATCTTATCATCAAGTATATTCACTAGTAAAGGTGTTGGAACAGGATGAACTGTTTACCCTCCACTTTCTTCA---TCAGGCCATGTAGGTCTAGCAGTTGATTTATCTATTTTTTCCCTCCACATTGCTGGTATATCTTCTATTATAGGAGCCATTAACTTTATTTCTACAATTATTAATATACGTAATAAAAGTCTTACTATAGATAAAATTTCTCTATTATCGTGATCTACTAACATTACTGCTATTCTTCTACTTTTATCTCTTCCAGTGCTAGCAGGAGCTATCACTATACTTTTAACTGACCGTAATTTTAATACATCTTTCTTTGATCCTGCTGGTGGAGGAGACCCAATTTTATACCAACATCTATTTTGATTTTTTGGTCATCCAGAAGTT   TATATTCTTATTCTACCTGGATTTGGAATAATCTCTCATATAATCACTAAAGAAGGTGGTAAAAAAGAAACCTTTGGAACTTTAGGAATAATTTATGCTATACTAGCAATT   GGATTCTTAGGGTTTGTAGTATGGGCTCATCATATATTTACTGTAGGAATAGATGTAGATACTCGAGCTTACTTCACTTCAGCTACTATAATTATTGCTGTACCAACAGGAATTAAAGTATTTAGCTGACTGGCTACTATAAATGGTATAAAATTAGAATTAAATCTTAATAATATA---TGATCCTTAGGATTTGTATTTCTTTTTACTGTTGGAGGTCTTACAGGTGTTATATTATCAAATTCATCTATTGATATTATTTTACATGACACTTATTAT
+StephanidaeA            TCAGGTATCCTTGGATCATCAATAAGTATAATTATTCGTATAGAACTCAGTATACCAGGAATTATAATTGGAAATGATCAAATTTATAATTCAATTGTAACAGCTCATGCTTTTATTATAATTTTTTTTATAATTATACCAATTATAATTGGAGGATTT   GGAAATTGACTAATTCCTATAATAATTGGAGTTCCTGATATAGCATTTCCTCGAATAAATAATATAAGATTCTGATTACTTCCTCCTTCATTAATTTTATTAATTTCAAGAATAATTACAGAAATTGGAATTGGAACAGGATGAACTATTTATCCCCCATTATCATCTAATTTAGGTCACAATAGTAAATCAGTAGATATAACTATTTTTTCTCTTCACATTGCAGGAATTTCATCAATTATAGGAGCAATTAACTTTATTTCAACAATTTTAAATATAATCCCAAATGGAATAATAAAAAAAAATATTCCACTAATACCCTGAGCCACAATAATTACAGCATTTCTTCTTCTTCTATCTTTACCAGTTCTTGCTGGAGCAATTACTATACTTTTAACAGATCGAAATATTAATACATCATTTTTTGATCCAGCAGGAGGTGGAGACCCAATCTTATTTCAACATTTATTTTGATTTTTTGGACATCCTGAAGTT   TATATTTTAATTCTTCCAGGATTTGGAATAATCTCCCATATTATTACCAATGAAAGAGGAAAAAAAGAAACATTTGGAAGAACTGGAATAATTTATGCTATAATAACCATT   GGAATACTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTTGGTCTTGATGTAGATACACGAGCCTATTTTACTTCAGCAACTATAATTATTGCAATTCCAACAGGAATTAAAATCTTTAGATGACTAGCTTCTTTTTATGGAAGAAAAATATATTTATCACCAACAATTTTA---TGATCAATAGGATTTATTTTTCTATTTACCATTGGTGGATTAACTGGAATTATATTATCAAATTCATCCATTGATCTAATTATACATGATACATATTAT
+StephanidaeB            TCAGGACTATTTGGATCTTCAATAAGATTAATTATTCGAATAGAATTAAGTATACCAGGACAAATAATTGGTAATGACCAAATTTATAATTCAATTGTTACAGCCCATGCATTTGTAATAATTTTTTTTATAATTATACCATTAATAATTGGGGGATTT   GGTAATTGATTAATTCCATTAATATTAGGGGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGATTTTGATTACTACCCCCATCAATTATACTATTAATTTCAAGAATAATAACTGATTCAGGTGCTGGAACAGGATGAACTATTTACCCCCCCCTATCCTCTAATATAGGACACAATAGAAAAACAATTGACTTAACAATTTTTTCATTACACCTTGCTGGAATCTCTTCAATCATAGGAGCAATTAATTTTATTTCCACAATTTTAAATATAACCCCCATAGGAATAAAATTAAAAAATATAACATTATTTACATGAGCAACCTTTATTACTGCTATTTTACTACTATTATCACTACCAGTTTTAGCTGGGGCTATTACTATACTATTAACCGATCGAAATATCAATACATCCTTTTTTGACCCCTCAGGAGGAGGAGACCCAATTTTATATCAACATTTATTTTGATTTTTTGGACATCCAGAAGTA   TATATCTTAATTCTTCCTGGGTTTGGAATAATTTCACATATTATTACTAATGAAAGAGGAAAAAAAGMAACATTTGGARCTATTGGAATAATTTATGCAATAACTGCTATT   GGAATTTTAGGATTTATTGTTTGAGCTCATCATATGTTTACAGTTGGTTTAGATGTTGATACACGAGCATATTTTACTTCAGCTACAATAATTATTGCTATTCCTACTGGAATTAAAATTTTTAGTTGACTAGCTTCATTTTATGGTAGAAAATTAAATTTTTCCCCACCTATTTTA---TGATCAATAGGATTTATTTTTCTATTTACATTAGGAGGTTTAACAGGAATTATATTGTCTAATTCATCTATTGATCTTGTTTTACATGACACATATTAC
+Megalyra                TCTGGGCTAGTTGGGTCTTCAATAAGTATATTAATTCGAATTGAATTAATGACACCTGGATCTTTTATAGGGAATGATCAGTTATATAATTCTTTTGTTACTGGTCATGCATTTATTATAATTTTTTTTATAGTAATACCTTTTATAATAGGGGGGTTT   GGAAATTTTTTAGTTCCTTTAATATTAGGTACTCCAGATATATCTTACCCTCGAATAAATAATATAAGATTTTGATTATTAATTCCTTCAATAGTATTTTTAATTATAAGAATATTTATTGGAGAGGGGGTAGGGACAGGTTGAACGGTTTATCCCCCTTTATCATCAATTAGTTATCATTCAAGTTTAAGAGTTGATTTAGCAATTTTTTCATTACATATTGCAGGGATATCTTCTATTTTAGGAGCTATTAATTTTATAAGAACAATTATTAATATAAA------AAGATTTAAGTTTAGTATATTATCTTTATTTGTATGATCAATTTTTATTACTGCTATTTTATTATTATTGTCATTACCTGTCTTAGCTGGGGCAATTACAATATTATTAACTGATCGAAATTTAAATTCTACATTTTTTGACCCTTCAGGGGGAGGGGATCCAATTTTATATCAGCATTTATTTTGATTTTTTGGTCATCCAGAAGTT   TATATTTTAATTTTACCTGGATTTGGAATTTTTTCTTATATTATTAGGTCAGAAAGAGGGAAAAAGGAATCATTTGGAACTTTGGGTATAATTTATGCAATATGTTCAATT   GGGTTATTAGGATTTTTAGTATGAGCTCATCATATATTTACTGTTGGGTTAGATGTTGATACACGGGCGTATTTTACTGCAGCAACGATATTAATTGCAATTCCTACAGGGATTAAAGTTTTTACTTGATTAATAACTTTAATAGGGTATCGAGAATGTAATTATTCTCCTTCATTATATTGAGCTTTAGGATTTATTTTTTTATTTACATTAGGAGGGTTAACTGGGGTTTTATTGTCTAATTCTTCAATTGATTTGGTTCTTCATGATACATAT???
+Trigonalidae            TCTGGAATAATTGGAGTTGGATTAAGATTAATTATTCGGTTAGAATTAGGAATTGTTGGTAAGTTATTAGGGAATGATCAAATTTATAATAGGGTTGTTACTGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTTTTATAATTGGAGGATTT   GGTAATTGATTAATTCCTTTAATATTAGGAGCTCCTGACATATCTTTTCCTCGAATGAATAATATGAGATTTTGATTATTACCTCCATCAATTTTTTTACTTTTAATTAGAGGGTTTATTAATATAGGTGTAGGAACAGGATGAACTGTTTATCCACCTTTATCTAATATATTATATCATAGGGGGGTATCAGTTGATTTATGTATTTTTTCTTTACATATAGCTGGAATTTCTTCAATTATAGGAGCTATTAATTTTATTACAACAATTTTAAGAATAAAAAATATTAAAATAAATTTTTCACAAATTAACTTATTATCATGATCTGTTTTAATTACAGCTGTTTTATTATTGTTATCATTACCGGTTTTAGCAGGAGCTATCACTATATTATTATTTGATCGTAATTTTAATACAACATTTTTTGATCCTTCTGGAGGGGGAGATCCAATTTTATATCAACATTTATTT------------------------   -------------------------------TTTCACATATAATTATTAATGAKAGAGGAAAAAGAGAAGTATTTGGTACATTAGGAATAATTTATGCTATAATTTCTATT   GGAATTTTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTTGGATTAGATGTTGATACACGGGCATATTTTACTTCTGCAACAATAATTATTGCTATTCCTACAGGTGTAAAAGTTTTTAGTTGACTTTCAACATTATATGGAGTAAAATTACGATATTCAATTGTTATATTATGATCAATTGGATTTATTTTTTTATTTACATTGGGAGGATTAACAGGAATTTTACTTTCAAATTCATCTATTGATTTAATTATACATGATACATATTA????
+Chalcidoidea            ---------------------------------------------------------------------------------------------------------------------------------------------------------------   -------------------------------------------------------------------GATTTTGATTATTACCTCCTAGATTATTATTGTTATTATTAAGAATATTTTTAGGAGCAGGAACTGGAACAGGATGAACAGTTTATCCTCCTTTATCTACA---GACGGTCATTCAGGTCCATCTGTAGATTTATCAATTTTTTCTTTGCATATAGCTGGAATAAGATCTATTATAGGATCAATTAATTTTATTTCTACAATTTGTAATATAAA------GATTTATAAAATAGAAATAATTTCTTTATTTTCTTGATCAATATTATTAACAGCAATTTTATTATTATTATCTTTACCAGTATTAGCAGGAGCCATTACTATATTATTATTTGATCGAAATTTAAATACATCTTTTTTTGATCCAATAGGAGGGGGTGATCCAATTTTGTATCAACATTTATTTTGATTTTTTGGTCACCCAGAAGTT   TATATTTTAATTTTACCAGGATTTGGTTTAATTTCTCATATAATTTGTATAAAAAATTTTAAAAAAGAAACTTTTGGAATTATAGGTATAATTTATGCAATAATTTCAATT   GGAATTTTAGGATTTATTGTTTGAGCTCATCATATATTTACTGTCGGAATAGATGTAGATACTCGGGCATATTTCACTTCTGCTACTATAATTATTGCTATCCCTACTGGAATTAAAGTTTTTAGATGATTAGCAACAATATTAGGAAATAAAATAGACTTATCTATTACTAATATA---TGATTATTAGGATTTATTTTTTTATTTACAATTGGAGGTTTAACTGGAATTGTTTTATCAAATTCATCAATTGATATTGTTTTACATGATACTTATTAT
+Evanioidea              -CAGGAACCTTAGGCTCCTCTCTTAGTATAATTATTCGCCTTGAACTTGCAACCCCCCATCGATTTATCGGAAACGAACAAGTCTATAATTCTATTGTTACTATACATGCCTTTGTTATAATTTTTTTTATAGTTATACCCTTAATAATTGGAGGATTC   GGAAACTGAATAATTCCACTTATAATTGGAGCCCCTGATCTCGCTTTCCCCCGACTAAATAATATAAGTTTCTGACTCCTACCTCCCTCACTTCTTCTTCTAGTAGGAGCAGGATACCTTAACTCAGGAAGAGGAACTGGATGAACTATCTATCCACCCCTTTCTGCTGCTTCATTCCACAGAGGTTATTCTGTTGATCTCTCTCTTTTTTCACTACATTTGTCTGGAATAAGATCAATTTTAGGTTCTATTAATTTTCTTGTAAGTATCTTTAACATAAAACTTAAACCTCTTAAATGAAACCATCTTACCCTTTTCACTTGATCCATTATTTTAACAACAATTCTTCTTCTTCTTTCTATCCCCGTTCTAGCAGGAGCTATTACAATACTTATTATAGACCGAAACACAAATACTTCATTCTTCGATCCATTCGGGGGTGGAGATCCTGTTCTATTCCAACACTTATTCTGATTTTTTGGTCACCC-------   ---------------------------------------------------------------------------------------------------------------   ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Ichneumonidae           TCAGGAATAATCGGAACTTCATTAAGATTAATTATTCGTTTAGAACTTGGAAATCCAGGGTTTTTAATTAATAATGATCAAATTTACAATACAATAGTTACAGCACACGCTTTTATTATAATTTTTTTTTTTGTAATACCTATTATAATTGGAGGATTT   GGAAACTGACTCATTCCTTTAATATTAGGAAGTCCAGATATAGCCTTTCCACGTATAAATAATTTAAGATTTTGACTTTTACCACCATCACTTATATTATTAATTGCAAGTAGAATTACTAATCAAGGAACAGGAACAGGATGAACGGTTTATCCTCCATTATCATTAAATATAAATCATAATGGATCATCAGTTGATTTATCAATTTTTTCTCTTCACATAGCTGGGATATCCTCAATTTTAGGAGCAATTAATTTTATTTCAACAATTCTATTTATAATCCCTTTAAAAATAAAACTAGAACAAATACCTTTATTCTCATGATCAATTTTAATTACAACAATTTTATTACTTTTAGCAGTTCCAGTATTAGCTGGAGCAATCACTATACTTCTATCTGACCGTAATTTAAATACATCATTCTTTGATCCATCCGGCGGAGGTGACCCTATTCTTTATCAACATTTATTCTGATTTTTTGGCCACCCTGAAGTT   TATATTCTCATTTTACCAGGATTTGGAATAATTTCACATATAATCTTTAATAAAAGAAAAAAAAAAGAAACATTTGGATGTCTAAGAATAATTTATGCCATATTAACCATT   GGATTTTTAGGATTTATTGTATGAGCTCATCATATATTTACTATTGGTATAGATGTTGATACACGAGCTTACTTTACATCAGCTACCATAATCATTGCAATTCCCACTGGAATTAAAGTATTTAGTTGATTAGCAACTATTCATGGAACAAAAATAAATTCTAACCCTATTAATTTA---TGATCAATTGGATTTATTTTCTTATTTACAATTGGAGGATTAACTGGTGTTATTCTTGCAAATTCATCAATTGACATTGTTCTACATGATACATATTAT
+Cynipoidea              TCAGGATTAATTGGAGCTAGTATAAGATTAATTATCCGWATAGAATTAGGGATACCTGGGCAATTAATTAATAATGATCAAATTTATAATTCTATTGTAACTATTCATGCTTTTATTATAATTTTTTTTATAGTKATACCTATTATAGTAGGAGGATTT   GGRAATTATTTAATTCCTTTAATATTAGTTGTTCCAGATATGGCTTTCCCTCGATTAAATAATATAAGATTTTGATTATTARTCCCTGCTCAGGTATTTTTAATMGCTGGGTTAWTAATTGATCAAGGAGCMGGTACTGGATGAACTGTTTATCCTCCTTTATCTTCWTTATTRGGACATTCTAGAATTTCAGTTGATTTAACTATTTTTTCTTTACATTTAAGAGGAATCTCTTCAATTTTAGGATCTATTAATTTTATTAGAACAMTTTATAAKATACG---TYW---AATAAGAATAGATMAAATYACTCTATWTGATCGATCAATGTTATWAACARCTRTWCTTYTATTATTATMTTTACCTGTATTAGCAGGAGGAATCACTATRTTAYTATWKGAKSGRRAKTTAAATACTTCTTTTTTTGATCCAATAGGAGGAGGGGATCCAATCTTATACCAACATTTATTTTGATTTTTTGGACATCCTGAAGTT   TATATTTTAATTTTACCTGGATTTGGAATAATTTCACATATTATTTACACTGAATGTGGAAAAAAAAGAACTTTTGGAGCTCTAGGAATAATATATGCTATAATTTCAATT   GGAATATTAGGATTTATTGTATGAGGCCATCATATATTTACAGTAGGAATAGATGTAGATACTCGAGCTTATTATACTTCAGTAACTATAGTTATTGCAATTCCTACAGGAATCAAAATTTTTAGTTGATTAGCTAGAATATATGGATCTAAAATTAATTACACTCCTTCAATAATT---TGATCTATTGGATTTATTTTTTTATTTTCTATTGGAGGAATAACAGGAGTAACTTTATCTAATTCTTCAATT???????????????????????????
+ApoideaA                AGAGGAATAATTGGATCAGCATTAAGAATATTAATTCGTATAGAATTAGGAACACCAAGAAAATTAATTGGAAACGATCAAATTTATAATAGAATTGTTACAGCTCACGCTTTTGTAATAATTTTTTTTATAGTAATACCATTTATAATCGGAGGATTT   GGAAATTGATTAGTACCTATGATATTAGGAGCCCCAGATATAGCCTATCCACGAATAAATAATATAAGATTTTGATTATTACCACCATCATTATTTTTATTAATTACAAGAAATACAATTAACTCAGGAACAGGAACAGGATGAACAGTCTATCCACCTCTATCATCAAATATATTTCATAGAGGAGCATGTGTAGATTATAGAATTTTTTCATTACATATAGCAGGGATATCTTCAATTATAGGAGCTATTAATTTCATTACAACAATTATTAATATAAAAAATATATATATACCTATAAACTTAATTAATCTTTTTAGATGATCTATTCTCATTACAGCATTTTTATTAGTTATTTCTCTACCAGTTCTAGCAGGAGCCATCACTATATTATTAACAGATCGTAATTTAAATACTTCATTTTTCGACCCAGCTGGAGGAGGTGATCCAATCTTATATCAACACTTATTTTGATTTTTTGGTCATCCAGAAGTT   TACATTCTAATTTTACCAGGATTTGGATTAATTTCTCAAATTATTATTAACGAAAGAGGAAAAAAAGAATCATTTGGAACTATTGGTATAATTTATGCTATAATAACTATT   GGACTATTAGGATTTATTGTTTGAGCCCATCATATATTTACTGTAGGATTAGATGTAGATACTCGAGCTTATTTCACTTCAGCTACTATAATTATTGCAATTCCAACAGGTATTAAAGTTTTCAGATGAATAGCAACTTTTTCAGGTTCTAAAATCAAAATAAATCCATCATCTCTT---TGATCAATAGGATTTATTATACTTTTTACTATTGGAGGTCTAACAGGAATTATTTTATCAAATTCATCAATCGATATTGTTCTTCATGATACTTATTAT
+ApoideaB                GCAGGTATATATGGAGCTTCATTAAGAATAATTATTCGAATAGAACTAGGTACACCTGGAAGATTAATTGGAAATGATCAAATTTACAATAGAATTGTTACAGCCCACGCATTTATTATAATTTTTTTTATAATTATACCATTTATAATTGGAGGTTTC   GGAAATTGATTGATTCCATTAATACTAGGAGCACCAGACATAGCTTATCCTCGAATAAATAATATAAGATTTTGATTATTACCCCCATCCTTATTCTTATTAATCTCTAGAAGAATTGTGGATTCAGGAACAGGGACAGGATGGACAGTCTATCCTCCTTTATCTTCAAATTTATTCCATAATGGAATATCTGTAGACCTAAGAATCTTATCCCTTCATTTAGCTGGAGCTTCATCTTTAATAGGTACAATTAATTTTATTGCAACAATTATAAATATAAAAAATTCTAACTTATCAATAGAAAAAATTCCTTTATTTTCTTGATCAATTTTAATCACTACATTTTTATTACTTTTATCATTACCAGTACTAGCCGGAGCAATTACTATACTCTTAACTGATCGAAATTTAAATACATCATTTTTTGACCCTACGGGAGGAGGAGATCCAATCTTATATCAACATTTATTCTGATTTTTTGGACATCCAGAAGTT   TATATTTTAATTTTACCTGGATTTGGATTAATCTCCCAAATAATTACTAATGAAAGAGGAAAAAAAGAATCATTTGGAACTATGGGAATAATTTATGCCATACTAACTATT   GGAATTTTAGGTTTTATTGTATGGGCCCATCATATATTTACTGTAGGATTAGATGTAGATACTCGAGCCTATTTTACCTCAGCTACTATAATTATTGCAGTACCTACTGGAATTAAAGTATTTAGATGATTAGCCTCATTAAGAGGAATAGTCTTTAATCCATCCCCATCTATTCTA---TGATCCATAGGATTCATTTTACTCTTTACAATTGGTGGATTAACAGGAATTATTTTATCAAACTCTTCAATTGATATTATCTTACACGACACTTATTAT
+ApoideaC                TCAGGAATAATTGGAACTTCTATGAGATTTATTATTCGTATAGAATTAAGTAATCCTGGTGAATGAATTATAAATGATCAAATTTATAATTCNTTAGTNACNGCTCATGCTTTTTTAATAATTTTTTTTATAGTAATACCTTTTATAATTGGGGGATTT   GGTAATTGATTANTTCCTTTAATATTAGGATGTCCTGATATAGCTTTCCCTCGAATAAACAATATTAGATTTTGATTATTACCCCCATCTTTAATTTTATTATTATTAAGAAATTTATTTAATATTACTCCNGGAACAGGATGAACAGTTTATCCTCCATTATCTTCATCAATATTTCATAGATCTCCTTCAGTTGATTTAGCAATTTTTTCNCTTCATATATCTGGTATTTCTTCTATTATAGGAGCTATAAATTTTATAGTTACAATTATATTAATAAAAAATATTTCAATAAATTATGATCAAATTAATTTATTTTCATGATCAATTTTCATTACAGCAATTTTGTTATTATTATCATTACCTGTTTTAGCTGGTGCTATTACTATATTATTATTTGATCGAAATTTTAATACTTCATTTTTTGATCCTATAGGAGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTTTTTGGTCATCCTGAAGTT   TATATTTTAATTTTACCNGGNTTTGGGTTAATTTCACAAATTATTATAAATGAAAGAGGGAAAAAAGAGATTTTTGGTAATATTGGAATAATTTATGCAATAATAGGAATT   GGATTATTAGGATTTATTGTATGAGCTCATCATATATTTACTGTGGGGTTAGATGTTGATACTCGAGCTTATTTTACTTCAGCAACTATAATTATTGCAGTTCCAACAGGAATTAAAGTATTTAGATGATTAACTACTTATCATGGAGTTAAATTAGAATTTTTTAATAATTCAATTATTTGAAGATTTGGTTTTATTTTTTTATTTACTTTAGGGGGTTTAACTGGAATTATATTATCAAATTCTTCAATTGATATTATTATACATGATACTTATTAT
+Vespidae                ???????TAATTGGAAGATCATTAAGATTAATTATTCGTTTAGAATTAGGTACACCTTTATCAATTATTAATAATGATCAAATCTATAATTCAATTATTACAGCTCACGCATTAATTATAATTTTTTTCATAGTTATACCATTTATAATTGGAGGATTT   GGAAATTGATTAATTCCCTTAATATTAGGTGCCCCAGATATAGCGTTCCCACGAATAAATAATATAAGATTTTGATTATTACCACCATCATTATTATTATTAATTATTAGAAATATTAATGATATAGGAGTAGGAACTGGATGAACTTTATATCCACCTTTATCATCTAATATAGGACACAATTCATCATCAGTTGATTTTGCTATTTTCTCTCTTCACATCGCAGGAATTTCATCAATTATAGGAGCTATTAATTTCATCGTAACAATCTTAAATATACATATTAAAACTCATTCATTAAATTTTTTACCTATATTTACATGATCAGTTTTAATTACTGCAATTTTACTTTTATTATCTTTACCTGTCCTAGCCGGAGCAATTACCATACTATTAACTGATCGGAATATTAATACATCTTTTTTTGATCCATTAGGAGGTGGAGATCCAATTTTATTCCAACATTTATTTTGATTTTTTGGACATCCAGAAGTA   TATATTTTAATTTTACCAGGATTTGGAATTATTTCACAAATTATTACCAATGAAACAGGAAAAAAAGAAATTTTTGGATCTTTAGGAATGATTTACGCTATAGTATCAATT   GGAATTTTAGGATTTATTGTATGAGCTCATCATATATTTACAGTTGGATTAGATATTGATACACGTGCATATTTTACCTCAGCAACAATAATTATTGCTATTCCAACAGGAATTAAAGTTTTTAGTTGAATAGCTACAATTTATGGATCAAAATTAAATTTTTCACCAGCAATAATT---TGATCTATAGGATTTATTTTCCTCTTCACAATAGGAGGTCTTACAGGAATTATTTTATCAAATTCATCTCTTGATATTATTCTTCATGATACATATTAT
+Triassoxyela            ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Asioxyela               ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Nigrimonticola          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Gigantoxyelinae         ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Spathoxyela             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyela_mesozoica         ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Angaridyela             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyelotoma               ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Undatoma                ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Dahuratoma              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mesolyda                ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Turgidontes             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aulidontes              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Protosirex              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Aulisca                 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Anaxyela                ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Syntexyela              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Karatavites             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Stephanogaster          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Leptephialtites         ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Cleistogaster           ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sepulca                 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Onochoius               ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Ghilarella              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Paroryssus              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Praeoryssus             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Mesorussus              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Trematothorax           ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Thoracotrema            ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Prosyntexis             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Kulbastavia             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Brachysyntexis          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Symphytopterus          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Eoxyela                 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Liadoxyela              ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Abrotoxyela             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Pseudoxyelocerus        ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Palaeathalia            ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Ferganolyda             ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+PamphiliidaeUndesc      ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Rudisiricius            ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Sogutia                 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Xyelula                 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Brigittepterus          ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+Grimmaratavites         ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????   ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
+
+
+[EF1a  F2 3269-4360, 1092 chars]
+Orthoptera              GCCGAACGTGAACGTGGTATTACTATTGATATTGCTCTGTGGAAATTCGAAACTAGCAAATACTATGTTACTATCATTGATGCCCCTGGTCACAGAGATTTCATTAAGAACATGATCACTGGCACTTCCCAGGCTGACTGTGCGGTGTTGATTGTTGCTGCGGGTACTGGTGAGTTTGAAGCCGGTATTTCCAAGAACGGACAGACCCGTGAACACGCTTTGCTGGCTTTCACACTTGGTGTGAAGCAGTTGATTGTGGGTGTTAATAAGATGGATTCTACAGAGCCTCCCTACAGCGAGGCTCGTTTTGAGGAAATCAAGAAGGAAGTTAGCAATTATATTAAGAAGATTGGTTACAACCCTGCTGCTGTTGCTTTTGTGCCCATTTCTGGGTGGCATGGTGACAACATGTTGGAGCACTCCGACAAAATGGGATGGTTTAAGGGTTGGAATATTGAACGCAAGGAAGGAAAGGCTGAAGGAAAGACTCTTATTGAAGCTTTGGATGCCATCCTTCCTCCTTCTAGGCCAACTGAGAAGCCCCTTAGGCTTCCTCTTCAGGATGTATACAAAATTGGTGGTATTGGAACAGTGCCCGTGGGCCGTGTTGAAACTGGTGTTCTGAAGCCAGGTATGGTGGTGACTTTTGCCCCAGCCAATCTAACCACTGAAGTGAAGTCTGTGGAGATGCACCATGAAGCTCTCCAAGAAGCTGTTCCTGGAGACAACGTTGGTTTCAACGTCAAGAACGTCTCTGTTAAGGAATTGCGTCGTGGTTATGTTGCTGGAGATTCTAAAAACAATCCTCCTAAGAGTGCTGCTGATTTCCTTGCTCAGGTCATTGTTCTTAACCATCCTGGTCAAATTTCCAATGGTTATACTCCAGTTTTGGATTGCCACACTGCTCATATTGCCTGCAAATTTGCAGAAATTAAGGAAAAGTGCGACCGTCGTACTGGCAAGACTACTGAAGATAATCCAAAGTCTATCAAATCTGGTGATGCTGCCATTGTCAACTTGGTTCCCACAAAACCCATGTGTGTGGAATCCTTCCAAGAATTTCCTCCTCTGGGACGGTTTGCTGTGCGTGAT
+Paraneoptera            GCTGAACGTGAGCGTGGTATTACTATCGATATTGCCCTTTGGAAATTTGAAACTGCCAAGTACTATGTTACCATCATTGATGCTCCCGGACACAGAGATTTCATCAAGAACATGATCACAGGAACTTCTCAGGCTGATTGTGCTGTACTGATTGTGGCTGCTGGTACCGGTGAGTTTGAAGCTGGCATTTCCAAGAACGGTCAGACTCGTGAACATGCTCTCCTTGCTTTTACTTTGGGTGTGAAACAACTGATTGTTGGAGTTAACAAGATGGATTCTACTGAACCCGCTTACAGTGAAAGCCGATTTGAGGAAATCAAGAAAGAAGTCAGTAACTACATCAAGAAAATCGGTTACAACCCAGCAGCTGTTGCTTTCGTGCCCATTTCTGGATGGCACGGAGATAATATGCTGGAGCCCTCTGACAAGATGCCATGGTTCAAGGGGTGGGCCATCGAGCGTAAGGAAGGCAAGGCTGAGGGCAAGTGCTTGATTGAAGCTTTAGATGCCATTCTTCCTCCATCAAGACCTACTGAGAAGCCCCTCAGGCTGCCTCTTCAGGATGTATACAAGATTGGTGGTATTGGAACAGTGCCTGTAGGCCGAGTAGAGACTGGAGTGCTTAAACCTGGTATGGTGGTCACTTTCGCCCCTGCTAATCTGACTACTGAAGTCAAGTCTGTTGAAATGCACCACGAAGCTCTCCAGGAGGCCGTCCCTGGAGACAATGTGGGCTTCAACGTTAAGAACGTTTCTGTCAAAGAATTGAGGCGAGGTTTTGTTGCTGGGGACTCCAAATCTAACCCACCCAAGGCTGCCGCTGACTTCACTGCACAGGTTATTGTTCTGAACCATCCTGGTCAAATCTCCAACGGATATACTCCTGTCCTCGACTGTCACACTGCTCACATTGCGTGCAAATTCGCAGAGATCAAAGAAAAGTGCGACCGTCGTACTGGCAAGACTACTGAAGATAATCCAAAATCCATAAAGTCTGGTGATGCGGCTATCATCACTTTGGTTCCTTCCAAACCCATGTGTGTCGAGAGTTTCCAGGAGTTCCCACCTCTGGGACGTTTCGCTGTGCGTGAC
+Chrysopidae             GCTGAGCGTGARCGTGGTATCACGATTGAWATTGCGTTATGGAAATTCGAAACTGCTAAATATTACGTGACTATCATCGATGCCCCAGGACATCGTGATTTTATTAAAAATATGATTACGGGTACATCACAAGCCGATTGTGCTGTTCTAATTGTTGCTGCCGGTACAGGAGAATTTGAGGCTGGTATTTCAAAAAATGGYCAAACTCGTGAACATGCCCTACTTGCGTTTACACTTGGTGTTAAACAATTGATTGTTGGAGTTAATAAAATGGATTCGACAGAGCCTNCATATAGYGAGGCACGCTATGAAGAAATCAAGAAAGAAGTATCTTCGTATATTAAAAAAATTGGATATAATCCAGCTGCTGTTGCTTTTGTGCCAATTTCGGGTTGGCATGGTGACAATATGCTTGAACCATCTGAAAAGATGCCATGGTTTAAAGGATGGACAATTGATCGAAAAGAAGGTAAAGCGGAAGGGAAATGTCTTATCGAAGCTTTAGATGCAATCATGCCACCGAGTCGTCCTACTGAGAAACCATTACGACTNCCATTACAGGATGTATACAAGATTGGTGGTATAGGAACAGTTCCTGTTGGTCGTGTGGAAACAGGAATTTTAAAACCGGGTTGTATTGTTGTATTCGCTCCAGCAAATTTAACAACTGAAGTCAAATCAGTCGAAATGCATCATGAAGCTTTACAAGAAGCCTTACCAGGTGATAATGTTGGATTTAACGTGAAGAACGTTTCTGTTAAAGAGCTACGACGTGGATATGTAGCTGGTGATTCGAAAAATAATCCTCCACGTGGTGCAGCTGATTTTACTGCCCAAGTAATTGTATTAAACCATCCCGGACAAATTAGTAATGGTTATACACCAGTTTTAGATTGCCACACAGCTCATATTGCTTGTAAATTTTCTGAAATTAAAGAAAAAGTAGATCGTCGTACTGGAAAAACAACCGAAGAACAACCAAAATCGATTAAATCAGGTGACGCAGCTATTATAACATTGGTGCCAACAAAACCAATGTGCGTTGAATCATTTCAAGAGTTTCCACCATTAGGTCGTTTTGCAGTACGTGAC
+Raphidioptera           GCTGAGCGTGAGCGTGGTATCACTATAGATATCGCACTGTGGAAATTTGAAACTGCAAAATACTATGTCACTATAATTGATGCTCCGGGCCATCGTGATTTCATTAAGAACATGATTACGGGTACGTCCCAGGCCGATTRTGCTGTCTTGATAGTTGCGGCCGGCACAGGAGAATTCGAAGCTGGTATTTCAAAGAACGGACAAACTCGTGAACATGCTTTGCTCGCTTTCACGCTCGGCGTAAAACAATTGATCGTCGGCGTCAATAAAATGGACTCGACCGATCCACCCTACAGTGAAACGCGATATGAGGAAATTAAAAAAGAAGTCTCCTCGTACATTAAAAAGATTGGATATAATYCGGCAGCGGTGGCTTTTGTTCCTATTTCTGGGTGGCACGGAGACAACATGCTGGAACCGTCTGAAAAAATGCCGTGGTTCAAGGGATGGAACGTCGATCGTAAAGAGGGAAAAGCTGAAGGCAAAACTCTCATTGAAGCTCTGGACGCAATTCTGCCCCCTTCGCGACCGACAGATAAACCATTGCGCCTACCGTTACAGGATGTATACAAGATCGGAGGCATCGGTACAGTTCCAGTAGGTCGTGTCGAAACTGGAGTTCTTAAACCGGGCGCGGTCGTTGTGTTTGCGCCTGCCAACATTACCACTGAAGTTAAATCCGTAGAAATGCATCATGAAGCGCTTCAANAAGCNCTGCCAGGNGACAATGTTGGTTTCACCGTTAAGAATGTATCGGTAAAAGAATTGCGTCGTGGATATGTAGCAGGAGATTCCAAAAACAACCCGCCGAAAGGCGCANCCGATTTCACATCCCAAGTTATTGTCCTGAATCATCCGGGTCAAATCAGTAATGGATACACGCCCGTGCTCGACTGTCATACGGCTCACATTGCGTGCAAATTTTCCGAAATCAAAGANAAGGTTGACCGTCGTACAGGCAAAACAACGGAAGAGAACCCAAAATCNATTAAATCTGGTGNCGCTGCAATTATTACTCTTGTCCCAACCAARCCTATGTGTGTTGAATCGTTCCAGGAGTTCCCTCCGTTGGGTCGTTTTGCTGTTCGTGAC
+Coleo_Polyphaga         GCCGAGCGTGAACGTGGTATCACCATCGATATCGCGCTGTGGAAATTCGAAACTTCCAAATACTACGTTACTATCATTGACGCTCCCGGCCACAGAGATTTCATCAAGAACATGATCACGGGGACGTCTCAGGCCGATTGCGCCGTTTTGATCGTGGCCGCAGGTACCGGTGAGTTCGAAGCCGGCATCTCCAAGAACGGACAGACCCGCGAACACGCCCTTCTGGCCTTCACTCTGGGAGTCAAACAACTGATCGTTGGTGTGAACAAGATGGACTCCACTGAACCACCATACAGCGAAGCTAGATACGAAGAAATCAAAAAGGAAGTGTCTTCCTACATCAAGAAGATCGGCTACAACCCAGCCGCTGTTGCCTTCGTACCCATCTCCGGGTGGCACGGGGACAACATGTTGGAACCCTCCACCAAAATGCCCTGGTTCAAGGGGTGGAACATCGAACGCAAGGAGGGCAAAGCTGAGGGCAAATGCTTGATCGAGGCCCTTGATGCCATCCTCCCGCCCACGCGCCCCACCGACAAGCCCCTCCGTCTTCCGCTCCAGGACGTGTACAAGATCGGCGGTATTGGAACAGTACCAGTCGGTCGTGTCGAAACCGGAGTCTTGAAACCCGGAATGGTGGTCGTGTTCGCGCCCGCTAACATCACGACTGAAGTCAAGTCCGTCGAAATGCACCACGAGGCGCTCCCGGAGGCCGTGCCCGGCGACAACGTCGGCTTCAACGTGAAGAACGTGTCCGTGAAGGAGTTGCGTCGTGGGTACGTGGCCGGCGACTCGAAGGCCAGCCCCCCGAAAGGCGCGGCTGACTTCTTGGCGCAAGTTATCGTGTTGAACCACCCTGGACAAATTTCGAACGGTTACACCCCCGTTCTTGACTGTCACACCGCTCACATCGCGTGCAAGTTCGCCGAAATCAAAGAAAAG------------------------------------------------------------------------------------------------------------------------------------------------------
+Coleo_Adephaga          GCAGAACGCGAGCGTGGCATCACCATTGATATTGCATTGTGGAAGTTCGAAACCGCAAAATATTATGTCACCATCATTGATGCCCCTGGTCACAGAGATTTCATTAAGAACATGATCACTGGTACATCCCAAGCTGATTGTGCCGTACTCATTGTCGCTGCCGGTACTGGTGAATTTGAAGCAGGTATCTCCAAAAATGGTCAAACCCGTGAACACGCTCTTCTTGCCTTCACCCTTGGAGTCAAACAACTAATTGTTGGCGTCAACAAGATGGACTCTACCGAACCAGCTTACAGCGAACCCCGTTTCGAAGAAATCAAAAAAGAAGTCTCTTCCTACATCAAGAAGATCGGTTACAACCCAGCTGCTGTAGCCTTCGTACCAATCTCTGGCTGGCACGGAGACAACATGCTTGAACCATCTACCAAGATGCCATGGTTCAAGGGATGGGCTATTGAACGCAAAGAAGGCAAAGCTGACGGTAAATGTCTCATTGAAGCACTCGATGCCATCCTTCCACCAAGCAGACCCACAGAAAAGCCTCTACGTCTTCCACTCCAAGATGTCTACAAAATTGGCGGTATCGGAACAGTACCAGTTGGTCGTGTTGAAACTGGTGTTCTTAAACCAGGCATGGTTGTCGTCTTCGCCCCAGCCAATATCACCACAGAAGTAAAGTCCGTTGAAATGCACCACGAAGCACTCCAAGAAGCCGTTCCCGGAGATAACGTTGGTTTCAACGTTAAGAACGTCTCCGTCAAAGAATTGCGTCGTGGTTACGTCGCTGGTGATTCCAAAGCCAGTCCACCCAGAGGAGCCGCTGACTTTACCGCTCAGGTTATTGTATTGAACCATCCAGGCCAAATCAGCAACGGATACACACCTGTGCTCGATTGCCACACTGCACATATTGCATGCAAATTCGCCGAAATCAAAGAGAAGGTCGACAGACGTACTGGCAAGACCACCGAAGAGAACCCCAAGGCTATCAAGTCCGGTGATGCCGCCATCGTTATCTTGGTACCAAGCAAACCCATGTGCGTTGAATCCTTCCAGGAATTCCCACCTCTAGGACGTTTCGCCGTCCGTGAC
+Lepid_Micropterigidae   -------------GTGGTATCACCATCGACATCGCCCTGTGGAAGTTTGAAACCGCCAAGNACTACGTCACCATCATCGACGCCCCCGGACACAGGGATTTCATCAAGAACATGATCACGGGAACGTCCCAGGCCGACTGCGCTGTACTCNTCGTNGCCGCCGGTACNGGTGAATTCGARGCGGGCATCTCGAAGAACGGCCAGACCCGCGAACACGCTCTCCTTGCCTTCACGCTCGGAGTGAAACAACTCATCGTCGGCGTCAACAAGATGGACTCCACCGAGCCGCCTTACAGCGAGCCCCGCTTCGAAGAAATCAAAAAAGAAGTGTCTTCTTACATCAAGAAGATCGGTTATAACCCAGCCGCCGTCGCTTTCGTGCCCATCTCC?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????TCGGAACGGTGCCCGTCGGCCGAGTGGAGACCGGAATCCTCAAGCCCGGCACCGTGGTCGTTTTCGCCCCGGCCAACATCACCACCGAAGTCAAGTCCGTTGAGATGCACCACGAAGCTCTCCAGGAGGCCGTTCCCGGAGACAACGTGGGTTTCAACGTAAAGAACGTTGCCGTGAAGGATCTTCGCCGTGGTTACGTCGCCGGAGATACTAAGAATAACCCCCCGAAGGGAGCTGGTGACTTCACCGCGCAGGTCATTGTTCTCAACCACCCCGGACAGATCTCAAACGGTTACACGCCTGTCCTCGATTGCCACACCGCTCACATTGCCTGCAAATTCGCAGAGATCAAAGAGAAAGTCGACCGTCGTACTGGCAAATCCACCGAAGACAACCCGAAAGCCATTAAATCGGGAGACGCCGCCATCGTTATCCTGGTCCCGTCCAAGCCGATGTGCGTCGAGTCCTTCCAGGAGTTCCCCCCTCTCGGCAGATTCGCCGTGCGC---
+Lepid_Papilionidae      GCTGAGCGTGAGCGTGGTATCACCATCGATATCGCCCTGTGGAAGTTCGAGACCAGCAAATACTATGTCACCATCATTGACGCTCCCGGACACAGAGATTTCATCAAAAACATGATCACAGGAACATCGCAGGCTGACTGCGCCGTGCTCATCGTCGCTGCCGGTACCGGTGAGTTTGAAGCGGGTATCTCCAAGAACGGACAGACCCGTGAACACGCGCTCCTCGCGTTCACACTCGGTGTCAAGCAACTGATTGTTGGTGTCAACAAAATGGACTCCACTGAGCCGCCATACAGCGAGTCTCGCTTCGAGGAAATCAAGAAGGAAGTATCTTCATACATCAAGAAGATCGGTTACAACCCAGCTGCTGTCGCTTTCGTACCCATTTCTGGCTGGCACGGAGATAACATGCTGGAGCCATCCACCAAAATGCCCTGGTTCAAGGGGTGGAATGTTGAGCGTAAGGAGGGCAAGGCTGAGGGTAAATGCCTGATTGAAGCTCTGGATGCCATCCTGCCCCCAGCTCGTCCCACCGACAAGGCTCTCCGTCTTCCCCTGCAAGACGTTTACAAAATCGGCGGTATTGGTACAGTGCCCGTAGGCAGAGTTGAAACCGGTGTCCTCAAGCCAGGTACCATCGTCGTGTTTGCGCCTGCTAACATCACCACTGAAGTRAAATCTGTTGAAATGCACCACGAAGCTCTCCAGGAGGCTGTACCTGGTGACAATGTTGGTTTCAACGTAAAGAACGTTTCCGTCAAGGAGTTGCGTCGTGGTTATGTCGCTGGCGACTCCAAAAACAACCCACCCAGGGGAGCTGCAGACTTCACTGCACAGGTCATCGTTCTCAACCACCCTGGTCAAATCTCCAATGGTTATACACCAGTGTTGGATTGCCACACAGCTCACATTGCCTGCAAATTCGCCGAAATTAAAGAGAAGGTTGACCGTCGTACTGGTAAATCCACTGAAGACAACCCTAAGTCCATCAAATCTGGTGATGCCGCCATTGTCAACCTCGTGCCCTCCAAGCCCYTGTGTGTGGAATCCTTCCAGGAATTCCCACCTCTTGGTCGTTTCGCCGTGCGT---
+Mecoptera               ---GGGCGTGAACGTGGTATCACCATTGATATTGCTTTGTGGAAATTCGAAACCGCCAAATATTATGTTACAATCATCGATGCTCCTGGACACAGAGATTTCATTAAGAACATGATTACTGGAACATCTCAGGCTGATTGTGCTGTGCTCATTGTTGCTGCTGGTACTGGTGAATTCGAAGCTGGTATCTCTAAAAATGGACAGACCCGTGAACATGCCCTCCTTGCCTTCACTCTTGGTGTCAAACAATTGATTGTCGGTGTCAACAAGATGGACTCCACTGAACCTCCATACAGCGAATCTCGTTTCGAGGAAATCAAAAAGGAAGTATCTTCATACATTAAGAAGATCGGTTACAACCCTGCTGCTGTTGCTTTCGTACCAATCTCTGGATGGCACGGAGATAACATGTTAGAAGTTTCCACGAAGATGAGTTGGTTCAAGGGATGGAACGTTGAACGCAAAGAAGGCAAGGCTGATGGTAAATGTCTCATTGAAGCTTTGGACGCAATCCTTCCACCTGCTCGTCCCACAGACAAACCCCTCCGTCTTCCACTCCAGGATGTCTACAAAATCGGTGGAATCGGAACAGTACCAGTTGGACGTGTTGAAACTGGTATATTAAAACCCGGTACCGTTGTTGTATTCGCACCAGCTAACCTTACTACTGAAGTCAAGTCCGTCGAAATGCACCACGAAGCCCTCCAAGAAGCTGTTCCTGGAGACAATGTTGGTTTCAACGTAAAGAACGTATCTGTCAAGGAATTACGTCGTGGTTACGTTGCTGGAGATTCCAAGGCCAGTCCACCCAAGGGAGCCGCTGATTTCACTGCTCAGGTCATCGTCCTCAATCACCCCGGACAAATTAGCAACGGATACACACCTGTACTCGATTGCCACACCGCCCATATTGCCTGCAAATTCGCCGAAATCAAAGAAAAGGTCGATCGTCGTACTGGAAAATCAACTGAAGATAACCCAAAAGCCATTAAATCTGGTGATGCCGCTATTGTCAACTTAGTACCCTCTAAACCCATGTGCGTTGAATCTTTCCAAGAATTCCCTCCACTTGGACGTTTTGCTGTTCGTGAC
+Xyela                   GCTGAGCGYGARCGTGGTATCACCATCGACATTGCTCTGTGGAAGTTCGAGACCGCCAGGTACTACGTCACCATCATCGACGCCCCTGGCCACAGGGATTTCATCAAGAACATGATCACTGGTACCTCTCAGGCCGATTGCGCCGTACTTATCGTCGCTGCCGGTACTGGAGAATTTGAAGCCGGTATCTCCAAGAACGGACAGACCCGCGAGCACGCCCTTCTCGCTTTCACCCTTGGAGTGAAGCAGCTGATCGTTGGAGTCAACAAGATGGACTCCACCGAGCCCCCGTACTCCGAGGCCCGTTTCGAGGAAATCAAGAAGGAAGTTTCCTCATACATCAAGAAGATCGGTTACAACCCCTCCAACGTTCCTTTCGTGCCCATCTCCGGATGGCATGGAGACAACATGTTGGAGGCTTCCTCCAAGATGCCATGGTTCAAGGGATGGGCTGTGGAGCGCAAGGAAGGAAAGGCTGACGGCAAGTGCCTGATTGAGGCCCTTGACGCTATCCTCCCCCCCAGCAGGCCCACCGACAAGGCCCTCCGTCTTCCCCTTCAGGACGTGTACAAGATTGGTGGTATCGGAACGGTACCCGTTGGCCGTGTCGAGACTGGTCTCCTGAAGCCCGGTATGCTCGTGACTTTCGCCCCCGCTGGTCTGACCACTGAGGTTAAGTCCGTCGAGATGCATCACGAAGCCCTCGTTGAAGCCGTTCCCGGTGACAACGTTGGTTTCAACGTCAAGAACGTGTCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGTGACTCCAAGAGCAACCCCCCTAAGGGCGCTGCTGACTTCACCGCTCAGGTTATCGTGCTGAACCACCCCGGTCAGATCAGCAACGGATACACTCCCGTGCTCGATTGCCACACAGCTCACATTGCCTGCAAGTTCGCCGAGATCAAGGAGAAGTGCGACCGTCGTACCGGCAAGACCACCGAGGAGAACCCCAAGGCCATCAAATCTGGTGACGCTGCCATTGTCAACCTAGTCCCCAGCAAGCCCATGTGCGTCGAGGCCTTCCAGGAGTTCCCNCCCTTGGGACGTTTCGCTGTACGTGAC
+Macroxyela              GCTGAGCGTGARCGTGGTATCACCATCGATATTGCTCTGTGGAAGTTCGAGACTGCCAAGTACTATGTCACCATCATTGACGCCCCTGGCCACAGGGATTTCATCAAGAACATGATCACTGGTACATCCCAGGCCGATTGCGCCGTGTTGATCGTCGCTGCTGGTACTGGAGAATTTGAGGCTGGTATCTCCAAGAACGGACAGACCCGTGAGCACGCCCTTCTCGCCTTCACCCTTGGAGTGAAGCAGCTGATTGTTGGTGTTAACAAGATGGACTCCACCGAGCCCCCGTACTCTGAGGCCCGTTTCGAAGAAATCAAGAAGGAAGTCTCTTCGTACATCAAGAAGATCGGTTACAACCCCGCCGCTGTCGCTTTCGTGCCCATCTCTGGATGGCACGGAGACAACATGTTGGAGTCTTCCAGCAAGATGCCATGGTTCAAGGGATGGGCTGTGGAGCGCAAGGAAGGCAAGGCTGACGGCAAGTGCCTCATTGAGGCCCTTGACGCCATCCTGCAACCTAGCAGACCCACTGACAAGCCCCTTCGTCTTCCCCTTCAGGACGTCTACAAGATTGGTGGTATTGGAACGGTACCCGTCGGCCGTGTGGAGACTGGTCTCTTGAAACCCGGTATGGTTGTGACCTTCGCGCCCGCTGGTTTGACCACTGAAGTCAAGTCCGTCGAGATGCACCACGAAGCCCTCACTGAAGCCGTTCCCGGTGACAATGTCGGTTTCAACGTAAAGAACGTTTCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGTGACTCCAAGAGCAACCCCCCTAAGGGCGCTGCTGACTTCACCGCTCAGGTTATTGTGCTGAACCATCCTGGTCAGATCAGCAACGGATACACACCCGTGCTCGATTGCCACACAGCTCACATTGCCTGCAAGTTCGCTGAGATCAARGAAARGTGCGACCGTCGTACTGGCAAAAYCACTGAGGAGAACCCCAAGGCCATCAAGTCTGGTGACGCCGCCATCGTCAACCTGGTCCCCAGCAAGCCCATGTGCGTTGAGGCCTTCCAAGAGTTCCCTCCCCTGGGACGTTTCGCTGTACGTGAC
+Runaria                 GCCGAGCGTGAGCGTGGTATCACCATCGATATCGCCCTGTGGAAATTCGAGACGGCCAAATACTACGTGACGATCATCGACGCCCCGGGGCACAGAGATTTCATCAAGAACATGATCACCGGAACTTCGCAGGCCGATTGCGCCGTACTGATCGTCGCCGCAGGTACCGGAGAGTTCGAGGCCGGTATCTCCAAGAACGGCCAGACCCGCGAGCACGCGCTGCTCGCCTTCACTCTGGGCGTCAAGCAGCTCATCGTCGGCGTCAACAAAATGGACAACACCGAACCCCCGTACTCGGAGTCTCGCTTCGAGGAAATCAAGAAGGAAGTATCTTCCTACATCAAGAAGATCGGCTACAATCCCGCCGCCGTCGCTTTCGTTCCCATCTCCGGATGGCACGGAGACAACATGCTGGAACCGTCCACCAAGATGCCGTGGTTCAAGGGATGGGCCGTCGAACGTAAGGAGGGCAAAGCCGACGGCAAGTGCCTCATCGAAGCCCTGGACGCTATCCTCCCCCCCAGCAGACCTACCGACAAGGCTCTTCGCCTTCCCCTTCAGGATGTGTACAAGATTGGCGGTATTGGAACGGTACCCGTCGGTCGTGTCGAGACTGGCGTGCTGAAGCCCGGCATGGTCGTGACTTTCGCGCCGGCCGGTCTGACCACCGAAGTAAAGTCCGTGGAGATGCACCACGAGGCTCTCGTCGAGGCCGTGCCCGGCGACAACGTTGGTTTTAACGTCAAGAACGTCTCCGTCAAGGAGCTGCGACGTGGATTCGTCGCCGGCGACTCCAAGAACAACCCGCCCAAGGGCGCCGCCGACTTTACCGCTCAGGTCATCGTGTTGAATCACCCCGGTCAAATCTGCAACGGATACACTCCCGTGCTCGATTGTCACACGGCCCATATCGCCTGCAAGTTCGCGGAAATCAAGGAGAAGTGCGACCGTCGTACCGGCAAGACCACCGAGGAGAATCCCAAGGCCATCAAGTCCGGGGACGCGGCTATCGTCAATCTGGTACCCAGCAAGCCTATGTGCGTCGAGGCTTTCCAGGAGTTCCCTCCTCTCGGACGCTTCGCCGTGCGTGAC
+Paremphytus             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Blasticotoma            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Tenthredo               ---------------------------------------------------------------------------------------------------------------ATGATCACTGGTACTTCGCAGGCTGATTGCGCTGTATTGATAGTAGCAGCTGGTACGGGTGAATTCGAAGCTGGTATTTCAAAGAATGGTCAAACCCGAGAGCACGCACTTCTTGCTTTTACTCTTGGAGTTAAACAGCTGATTGTTGGTGTTAACAAAATGGATTCAACCGACCCACCGTACTCAGAGGCTCGTTATGAGGAAATTAAGAAGGAAGTTTCTTCTTACATTAAGAAAATTGGATACAATCCACTCGCCGTCGCTTTCGTACCTATCTCAGGATGGCACGGAGACAACATGCTCGAACCATCTAGCAAAATGCCATGGTTTAAGGGATGGGCTGTTGAACGTAAGGAAGGAAAGGCTGACGGCAAGTGCCTCATTGAAGCTCTTGACGCTATCCTACCGCCAAGCAGACCCACCGACAAGGCTCTCCGTCTTCCCCTTCAGGACGTCTACAAGATTGGAGGTATTGGAACGGTCCCAGTCGGTCGTGTAGAAACTGGAGTACTGAAGCCTGGTACCGTTGTGACTTTCGCACCTGCCGGACTAACGACTGAAGTTAAATCCGTCGAGATGCATCACGAAGCTCTCGTCGAAGCTGTACCCGGCGACAACGTTGGTTTCAACGTAAAGAACATCTCCGTCAAGGATCTTCGTCGTGGATACGTTGCCGGTGACTCAAAGAACAACCCGCCTAAAGGCGCTGCCGACTTCACCGCTCAGGTAATCGTGTTGAACCATCCGGGTCAAATCAGCAACGGTTACACGCCTGTGTTGGATTGTCACACAGCTCATATAGCGTGTAAATTCGCTGAGATAAAGGAGAAGTGTGACCGACGTACGGGTAAAACAACTGAAGAAAATCCAAAGGCTATAAAATCCGGAGACGCTGCGATCGTGAACCTTGTACCAAGCAAGCCAATGTGCGTTGAAGCTTTCCAGGAGTTTCCACCATTGGGACGTTTCGCTGTACGTGAC
+Aglaostigma             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Dolerus                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------GTCAAGGAACTTCGTCGTGGATACGTCGCTGGCGACTCCAAGAACAACCCGCCCAAGGGGGCCGCCGATTTCACCGCTCAGGTAATCGTGTTGAACCACCCTGGTCAAATCAGCAACGGTTACACGCCAGTGTTGGATTGCCACACAGCCCATATAGCGTGTAAATTCGCAGAGATAAAAGAGAAGTGTGACAGACGTACGGGAAAAACAACCGAAGAAAATCCAAAAGCAATAAAATCCGGAGACGCGGCCATCGTAAACTTGGTACCCAGCAAGCCCATGTGCGTCGAGGCTTCCCAGGAGTTCCC----------------------------
+Selandria               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Strongylogaster         ------------------------------------------------------------TACTACGTAACAATCATCGACGCTCCCGGTCACAGAGATTTCATCAAGAACATGATCACCGGTACGTCGCAGGCTGATTGCGCCGTACTCATCGTAGCTGCTGGTACGGGAGAATTTGAAGCTGGTATTTCAAAGAACGGACAAACCCGTGAGCACGCTCTTCTCGCTTTCACTCTTGGAGTAAAGCAGCTGATCGTTGGAGTTAACAAAATGGATTCCACCGAACCCCCGTACTCCGAAGCTCGTTTCGAGGAAATCAAGAAGGAAGTATCTTCCTACATTAAGAAGATCGGTTACAATCCTGCCGCTGTTGCTTTCGTACCAATCTCCGGTTGGCACGGAGACAACATGCTCGAACCATCCTCAAAGATGCCATGGTTCAAGGGATGGGCTGTCGAACGTAAGGAAGGCAAGGCTGACGGCAAGTGCCTCATCGAAGCTCTCGACGCTATCCTTCAACCCAGCCGTCCAACCGACAAGGCTCTCCGTCTTCCCCTTCAGGACGTCTACAAGATTGGTGGTATCGGAACGGTCCCAGTCGGTCGTGTAGAAACTGGAGTCTTGAAACCAGGTACCGTTGTTACATTCGCTCCTGCTGGACTCACCACTGAAGTTAAATCCGTTGAAATGCACCACGAAGCTCTGGCAGAAGCTGTTCCCGGTGACAACGTTGGTTTCAACGTTAAGAACGTTTCCGTTAAGGAACTTAGACGTGGATACGTAGCTGGTGACTCAAAGAACAACCCACCAAAGGGTGCCGCCGACTTCACCGCTCAG---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Monophadnoides          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Metallus                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Athalia                 GCAGAGCGTGAACGTGGTATCACGATCGATATTGCTCTGTGGAAGTTTGAGACTTCTAGATACTACGTAACAATCATCGACGCGCCCGGACACAGAGATTTTATCAAGAACATGATCACTGGTACGTCGCAGGCCGATTGTGCGGTGCTGATCGTTGCTGCTGGTACTGGAGAATTCGAGGCTGGTATTTCCAAGAGCGGACAAACCCGTGAGCATGCACTCCTTGCCTTCACTCTTGGTGTCAAGCAGCTCATCGTAGGAGTCAACAAAATGGACTCGACCGAACCACCATTCTCTGAATCACGTTTCGAAGAAATCAAGAAGGAAGTTTCTTCCTACATCAAAAAGATCGGTTACAACCCAGCTGCTGTAGCATTCGTGCCAATCTCTGGATGGCATGGAGACAACATGCTTGAGCCATCCAGCAAAATGCCGTGGTTCAAGGGATGGGCTGTTGAGCGTAAGGAAGGCAAGGCTGATGGCAAGTGCCTCATCGAAGCTCTTGACGCCATCCTGCCACCCAGCAGACCCACTGACAAGGCTCTCCGTCTTCCTCTTCAGGATGTTTACAAGATTGGTGGTATTGGAACGGTACCAGTCGGTCGTGTTGAAACTGGTGTCCTGAAGCCAGGTACTGTCGTCACCTTTGCCCCAGCTGGACTTACTACTGAAGTCAAGTCCGTCGAAATGCACCACGAAGCTCTCCTTGAAGCCGTTCCCGGTGACAATGTTGGTTTCAATGTGAAGAACGTCTCCGTCAAGGAACTCCGACGTGGATACGTTGCTGGTGATACGAAGAACAACCCACCAAAGGGAGCCGCTGACTTCACTGCTCAGGTNATCGTGCTGAACCACCCCGGTCAAATTAGCAAGGGATACACGCCTGTGTTGGATTGCCACACGGCTCATATCGCTTCAAAGTTTGCACAGATTAAGGAGAAGTGCGACCGCCGTACGGGTAAAACAACTGAAGAGAATCCAAGGGCGATCAAATCTGGAGATGCTGCAATNGTAACCCTGGTGCCAAGCAAGCCAATGTGCGTTGAGGCTTTCCAGGAATTCCCACCTTTGGGACG----------------
+Taxonus                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Hoplocampa              ------------------------------------------------------------TACTATGTCACGATCATCGATGCCCCAGGACACAGAGATTTCATCAAGAACATGATCACGGGAACGTCGCAGGCCGATTGCGCTGTGTTGATTGTAGCCGCTGGTACGGGAGAGTTCGAGGCTGGTATTTCCAAGAACGGTCAGACCCGCGAGCATGCGCTCCTCGCCTTCACCCTTGGAGTAAAGCAGCTGATCGTCGGAGTCAACAAAATGGACTCCACCGAGCCACCCTACTCCGAGTCTCGTTTCGAGGAAATCAAGAAGGAAGTGTCCTCTTACATCAAAAAGATCGGTTACAATCCCGCCGCTGTTGCTTTCGTTCCCATCTCTGGATGGCACGGAGATAACATGCTTGAGCCATCCACCAAAATGGGGTGGTTCAAGGGATGGGCTGTTGAGCGCAAGGAAGGAAAGGCTGACGGCAAGTGCCTCATCGAAGCTCTCGACGCTATCCTGCCACCCAGCAGACCCACCGACAAGGCTCTCCGTCTTCCCCTTCAGGACGTCTACAAGATTGGTGGTATTGGAACGGTACCAGTTGGTCGTGTAGAAACCGGAGTCTTGAAGCCAGGTACTGTGGTAACATTCGCTCCTGCTGGACTCACCACTGAAGTAAAGTCCGTCGAGATGCACCACGAAGCTCTCGTCGAAGCCGTTCCCGGCGACAACGTTGGTTTCAACGTAAAGAACGTTTCCGTCAAAGAACTCCGTCGTGGATACGTTGCCGGTGACTCGAAGAACAACCCGCCCAAGGGCGCCGCCGACTTCACCGCTCAG---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Nematinus               ------------------------------------------------------------TACTACGTCACAATCATCGACGCCCCTGGACACAGAGATTTCATCAAGAACATGATCACTGGTACGTCGCAGGCCGATTGTGCAGTGTTGATCGTAGCCGCTGGTACCGGAGAGTTTGAAGCTGGTATTTCCAAGAACGGTCAGACCCGTGAGCACGCTCTCCTTGCCTTCACTCTTGGAGTCAAGCAGCTCATCGTCGGAGTCAACAAAATGGACTCCACCGAGCCACCCTACTCCGAATCCCGTTTCGAGGAAATCAAGAAGGAAGTCTCATCCTACATCAAGAAGATCGGTTACAACCCAGCTGCCGTTCCCTTCGTTCCCATCTCCGGATGGCACGGAGACAACATGCTCGAGCCATCCAGCAAAATGGGATGGTTCAAGGGATGGGCTGTTGAGCGCAAGGAAGGCAAGGCTGACGGCAAGTGCCTCATCGAAGCTCTCGACGCTATCCTGCCACCCAGCAGACCCACCGACAAGGCTCTTCGTCTTCCCCTTCAGGACGTCTACAAGATTGGTGGTATCGGAACGGTACCAGTTGGTCGTGTGGAAACTGGAGTCCTGAAGCCAGGTACTGTTGTAACATTCGCTCCTGCTGGACTCACCACTGAAGTCAAGTCCGTTGAGATGCACCACGAAGCTCTCGTCGAAGCCGTTCCCGGTGACAACGTCGGTTTCAACGTAAAGAACGTCTCCGTCAAGGAACTCCGTCGTGGATACGTTGCCGGTGACTCAAAGAACAACCCGCCCAAGGGAGCTGCCGACTTCAACGCTCAG---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Nematus                 GCTGAGCGBGARCGTGGTATCACCATCGACATTGCCCTRTGGAAGTTCGAGACTGGCAAATACTACGTGACGATCATCGACGCCCCGGGACACAGAGATTTCAWCAAGAACATGATCACTGGTACGTCGCAGGCCGATTGTGCGGTGYTGATCGTAGCCGCCGGTACCGGAGAATTCGAGGCTGGTATCTCCAAGAACGGACAGACCCGCGAGCACGCGCTTCTCGCCTTCACTCTTGGAGTCAAGCAGCTGATCGTAGGAGTCAACAAAATGGACTCCACCGAGCCACCCTACTCAGAGGCCCGTTTCGAGGAAATCAAGAAGGAAGTCTCCTCCTACATCAAGAAGATCGGTTACAACCCAGCCGCCGTTGCCTTCGTTCCCATCTCAGGATGGCACGGAGACAACATGCTCGAGCCATCCACCAAAATGGGATGGTTCAAGGGATGGGCTGYCGAGCGCAAGGAAGGAAAGGCCGACGGCAAGTGCCTCATCGAAGCTCTTGACGCTATCCTCCAACCCAGCAGACCCACCGACAAGGCTCTCCGTCTTCCCCTTCAGGATGTCTACAAGATTGGTGGTATCGGAACGGTACCAGYTGGTCGTGTAGAAACTGGAGTCCTGAAGCCAGGTACTGTTGTAACATTCGCTCCTGCTGGACTCACCACCGAAGTCAAGTCAGTTGAGATGCACCACGAAGCTCTCGTCGAAGCTGTTCCCGGTGACAACGTTGGTTTCAACGTAAAGAACGTCTCCGTCAAGGAACTCCGTCGTGGATACGTCGCTGGTGACTCAAAGAACAACCCACCCAAGGGAGCCGCCGACTTCAACGCTCAGGTCATCGTTCTGAACCACCCTGGTCAGATCAGCAACGGTTACACTCCAGTGTTGGATTGCCACACCGCTCACATAGCGTGCAAGTTCGCAGAGATCAAGGAGAAGTGTGACAGACGTACGGGAAAAACTACCGAGGAAAATCCTAAGGCTATCAAATCCGGAGACGCGGCGATAGTCACGCTGATACCCAGCAAGCCGATGTGCGTCGAAGCTTTCCAGGAGTTCCCACCTCTGGGACGTTTCGCCGTGCGTGAC
+Cladius                 ------------------------------------------------------------TACTATGTCACGATCATCGATGCCCCTGGACACAGAGATTTCATTAAGAACATGATCACTGGAACGTCGCAGGCGGATTGTGCTGTGTTGATTGTAGCTGCAGGTACCGGAGAGTTCGAGGCTGGTATTTCCAAGAACGGACAAACCCGTGAGCACGCGCTTCTTGCCTTCACTCTTGGAGTCAAGCAGCTGATTGTTGGAGTCAACAAAATGGACTCTACCGAGCCACCCTACTCTGAGGCTCGTTTCGAGGAAATCAAGAAGGAAGTCTCATCTTACATCAAGAAGATCGGTTACAACCCAGCGGCTGTTGCCTTTGTTCCCATCTCTGGATGGCACGGAGACAACATGCTTGAGCCTTCCACCAAAATGGGATGGTTCAAGGGATGGGCTGTCGAACGCAAGGAAGGAAAGGCTGACGGCAAGTGCCTCATCGAAGCTCTTGATGCTATCCTGCCGCCCAGCAGACCCACCGACAAGGCTCTCCGTCTTCCTCTCCAGGACGTCTACAAGATTGGTGGTATCGGAACAGTACCAGTCGGTCGTGTAGAAACTGGAGTCCTGAAGCCAGGTACTGTGGTAACATTCGCTCCTGCTGGTCTCACCACTGAAGTCAAGTCAGTCGAGATGCACCACGAAGCCCTTGTTGAAGCCGTTCCCGGTGACAATGTTGGTTTCAACGTTAAGAACGTCTCTGTCAAGGAACTCCGTCGTGGATACGTTGCCGGTGACTCTAAGAACAACCCACCCAAGGGTGCCGCTGACTTCAACGCTCAG---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Monoctenus              GCTGAGCGTGAACGTGGTATCACRATCGACATCGCTCTGTGGAAGTTTGAGACTGCCAGGTACTATGTGACTATCATCGATGCACCTGGACACAGGGATTTCATCAAGAACATGATCACCGGTACGTCGCAGGCCGACTGCGYGGTGTTGATCGTTGCTGCGGGAACGGGAGAATTCGAGGCTGGTATTTCTAAGAACGGTCAGACCCGCGAGCACGCCCTGCTCGCCTTCACTCTTGGAGTCAAGCAGCTCATCGTCGGAGTCAACAAAATGGACTCTACTGAGCCGCCGTACTCCGAGGCTCGTTTTGAGGAAATCAAGAAGGAAGTCTCGTCATACATCAAGAAAATCGGTTACAATCCTGCTGCCGTAGCCTTCGTCCCAATTTCCGGATGGCACGGAGACAACATGCTCGAACCCTCGAGCAAAATGCCATGGTTCAAGGGGTGGGCCGTTGAACGCAAAGAAGGAAAGGCTGACGGCAAGTGCCTCATTGAAGCTCTTGACGCCATCCTACCACCCAGCAGACCCACCGACAAAGCTCTGCGTCTTCCCCTGCAGGACGTATACAAGATTGGAGGTATCGGAACAGTACCCGTAGGCCGTGTCGAGACCGGAGTCCTGAAACCAGGTACCGTCGTTACCTTCGCCCCTGCCGGACTTACGACTGAAGTAAAATCCGTCGAAATGCATCACGAAGCT---------------------------------------------------------------------------------------------------------------------------------------GTAATCGTATTGAACCACCCCGGTCAGATAAGCAACGGTTACACGCCTGTACTGGATTGTCACACAGCTCACATAGCGTGCAAGTTCGCTGAGATCAAGGAGAAATGTGACCGACGTACCGGTAAAACGACGGAAGAAAATCCAAAGGCGATAAAATCAGGAGACGCAGCGATAGTGAACCTGGTACCCAGCAAGCCAATGTGCGTCGAGGCCTTCCAAGAATTCCCATCACTTGGACGTTTCGCTGCACGTGAT
+Gilpinia                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Diprion                 GCTGAGCGTGAACGTGGTATCACAATTGATATCGCACTTTGGAAATTTGAAACTGCCAAGTACTATGTGACTATCATCGATGCGCCGGGACACAGAGATTTCATTAAGAACATGATCACTGGTACGTCTCAGGCCGACTGTGCAGTGTTGATTGTGGCTGCTGGTACGGGAGAATTCGAAGCTGGTATTTCCAAGAACGGTCAGACCCGTGAGCACGCACTACTTGCCTTCACCCTCGGCGTCAAGCAGCTCATCGTTGGTGTCAATAAAATGGACTCCACTGAGCCGCCATACTCGGAGGCTCGTTTCGAGGAAATTAAGAAGGAAGTTTCCTCTTATATCAAAAAGATTGGTTACAACCCAGCCGCTGTCGCTTTCGTTCCCATCTCAGGGTGGCACGGAGACAACATGCTCGAGCCCTCGAGCAAGATGCCATGGTTCAAGGGATGGGCCGTCGAACGCAAGGAAGGCAAAGCTGATGGAAAGTGTCTCATTGAGGCTCTCGATGCCATCCTTCCACCCAGCAGACCTACCGATAAGGCTCTGCGTCTTCCCCTGCAGGACGTTTACAAGATTGGAGGTATTGGAACGGTGCCCGTAGGCCGTGTAGAAACTGGAGTTCTGAAGCCAGGTACCGTCGTAACCTTTGCTCCAGCAGGTCTCACGACTGAAGTAAAATCCGTCGAGATGCACCACGAGGCTTTGACTGAAGCCGTGCCCGGCGACAACGTTGGTTTCAACGTAAAGAACGTNTCCGTCAAGGAACTTCGACGTGGATACGTTGCTGGTGACTCTAAGAACAATCCGCCCAAGGGCGCCGCCGATTTCACCGCTCAGGTAATCGTATTGAACCACCCCGGTCAGATCAGCAACGGTTATACGCCAGTGTTGGACTGTCACACGGCACATATAGCGTGCAAGTTCGCCGAGATTAAGGAGAAATGCGACCGACGTACGGGTAAAACGACTGAGGAGAATCCAAAGGCGATAAAGTCGGGAGACGCGGCCATCGTGACTCTGGTGCCGAGCAAGCCGATGTGCGTCGAAGCCTTCCAAGAATTCCCGCCATTGGGTCGCTTCGCTGCACGTGAT
+Cimbicinae              GCTGAGCGYGARCGTGGTATCACCATTGACATTGCCCTGTGGAAGTTCGAGACGAGCAGGTACTACGTGACGATCATCGACGCCCCTGGTCACAGAGATTTCATCAAGAACATGATCACTGGTACCTCACAGGCTGATTGCGCTGTGTTGATTGTCGCCGCTGGTACGGGAGAGTTCGAGGCTGGTATCTCAAAGAACGGACAAACCCGAGAGCACGCGCTTCTCGCCTTCACTCTTGGAGTCAAGCAGCTGATTGTTGGAGTTAACAAAATGGACTCCACCGAGCCCCCGTACTCCGAGTCTCGTTTCGAAGAAATCAAGAAGGAAGTTTCATCCTACATCAAGAAGATCGGTTACAACCCTGCCGCCGTCGCTTTCGTTCCCATCTCTGGATGGCACGGAGACAACATGCTTGAGCYATCGAGCAAGATGCCGTGGTTCAAGGGGTGGGCTGTTGRACGCAAGGAAGGCAAGGCTGATGGCAAATGCCTCATCGAAGCCCTCGATGCTATCCTCCCACCCAGCAGACCTACCGACAAGGCTCTGCGTCTCCCCCTCCAGGACGTCTACAAGATCGGTGGTATTGGAACGGTACCCGTTGGTCGAGTTGAAACTGGTGTGTTGAAGCCTGGTACCGTCGTTACTTTCGCTCCCGCTGGACTCACTACTGAAGTAAAGTCTGTTGAAATGCACCACGAAGCTCTCGTTGAAGCCGTTCCCGGTGACAACGTTGGTTTCAACGTTAAGAACGTCTCCGTCAAGGAACTTCGTCGTGGATACGTTGCTGGCGACTCTAAGAMCAACCCACCCAAGGGAGCTGCCGATTTCACTGCTCAGGTCATCGTCCTGAACCACCCTGGCCAGATCAGCAACGGTTATACACCGGTGTTGGATTGTCACACCGCACATATAGCGTGCAAATTCGCTGAAATTAAAGAGAAGTGCGACCGACGTACGGGAARAACAACAGAAGAGAATCCTAARGCGATAAAATCCGGAGACGCTGCGATAGTAAATCTGGTACCTAGCAAGCCAATGTGCGTTGAAGCTTTCCAAGAATTCCCACCGCTGGGACGTTTCGCCGTACGTGAC
+Abia                    GCTGAGCGTGAACGTGGTATTACCATCGACATTGCCCTGTGGAAGTTTGAGACTGGCAGATACTACGTGACAATCATCGACGCCCCTGGACACAGAGATTTCATTAAGAACATGATCACTGGTACTTCCCAGGCTGATTGTGCAGTGTTGATAGTCGCCGCTGGTACGGGAGAGTTCGAGGCTGGTATCTCAAAGAACGGACAAACCCGAGAGCACGCTCTTCTTGCTTTCACTCTTGGCGTAAAGCAGCTCATCGTCGGAGTTAACAAAATGGACTCCACCGAGCCTCCCTACTCCGAATCTCGATTCGAGGAAATCAAGAAGGAAGTATCATCCTACATCAAGAAGATCGGTTACAACCCTGCCGCCGTCGCTTTCGTTCCCATCTCTGGATGGCACGGAGACAACATGCTTGAGCCCTCTAGCAAGATGCCGTGGTTCAAGGGATGGGCTGTTGAGCGTAAGGAAGGCAAAGCTGACGGCAAGTGCCTGATCGAAGCTCTCGATGCTATCCTCCCACCCAGCAGACCAACCGATAAGGCTCTGCGTCTTCCCCTCCAGGACGTCTACAAAATTGGTGGTATTGGAACGGTACCCGTTGGTCGTGTCGAAACCGGTGTGCTGAANCCCGGTACCGTCGTAACTTTTGCTCCCGCTGGACTCACCACTGAAGTAAAGTCCGTTGAGATGCACCACGAAGCTCTCGTTGAAGCCGTTCCCGGTGACAACGTTGGTTTCAACGTAAAGAACGTCTCCGTTAAGGAACTTCGTCGTGGATATGTCGCTGGCGACTCTAAGAACAACCCACCCAAGGGAGCTGCNGANTTTACNGCTCAGGTTATCGTTCTGAACCATCCTGGTCAGATTAGCAACGGTTACACACCGGTTTTGGATTGCCACACCGCACATATAGCGTGCAAATTCGCTGAAATCAAAGAGAAGTGCGACCGACGTACGGGAAAAACAACAGAAGAGAATCCTAAGGCGATAAAATCTGGAGATGCTGCGATAGTTAATCTTGTACCTAGCAAGCCTATGTGCGTCGAGGCTTCCCAGGAATTCCCACCTTTGGGACGTTTC------------
+Corynis                 GCTGAACGTGAACGTGGTATCACCATTGATATTGCTCTGTGGAAGTTCGAGACTAGCAAGTACTATGTAACCATCATTGATGCTCCTGGTCACAGAGATTTCATCAAGAACATGATCACTGGTACCTCTCAGGCCGATTGTGCGGTGTTGATTGTTGCCGCTGGTACAGGAGAGTTTGAAGCTGGTATTTCGAAGAATGGTCAGACCCGTGAGCACGCGCTCCTTGCTTTCACTCTTGGTGTAAAGCAGCTGATTGTTGGAGTGAACAAGATGGATTCCACTGAGCCTCCTTACTCTGAAGCTCGTTTTGAGGAAATTAAGAAGGAAGTATCGTCGTACATCAAGAAAATTGGTTACAACCCTGCAGCTGTTGCTTTCGTTCCCATTTCTGGATGGCACGGAGACAACATGCTCGAACAATCCTCCAAAATGCCATGGTTCAAGGGATGGAGCGTTGAGCGCAAAGAAGGCAAGGCTGATGGCAAGTGCTTGATTGAAGCTCTCGATGCTATCCTCCCACCCAGCAGACCTACCGACAAGGCTCTCCGACTTCCCCTTCAGGACGTCTACAAGATTGGTGGTATTGGAACTGTACCTGTCGGTCGTGTTGAAACCGGTGTCTTGAAGCCTGGTACCGTTGTTACATTCGCACCTGCAGGACTTACCACTGAAGTAAAATCCGTTGAAATGCATCACGAAGCTCTCGTCGAGGCTGTGCCTGGTGACAACGTTGGATTCAACGTAAAGAACGTCTCCGTAAAGGAACTTCGTCGTGGATACGTCGCTGGCGACTCAAAGAACAACCCGCCTAGGGGAGCAGCTGACTTCACCGCTCAGGTCATCGTTCTGAACCATCCAGGACAGATTAGCAACGGTTATACTCCAGTTTTGGATTGCCACACCGCACACATAGCGTGCAAGTTTGCCGAAATCAAGGAAAAGTGTGACCGACGTACGGGTAAAACAACTGAGGAAAATCCAAAGGCGATAAAGTCAGGAGATGCTGCGATAGTGAATCTGGTACCCAGCAAACCAATGTGCGTTGAGGCTTTCCAAGAATTTCCACCTTTGGGACGTTTTGCTGTACGTGAC
+Arge                    GCTGAACGTGAACGTGGTATCACCATCGATATCGCTCTGTGGAAGTTCGAGACTGCCAAGTACTACGTAACGATCATTGACGCTCCTGGACACAGGGATTTCATCAAGAACATGATCACTGGTACCTCCCAGGCTGATTGCGCCGTGCTCATTGTCGCCGCTGGTACGGGAGAGTTCGAGGCTGGTATCTCCAAGAATGGACAGACTCGCGAGCACGCTCTTCTCGCTTTCACTTTGGGAGTGAAACAGCTGATTGTCGGAGTCAACAAAATGGACTCTACCGAACCCCCTTACTCCGAGTCTCGTTTCGAGGAAATCAAGAAAGAAGTATCGTCGTACATCAAGAAGATCGGTTACAACCCTGCTGCCGTTGCCTTCGTACCCATTTCCGGATGGCACGGAGACAACATGTTGGAACCATCCACTAAGATGCCGTGGTTCAAGGGATGGGCTGTTGAACGTAAGGAAGGTAAAGCGGACGGCAAGTGCCTGATCGAAGCCCTCGACGCTATCCTTCCACCCAGCAGACCCACCGACAAGGCTCTTCGTCTGCCCCTGCAGGACGTCTACAAGATTGGTGGTATCGGAACGGTACCCGTCGGTCGTGTCGAAACTGGTGTCCTGAAACCAGGTACCGTCGTCACTTTCGCACCAGCTGGCCTCACGACTGAAGTAAAGTCCGTGGAAATGCACCACGAAGCCCTCGTCGAAGCTGTTCCCGGAGACAACGTTGGTTTCAACGTTAAAAACGTCTCCGTTAAGGAATTGCGTCGTGGTTACGTCGCCGGTGACTCCAAGAACAACCCGCCCAGAGGAGCTGCTGATTTCACGGCTCAGGTTATCGTGTTGAACCATCCTGGTCAGATCAGCAACGGTTATACTCCAGTTTTGGATTGCCACACGGCCCACATCGCGTGCAAGTTCGCGGAGATCAAGGAGAAGTGTGACCGACGTACCGGTAAAACGACGGAAGAGAACCCAAAGGCGATCAAATCTGGTGACGCCGCGATCGTGAACCTGGTCCCGAGCAAGCCAATGTGCGTCGAATCTTTCCAGGAGTTCCCACCGTTGGG-------------------
+Sterictiphora           ---------------------------------------------------------------------------------------------------------------ATGATCACTGGTACCTCTCAGGCCGATTGCGCTGTGCTGATTGTCGCTGCCGGTACGGGAGAATTCGAGGCTGGTATCTCGAAGAATGGCCAGACCCGTGAGCACGCTCTGCTTGCTTTCACCTTGGGAGTCAAGCAGCTGATCGTTGGAGTCAACAAAATGGACTCCACCGAGCCCCCCTTCTCTGAGTCCCGTTTCGAGGAAATCAAGAAAGAAGTCTCCTCCTACATCAAGAAGATCGGTTACAACCCAGCTGCCGTTGCCTTCGTTCCCATCTCCGGATGGCACGGTGACAACATGTTGGAGGTCTCCACCAAGATGCCATGGTTCAAGGGATGGGCTGTTGAGCGCAAGGAAGGCAAGGCCGACGGCAAGTGCCTGATCGAAGCTCTCGACGCTATCCTGCCCCCTAGCAGACCCACCGACAAGGCTCTGCGTCTGCCCCTGCAGGACGTTTACAAGATTGGTGGTATTGGAACGGTACCCGTCGGTCGTGTCGAGACTGGTGTGCTGAAGCCCGGTACCGTCGTCACTTTCGCGCCTGCTGGTCTGACCACTGAAGTCAAATCCGTGGAAATGCACCACGAAGCCCTCACTGAGGCCGTTCCCGGAGACAACGTTGGTTTCAACGTTAAGAACGTCTCCGTCAAGGAATTGCGTCGTGGATACGT----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Perga                   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Phylacteophaga          GCTGAGCGTGAACGTGGTATCACCATTGACATTGCTCTGTGGAAGTTTGAGACTGCCAAGTACTACGTTACCATCATTGACGCCCCTGGACACAGAGATTTCATTAAGAACATGATCACTGGAACGTCGCAAGCTGATTGTGCTGTGTTGATCGTCGCTGCTGGTACGGGAGAATTCGAGGCTGGTATCTCGAAAAATGGGCAGACTCGTGAGCATGCCCTCCTAGCTTTCACTCTGGGAGTGAAGCAACTCATTGTTGGAGTGAACAAGATGGATTCCACTGAGCCGCCATACTCTGAGGCTCGATTTGAGGAAATTAAGAAGGAAGTTTCCTCATACATCAAGAAAATTGGGTATAACCCAGCTGCCGTTGCCTTCGTCCCCATTTCTGGATGGCACGGAGACAACATGTTGGAACCTTCCACCAAAATGTCCTGGTTCAAGGGATGGGCTGTGGAACGTAAGGAAGGCAAGGCTGACGGCAAGTGCCTCATTGAAGCTCTAGACGCCATCCTTCCCCCCAGCAGACCCACCGACAAGGCTCTGCGTCTCCCTCTGCAGGACGTGTACAAAATCGGCGGTATTGGAACGGTACCCGTCGGTCGTGTTGAGACTGGAGTGTTGAAACCAGGTATGGTTGTGACCTTCGCTCCAGCTGGTCTCACCACTGAAGTCAAGTCTGTCGAGATGCACCACGAAGCCCTCACGGAGGCTGTTCCCGGAGACAACGTTGGTTTCAACGTCAAGAACGTCTCCGTCAAGGAATTGCGTCGTGGATACGTGGCTGGCGACTCAAAAGCCAACCCACCGCGAGGAGCAGCTGACTTCACTGCTCAGGTCATCGTGTTGAACCATCCCGGACAAATTAGCAACGGATACACGCCAGTGCTGGATTGCCACACCGCTCACATCGCCTGCAAGTTCGCTGAAATCAAAGAGAAGTGTGACCGACGTACCGGTAAAACGACGGAAGAGAACCCGAAGGCTATCAAATCTGGGGACGCTGCGATTGTGAATCTCGTACCCAGCAAGCCTATGTGCGTGGAAGCCTTCCAGGAGTTCCCGCCTT-----------------------
+Lophyrotoma             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Acordulecera            GCAGAGCGTGAACGTGGTATCACCATCGACATTGCCCTGTGGAAGTTCGAGACTGCCAAATACTACGTAACGATCATCGACGCTCCAGGACACAGAGATTTCATCAAGAACATGATCACTGGTACGTCCCAGGCTGACTGCGCCGTCTTGATCGTTGCTGCCGGTACCGGAGAATTTGAGGCTGGTATCTCGAAGAACGGACAAACTCGCGAGCACGCTCTCCTTGCCTTCACTTTGGGAGTGAAGCAGCTGATCGTAGGAGTTAACAAGATGGACTCCACCGAGCCACCATACTCCGAAGCTCGTTTCGAGGAAATCAAGAAGGAAGTGTCTTCTTACATCAAGAAAATTGGTTACAATCCAGTTGCTGTACCATTCGTTCCCATCTCTGGATGGCACGGAGACAACATGTTGGAAGTTTCCAGCAAAATGAACTGGTTCAAGGGATGGTCTGTCGAGCGCAAGGAAGGCAAGGCTGACGGCAAGTGCTTGATTGAAGCTCTTGACGCTATCCTGCCACCCAGCCGACCCACCGACAAGGCACTCCGTCTTCCCCTTCAGGATGTCTACAAAATTGGTGGTATTGGAACAGTACCCGTCGGTCGTGTCGAGACTGGTGTCATCAAGCCCGGTATGGTCGTCGTTTTCGCTCCAGCTGGTCTGACGACTGAAGTCAAGTCAGTCGAGATGCACCACGAAGCCCTCGTCGAAGCCGTTCCCGGCGACAACGTTGGTTTCAACGTCAAGAACGTGTCCGTCAAGGAATTGCGTCGTGGATACGTCGCCGGTGACACGAAGTCCAACCCACCCAAGGGAGCTGCCGACTTCACGGCTCAGGTCATCGTCCTGAACCACCCTGGACAAATCAGCAACGGATACACTCCGGTTTTGGATTGCCACACCGCTCACATCGCGTGCAAGTTCGCCGAGATCAAGGAGAAGTGCGACCGACGTACCGGCAAAACCACCGAAGAAAATCCCAAGGCAATCAAGTCCGGAGACGCAGCTATCGTCAACCTAGTGCCCAGCAAACCAATGTGCGTCGAAGCTTTCCAGGAGTTCCCACCTCTGGGTCGTTTCGCTGTCCNTGAC
+Decameria               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Neurotoma               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Onycholyda              GCTGAGCGTGANCGTGGTATCACCATCGACATTGCCCTGTGGAAGTTCGAGACCGCCAAGTACTATGTCACCATCATCGACGCCCCCGGTCACAGGGATTTCATCAAGAACATGATCACTGGTACTTCGCAGGCTGATTGTGCTGTGCTGATCGTCGCTGCCGGTACGGGAGAGTTCGAGGCTGGTATCTCGAAGAACGGACAGACCCGCGAGCACGCCCTGCTCGCCTTCACCCTTGGAGTGAAGCAGCTGATCGTTGGTGTCAACAAGATGGACTCCTCCGAACCCCCGTACTCTGAGACCCGTTTCGAGGAAACCAAGAAGGAAGTTTCTTCTTTCCTTAAGAAAATCGGTTACAATCCAGCTGCCGTCGCTTTCGTGCCCATTTCCGGATGGAACGGAGACAACATGTTGGAGGCCTCCGCCAAAATGCCATGGTTCAAGGGATGGGCTGTT---------------------------------------------------------------------------------------------------------GACGTTTACAAAATTGGTGGTATTGGAACGGTACCCGTTGGCCGTGTGGAGACTGGTCTGCTTAAGCCTGGTATGGTCGTAACTTTCGCCCCTGCTGGTCTGACGACTGAAGTTAAGTCCGTTGAGATGCACCACGAAGCCCTCGTCGAGGCTGTGCCCGGAGACAACGTCGGTTTCAACGTCAAGAACGTTTCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGTGAC------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Pamphilius              GCTGAGCGTGAACGTGGTATCACCATCGACATTGCCCTGTGGAAGTTCGAGACCGCCAAGTACTATGTCACCATCATCGACGCCCCCGGTCACAGGGATTTCATCAAGAACATGATCACTGGTACTTCGCAGGCTGATTGTGCTGTGCTGATCGTCGCTGCCGGTACGGGAGAGTTCGAGGCTGGTATCTCGAAGAACGGACAGACCCGTGAGCACGCCCTGCTCGCCTTCACCCTTGGAGTGAAGCAGCTGATCGTTGGTGTCAACAAGATGGACTCCTCCGAACCCCCGTACTCTGAGACCCGTTTCGAGGAAATCAAGAAGGAAGTTTCTTCTTACATTAAGAAAATCGGTTACAACCCAGCTGCCGTCGCTTTCGTGCCCATTTCCGGATGGAACGGAGACAACATGTTGGAGCCCTCCGCAAACATGCCATGGTTCAAGGGATGGGCTGTGGACCGCAAGGAAGGCAAGGCTGAAGGCAAATGCCTGATTGAGGCCCTCGACGCTATCCTGCCACCTTCCAGGCCAACCAACAAGCCCCTTCGTCTTCCCCTCCAGGACGTTTACAAAATTGGTGGTATTGGAACGGTACCCGTTGGCCGTGTGGAGACTGGTCTGCTCAAGCCTGGTATGGTCGTTACTTTCGCCCCTGCTGGTCTGACGACTGAAGTTAAGTCCGTTGAGATGCACCACGAAGCCCTCGTCGAGGCTGTGCCCGGAGACAACGTCGGTTTCAACGTCAAGAACGTTTCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGTGACTCAAAGAGCAACCCACCCAGGGGTGCTGCTGACTTCAACGCTCAGGTCATTGTACTGAACCACCCTGGTCAGATCAGCAACGGCTACACTCCAGTGCTTGATTGCCACACGGCTCACATTGCCTGCAAATTCGCTGAGATCAAAGAGAAGTGTGACCGTCGTACCGGCAAAACCACCGAAGAAAACCCCAAGGCCATCAAGTCTGGAGACGCCGCCATCGTCACCCTAGTGCCCAGCAAGCCCATGTGCGTCGAGCCTTCCCAGGAGTTCCCTCCTTTGGGACGTTTCGCTGCACGTGAT
+Cephalcia               ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGTGACTCAAAGAGCAACCCACCCAGGGGTGCTGCTGACTTCAACGCTCAGGTCATNGTACTGAACCACCCTGGTCAGATCAGCAACGGCTACACTCCAGTGCTCGATTGCCACACGGCTCACATGGCCTGCAAATTCGCTGAGATCAAAGAGAAGTGTGACCGTCGTACCGGCAAAACCACCGAAGAAAACCCCAAGGCCATCAAGTCTGGAGACGCCGCCATCGTCACCCTAGTGCCCAGCAAGCCCATGTGCGTCGAGGCTTCCCAGGAGTTCCCTCCTTTAGGACGTTTCGCNGTNCGTGAC
+Acantholyda             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Megalodontesc           GCTGAGCGCGAACGTGGTATCACCATTGATATTGCCCTCTGGAAGTTTGAAACCTCCAAGTACTACGTCACCATCATTGATGCTCCAGGACACAGGGATTTCATTAAGAACATGATTACTGGAACTTCTCAGGCTGATTGTGCCGTATTGATCGTTGCTGCTGGTACTGGTGAATTCGAAGCCGGTATCTCAAAGAACGGTCAGACTCGTGAGCACGCCCTGTTGGCTTTCACTCTTGGTGTCAAACAATTGATTGTTGGTGTCAACAAGATGGATTCAACCGAACCTCCCTACTCCGAATCCCGTTTCGAGGAAATCAAGAAAGAAGTTTCTTCGTACATCAAGAAAATTGGTTACAATCCTGACGCCGTTGCTTTCGTACCTATCTCTGGATGGCACGGAGATAACATGTTGGAGCCATCTTCCAAAATGCCATGGTTCAAGGGATGGGCTGTTGAACGTAAAGATGGAAACGCTAAGGGTAATTGCCTCATCGAAGCTCTCGACGCCATCCTCCCTCCCAGCAGACCCACTGACAAGCCCCTCCGTCTTCCATTGCAGGACGTTTACAAAATTGGTGGTATCGGAACGGTACCCGTTGGTCGTGTAGAAACTGGTATGCTGAAACCAGGTATGGTCGTTACATTCGCCCCCGCTGGTCTGACCACTGAAGTTAAATCCGTGGAAATGCACCACGAAGCCTTTACGGAGGCTGTGCCCGGTGACAACGTTGGTTTCAACGTCAAGAACGTTTCTGTTAAGGAATTGCGTCGTGGATACGTAGCTGGTGACTCTAAGAACAATCCACCAAGGGGTGCTGCTGACTTCACAGCACAGGTCATCGTGTTGAATCACCCTGGTCAAATCAGTAACGGATACACGCCTGTGTTGGATTGCCACACGGCTCACATCGCTTGCAAGTTCGCTGAAATCAAAGAGAAGTGCGACCGTCGTACTGGTAAAACCACTGAAGAAAACCCTAAGGCTATTAAATCCGGAGACGCTGCGATTGTTAACCTCGTCCCCAGCAAGCCCATGTGTGTAGAGGCCTTCCAAGAGTTCCCGCCTTTAGGACG----------------
+Megalodontessk          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Cephus                  GCCGAGCGTGAACGTGGTATCACCATTGACATTGCTCTCTGGAAATTCGAGACGGCCAAATATTACGTGACCATCATCGATGCTCCCGGACACAGAGATTTCATCAAGAACATGATCACGGGAACGAGTCAGGCCGATTGTGCTGTGCTAATTGTGGCAGCTGGTACTGGAGAGTTCGAGGCGGGTATCTCGAAGAACGGACAGACCCGTGAGCACGCACTTCTTGCTTTCACCCTGGGTGTCAAGCAACTCATCGTCGGTGTCAACAAGATGGACTTCACCACACCTCCATACTCTGAGGCTCGTTACGAGGAAATCAAGAAGGAAGTATCGTCATACATTAAGAAGATTGGTTACAACCCATCTGCGGTTGCCTTTGTTCCCATTTCCGGATGGAACGGCGACAACATGTTGGAGCCCTCCGCCAAAATGCCATGGTTCAAGGGATGGACTGTGGAACGTAAGGAAGGCAAGGTTGAAGGAAAGACCCTCATTGAGGCCCTAGACGCTATCCTTCCACCTTCCAGGCCCACCGACAAGCCCCTGCGTCTTCCTCTCCAGGACGTATACAAGATTGGTGGTATTGGAACAGTACCCGTTGGTCGTGTTGAGACTGGTGTCTTGAAACCCTCTATGGTGGTGACTTTCGCTCCCGCTGGAATTACCACTGAAGTCAAGTCCGTTGAAATGCATCACGAGGCCCTGACGGAAGCTGTTCCCGGAGACAATGTTGGTTTCAACGTCAAGAGCGTCTCCGTGAAGGAATTGCGTCGTGGATACGTCGCTGGAGACTCCAAAAACAATCCACCCAAGGGTGCTGCTGACTTCACTGCACAGGTCATCGTGCTGAACCACCCTGGTCAGATTAGCAACGGATACACGCCCGTGTTGGATTGCCACACGGCACACATTGCGTGCAAGTTCGCAGAGATCAAGGAGAAGTGCGACCGTCGTACCGGCAAAACCACCGAGGAGAACCCGAAGGCAATCAAGTCCGGTGACGCCGCCATCGTCAATCTGGTGCCCAGCAAGCCCATGTGCGTCGAGGCTTTCCAGGAGTTCCCTCCC------------------------
+Calameuta               GCTGAGCGYGARCGTGGTATCACCATTGACATTGCTCTATGGARATTCGAGACGGCCAAGTATTACGTGACCATCATCGATGCTCCTGGACACAGAGATTTCATTAAGAACATGATCACGGGAACGAGTCAGGCTGATTGTGCTGTGCTGATCGTGGCAGCTGGTACCGGAGAGTTCGAAGCGGGTATCTCCAAGAACGGACAGACCCGYGAGCACGCACTTCTTGCTTTCACCCTGGGTGTCAAGCAGCTCATCGTCGGTGTCAACAAGATGGACTTCACCACACCCCCATACTCTGAGGCTCGTTACGAAGAAATCAAGAAGGAAGTATCGTCATACATCAAGAAGATTGGTTACAACCCAGCTGCTGTTGCCTTCGTTCCCATTTCCGGRTGGAACGGCGACAACATGTTGGAGCCCTCCGCCAAAATGCCATGGTTCAAGGGATGGACTGTGGAACGTAAGGAAGGCAAGGTTGAAGGAAAGTGCCTCATTGAGGCCCTAGACGCTATCCTCCCACCTTYCAGGCCCACCGACAAGCCCCTGCGTCTTCCTCTCCAGGACGTGTACAAGATTGGTGGTATTGGAACAGTACCCGTTGGTCGTGTGAAGACTGGTGTCTTGAAACCCTCTATGTTGGTGACTTTCGCTCCCGCTGGAATCACCACTGAAGTCAAGTCCGTYGAAATGCATCACGAGGCTCTAACGGAAGCTGTTCCCGGGGACAACGTTGGTTTCAACGTCAAGAGCGTCTCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGAGACTCCAAAAATAATCCACCCAAGGGTGCTGCTGACTTCACTGCACAGGTCATCGTGCTGAACCACCCTGGTCAGATTAGCAACGGATACACGCCCGTGCTGGATTGCCACACGGCACACAYTGCGTGCAAGTTCGCAGAGATCAAGGAGAAGTGCGACCGTCGTACCGGCAAAACTACCGAGGAAAACCCGAAGGCAATCAAGTCCGGTGACGCCGCCATCGTCAATCTGGTGCCCAGCAAGCCCATGTGCGTCGAGGCTTTCCAGGAGTTCCCTCCCCTGGGTCGTTTCGCCGTTCGTGAC
+Hartigia                GCTGANCGCGAACGTGGTATCACCATTGACATTGCTCTCTGGAAATTCGAGACGGCCAAGTATTACGTGACCATCATCGATGCTCCTGGACACAGAGATTTCATCAAGAACATGATCACGGGAACAAGTCAGGCTGATTGTGCTGTGTTAATCGTGGCAGCTGGTACTGGAGAGTTCGAAGCGGGTATCTCCAAGAACGGACAGACCCGTGAACACGCACTTCTTGCTTTCACCTTGGGTGTCAAGCAGCTCATCGTCGGTGTCAACAAGATGGACTCCACTGCACCACCATACTCTGAGGCCCGTTTCGAGGAAATCAAGAAAGAAGTATCGTCATACATCAAGAAGATCGGTTATAACCCAGCTGCTGTTGCCTTCGTTCCCATTTCCGGATGGAATGGCGACAACATGCTGGAGGCCTCCGCCAAAATGCCATGGTTCAAGGGATGGCTTGTGGAACGTAAGGAAGGCAAGGTTGAAGGAAAGTGCCTCATTGAGGCCCTAGATGCTATCCTCCCACCTTCCAGGCCCACCGACAAGCCTCTGCGTCTTCCTCTCCAGGACGTCTACAAGATTGGTGGTATCGGAACAGTACCCGTTGGTCGTGTGGAGACTGGTGTCTTGAAACCCTCTATGGTGGTGACTTTCGCTCCTGCTGGAATCACCACTGAAGTCAAGTCCGTTGAAATGCATCACGAAGCCCTGACGGAGGCTGTTCCCGGAGACAATGTTGGTTTCAACGTCAAGAGCGTCTCCGTCAAGGAATTGCGTCGTGGATACGTCGCTGGAGACTCCAAAAACAATCCACCTAAGGGTGCTGCTGACTTCACTGCACAGGTCATCGTGCTGAACCACCCTGGTCAGATTAGCAATGGATACACGCCCGTGCTGGATTGCCACACGGCTCACATCGCGTGCAAGTTCGCAGAGATCAAGGAGAAGTGCGACCGTCGTACCGGCAAAACCACTGAGGAGAACCCGAAGGCAATCAAATCCGGTGACGCTGCCATCGTCAACCTGGTGCCCAGCAAGCCCATGTGCGTCGAGGCTTTCCAGGAGTTCCCTCCCTTGGGTCGTTTCGCCGTTCGTGAC
+Syntexis                GCTGANCGTGAGCGTGGTATCACCATCGACGTTGCCCTGTGGAAGTTCGAAACGGGCAAGTACTATGTCACTATTATCGACGCCCCTGGACACAGAGATTTCATCAAGAACATGATTACCGGAACCTCGCAGGCTGACTGCGCAGTCTTGATCGTCGCGGCTGGTACTGGTGAATTTGAGGCTGGTATCTCGAAGAACGGACAGACCCGTGAGCACGCTCTGCTTGCCTTCACTCTTGGTGTGAAGCAGCTGATCGTCGGTGTTAACAAGATGGACTCCACCGAGCCCCCGTATTCGGAAGCTCGTTTCGAGGAAATCAAGAAGGAAGTGTCTTCTTACATCAAGAAGATCGGTTACAATCCCGCTGCCGTCGCTTTTGTACCTATTTCTGGCTGGCACGGTGATAACATGTTGGAGCCGTCCTCCAAAATGCCATGGTTCAAGGGATGGAACGTCGACCGCAAGGAAGGCAAGGGTGAAGGCAAGTGCCTCATCGAAGCTCTCGATGCCATCCTGCCACCCAGTAGGCCAACCGACAAGCCGCTCCGTCTTCCCCTCCAGGACGTGTACAAGATTGGTGGTATCGGAACGGTACCAGTCGGTCGTGTTGAGACCGGTGTCCTGAAGCCCGGTATGGTGGTTACGTTTGCCCCTGCTGGACTGACGACTGAAGTCAAATCCGTTGAAATGCATCACGAGGCTCTGACCGAAGCTGTACCCGGTGACAACGTCGGTTTCAACGTCAAGAACGTATCTGTCAAGGAGTTGCGTCGTGGATACGTCGCTGGTGACTCCAAGAATAATCCCCCCAAAGGAGCTGCTGACTTCACTGCACAGGTAATTGTGCTCAACCACCCTGGTCAGATCAGCAATGGATACACGCCCGTGTTGGATTGCCACACGGCCCACATTGCTTGCAAGTTTGCCGAGATCAAGGAGAAGTGCGACCGTCGTACGGGAAAGACCACAGAGGAAAATCCTAAGGCCATCAAGTCTGGTGATGCCGCCATCGTGAACCTCGTGCCGAGCAAACCCATGTGCGTCGAGGCTTTCCAGGAATTCCCTCCTCTAGGACGTTTC------------
+Sirex                   GCTGAGCGCGAACGTGGTATCACCATTGACATTGCCCTGTGGAAATTCGAAACGGCAAAATATTACGTTACTATTATTGATGCTCCCGGACACAGAGATTTCATCAAGAACATGATCACTGGAACTTCGCAAGCCGATTGTGCAGTTCTGATTGTCGCGGCTGGTACCGGAGAATTTGAGGCCGGTATTTCGAAAAATGGACAGACTCGTGAGCATGCTTTGCTCGCTTTCACTCTCGGCGTCAAGCAATTGATCGTTGGTGTGAACAAGATGGACTCTACCGAACCTCCTTACTCCGAAGCCCGTTTCGAGGAAATTAAGAAAGAAGTCTCCTCGTACATTAAAAAGATTGGTTACAATCCTAGTGCTGTTGCCTTTGTACCAATTTCTGGCTGGCACGGAGACAACATGTTAGAAAGTTCTTCTAAAATGCCCTGGTTCAAGGGATGGAACGTGGAGCGCAAGGAGGGCAAGGCTGAAGGCAAGTGCCTCATCGAAGCACTCGATGCCATTTTGCCACCTTCCAGGCCAACTGACAAGCCTCTGCGTCTTCCCCTTCAG------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------GTTATTGTGCTGAACCATCCTGGTCAGATTAGCAATGGATACACGCCTGTGTTAGATTGTCACACGGCTCACATTGCATGCAAATTCGCCGAGATCAAGGAGAAGTGCGATCGTCGTACGGGAAAAACCACGGAAGAAAATCCTAAGGCCATCAAATCTGGCGATGCTGCAATTGTGAACCTCGTGCCGAGCAAACCCATGTGCGTCGAATCTTTCCAAGAATTCCCACCGTTGGCACGTTTTGCGGTGCGTGAC
+Xeris                   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Urocerus                ------------------------------ATTGCCCTCTGGAAATTTGAAACGGCAAAGTACTACGTTACCATCATCGATGCTGGCGGACACAGAGATTTCATCAAGAACATGATCACCGGAACTTCGCAAGCCGATTGTGCAGTTCTAATTGTCGCGGGTGGCACCGGAGAGTTTGAGGCGGGTATTTCAAAAAATGGACAGACTCGCGAGCATGCTTTACTCGCGTTCACTCTCGGTGTCAAGCAATTGATCGTTGGTGTGAACAAGATGGACTCTACCGAACCTCCTTATTCCGAGTCCCGTTTCGAGGAAATCAAGAAGGAAGTGTCCTCGTACATCAAAAAGATTGGTTACAATCCTAGTGCCGTTGCCTTCGTACCAATTTCTGGCTGGCACGGAAACAATATGTTGGAAAGTTCTTCTAAAATGCCCTGGTTCAAGGGATGGAACGTAGAGCGCAAGGAAGGCAAGGCCAAAGGCAAGTGCCTCATCGAAGCACTCAATGCCATCCTGCCACCTTCCAGGCCAACTGACAAGCCTCTCCGTCTTCCCCTTCAG------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TCTGTCAAGGAACTGCGTCGTGGATACGTCGCTGGCGACTCGAAGAACAATCCTCCCAAAGGCGCCGCTGATTTCACTGCACAGGTTATCGTACTGAACCATCCTGGTCAGATTAGCAACGGGTACACACCTGTGCTGGATTGTCACACGGCTCACATTGCGTGCAAATTCGCCGAGATTAAGGAGAAGTGCGATCGTCGTACGGGAAAGACCACCGAAGAAAATCCCAAGGCCATCAAATCTGGCGATGCCGCCATTGTGAACCTCGTGCCGAGCAAACCCATGTGCGTCGAATCTTTCCAAGAATTTCCCCCGTTGGGACGTTTCGCCGTTCGTGAC
+Tremex                  -----------------------------CATTGCTCTCTGGAAATTTGAAACAGCCAAATACTATGTTACTATTATTGATGCTCCCGGACACAGAGATTTTATTAAAAACATGATTACTGGAACTTCACAAGCCGATTGTGCAGTTTTAATCGTCGCAGCTGGTACCGGAGAGTTCGAAGCGGGTATTTCAAAAAACGGACAGACACGTGAGCATGCTTTGCTCGCTTTCACTCTTGGTGTCAAGCAACTGATTGTTGGTGTTAATAAGATGGACTCTACCGAACCTCCTTATTCCGAGTCTCGTTTCGAGGAAATCAAGAAGGAAGTGTCCTCGTACATTAAGAAGATTGGTTACAATCCTAGTGCTGTTGCTTTCGTACCTATTTCTGGCTGGCACGGAGACAATATGTTAGAAAGTTCTGCTAAAATGCCCTGGTTCAAGGGATGGAACGTGGAGCGCAAGGAAGGAAAGGCCAATGGNAACACCCTCATCGAGGCACTCGATGCTATCTTGCCGCCTTCCAGGCCAACTGACAAGCCTCTACGTCTTCCCCTCCAGGATGTGTACAAGATTGGTGGTATTGAAACAGTACCCGTTGGTCGTGTCGAGACTGGTGTACTGAAACCCGGTATGGTGGTTACCTTTGCTCCTGCTGGAATCACCACTGAAGTTAAATCCGTTGAAATGCATCACGAGGCCTTGACCGAGGCTGTACCGGGTGACAATGTTGGTTTCAACGTAAAGAACGTTTCCGTCAAGGAATTACGTCGTGGATACGTTACTGGTGACTCGAAGAACAATCCTCCCAGAGGTGCCGCTGATTTCACTGCACAGGTCATTGTATTGAATCACCCTGGTCAGATAAGCAATGGATACACGCCCGTGCTGGATTGTCACACGGCTCACATTGCCTGCAAATTCGCTGAGATCAAGGAGAAGTGCGACCGTCGTACGGGAAAGACCACAGAGGAAAATCCCAAGGCGATAAAATCTGGCGACGCTGCCATTGTAAACCTCGTCCCGAGCAAACCCATGTGCGTCGGAGCTTCCCAGGAGTTTCCCCCGTTGGGACGTTTCGCCGTTCGTGAC
+Xiphydria               GCTGAGCGCGAGCGTGGTATCACCATCGACATCGCTCTCTGGAAGTTTGAGACGAACAAGTACTATGTCACGATCATCGACGCCCCGGGACATAGAGATTTCATCAAAAACATGATCACGGGAACCTCGCAAGCTGACTGCGCCGTTTTGATTGTCGCTGCCGGTACCGGCGAATTCGAGGCCGGTATCTCGAAAAATGGACAAACCCGCGAACACGCTCTGCTCGCCTTCACCCTCGGCGTGAAGCAGCTGATCGTCGGCGTGAACAAGATGGACTCCACAGAGCCTCCCTACTCGGAGGCCCGTTTCGAAGAAATTAAGAAAGAAGTTTCCTCNTACATCAAGAAGATCGGTTACAATCCCGCCGCTGTGGCTTTCGTCCCCATTTCCGGCTGGCACGGAGACAACATGCTCGAGCCCTCCTCCAAAATGCCNTGGATCAAGGGATGGGCCGTGGAGCGCAAAAAAGGCAAGGCCGATGGCAAATGCCTGATCGAAGCTCTCAATGCCATCCTGCCACCTTCCAGGCCAACTGACAAGCCTCTCCGTCTTCCCTTTCAGGATGTATACAAAATTGGTGGAATCGGAACGGTACCAGTCGGTCGTGTGGAGACTGGTGTCCTCAAGCCAGGCATGGTTGTTACATTCGCACCCGCGGGCCTGACGACTGAAGTTAAGTCCGTAGAGATGCACCACGAAGCCCTGACCGAGGCCGTCCCGGGTGACAACGTTGGTTTCAACGTTAAGAACGTCTCAGTCAAGGAATTGCGTCGTGGTTACGTCGCTGGTGACTCGAAAAATAACCCGCCCAGAGGAGCAGCTGACTTCACTGCACAGGTTATCGTGCTGAATCACCCTGGTCAAATCAGCAACGGATATACGCCAGTGTTGGACTGTCACACGGCCCACATTGCGTGCAAGTTCGCTGAGATCAAGGAGAAGTGCGACCGTCGTACGGGAAAGACCACCGAAGAGAATCCCAAGTCCATCAAGTCTGGCGATGCCGCTATTGTGACTCTTGTGCCCAGCAAACCCATGTGCGTCGAGGCCTTCCAAGAGTTCCCTCCGTTAGGACGGTTCGCAGTGCGTGAC
+Orussus                 GCTGAGCGYGARCGTGGTATCACTATTGACATTGCCTTGTGGAAGTTTGAAACGGCTAAATACTATGTCACTATTATCGATGCGCCTGGACACAGAGACTTTATTAAAAACATGATTACTGGAACCTCGCAAGCTGACTGCGCTGTACTCATTGTCGCCGCAGGTACCGGCGAGTTTGAAGCCGGTATCTCCAAGAATGGACAGACTCGTGAGCACGCTCTGCTCGCGTTTACCCTTGGCGTCAAGCAGCTGATCGTTGGTGTCAATAAAATGGACTCCACCGAACCCCCATACTCGGAAACTCGATTCGAGGAAATTAAGAAGGAAGTGTCGTCGTACATTAAGAAAATCGGTTACAACCCTGCTGCTGTAGCGTTTGTACCGATCTCAGGATGGCACGGAGATAACATGTTGGAATCCTCTTCCAAGATGCCTTGGTTCAAGGGATGGACCGTGGAACGAAAGGAAGGCAAGACGGAGGGCAAGTGCCTCATCGAAGCCCTCGATGCTATCTTGCCCCCTACCAGGCCTACCGACARGCCTCTGCGTCTTCCYCTCCAGGACGTGTACAAGATCGGCGGTATCGGAACGGTACCGGTAGGTCGTGTGGAGACTGGCGTTCTGAAACCCGGTATGGTGGTTACGTTTGCTCCTGCTGCCCTGACCACCGAAGTGAAGTCGGTCGAGATGCATCACGAGGCCTTGGTGGAGGCCGTTCCCGGTGACAACGTAGGTTTCAACGTGAAAAACGTGCCTGTTAAGGATCTGCGTCGAGGATACGTAGCTGGTGATTCGAAAAATAATCCCCCAAGGGGAGCCGCTGACTTCACTGCACAGGTAATCGTATTAAACCACCCTGGCCAAATTCAGGACGGGTACACGCCCGTGTTGGATTGTCACACGGCCCACATTGCTTGCAAGTTCGCCGAGATCAAGGAAAAGTGCGACCGTCGTACGGGAAAGAGTACCGAAGTCAACCCGAAGTCCATCAAGACCGGCGACGCCGCCATCGTGACCCTTGTGCCCACCAAGCCCATGTGCGTCGGAGCCTTCCAGGAGTTCCCACCCCTGGGACGATTCGCGGTGCGTGAC
+StephanidaeA            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+StephanidaeB            ---------------------ACCATCGACATTGCTCTGTGGAAGTTTGAAACTGCCAAATACTATGTCACGATTATTGATGCTCCAGGACATAGAGATTTTATCAAGAATATGATTACTGGAACATCACAAGCTGATTGTGCAGTATTAATTGTGGCAGCTGGCACTGGAGAATTTGAAGCTGGAATTTCGAAAAATGGACAAACTCGTGAACATGCATTACTTGCTTTCACTTTGGGTGTCAAACAGCTAATTGTGGGTGTTAATAAGATGGACTCAACTGATCCTCCATATTCTGAGGCTCGTTTTGAGGAAATAAAGAAAGAAGTTTCTTCGTATATTAAAAAAATTGGTTATAATCCTGCTGGAGTTGCATTTGTGCCAATTTCTGGTTGGCATGGTGATAATATGTTGGAGGTTTCTCCTAAAATGCCTTGGTTTAAGGGATGGAATGTTGAACGTAAGGAAGGTAAAGGTGAAGGAAAATGCCTTATTGAAGCTCTTGATGCTATTTTACCTCCTACAAGACCAACAGATAAGCCTCTCCGTCTTCCTCTCCAGGACGTGTACAAAATTGGTGGTATTGGAACAGTACCAGTTGGTCGTGTGGAGACTGGTGTGCTAAAACCTGGTATGGTAGTCACATTTGCACCTGCTGGTCTAACAACTGAAGTAAAATCTGTTGAAATGCATCATGAAGCATTGCAAGAAGCAGTCCCCGGAGACAATGTTGGTTTCAATGTTAAAAACGTATCTGTAAAAGAATTGCGT---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Megalyra                GCTGAGCGTGAGCGTGGTATCACGATCGATGTCGCTCTGTGGAAGTTTGAGACATCCAAGTACTATGTTACCATCATTGACGCTCCTGGGCACAGAGATTTCATCAAGAACATGATCACTGGAACGTCGCAGGCCGACTGCGCGGTACTGATCGTTGCTGCTGGTACTGGAGAGTTCGAAGCTGGTATTTCCAAGAATGGACAAACCCGTGAGCATGCTCTGCTCGCCTTCACCTTGGGTGTCAAGCAACTGATCGTTGGTGTGAACAAAATGGACTCCACCGAGCCTCCGTACTCGGAGTCGCGTTTTGAGGAAATCAAGAAGGAAGTTTCCTCCTACATCAAGAAGATCGGTTACAATCCGGCTGCCGTCGCCTTTGTCCCGATCTCTGGATGGCACGGAGACAACATGTTGGAGGTCTCCTCCAAAATGCCCTGGTTCAAGGGATGGGTTGTTGAGCGCAAGGAAGGAAAGGCAGAAGGAAAGTGCCTCATTGAGGCTCTTGACGCCATCCTCCCGCCTTCCAGGCCTACCGACAAGGCTCTCCGTCTTCCTCTGCAGGACGTGTACAAAATCGGCGGTATCGGAACGGTACCCGTCGGTCGTGTCGAGACTGGTGTCCTGAAGGCCGGTATGGTCGTGACGTTCGCCCCCGCTGGGCTGACTACTGAAGTTAAGTCCGTGGAAATGCACCACGAAGCACTCACAGAAGCTGTCCCCGGAGACAACGTTGGCGTCAACGTCAAGAACGTGCCCGTTAA-GAGCTGCGTCGTGGTTACGTAGCTGGAGACTCTAAGAACCAACCTCCCAAGGGAGCTTCTGACTTCACCGCACAGGTGATTGTGCTGAACCATCCTGGTCAAATCAGCAACGGTTACACGCCCGTGCTGGATTGCCACACGGCTCACATTGCCTGCAAGTTCGCCGAGATCAAAGAGAAGTGCGACCGTCGTACCGGCAAGACCACCGAAGAGAACCCTAAGGCCATCAAGTCCGGCGACGCGGCCATCGTGAACCTCATACCGACCAAGCCCATGTGCGTCGAGGCCTTCCAAGAGTTCC-----------------------------
+Trigonalidae            GCTGAGCGTGAACGTGGTATTACCATTGACATTGCCCTCTGGAAATTCGAGACTGCCAAGTACTACGTCACCATCATCGACGCCCCAGGCCACAGAGATTTCATCAAGAACATGATCACTGGTACATCGCAGGCTGATTGCGCCGTGTTGATTGTCGCTGCTGGTACTGGAGAGTTCGAAGCTGGTATCTCGAAGAACGGACAAACCCGTGAGCACGCTCTGCTTGCTTTCACCCTCGGTGTCAAGCAGCTCATCGTCGGAGTCAACAAGATGGATTCCACCGAGCCCCCGTACTCGGAAGCCCGTTTCGAAGAAATTAAGAAAGAAGTATCGTCGTACATCAAGAAAATCGGTTACAATCCAGCGGCGGTTGCTTTCGTGCCCATCTCTGGTTGGCACGGAGACAACATGTTGGAAACTTCTTCCAAGATGCCATGGTTCAAGGGATGGGCCGTAGACCGTAAAGAAGGAAAGGCTGACGGTAAATGCCTTATCGAGGCCCTCGACGCTATCCTGCCACCTTCCAGACCTACCGACAAGGCTCTCCGTCTTCCGCTTCAGGACGTGTACAAGATTGGTGGTATCGGAACTGTACCGGTCGGCCGTGTGGAGACTGGTCTACTGAAACCCGGTATGCTCGTCACCTTCGCACCTGCCGGTCTGACCACCGAAGTTAAGTCCGTCGAGATGCACCACGAAGCTCTCGTCGAGGCTGTCCCCGGTGACAATGTCGGTTTCAACGTCAAGAACGTACCTGTCAAGGAATTGCGTCGTGGATACGTCGCTGGTGATTCCAAAAACAACCCACCCAAGGGCGCTGCCGACTTCACCGCGCAGGTCATTGTGCTGAACCACCCCGGTCAGATCAGCAACGGNTACACGCCCGTGCTCGATTGTCACACGGCTCACATCGCCTGCAAGTTCGCCGAGATCAAGGAGAAGTGCGACCGTCGTACCGGCAAGACCACCGAAGAGAACCCGAAGGCCATCAAGTCCGGCGACGCAGCTATCGTGAACCTCGTGCCGAGCAAGCCCATGTGCGTCGAGGCTTTCCAAGAGTTCCCGCCATTGGGACGTTTCGCGGTGCGTGAC
+Chalcidoidea            ---------------------------------------TGGAAATTCGAGACTTCCAAGTACTACGTCACCATCATCGACGCTCCCGGACACAGAGATTTCATCAAGAACATGATCACTGGTACGTCGCAGGCCGATTGCGCCGTGTTGATCGTCGCTGCCGGTACTGGTGAATTCGAAGCCGGTATCTCCAAGAACGGTCAGACCCGTGAGCACGCTCTGCTTGCCTTCACTCTTGGTGTCAAGCAGTTGATCGTTGGTGTCAACAAGATGGACTCCACCGAGCCACCCTACTCGGAGGCTCGTTTCGAGGAAATCAAGAAGGAAGTATCTTCCTACATCAAGAAGATCGGTTACAACCCAGCCGCTGTTGCCTTCGTACCCATCTCTGGATGGCACGGAGACAACATGTTGGAGCCATCCACCAAAATGCCCTGGTTCAAGGGATGGGCTGTTGAGCGCAAGGAAGGCAAGGCCGACGGCAAGTGCCTCATCGAAGCTCTTGACGCCATCCTGCCACCCAGCAGGCCCACCGACAAAGCCCTTCGTCTTCCCCTCCAGGACGTCTACAAGATTGGTGGTATTGGAACGGTACCCGTCGGTCGTGTCGAGACTGGTGTGCTGAAGCCCGGTATGGTCGTCACCTTCGCCCCAGCTGGACTCACCACTGAGGTTAAGTCCGTCGAAATGCACCACGAAGCTCTGACTGAGGCCGTCCCCGGAGACAACGTTGGTTTCAACGTTAAGAACGTTTCCGTCAAGGACTTGCGTCGTGGATACGTCGCTGGTGACTCCAAGAACAACCCACCCAAGGGAGCCGCTGACTTCACCGCTCAGGTCATCGTCCTGAACCACCCTGGTCAGATCAGCAACGGATACACGCCCGTGCTCGATTGCCACACGGCCCACATTGCTTGCAAGTTCGCCGAAATCAAGGAGAAGTGCGACCGTCGTACCGGTAAAACCACCGAAGAGAACCCCAAGGCCATCAAGTCTGGTGATGCCGCCATCGTCAACCTTGTGCCCAGCAAGCCCATGTGCGTAGAGGCCTTCCAGGATTTCCCACCCCTGGGACGTTTCGCTGTACGTGAC
+Evanioidea              ------CGTGAACGTGGTATCACCATTGATATCGCCTTGTGGAAGTTCGAGACGGCAAAGTACTACGTGACATTCATCGACGCCCCGGGACACAGGTTCTTCATAAAGAACATGATCACCGGTACATCGCAGGCTGACTGCGCGGTATTGATCGTCGCCGCCGGTACCGGCGAGTTCGAGGCGGGCATCTCGAAGAACGGGCAGACGCGCGAGCACGCCCTCCTCGCTTTCACCCTGGGAGTCAAGCATCTGATCGTCGGGGTCAACAAGATGGACTCCACCGAGCCGCCCTACTCCGAGGCTCGCTTCGAGGAGATCAAGAAGGAGGTCTCCTCGTACATCAAGAAGATCGGCTACAACCCGGCGGCTGTTGCCTTCGTGCCTATCTCCGGGTGGCACGGCGACAACATGCTGGAGAGCTCCTCCAAGATGCCCTGGTTCAAGGGATGGATGGTCGAGCGTAAGGAGGGCAAGGCCGAGGGCAAATGCCTCATCGAAGCTCTCGATGCCATCCTTCCACCCAGCCGGCCTACCGACAAGGCCCTCCGTCTTCCTCTCCAGGACGTGTACAAAATCGGTGGAATTGGAACGGTGCCAGTCGGTCGTGTGGAAACCGGCATCCTGAAGCCCGGAATGGTCGTGACCTTCGCGCCCGCCGGTCTCACCACTGAAGTCAAGTCCGTAGAAATGCACCACGAGGCCCTGACAGAAGCCGTRCCGGGTGACAACGTTGGCTTCAACGTTAAGAACGTCTCCGTCAAAGAACTGCGTCGCGGATATGTTGCCGGTGAC------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Ichneumonidae           GCTGAGCGTGAGCGTGGTATCACCATCGATATCGCTCTATGGAAGTTCGAGACTGCTAAATATTACGTGACGATCATCGATGCTCCCGGACACAGAGATTTCATCAAAAACATGATCACCGGCACGTCGCAAGCCGATTGCGCTGTTCTCATCGTAGCTGCTGGTACTGGTGAATTTGAGGCCGGTATCTCGAAGAACGGACAGACCCGAGAGCACGCCCTCCTCGCCTTCACCCTTGGCGTCAAGCAGCTCATCGTCGGCGTCAACAAGATGGACTCGACCGAACCTCCCTATTCCGAGTCTCGTTTCGAGGAAATTAAGAAGGAAGTCTCGTCTTACATCAAGAAAATTGGTTATAATCCGGCAGCAGTCGCTTTCGTACCAATTTCCGGATGGCACGGTGATAACATGTTGGAGCCATCCTCCAAAATGCCATGGTTCANGGGATGGGCTGTTGAGCGCAAGGAAGGCAAAGCCGATGGCAAGTGCCTCATCGAAGCACTCGATGCTATTTTGCCACCCTCCAGGCCAACTGACAAGGCCCTTCGTCTTCCCCTCCAGGACGTTTACAAGATTGGCGGTATTGGAACAGTGCCCGTCGGTCGTGTTGAGACCGGTGTCCTTAAACCCGGTATGGTCGTGACCTTTGCACCAGCTGGTCTCACGACTGAAGTTAAGTCCGTCGAGATGCACCACGAGGCCCTCGTCGAGGCTGTTCCCGGTGACAATGTCGGTTTCAACGTCAAGAACGTTTCCGTCAAGGAATTACGTCGTGGCTACGTTGCTGGTGACTCCAAGAACAATCCACCCAGAGGTGCTGCCGATTTCAATGCTCAGGTCATCGTCCTCAACCATCCTGGTCAGATCAGCAATGGATACACACCCGTGTTGGATTGCCACACGGCTCACATCGCTTGCAAATTCGCCGAGATCAAAGAAAAGTGCGACCGTCGTACTGGCAAAACGACCGAGGAAAATCCAAAGGCCATTAAATCCGGCGATGCCGCTATTGTAAATCTCGTACCGAGCAAACCCATGTGCGTTGAGGCTTTCCAAGAATTCCCACCTCTTGGACGTTTTGCAGTTCGTGAC
+Cynipoidea              GCTGAGCGTGAACGTGGTATCACCATCGATATCGCTCTATGGAAGTTTGAGACCGCGAAGTATTACGTCACCATCATTGACGCCCCCGGACACAGAGATTTCATTAAGAACATGATCACTGGAACTTCGCAAGCTGACTGCGCCGTGTTGATCGTCGCTGCCGGTACCGGAGAATTCGAAGCTGGTATTTCGAAGAATGGACAAACCCGTGAACATGCTCTGCTCGCTTTTACCCTGGGAGTCAAGCAGCTTATCGTCGGAGTCAACAAGATGGACTCCACCGAGCCTCCATACTCTGAGTCTCGTTTCGAGGAAATTAAGAAGGAAGTCTCTTCTTATATCAAAAAGATCGGTTACAATCCTGCCTCTGTTGCTTTCGTTCCCATCTCAGGATGGCACGGAGACAACATGTTGGAGCCTTCCTCTAAAATGCCTTGGTTCAAGGGATGGGCGGTCGAACGTAAGGAGGGAAAAGCTGAAGGCAAGTGCCTCATTGAAGCCCTTGATGCCATCTTACCTCCCAGCAGACCTACCGACAAGGCGCTGCGTCTTCCCCTCCAGGACGTCTACAAGATCGGTGGTATCGGAACGGTGCCAGTCGGTCGAGTGGAGACTGGTGTTTTGAAGCCCGGTATGGTAGTTACTTTCGCCCCTGCTGGATTGACCACTGAAGTTAAGTCTGTCGAGATGCACCACGAAGCACTGACAGAGGCTGTTCCTGGTGACAACGTTGGTTTCAACGTTAAAAACGTCTCCGTTAAGGATCTGCGTCGTGGTTATGTCGCCGGAGATTCCAAAAACAACCCACCCAAGGGTGCTGCTGACTTCACCGCACAAGTTATCGTCTTGAACCATCCCGGACAAATTAGCAACGGCTACACGCCAGTGTTGGATTGCCACACGGCCCACATTGCCTGTAAATTCGCCGAGATTAAGGAAAAGTGTGACAGACGTACCGGAAAAACTACTGAGGAGAACCCTAAGGCCATCAAGTCTGGAGACGCAGCTATTGTAAACCTCGTTCCAAGCAAACCAATGTGTGTCGAGGCTTTCCAGGAGTTCCCTCCATTGGGACGTTTCGCCGTTCGTGAC
+ApoideaA                -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TGGTGACAATGTTGGTTTCAACGTTAAGAACGTCTCCGTTAAGGAATTGCGTCGTGGTTACGTAGCTGGTGACTCCAAGAACAACCCACCAAGGGGTGCTGCTGACTTTACCGCACAAGTCATCGTGCTGAACCACCCTGGCCAGATCAGCAGCGGATACACCCCAGTGTTGGATTGTCACACTGCTCACATTGCGTGTAAGTTCGCCGAGATGAAGGAGAAGTGTGACCGTCGTACCGGTAAGACCACCGAGGAGAATCCAAAGTCCATCAAATCTGGCGACGCCGCCATCGTCATCCTCGTGCCGAGCAAGCCCATGTGCGTGGAAGCTTTCCAAGAGTTCCCGCCACTGGGACGCTTCGCTGTCCGTGAC
+ApoideaB                ------------------ATTATCATTGATATTGCCCTGGGGAAGTTCGAAACCGCCAAATACTATGTCACAATTATTGACGCTCCTGGACACAAAGATTTCATCAAGAACATGATTCATGGTACCTCGCAGGCCGACTGTGCAGTACTGATTGTTGCCGCCGGAACTGGAGAGTTCGAAGCCGGTATTTCGAAAAATGGACAAACTCGTGAGCATGCTCTGCTCGCTTTTACTCTTGGTGTAAAGCAGTTGATTGTTGGTGTTAACAAGATGGACTCCACTGAGCCACCATACTCCGAAGCCAGATTCGAGGAAATCAAGAAGGAAGTATCTTCCTACATCAGGAAAATCGGTTATAATCCAGCTGCTGTTGCATTCGTGCCCATTTCTGGTTGGCATGGAGACAACATGTTGGAGGCTTCTTCCAAAATGGTCTGGTTCAAAGGATGGGCTGTTGAGCGCAAAGAGGGCAAGGCTGATGGCAAGACCCTCATCGAAGCTCTCGATGCCATCCTCCCACCCACTAGGCCCACAGACAAGGCTCTCCGTCTTCCCCTCCAGGACGTGTACAAAATCGGTGGTATCGGAACAGTACCCGTTGGTCGTGTGAAAACTGGTGTGTTGAAGCCGGGTATGGTTGTCACATTCGTTCCAGTTGGACTCACCACTGAAGTTAAGTCCGTTGAAATGCACCACGAAGCTCTGCAAGAAGCTGTTCCTGGTGACAACGTTGGTTTCAACGTTAAGAACGTATCTGTTAAGGAATTACGTCGTGGCTACGTAGCCGGTGACTCCAAAAACAGCCCACCACGCGGTGCCGCTGACTTCACTGCACAGGTTATCGTGCTGAACCACCCGGGCCAAATCACTAACGGATACACGCCAGTGTTGGATTGTCACACTGCCCACATCGCGTGTAAGTTCGCCGAAATCAAGGAGAAGTGCGACCGTCGTACCGGAAAGACCACTGAGGAGAATCCAAAATTCATAAAATCCGGAGATGCGGCCATTGTTACGCTCGTGCCGAGCAAGCCAATGTGCGTGGAGGCTTTCCAAGAATTCCCTCCTCTGGGACGTTTCGCTGTCCGTGAC
+ApoideaC                GCTGAACGTGAACGTGGTATTACCATTGACATTGCTTTATGGAAATTTGAAACTTCCAAGTACTATGTTACTATTATCGATGCTCCGGGGCATAGAGATTTCATCAAAAACATGATTACCGGTACCTCACAAGCTGACTGTGCAGTATTAATTGTTGCTGCTGGTACTGGCGAGTTTGAAGCTGGTATTTCAAAGAATGGACAAACCCGTGAGCATGCTTTGCTTGCTTTTACTCTCGGTGTAAAACAGTTGATCGTTGGTGTTAACAAGATGGACTCCACTGAGCCACCATATTCTGAAGTCCGATTTGAAGAAATTAAGAAGGAAGTGTCATCTTACATCAAGAAGATCGGTTACAATCCTGCTGGAGTAGCATTTGTGCCAATTTCTGGTTGGCACGGAGATAATATGTTGGAGATTTCTTCAAAAATGCCTTGGTTCAAGGGATGGACCGTGGAACGTAAAGAAGGTAAAGTTGAGGGAAAATGCCTTATTGAAGCGCTTGACGCCATTCTTCCACCATCTAGACCTACGGACAAGGCTCTCCGTCTTCCTCTTCAAGATGTATACAAAATTGGTGGTATTGGAACTGTACCTGTTGGTCGTGTTGAAACTGGTGTGTTGAAGCCAGGTATGGTTGTTACATTTGCTCCAGCTGGTTTGACCACTGAAGTTAAATCCGTCGAAATGCATCACGAAGCTTTGCCAGAAGCTGTTCCTGGTGATAACGTTGGTTTCAACGTTAAGAACGTGGCAGTAAAAGAATTGCGTCGTGGTTATGTAACTGGTGACTCCAAGAATAA-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Vespidae                GCTGAGCGCGAGCGTGGTATCACCATTGACATTGCTCTTTGGAAATTCGAAACTTCTAAATACTACGTCACAATTATTGACGCACCTGGACACAGAGATTTCATCAAGAACATGATCACTGGAACCTCGCAAGCAGATTGCGCTGTGCTGATCGTAGCTGCTGGTACAGGAGAATTTGAGGCTGGTATTTCTAAGAACGGACAAACGCGTGAGCATGCTTTGCTCGCTTTCACTCTTGGTGTGAAGCAACTCATCGTTGGTGTTAACAAAATGGACTCTACCGAGCCACCCTACTCCGAGACTCGATTCGAAGAAATTAAGAAGGAGGTCTCTTCGTACATTAAAAAAATTGGTTACAATCCTGTAACCGTCGCATTTGTACCAATCTCTGGCTGGCACGGAGACAACATGTTGGAAGTGTCTAGCAAGATGCCATGGTTCAAGGGATGGGTAGTAGAACGTAAAGAAGGCAAGGCAGAAGGAAAATGTCTTATCGAAGCTCTTGACGCCATCCTTCCACCTACCAGACCTACAGACAAGGCACTCCGTCTTCCACTTCAGGATGTGNACAAGATCGGTGGTATCGGAACGGTACCGGTCGGTCGTGTTGAAACCGGTGTATTGAAGCCGGGTATGGTTGTTACATTTGCTCCGGCGGGTCTTACCNCCGAAGTTAAATCCGTTGAAATGCATCACGAAGC-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Triassoxyela            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Asioxyela               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Nigrimonticola          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Gigantoxyelinae         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Spathoxyela             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyela_mesozoica         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Angaridyela             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyelotoma               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Undatoma                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Dahuratoma              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Mesolyda                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Turgidontes             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Aulidontes              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Protosirex              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Aulisca                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Anaxyela                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Syntexyela              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Karatavites             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Stephanogaster          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Leptephialtites         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Cleistogaster           ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Sepulca                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Onochoius               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Ghilarella              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Paroryssus              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Praeoryssus             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Mesorussus              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Trematothorax           ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Thoracotrema            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Prosyntexis             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Kulbastavia             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Brachysyntexis          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Symphytopterus          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Eoxyela                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Liadoxyela              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Abrotoxyela             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Pseudoxyelocerus        ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Palaeathalia            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Ferganolyda             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+PamphiliidaeUndesc      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Rudisiricius            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Sogutia                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyelula                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Brigittepterus          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Grimmaratavites         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+                        
+                        
+[EF1a F1 4361-5452, 1092 chars]
+Orthoptera              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Paraneoptera            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Chrysopidae             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Raphidioptera           ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Coleo_Polyphaga         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Coleo_Adephaga          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Lepid_Micropterigidae   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Lepid_Papilionidae      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Mecoptera               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyela                   GCCGAGCGCGAGCGTGGTATCACGATCGATATCGCCCTCTGGAAATTTGAGACAGCCAAATACTATGTAACCATCATCGATGCTCCGGGACACAGGGATTTCATCAAGAACATGATCACGGGAACGAGTCAAGCAGATTGCGCCGTACTCATAGTAGCCGCGGGTACCGGAGAATTTGAAGCTGGTATTTCCAAGAACGGGCAGACTCGCGAACACGCTCTGCTCGCGTTCACTCTGGGAGTCAAACAGCTGATCGTAGGGGTCAATAAGATGGACTCCACCGAACCTCCTTATTCTGAGAGCCGATTCGAAGAGATCAAGAAGGAAGTCTCCTCCTACATTAAGAAAATCGGATACAACCCTGCTTCTGTCGCTTTCGTCCCAATCTCAGGCTGGCACGGAGACAACATGCTGGAACCGTCTCCTAAGATGGCATGGTACAAGGGCTGGAAAGTTGAGCGCAAGGATGGTAACGCTGACGGCAAGTGTCTGATAGAAGCTTTGGATGCAATTTTGCCTCCATCCCGCCCCACTGATAAGGCTCTGCGTCTTCCCCTGCAGGATGTCTACAAAATCGGTGGTATCGGGACCGTACCGGTCGGTCGTGTCGAAACTGGTATCCTGAAACCAGGAATGCTCGTAACTTTCGCTCCAGCGGCTTTGACCACTGAAGTAAAGTCTGTTGAAATGCACCATGAAGCGTTGACCGAGGCTCTACCCGGCGACAACGTCGGGTTTAACGTGAAGAACATTTCGGTCAAAGAATTGCGTCGTGGTTACGTTGCTGGTGATTCTAAGAATTCGCCACCAAGAGGCGCGGCTGATTTTACCGCTCAGGTTATCGTTCTGAACCATCCTGGCCAAATCAGCAACGGTTATACTCCTGTGCTCGACTGCCACACGGCTCATATTGCTTGCAAATTCGCTGAGATCAAGGAGAAGTGCGATCGTCGTACGGGAAAGACAACGGAGGAAAATCCAAAAAGTATCAAGAGCGGGGACGCTGCGTTAGTCATGCTACAGCCCAGCAAGCCGATGTGCGTGGAGGCGTTCCAGGAGTTTCCGCCGTTGGGACG----------------
+Macroxyela              GCTGAGCGCGAGCGTGGTATCACGATCGATATCGCCCTTTGGAAATTCGAAACAGCCAAGTACTATGTAACCATCATCGACGCTCCGGGACACAGAGATTTCATCAAGAACATGATAACGGGAACGAGTCAAGCGGATTGCGCTGTACTCATAGTAGCAGCAGGTACCGGAGAGTTTGAAGCGGGCATTTCTAAAAACGGCCAAACTCGCGAACACGCTCTTCTCGCGTTCACTCTGGGTGTGAAACAGCTGATCGTAGGAGTCAATAAGATGGACTCCACCGAGCCTCCTTATTCCGAGAGTCGGTTCGAAGAGATCAAGAAAGAGGTATCGTCCTACATCAAGAAGATCGGGTATAATCCAGCTTCGGTTGCATTCGTGCCGATCTCAGGCTGGCACGGTGATAACATGCTTGAACCGTCTCCCAAGATGGCCTGGTACAAAGGCTGGAAAGTCGAACGCAAGGATGGTAACGCTGATGGTAAATGTCTGATAGAAGCTTTGGACGCTATTTTACCTCCGTCACGCCCGACTGACAAGGCTCTGCGTCTTCCGCTGCAGGATGTCTACAAAATCGGTGGTATTGGAACTGTACCCGTTGGTCGTGTCGAAACCGGTATCCTGAAACCTGGAATGCTCGTGACTTTCGCTCCTGCAGCACTGACCACTGAGGTGAAATCCGTTGAAATGCATCACGAGGCGCTGACCGAGGCTTTACCCGGTGACAACGTCGGGTTCAACGTGAAGAACATTTCGGTTAAAGAATTGCGTCGTGGTTACGTTGCCGGCGATTCCAAGAACTCGCCTCCTAGGGGTGCTGCTGATTTTACCGCTCAGGTCATTGTCCTGAACCATCCCGGGCAAATCAGCAACGGCTACACTCCGGTGCTTGATTGCCACACGGCCCATATTGCGTGCAAATTTGCTGAAATAAAAGAGAAATGCGACCGTCGTACGGGAAAAACAACAGAAGAAAATCCAAAGAGTATCAAGAGCGGGGACGCTGCGATAGTCATGCTGCAGCCCAGCAAGCCCATGTGCGCGGAGGCGTTCCAGGAATTTCCACCATTGGGACGCTTTGCTGTTCGTGAC
+Runaria                 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TGTGGGTTTCAACGTGAAGAACATCTCCGTCAAGGAACTGCGTCGCGGCTACGTCGCCGGCGATTCCAAAAATTCGCCGCCGAGAGGCGCCGCCGACTTCACGGCCCAGGTCATCGTGCTGAATCATCCCGGGCAAATTAACAACGGCTATACGCCGGTGCTGGATTGCCACACGGCGCATATCGCCTGCAAGTTCGCCGAGATCAAGGAGAAATGCGATCGTCGTACCGGAAAAACTACGGAGGAGAATCCAAAGAGTATTAAGAGCGGAGACGCCGCGATAGTGATGCTGCAGCCGAGCAAGCCCATGTGCGTCGAAGCTTTCCAAGAATTTCCCCCTCTGGGTCGCTTCGCCGTACGCGAC
+Paremphytus             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Blasticotoma            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Tenthredo               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Aglaostigma             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Dolerus                 GCTGAGCGTGAACGTGGTATCACAATCGACATCGCTCTATGGAAATTCGAAACAGCTAAATACTACGTAACCATAATCGACGCACCGGGCCACAGAGACTTCATCAATAACATGATCACCGGAACAAGTCAAGCCGATTGCGCGGTGCTGATAGTGGCAGCTGGAACCGGTGAATTCGAAGCCGGAATATCGAAGAATGGACAAACCCGAGAGCACGCTCTTCTCGCCTTCACTTTGGGAGTTAAACAACTAATCGTCGGCGTGAACAAGATGGATTACACCGAGCCACCGTACTCGGAATGCCGGTTCGAGGAGATAAAGAAAGAAGTATCCTCCTACATAAAGAAGATCGGCTACTATCCAGCGTCAGTAGCTTTCGTTCCGATCTCCGGATGGCACGGAGACAACATGCTAGAACCCTCTCCGAAGATGCCGTGGTACAAGGGGTGGAAAGTTGAGAGAAAAGACGGTAACGCTGATGGGAAGTGTCTGATCGAAGCGTTGGATGCCATCCTACCACCGTCTCGTCCCACTGATAAAGCTCTGCGTCTGCCTCTTCAGGATGTCTATAAAATTGGTGGAATTGGAACCGTCCCCGTTGGCCGGGTAGAAACTGGCATCTTGAAGCCCGGTATGCTCGTCACCTTTGCTCCTGCCGCTTTAACAACCGAAGTTAAATCCGTCGAAATGCATCACGAGGC-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Selandria               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Strongylogaster         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Monophadnoides          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Metallus                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Athalia                 GCTGAGCGYGAACGTGGTATCACTATCGATATCGCTTTGTGGAAGTTTGAAACGGCCAAATATTACGTGACAATTATCGACGCTCCGGGTCACAGGGATTTTATAAAGAACATGATCACCGGCACGAGCCAAGCCGACTGCGCGGTGCTGATAGTAGCTGCGGGTACCGGAGAATTCGAGGCCGGAATATCGAAGAATGGTCAAACTCGGGAGCACGCACTCCTGGCATTTACTTTGGGTGTTAAGCAGCTGATAGTTGGTGTTAACAAAATGGACTCGACCGAACCACCGTACTCGGAAGTTCGTTTCGAAGAGATAAAGAAGGAAGTGTCATCGTACATAAAGAAAATTGGCTACTACCCAACTTCCGTAGCATTTGTTCCAATATCCGGATGGAACGGGGACAACATGCTCGAACCGTCTCCAAAAATGCCGTGGTACAAGGGCTGGAAAGTTGAACGTAAAGACGGAAACGCCGACGGCAAATGTTTGATCGAAGCTCTGGACGCCATTTTACCCCCGTCTCGGCCAACCGACAAAGCTCTTCGTCTYCCGCTTCAAGACGTCTACAAAATCGGGGGCATCGGAACGGTCCCGGTYGGGAGAGTCGAGACGGGAATTTTGAAGCCTGGAATGGTGGTTACTTTCGCCCCAGCAGCACTTACTACCGAAGTAAAATCGGTCGAGATGCACCACGAGGCTCTGACGGAAGCTCTTCCCGGCGACAACGTCGGTTTCAACGTGAAGAACATCTCGGTCAAAGAATTACGTCGCGGTTACGTGGCCGGTGATTCGAAAAATTCGCCGCCGAGAGGAGCATCCGATTTCACGGCGCAAGTAATCGTCCTTAATCATCCGGGACAAATAAGTAACGGATACACGCCCGTCCTCGATTGCCACACGGCTCACATCGCTTGCAAATTTGCTGAGATTAAGGAAAAGTGCGATCGTCGTTCAGGAAAAACAACCGAAGAAAATCCTAAGAGCATCAAAAGCGGGGACGCTGCTATCGTGATGTTACAGCCGAGTAAGCCGATGTGCGTCGAAGCTTTTCAAGAATTTCCACCACTCGGACGTTTCGCTGTGCGCGAC
+Taxonus                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Hoplocampa              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Nematinus               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Nematus                 GCTGAGCGYGARCGTGGTATCACGATCGACATCGCTCTGTGGAAGTTCGAAACGGCCCGGTACTACGTTACCATAATCGACGCCCCGGGTCACAGAGACTTCATAAAGAACATGATAACCGGGACCAGCCAAGCCGACTGCGCGGTCCTCATAGTCGCCGCTGGAACCGGCGAATTCGAAGCAGGGATATCGAAGAACGGCCAGACCCGCGAGCACGCCCTCCTCGCCTTCACTCTAGGAGTGAAGCAGCTGATCGTCGGCGTGAACAAGATGGACTCGACCGAGCCACCCTACTCCGAATGCCGGTTCGAGGAGATCAAGAAGGAGGTGTCCTCCTACATCAAGAAGATCGGCTACCACCCGGCCTCCGTCGCCTTCGTGCCGATCTCCGGCTGGCATGGAGACAACATGCTCGAACCATCCCCGAAGATGCCTTGGTACAAGGGGTGGAAGGTGGAGCGCAAGGAGGGCAACGGTGATGGCAAGTGCCTCATCGAAGCCCTGGACGCGATCCTGCCGCCTTCGCGACCGACGGACAAGGCTCTGCGGCTCCCGCTCCAGGACGTATACAAAATCGGCGGTATCGGAACCGTCCCGGTTGGCCGGGTCGAGACCGGGATCCTGAAGCCGGGGATGCTGGTGACCTTCGCGCCAGCTGCGCTTACGACCGAGGTCAAGTCTGTYGARATGCATCACGARGCNCTGCCTGAAGCTCTGCCTGGGGACAACGTTGGTTTCAACGTGAAGAACATATCCGTGAAGGAACTCCGCCGCGGATACGTTGCCGGGGACTCGAAGAACTCGCCGCCCAGGGGGGCGGCCGACTTCACGGCCCAGGTGATCGTCCTGAATCATCCGGGACAGATCAGCAACGGGTACACTCCGGTGCTCGACTGTCACACCGCTCATATAGCTTGCAAGTTCGCTGAGATTAAGGAGAAGTGTGATCGCCGTACGGGAAAAACTACCGAGGAGAATCCTAAGAGCATCAAGAGCGGAGATGCGGCCATCGTGATGCTCCAGCCGAGCAAGCCGATGTGCGTCGAAGCTTTCCAGGAATTTCCGCCACTGGGACGATTCGCTGTACGCGAC
+Cladius                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Monoctenus              GCTGAGCGTGAACGTGGTATCACGATCGACATAGCCCTGTGGAAATTCGAGACGGCCAAGTACTACGTGACCATAATTGACGCGCCGGGTCACCGGGACTTCATAAAGAACATGATAACCGGCACGAGCCAGGCCGACTGCGTGGTTCTGATAGTGGCCGCAGGAACCGGCGAATTCGAGGCCGGGATATCGAAGAACGGCCAGACCCGTGAACACGCCCTGCTGGCGTTCACGCTCGGGGTGAAGCAGCTGATCGTCGGCGTGAACAANATGGACTCGACCGAGCCGCCGTACTCCGAGTGCCGGTTCGAGGAGATCAAGAAGGAGGTATCGTCCTACATAAAGAAGATCGGCTACTACCCGGCCTCGGTCGCCTTCGTGCCGATCTCGGGATGGCACGGCGACAACATGCTCGAGCCCTCGCCCAAGATGCCGTGGTACAAGGGGTGGCGGGTCGAACGCAAGGACGGCAACGCCGACGGCAAGTGCCTGATCGAGGCCCTGGACGCCATCCTGCCGCCGTCCCGGCCGACGGACAAGGCGCTGCGCCTGCCGCTGCAGGACGTCTACAAGATCGGCGGAATCGGGACCGTGCCGGTGGGCCGCGTCGAGACCGGGATCCTGAAGCCCGGGATGCTCGTGACCTTCGCACCCGCCGCACTCACCACCGAGGTAAAGTCCGTTGAAATGCATCACGAGGC-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Gilpinia                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Diprion                 GCTGAGCGTGAGCGGGGAATAACGATCGACATAGCTCTCTGGAAGTTCGAGACGGCCAAGTACTACGTGACGATAATAGACGCGCCCGGTCACCGTGACTTCATAAAGAACATGATAACCGGGACCAGTCAGGCGGACTGCGCTGTGCTGATAGTGGCGGCAGGAACAGGGGAATTCGAGGCCGGGATATCGAAGAACGGACAGACGCGGGAACACGCCCTCCTGGCCTTCACCCTGGGGGTGAAACAGCTGATCGTGGGTGTGAACAAGATGGACTCGACGGAGCCGCCGTACTCGGAGAGCCGGTTCGAGGAGATCAAGAAGGAGGTCTCCTCCTACATAAAGAAGATCGGCTACTACCCGGCCTCCGTTGCCTTTGTCCCGATCTCAGGATGGCACGGGGACAACATGCTCGAACCCTCGCCGAAGATGCCCTGGTACAAGGGGTGGAAGGTTGAGAGGAAGGACGGCAACGCCGACGGCAAGTGTCTGATCGAAGCTCTCGACGCCATCCTGCCGCCGTCGAGACCGACGGACAAGGCGCTCCGACTTCCGCTCCAGGACGTCTACAAGATCGGCGGCATCGGAACCGTCCCCGTCGGCAGGGTAGAGACTGGCATCCTGAAGCCGGGGATGCTGGTCACCTTTGCCCCCGCGGCCCTTACGACGGAGGTAAAATCCGTCGAGATGCACCACGAGGCTC--------------------------------------------------------------CTGCGTCGGGGTTACGTGGCTGGGGATTCAAAGAACTCGCCGCCGCGCGGCGCGGCTGATTTTACCGCTCAAGTAATCGTCCTCAATCATCCGGGTCAGATCAGCAACGGTTACACCCCCGTTCTCGACTGCCACACCGCTCATATCGCTTGCAAGTTCGCCGAGATCAAGGAGAAGTGCGACCGCAGGACCGGCAAAACTACCGAGGAAAATCCTAAGAGCATCAAAAGCGGCGACGCCGCCATCGTCATGCTGCAACCCAGCAAGCCGATGTGCGTCGAAGCTTTTCAGGAGTTTCCACCCCTCGGACGTTTCGCT---------
+Cimbicinae              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Abia                    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Corynis                 ---GAGCGCGAGCGTGGCATCACAATCGACATAGCCCTGTGGAAATTCGAAACAGCCAAGTACTACGTGACCATAATCGACGCCCCGGGACACCGGGACTTCATCAAGAACATGATCACCGGAACGAGTCAGGCCGATTGTGCCGTGTTAATAGTAGCAGCTGGAACAGGAGAATTCGAGGCTGGAATCTCAAAAAACGGTCAGACCCGCGAACACGCGCTCCTGGCCTTTACCCTGGGTGTCAAGCAATTGATCGTAGGAGTCAACAAGATGGACTCGACCGAACCACCCTATTCCGAATGCCGGTTCGAGGAGATCAAAAAAGAGGTGTCGTCCTACATCAAGAAGATCGGCTACAACCCGGTCTCCGTCGCCTTCGTACCCATCTCTGGCTGGCATGGCGACAATATGTTGGAACCATCCCCGAAAATGGCTTGGTACAAGGGTTGGAAGGTCGAGCGCAAGGATGGAAACGCCGATGGCAAATGTCTGATCGAGGCCCTGGATGCCATTCTTCCACCATCTCGACCCACCGACAAGGCTCTGCGTTTTCCGCTGCAGGACGTCTACAAAATCGGCGGAATCGGGACCGTNCCNGTTGGCCGCGTNGAGACNGGCATCCTGAAGCCNGGGATGCTCGTNACCTTTGCTCCCGCCGCCCTNACGACCGAGGTAAANTCCGTTGAGATGCATCACGANGCNCTGACCGAGGCTCTNCCCGGTGACAACGTTGGTTTCAACGTGAAGAACATCTTNGTCAAGGAACTGCGTCGCGGCTACGTTGCTGGAGATTCGAAAAATTCACCGCCTANAGGTGCCGCCGATTTTACCGCTCAAGTAATTGTGTTGAATCATCCTGGACAAATTAGCAATGGGTATACCCCGGTACTTGATTGTCATACGGCTCATATTGCTTGCAAATTTGCTGAAATTAAGGAGAAATGCGATCGTCGTACCGGTAAAACAACTGAGGAAAATCCTAAGAGTATTAAAAGCGGTGATGCTGCCATTGTTATGTTGCANCCAAGCAAGCCGATGTGCGTTGAAGCTTTTCAAGAATTTCCACCATCTGGACGTTTCGCTGTGCGCGAC
+Arge                    ---------------------------------------TGGAAATTTGAGACAGCTAAGTATTACGTGACTATAATCGACGCTCCGGGTCACAGAGATTTCATAAAAAACATGATTACCGGGACGAGTCAGGCGGAGTGCGCGGTGTTGATCGTGGCTGCCGGTACCGGTGAATTCGAGGCTGGTATCTCGAAGAATGGGCAGACGCGCGAGCATGCTCTGCTCGCTTTTACGCTGGGAGTGAAACAGCTGATAGTTGGTGTGAACAAGATGGATTCCACGGAGCCACCCTATTCGGAATGTCGTTTCGAGGAGATTAAGAGAGAAGTGTCTTCTTACATCAAAAAGATCGGCTACTATCCCGGAGCCGTAGCTTTCGTTCCCATCTCCGGATGGCACGGTGATAACATGCTGGAACCATCGCCCAAGATGCCTTGGTACAAGGGATGGAAGGTCGAGCGTAAGGAGGGATCCGCGGATGGAAAATGTTTGATCGAAGCTTTGGATGCTATTTTGCCACCGTCTCGACCTACCGACAAGGCTCTGCGGCTACCATTGCAGGACGTCTACAAAATCGGTGGAATCGGCACAGTTCCGGTTGGTCGGGTCGAGACCGGTATCCTGAAACCCGGGATGCTGGTTACCTTCGCTCCTGCCGCCCTGACGACGGAAGTTAAATCTGTGGAGATGCATCACGAAGCGTTGACCGAAGCTCTGCCAGGTGACAACGTTGGCTTCAACGTGAAGAATATCTCCGTGAAGGAATTGCGTCGCGGTTACGTAGCTGGAGACTCGAAGAACTCGCCTCCGAGGGGTGCCTCGGATTTCACGGCTCAGGTTATCGTGCTCAATCATCCTGGGCAAATCAGTAACGGCTACACGCCGGTACTCGATTGTCATACGGCTCACATCGCTTGCAAATTTGCCGAGATAAAGGAGAAGTGCGATCGTCGTACGGGGCGAACAACGGAAGAAAATCCGAAGAGCATCAAGACAGGCGACGCCGCTATAGTCATGCTTCAGCCAAGCAAGCCGATGTGCGTACGAGCGTTTCAGGAGTTCCCTCTGCTGGGACGATTCGCTGTACGGGAC
+Sterictiphora           GCCGAGCGCGAGCGCGGCATCACGATCGACATCGCGCTGTGGAAGTTCGAGACCGCCAAGTATTACGTGACCATAATCGACGCGCCGGGGCACCGGGACTTCATCAAGAACATGATAACCGGGACGAGCCAGGCGGACTGTGCCGTGCTGATCGTGGCCGCTGGTACCGGCGAATTTGAGGCGGGCATCTCGAAGAACGGGCAGACCCGCGAGCACGCTCTCCTCGCGTTCACCCTGGGCGTGAAGCAGCTGATTGTCGGCGTCAACAAGATGGACTCGACCGAGCCACCCTACTCCGAGTGTCGGTTCGAGGAGATCAAGAAAGAGGTGTCCTCGTACATCAAGAAGATCGGCTACTATCCGGGATCCGTGGCCTTCGTTCCCATCTCCGGGTGGCACGGCGATAACATGCTGGAACCGTCCCCGAAGATGGCCTGGTACAAGGGGTGGAAGGTCGACCGCAAAGAGGGCTCCGCCGACGGGAAGTGCCTCATCGAGGCGCTGGACGCGATCTTGCCACCGTCGCGTCCCACCGACAAGGCTTTGCGACTGCCACTTCAGGACGTCTACAAGATCGGTGGTATCGGCACGGTGCCGGTGGGTCGCGTCGAGACCGGCATCCTGAAGCCGGGAATGCTGGTGACCTTCGCGCCGGCAGCGCTGACGACCGAGGTCAAGTCCGTGGAGATGCACCACGAAGCGCTGACCGAGGCCCTACCGGGCGACAACGTTGGCTTCAACGTGAAGAACATCTCGGTCAAGGAGCTGCGTCGCGGCTACGTGGCCGGGGACTCGAAGAATTCCCCACCTCGGGGCGCCTCCGACTTCACGGCCCAAGTCATCGTGCTGAATCATCCGGGCCAGATCAGCAACGGGTACACGCCGGTCCTCGACTGTCACACTGCCCATATCGCGTGCAAGTTCGCCGAGATCAAGGAGAAGTGCGACCGTCGTACCGGAAAAACTACGGAGGAGAACCCGAAGAGCATCAAGAGCGGCGACGCCGCCATAGTCACGCTGCAGCCCAGCAAGCCGATGTGCGTCGAAGCCTTTCAGGAGTTTCCACCGCTGGGACGATTTGCTGTACGGGAC
+Perga                   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Phylacteophaga          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Lophyrotoma             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Acordulecera            ------CGTGAGCGCGGCATAACCATCGACATAGCTCTGTGGAAGTTCGAGACAGCCAAGTACTACGTAACCATAATCGACGCCCCTGGTCACCGAGACTTCATCAAGAACATGATCACGGGAACGAGTCAGGCTGATTGCGCCGTGCTGATAGTAGCTGCAGGAACCGGCGAGTTTGAGGCGGGAATTTCGAAGAACGGGCAGACTCGAGAGCACGCATTGCTGGCTTTCACTTTGGGAGTGAAACAGCTAATCGTCGGAGTGAACAAGATGGATTCAACCGAACCACCCTATTCGGAAACCCGTTTCGAGGAGATCAAGAAGGAGGTGTCNTCCTACATCAAGAAGATCGGCTACTATCCTGGAGCTGTGGCATTCGTTCCCATCTCTGGATGGCACGGAGACAACATGCTGGAACCGTCTCCGAAAATGGCTTGGTACAAGGGATGGAAGGTCGAGCGAAAGGAGGGCAACGCTGATGGNAAATGTNTGATCGAGGCCTTGGACGCCATTCTACCATCGTCGCGACCTACTGACAAGGCTCTGCGGCTACCATTGCAGGACGTTTACAAGATCGGAGGCATTGGNACAGTACCGGTGGGNCGAGTCGAGACTGGCATTTTAAAACCTGGAATGGTTGTGACCTTTGCACCCGCTGCGCTAACTACAGAAGTCAAATCTGTCGAGATGCATCNCGAGGCTTTGGTCGAAGCTCTCCCCGGGGATAACGTGGGATTCAACGTGAAGAACATCTCGGTCAAGGAACTTCGCCGCGGTTACGTTGCCGGNGACTCGAAGAATTCTCCGCCACGTGGCGCTGCTGACTTCACTGCTCAAGTCATCGTCCTCAACCATCCGGGACAAATCAGCAACGGATACCCTCCGGTGCTTGACTGCCACACTGCGCACATTGCCTGCAAGTTCGCCGAGATCAAAGAGAAGTGCGACAGACGCACTGGCAAGACTACCGAGGAAAATCCCAAGAGCATCAAGAGTGGCGATGCAGCCATAGTGGTCCTGCAACCCAGCAAACCCATGTGCGTCGAAGCTTTCCAGGA----------------------------------
+Decameria               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Neurotoma               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Onycholyda              GCTGAGCGCGAACGTGGTATCACCATCGACATCGCCCTCTGGAAGTTCGAAACCGCCAAGTACTACGTGACCATCATCGACGCGCCGGGTCACCGTGACTTCATCAAGAACATGATAACCGGAACGAGCCAGGCGGACTGCGCCGTCCTGATCGTCGCCGCCGGAACCGGCGAGTTCGAGGCCGGCATTTCCAAAAACGGCCAAACCCGCGAGCACGCGCTTCTAGCCTTCACCCTGGGGGTCAAGCAGCTCATCGTCGGCGTCAACAAGATGGACTCAACGGAACCGCCCTACTCCGAGAGCCGCTTCGAGGAAATCAAGAAGGAGGTCTCCTCGTACATCAAGAAGATCGGCTACAACCCCCCCTCCGTGGCCTTCGTGCCCATATCCGGATGGCACGGGGACAACATGCTGGAACCATCGCCGAAGATGGCCTGGTACAAGGGCTGGAAGGTGGAGCGCAAGGACGGCAACGCCGACGGCAAATGTCTGATCGAGGCGCTCGACGCGATCCTTCCGCCATCAAGGCCCACCGATAAGGCCCTCCGTCTGCCGCTGCAGGACGTCTACAAGATCGGCGGGATTGGGACCGTTCCAGTGGGACGCGTGGAGACGGGCATCCTGAAGCCGGGCATGCTGGTGACCTTCGCCCCGGCCGCCTTGACGACTGAAGTCAAGAGCGTGGAGATGCACCATGAGGCCCTGACCGAGGCCCTACCCGGGGACAACGTGGGCTTCAACGTTAAGAACATCTCCGTGAAGGAGCTGCGTCGCGGCTACGTTGCCGGGGACTCGAAGAACCAGCCGCCCAAGGGCGCTGCCGATTTCACGGCCCAGGTCATCGTCCTGAACCACCCGGGGCAGATCTGCAACGGCTATACGCCGGTCTTGGACTGCCACACGGCGCACATCGCGTGCAAGTTTGCGGAGATAAAGGAGAAGTGCGATCGTCGAACTGGGAAGACCACGGAGGAGAACCCGAAGAGCATCAAGAGCGGTGATGCTGCGATCGTGATGCTGCAGCCGAGCAAGCCGATGTGCGTCGAGGCGTTCCAGGAGTTTCCGCCTCTTGGACGCTTTGCTGTTCGCGAC
+Pamphilius              ------------CGCGGTATANCCATCGACATCGCCCTCTGGAAGTTCGAAACCGCCAAGTACTACGTGACCATCATCGACGCCCCGGGTCACCGTGACTTCATCAAGAACATGATAACCGGGACGAGCCAGGCGGACTGCGCCGTCCTGATCGTCGCCGCCGGAACCGGCGAGTTCGAGGCCGGCATTTCCAAAAACGGNCAGACCCGCGAGCACGCGCTNCTAGCCTTCACCCTGGGGGTCAAGCAGCTCATCGTCGGCGTCAACAAGATGGACTCAACGGAGCCGCCCTACTCCGAGAGCCGCTTCGAGGAAATCAAGAAGGAGGTCTCCTCGTACATCAAGAAGATCGGCTACAACCCCCCCTCCGTGGCCTTCGTGCCCATATCCGGATGGCACGGGGACAACATGCTGGAACCATCGCCGAAGATGGCCTGGTACAAGGGCTGGAAGGTGGAGCGCAAGGACGGCAATGCCGACGGCAAATGCCTGATCGAGGCGCTCGACGCGATCCTTCCGCCGTCAAGGCCCACCGATAAGGCCCTCCGTCTGCCGCTGCAGGACGTCTACAAGATCGGCGGGATTGGGACCGTTCCAGTGGGACGCGTGGAGACGGGCATCCTGAAGCCGGGCATGCTGGTCACCTTCGCCCCGGCCGCCTTGACGACCGAAGTCAAGAGCGTGGAGATGCACCATGAGGCCCTGACCGAGGTCCTTCCCGGGGATAACGTGGGCTTCAACGTTAAGAACATCTCCGTGAAGGAACTGCGTCGNGGCTACGTTGCCGGGGACTCGAAGAACCAGCCGCCCAAGGGCGCTGCCGATTTCACGGCCCAGGTCATCGTCCTGAACCATCCGGGGCAGATNTGCAACGGCTATACGCCGGTCTTGGACTGTCACACGGCGCACATCGCGTGCAAGTTTGCGGAGATAAAGGAGAAGTGCGATCGTCGAACTGGGAAGACCACGGAGGAGAACCCGAAGAGCATAAAAAGCGGTGATGCTGCGATCGTGATGCTGCGGCCGAGCAAGCCGATGTGCGTTGAGGCTTTCCAGGAGTTTCCGC--------------------------
+Cephalcia               GCTGAGCGCGAACGTGGTATCACCATCGACATCGCCCTCTGGAAGTTCGAAACCGCCAAGTACTACGTGACCATCATCGACGCCCCGGGTCACCGTGACTTCATCAAGAACATGATAACCGGCACGAGCCAGGCGGACTGCGCCGTTCTCATCGTCGCCGCCGGAACCGGCGAGTTCGAGGCCGGTATTTCCAAAAACGGACAGACCCGCGAGCACGCTCTCCTCGCCTTCACCCTGGGCGTGAAGCAGCTCATAGTCGGCGTCAACAAGATGGATTCCACCGAGCCACCCTACTCCGAAAGCCGCTTCGAGGAGATCAAGAAGGAGGTCTCGTCGTACATCAAGAAGATCGGATACAACCCTCCCTCCGTCGCCTTCGTGCCCATCTCCGGGTGGCACGGGGACAACATGCTGGAACCCTCTCCGAAGATGGCTTGGTACAAGGGCTGGAAGGTGGAGCGCAAGGACGGCAACGCCGACGGCAAGTGCCTGATCGAGGCGCTCGACGCGATCCTGCCGCCGTCAAGACCCACCGATAAGGCCCTCCGTTTGCCGCTGCAGGACGTCTACAAGATCGGCGGAATTGGKACCGTTCCAGTGGGACGCGTGGAGACGGGCATCCTGAAGCCGGGCATGCTGGTGACATTCGCGCCGGCTGCCCTGACGACTGAGGTCAAGTCAGTCGARATGCATCACGARGC-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Acantholyda             GCTGAGCGCGAACGCGGCATCACCATCGACATCGCTCTCTGGAAGTTCGAAACCGCCAAGTACTACGTGACCATCATCGACGCCCCGGGTCACCGTGACTTCATCAAGAACATGATAACCGGGACGAGCCAGGCGGACTGCGCCGTCCTGATCGTCGCCGCCGGAACCGGCGAGTTCGAGGCCGGCATTTCCAAAAACGGNCAGACCCGCGAGCACGCGCTNCTAGCCTTCACCCTGGGGGTCAAGCAGCTCATCGTCGGCGTCAACAAGATGGACTCAACGGAGCCGCCCTACTCCGAGAGCCGCTTCGAGGAAATCAAGAAGGAGGTCTCCTCGTACATCAAGAAGATCGGCTACAACCCCCCCTCCGTGGCCTTCGTGCCCATATCCGGATGGCACGGGGACAACATGCTGGAACCATCGCCGAAGATGGCCTGGTACAAGGGCTGGAAGGTGGAGCGCAAGGACGGCAATGCCGACGGCAAATGCCTGATCGAGGCGCTCGACGCGATCCTTCCGCCGTCAAGGCCCACCGATAAGGCCCTCCGTCTGCCGCTGCAGGACGTCTACAAGATCGGCGGGATTGGGACCGTTCCAGTGGGACGCGTGGAGACGGGCATCCTGAAGCCGGGCATGCTGGTCACCTTCGCCCCGGCCGCCTTGACGACCGAAGTCAAGAGCGTGGAGATGCACCATGAGGCCCTGACCGAGGTCCTTCCCGGGGATAACGTGGGCTTCAACGTTAAGAACATCTCCGTGAAGGAACTGCGTCGNGGCTACGTTGCCGGGGACTCGAAGAACCAGCCGCCCAAGGGCGCTGCCGATTTCACGGCCCAGGTCATCGTCCTGAACCATCCGGGGCAGATCTGCAACGGCTATACGCCGGTCTTGGACTGTCACACGGCGCACATCGCGTGCAAGTTTGCGGAGATAAAGGAGAAGTGCGATCGTCGAACTGGGAAGACCACGGAGGAGAACCCGAAGAGCATAAAAAGCGGTGATGCTGCGATCGTGATGCTGCGGCCGAGCAAGCCGATGTGCGTTGAGGCTTTCCAGGAGTTTCCGCC-------------------------
+Megalodontesc           GCTGAACGAGAACGTGGTATCACCATTGACATCGCCCTGTGGAAGTTCGAAACTGCCAAGTACTACGTGACCATCATCGACGCCCCGGGTCACAGGGACTTCATAAAGAACATGATAACCGGAACTAGCCAAGCCGATTGCGCTGTGTTGATAGTTGCAGCCGGAACCGGTGAATTCGAGGCTGGGATCTCGAAGAACGGGCAAACCCGAGAGCACGCNTTGCTGGCGTTTACCCTAGGGGTAAAACAATTGATCGTCGGGGTGAACAAGATGGACTCAACCGAGCCACCTTACTCCGAGAGTCGCTTCGAAGAGATAAAGAAAGAAGTGTCCTCTTACATCAAGAAGATCGGCTACAACCCCCCTTCCGTAGCCTTCGTCCCAATTTCCGGGTGGCACGGCGACAACATGTTGGAACCCTCGCCGAAGATGCCATGGTACAAGGGGTGGAAGGTCGAACGAAAGGACGGAAACGCCGACGGGAAGTGTCTGATCGAAGCCCTGGACGCAATTCTTCCTCCTTCGAGACCTACGGACAAGGCATTGCGTCTGCCTCTGCAGGACGTCTACAAGATCGGGGGCATTGGAACGGTCCCGGTCGGTCGTGTGGAGACCGGGATCCTAAAACCCGGGATGCTCGTGACCTTCGCTCCGGCAGCATTGACTACGGAGGTCAAGTCCGTCGAGATGCATCACGAGGCTCTAACCGAGGCTTTGCCAGGTGACAACGTAGGCTTCAACGTGAAGAACATCTCCGTGAAGGAGTTGCGTCGCGGGTACGTGGCTGGAGATTCGAAGAACCAGCCGCCGAAAGGAGCTTCTGACTTCACCGCTCAGGTCATCGTCCTGAACCACCCGGGACAAATCAGCAACGGGTATACCCCGGTGTTGGATTGTCACACGGCTCACATCGCGTGCAAGTTTGCTGAGATAAAGGAGAAGTGCGATCGTCGTACGGGAAAAACTACGGAGGAGAACCCTAAGAGCATCAAGAGCGGAGATGCGGCTATTGTGATGCTGCAACCCAGCAAGCCGTTGTGCGTCGAGGCTTTCCAGGAGTTTCCGCC-------------------------
+Megalodontessk          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Cephus                  GCTGAGCGTGAACGTGGCATCACTATTGATATTGCTCTTTGGAAGTTTGAAACAGCTAAGTACTATGTAACCATCATCGATGCCCCTGGACATAGAGATTTCATAAAGAACATGATCACTGGCACAAGTCAAGCTGACTGCGCTGTGCTCATAGTGGCAGCTGGTATAGGAGAGTTCGAGGCAGGCATTTCTAAAAATGGACAAACCCGTGAACATGCATTACTTGCATTCACTTTGGGTGTTAAGCAGCTGATTGTTGGAATCAATAAAATGGACATGACCGAACCACCATATTCTGAAAGTCGCTTTGAGGAAATCAAAAAGGAAGTCTCCTCATACATCAAGAAGATTGGGTATAACACTGCTTCTGTAGCTTTTGTACCCATCTCAGGTTGGCATGGTGATAATATGCTTGAGCCGTCTCCAAAAACATCATGGTACAAGGGCTGGAAAGTAGAGCGTAAAGATGGCAATGCTGATGGAAAAACTTTGATCGAAGCATTGGATGCTATTCTTCCACCTTCTCGTCCTACAGATAAAGCATTGCGGCTTCCACTACAAGATGTTTACAAGATTGGTGGTATTGGTACAGTGCCTGTGGGTCGCGTTGAAACTGGTATTTTGAAGCCAGGCATGGTGGTAACTTTTGCTCCTGCAGCTCTTACTACTGAAGTAAAATCTGTGGAGATGCATCACGAAGCCCTGCCTGAGGCTGTGCCTGGTGACAATGTAGGCTTCAACGTGAAAAACATCTCAGTGAAGGAATTGCGTCGTGGCTACGTAGCTGGGGATTCAAAAAATCAGCCACCCCGTGGAGCCGCTGATTTCACTGCTCAGGTTATCGTACTCAATCATCCCGGTCAAATTAGCAATGGTTACACTCCTGTTCTTGATTGTCATACTGCTCACATCGCATGCAAATTCGCTGAGATAAAAGAAAAATGTGACCGTCGTACCGGAAAAACAACTGAGGAAAATCCGAAAAGCATTAAGAGCGGCGACGCTGCCATAGTAATGCTGCAACCGAGTAAGCCGATGTGCGTTGAAGCTTTTCAGGAATTCCCGCCTATGGGACGCTTCGCAGTTCG----
+Calameuta               GCTGAGCGYGARCGTGGTATCACTATTGACATTGCTCTGTGGAAGTTTGAAACAGCCAAGTACTACGTAACCATCATCGATGCACCTGGACATAGAGATTTCATAAAGAACATGATCACTGGCACAAGTCAGRCTGACTGCGCTGTGCTCATAGTGGCAGCTGGTGTAGGAGAGTTTGAGGCAGGCATTTCGAAAAACGGACAGACCCGTGAACATGCATTGCTTGCATTCACTYTGGGTGTTAAACAGCTGATTGTTGGAATCAATAAAATGGACACGACCGAACCACCATATTCCGAAAGTCGCTTTGAGGAAATCAAAAAGGAAGTCTCCTCGTACATCAAGAAGATTGGGTATAACACTGCTTCCGTAGCCTTTGTACCCATCTCAGGTTGGCATGGTGATAATATGCTTGAGCCATCTCCAAAAACATCATGGTACAAGGGCTGGAAAGTAGAGCGAAAGGATGGCAATGCTGATGGAAAAACTTTGATCGAAGCACTGGATGCTATTCTTCCACCTTCTCGTCCTACGGACAAAGCATTGCGGCTTCCACTGCAAGATGTTTACAAGATTGGCGGGATTGGTACAGTGCCTGTGGGTCGCGTTGAAACTGGTATTTTGAAGCCAGGCATGGTGGTAACTTTTGCTCCTGCAGCCCTTACCACCGAAGTCAAATCTGTCGAGATGCATCACGAAGCACTGCCTGAAGCTGTGCCCGGTGACAACGTGGGCTTTAACGTGAAGAACATCTCAGTGAAGGAATTGCGTCGTGGCTACGTAGCTGGAGATTCGAAAAATCAGCCACCCCGTGGAGCCGCTGATTTCACTGCTCAGGTTATCGTACTCAATCATCCCGGTCAGATTAGCAATGGTTACACTCCTGTTCTCGATTGTCACACTGCCCACATCGCGTGCAAATTCGCTGAGATAAAAGAAAAATGTGACCGTCGTACCGGAAAAACAACAGAGGAAAATCCGAAAAGCATTAAGAGCGGCGACGCTGCCATAGTAATGCTGCAACCGAGTAAGCCGATGTGCGTTGAAGCTTTTCAGGAATTCCCGCCTCTGGGGCGCTTCGCAGTACGCGAC
+Hartigia                GCTGAGCGCGAACGCGGTATCACAATCGACATAGCCCTGTGGAAATTCGAAACAGCCAAGTACTACGTGACGATAATCGACGCCCCGGGACACCGGGACTTCATCAAGAACATGATCACCGGAACGAGTCAGGCCGATTGTGCCGTGTTAATAGTAGCAGCTGGAACAGGAGAATTCGAGGCTGGAATCTCAAAAAACGGTCAGACCCGCGAACACGCGCTCCTGGCATTTACCCTGGGTGTCAAGCAATTGATCGTAGGAGTCAACAAGATGGACTCGACCGAACCACCCTATTCCGAGAGTAGATTCGAGGAGATCAAAAAAGAAGTGTCGTCCTACATCAAGAAGATCGGCTACAACACGTCCTCGGTGGCATTCGTTCCGATCTCAGGCTGGCACGGGGACAATATGTTGGAACCCTCCCCCAAAATGGCTTGGTACAAGGGTTGGAAAGTGGAACGCAAGGATGGCAATGCCGATGGCAAAACACTGATCGAGGCATTGGACGCAATTTTACCACCGTCGCGTCCAACCGACAAGGCACTTCGTCTTCCTCTTCAGGATGTCTACAAAATCGGCGGAATCGGAACAGTGCCAGTTGGTCGTGTAGAAACTGGCATCTTGAAGCCGGGAATGCTCGTGACTTTTGCCCCGGCAGCTCTTACCACTGAAGTTAAATCCGTCGAGATGCACCACGAGGCACTGACCGAAGCTCTACCCGGCGACAACGTTGGCTTCAACGTGAAGAACATCTCGGTKAAGGAATTACGTCGTGGCTATGTAGCAGGGGATTCAAAAAATCAACCACCTCGTGGAGCCGCCGATTTCACTGCTCAGGTTATCGTACTGAATCATCCCGGTCAGATCAGCAATGGTTATACACCGGTTCTTGATTGTCATACTGCTCACATCGCGTGCAAATTCGCCGAGATAAAAGAAAAATGTGACCGTCGTACCGGAAAAACAACTGAGGAAAACCCGAAAAGTATNAAAAGTGGCGACGCTGCCATAGTAATGCTGCAACCGAGTAAGCCAATGTGCGTTGAAGCTTTTCAGGAATTCCCGCCTTTGGGGCGCTTTGCAGTGCGCGAC
+Syntexis                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Sirex                   GCCGAACGCGAACGTGGTATCACGATCGATATAGCCCTGTGGAAATTCGAAACGGCCAAGTACTACGTNACGATAATCGACGCCCCGGGTCACCGAGACTTCATCAAAAACATGATCACAGGAACGAGTCAAGCCGATTGTGCAGTGCTCATTGTAGCAGCTGGAACTGGTGAATTTGAGGCTGGAATCTCNAAAAATGGTCAAACCCGTGAACACGCTCTCCTGGCATTTACCTTGGGAGTGAAACAATTGATCGTCGGAGTCAACAAGATGGACTCGACCGAGCCACCCTATTCTGAGAGCCGATTCGAAGAGATCAAGAAAGAAGTGTCATCCTACATCAAGAAGATCGGATACAACACGGCCTCAGTGGCATTCGTTCCAATTTCAGGATGGCATGGGGACAATATGTTGGAACCATCTCCCAAAATGGCTTGGTACAAAGGTTGGAAAGTGGAACGTAAGGACGGCAATGCCGATGGCAAGACTCTGATCGAAGCATTAGACGCAATTTTACCACCATCCCGTCCAACCGACAAGGCTCTTCGTCTTCCACTTCAAGATGTCTACAAGATCGGTGGAATCGGAACAGTTCCAGTTGGTAGAGTCGAAACTGGCATTTTAAAACCAGGAATGCTCGTAACTTTTGCCCCAGCAGCTCTTACCACCGAAGTCAAGTCCGTCGAGATGCACCATGAGGCTCTGACCGAGGCTTTGCCTGGTGACAACGTGGGCTTCAACGTAAAAAACATCTCGGTTAAGGAATTACGTCGTGGTTACGTGGCTGGAGACTCGAAAAATCAACCCCCTAAAGGTGCTGCTGACTTTACCGCTCAGGTAATCGTACTGAATCATCCTGGGCAAATCAGCAATGGCTACACGCCTGTTCTTGACTGCCATACCGCTCATATTGCCTGCAAATTTGCCGAGATCAAGGAAAAGTGCGATCGTCGAACTGGCAAGACTACCGAGGAGAATCCAAAGAGCATCAAAAGCGGCGACGCGGCAATAGTCATACTGCAGCCAAGTAAGCCGATGTGCGTTGAGGCTTTTCAAG-----------------------------------
+Xeris                   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Urocerus                ---------------------------------------TGGAAATTCGAAACAGCCAAGTACTACGTGACGATAATCGACGCCCCGGGACACCGGGACTTCATCAAGAACATGATCACCGGAACGAGTCAGGCCGATTGTGCCGTGTTAATAGTAGCAGCTGGAACANGAGAATTCGAGGCTGGAATCTCAAAAAACGGTCAGACCCGCGAACACGCGCTCCTGGTATTTACCCTGGGTGTCAAGCAATTGATCGTAGGAGTCAACAAGATGGACTCGACCGAGCCACCCTATTCCGAGAGTAGATTCGAGGAGATCAAAAAAGAAGTGTCGTCCTACATCAAGAAGATCGGCTACAACACGTCCTCGGTGGCATTCGTTCCGATCTCAGGCTGGCACGGGGACAATATGTTGGAACCCTCCCCCAAAATGGCTTGGTACAAGGGTTGGAAAGTGGAACGCAAGGATGGCAATGCCGATGGCAAAACACTGATCGAGGCATTGGACGCAATTTTACCACCGTCGCGTCCAACCGACAAGGCACTTCGTCTTCCTCTTCAGGATGTCTACAAAATCGGCGGAATCGGAACAGTGCCGGTTGGTCGTGTAGAAACTGGCATCTTGAAGCCGGGAATGCTCGTGACTTTTGCCCCGGCAGCTCTTACCACTGAAGTTAAATCCGTCGAGATGCACCACGAGGCACTGACCGAAGCTCTACCCGGCGACAACGTTGGCTTCAACGTGAAGAACATCTCGGTTAAGGAATTACGTCGTGGTTACGTGGCTGGAGACTCGAAGAATCAGCCGCCCAAAGGTGCTGCCGACTTTACTGCCCAGGTGATCGTGCTGAATCATCCTGGACAGATCAGCAATGGTTACACGCCGGTTCTCGACTGTCACACCGCCCATATTGCCTGCAAGTTTGCCGAGATCAAGGAAAAGTGCGATCGTCGTACCGGCAAGACGACCGAGGAGAATCCTAAGAGCATTAAGAGCGGCGATGCTGCAATAGTCATGCTACAGCCGAGCAAACCGATGTGCGTTGAGGCTTTCCAAGAGTTTCCGCCGTTGGGACGCTTTGCTGTTCGCAAC
+Tremex                  ---------------------------------------TGGAAATTCGAAACTGCCAAGTATTACGCTACGATCATCGACGCGCCGGGTCATCGGGACTTCATCAAGAACATGATAACTGGAACGAGTCAGGCCGATTGCGCGGTGCTGATAGTGGCCGCTGGAACCGGAGAATTCGAGGCTGGAATTTCAAAAAATGGTCAAACGCGAGAACACCCTCTCCTGGTATTCACCCTTGGGGTCAAGCAATTGATCGTCGGGGTCAATAAAATGGACTCGACCGAGCCGGCCTATTCCGAGAGCCGATTCGAGGAGATCAAGAAGGAGGTGTCGTCGTACATCAAGAAGATCGGCTACAACCCGGCCTCGGTGGCGTTCGTCCCGATTTCAGGTTGGCACGGGGACAACATGCTGGAGCCATCCCCGAAAATGGCCTGGTACAAGGGTTGGAAGGTCGAACGTAAGGACGGTAATGCCGACGGTAAGACCCTGATCGAGGCCCTGGACGCGATCCTGCCGCCATCGCGTCCGACCGACAAGGCCCTTCGTCTTCCTCTTCAGGACGTTTACAAGATCGGGGGAATCGAAACGGTCCCGGTCGGTCGGGTCGAAACCGGGATCCTAAAGCCAGGAATGCTCGTAACCTTTGCCCCGGCCGCCCTTACGACCGAGGTCAAGTCCGTCGAGATGCACCACGAGGCCCTGACCGAGGCCCTACCCGGCGACAACGTGGGCTTCAACGTGAAGAACATCTCGGTCAAGGAGCTGCGCCGCGGCTACGTGGCCGGGGACTCGAAGAATCAGCCACCGAAAGGCGCGGCCGACTTCACCGCCCAGGTCATCGTCCTGAATCATCCTGGACAGATCAGCAATGGCTACACTCCCGTTCTCGATTGCCACACCGCTCATATAGCCTGCAAATTCGCCGAGATCAAGGAGAAGTGCGATCGTCGAACCGGAAAGACCACGGAAGAGAATCCGAAGAGCATCAAGAGCGGCGACGCGGCGATAGTTATGCTGCAACCCAGCAAGCCGATGTGCGTGGAAGCCTTCCAGGAGTTCCCGCCGCTGGGACGCTTTGCTGTTCGCGAC
+Xiphydria               GCTGAGCGCGAGCGTGGTATCACCATCGACATCGCGCTCTGGAAATTTGAGACGGCCAAGTACTACGTGACGATAATCGACGCGCCCGGTCATCGGGATTTTATCAAGAACATGATCACCGGTACTAGTCAGGCCGATTGCGCGGTACTGATCGTCGCCGCCGGTACCGGGGAATTCGAAGCGGGCATCTCGAAGAACGGCCAGACTCGCGAACACGCCCTACTCGCCTTCACTCTCGGCGTGAAGCAGCTGATCGTCGGCGTCAATAAGATGGACTCGACCGAGCCGCCTTATTCGGAGAGTCGCTTCGAGGAGATAAAAAAAGAGGTGTCCTCCTACATCAAGAAAATCGGCTACAACACAGCGTCGGTCGCCTTCGTGCCGATTTCCGGCTGGCACGGCGACAATATGCTCGAGCCCTCCCCGAAGATGCCTTGGTACAAGGGTTGGAAGGTGGAGCGCAAGGACAACACCGCCGACGGAAGGACGCTCATCGAGGCGCTCGACGCCATCCTGCCGCCTTCGCGTCCCACCGACAAGGCTCTCCGTCTGCCGCTGCAGGATGTCTACAAGATCGGTGGCATCGGTACCGTACCGGTGGGTCGCGTCGAAACCGGTATCTTGAAACCGGGCATGCTCGTCACCTTCGCACCGGCCGCTCTCACCACCGAAGTCAAGAGCGTCGAGATGCACCACGAGGCCCTCACCGAAGCCGTGCCCGGTGACAACGTCGGCTTCAACGTCAAGAACATTTCCGTGAAGGAGTTGCGTCGCGGATATGTGGCTGGCGACTCCAAGAACCAGCCGCCGAGGGGAGCCGCCGATTTTACTGCTCAAGTGATCGTTCTGAATCACCCCGGTCAGATCAGCAACGGCTACACGCCCGTGCTCGATTGTCACACTGCTCACATCGCCTGTAAGTTCGCCGAGATCAAGGAGAAGTGCGACCGTCGTACCGGAAAGATGACCGAGGAGAACCCGAGGTGCATCAAGAGCGGTGACGCAGCGATAGTGATGCTCCAGCCGAGCAAGCCCATGTGCGTCGAGGCTTTTCAGGAGTTTCCGCCGCTGGGACGCTTCGCCGTGCGCAAC
+Orussus                 GCTGAGCGTGAACGTGGTATCACGATCGACATAGCGCTCTGGAAGTTCGAGACGGCAAAGTACTACGTGACCATAATCGACGCACCGGGTCACCGAGACTTCATCAAGAACATGATAACGGGAACAAGCCAGGCGGACTGCGCGGTGCTGATAGTGGCAGCAGGAATCGGTGAATTCGAGGCAGGGATCTCGAAAAACGGGCAGACCAGAGAGCACGCCCTGCTGGCGTTCACCCTGGGAGTGAAACAGCTGATCGTCGGGGTGAACAAAATGGACATGACCGAGCCCCCGTACTCGGAGAGCCGCTTCGAGGAGATCAAGAAGGAGGTCTCCTCCTACATCAAGAAGATCGGCTACAACACCGGGTCCGTGGCCTTCGTGCCCATCTCCGGCTGGCACGGCGACAACATGTTGGAGCCGTCCCCGAAGACGCCCTGGTACAAGGGGTGGAAAGTCGAGCGTAAAGACGGCAACGCCGACGGGAAGACCCTGATCGAGGCTCTGGACGCCATCTTGCCACCCTCTCGACCCACCGACAAGGCTCTGCGACTTCCTCTTCAGGACGTCTACAAGATAGGCGGCATCGGAACCGTCCCGGTCGGCAGAGTGGAGACCGGTATCCTGAAGCCGGGGATGTTGGTCACCTTCGCCCCTGCTGCCCTGACCACCGAGGTCAAGTCCGTTGAAATGCATCACGAAGC-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+StephanidaeA            GCCGAACGTGAACGCGGTATTACCATCGATATTGCTTTGTGGAAATTCGAGACAGCCAAGTACTATGTGACTATTATCGATGCTCCTGGTCATCGTGATTTTATCAAGAACATGATAACCGGTACCAGTCAAGCCGATTGCGCGGTATTGATAGTAGCAGCTGGAATAGGTGAATTCGAGGCTGGAATCTCAAAAAGCGGTCAAACCCGCGAACATGCTCTATTGGCATTCACGTTGGGTGTCAAACAACTGATCGTTGGAGTGAACAAGATGGATATGACCAAACCACCATATTCGGAAAATCGATTTGAAGAGATCAAGAAGGAAGTATCTTCCTACATCAAGAAGATCGGTTATAATACCGCTTCGGTGGCGTTTGTACCGATTTCCGGTTGGTACGGGGATAATATGTTGGAACCGACACCCAAAACGTCGTGGTACAAAGGATGGAAGGTGGAAAGAAAAGATGGCAATGCAGATGGCAAAACTTTGATCGAAGCTCTTGATGCAATTTTACCACCTTCCAGACCCACCGACAAGGCATTGCGTTTACCACTTCAAGACGTTTATAAGATCGGTGGTATCGGTACAGTACCTGTCGGTCGTGTGGAGACTGGTATTTTGAAACCAGGTATGCTGGTTACTTTTGCCCCAGCGGCATTGACCACTGAAGTTAAATCGGTTGAAATGCACCACGAAGCTTTGCCGGAAGCTTTACCCGGCGACAACGTTGGCTTCAACGTTAAGAATATNTCCGTTAAGGAATTGAGGCGTGGCTATGTAGCTGGCGATTCGAAAAATCAACCTCCGAAAGGAGCATCCGATTTTACCGCTCAAGTGATCGTTCTTAATCATCCTGGTCAAATCAGCAACGGTTATACGCCAGTTCTTGATTGTCACACGGCTCATATTGCTTGCAAATTTGCAGAAATTAAAGAAAAGTGTGACCGTCGTACTGGAAAAACTACCGAAGAAAATCCCAAAAGCATCAAAAGCGGTGATGCGGCGATAGTGATGCTTCAACCGACCAAACCGATGTGTGTTGAAGCTTTTCAAGAGTTTCCACCCTTAGGACGCTTTGCCGTACGCGAC
+StephanidaeB            ---------------------ACCATCGATATTGCTTTGTGGAAATTCGAGACAGCTAAATATTATGTGACCATCATCGATGCTCCTGGTCATCGTGATTTTATCAAGAATATGATAACGGGTACCAGTCAAGCCGATTGCGCCGTATTGATAGTAGCGGCTGGAATAGGTGAATTCGAGGCTGGAATTTCGAAAAGTGGACAAACTCGCGAACATGCTCTTTTGGCGTTCACTTTGGGCGTTAAACAATTGATCGTTGGAGTAAATAAGATGGATATGACCAAACCACCATATTCGGAGAGTAGATTCGAAGAGATCAAGAAAGAAGTATCTTCCTACATTAAGAAGATCGGTTATAATACTGCTTCGGTGGCATTTGTACCGATTTCCGGTTGGTACGGGGATAATATGTTGGAATCGTCACCCAAAACATCTTGGTACAAAGGATGGAAAGTGGAAAGAAAGGATGGCAATGCCGATGGGAAAACTTTGATCGAAGCTCTCGATGCGATTTTACCACCTTCCAGACCGACCGATAAGGCACTGCGTTTGCCACTTCAAGATGTTTATAAGATAGGTGGTATTGGTACCGTACCTGTTGGTCGTGTGGAGACCGGTATTTTGAAACCGGGTATGCTCGTAACTTTTGCTCCAGCAGCGTTGACCACTGAAGTTAAATCGGTTGAAATGCATCATGAAGCTCTGCCGGAAGCTTTACCCGGTGATAACGTTGGTTTCAACGTTAAAAATATCTCCGTGAAGGAATTGAGACGCGGCTATGT----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Megalyra                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Trigonalidae            ---------------GGTATCACTATCGANATCGCTCTATGGAAATTCGAGACGGCCAAGTATTACGTGACCATCATCGACGCGCCGGGTCATCGCGACTTCATCAAGAACATGATAACCGGAACTAGCCAAGCGGATTGCGCCGTCNTGGTCGTGGCTGCGGGTATCGGNGAGTTCGAGGCNGGGATATCGAAGAACGGCCAGACCCGCGAACACGCCCTGCTGGCGTTCACCCTGGGCGTCAAGCAGCTCATCGTCGGCGTGAATAAGATGGACATGACCGAGCCACCTTACTCGGAGCCTCGCTTCGAGGAGATCAAGAAAGAAGTTTCCTCGTACATCAAGAAGATCGGCTACAACACCGCGTCCGTGGCCTTCGTGCCGATATCCGGTTGGCACGGCGACAACATGCTGGAACCCTCGCCGAAGACTTCCTGGTACAAGGGTTGGAAGGTCGAGCGCAAGGACGGCAACGCCGACGGCAAGACGCTCATCGAAGCTCTCGACGCCATTCTCCCACCGTCCAGACCTACGGACAAGGCTTTGCGTCTACCTCTGCAGGATGTTTACAAGATCGGTGGCATCGGNACNGAACCNGTTGGTCGAGTGGAGACAGGTATCCTCAAACCAGGT---------------------------------------------------------------------------------------------------------------------------GTGAAGGAACTTCGACGCGGTTACGTGGCCGGCGACTCCAAGAATCAACCACCGAGAGGCGCAGCTGATTTTACCGCTCAGGTTATCGTGCTCAATCATCCTGGACAGATCAGCAACGGCTACACGCCGGTTCTCGACTGCCACACTGCTCACATCGCTTGCAAGTTCGCCGAGATCAAGGAAAAGTGCGATCGTCGTACGGGCAAGACCACCGAGGAAAACCCAAAGAGTATCAAGAGCGGCGACGCGGCCATAGTTACCCTACAACCTACGAAACCCATGTGCGTGGAAGCTTTCCCGGAATTCCCACCACTCGGTCGCTTCGCTGTACGTGAC
+Chalcidoidea            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Evanioidea              GCTGAGCGTGAACGTGGTATCACGATCGACATCGCCCTGTGGAAGTTCGAGACTGCCAAGTACTACGTGACGATAATCGACGCGCCTGGACACCGGGACTTCATAAAGAACATGATAACCGGGACGAGTCAGGCGGATTGCGCGGTCCTGATCGTCGCAGCCGGGTTAGGCGAGTTCGAGACCGGCATCTCGAAGAACGGGCAGACGCGCGAGCACGCCCTGCTCGCGTTCACCCTGGGCGTCAAGCAGCTCATCGTCGGGGTCAATAAGATGGACCAGACCCAGCCGCCATACTCGGAGGACCGCTTCGAGGAGATCAAGAAGGAGGTCTCGTCCTACATCAAGAAGATCGGCTACAACCCCGCCTCCGTCGCCTTCGTGCCCATCTCCGGGTGGCACGGGGACAACATGCTCGAGTCCTCCCCGAAGACGTCCTGGTACAAGGGGTGGAAGGTCGAGCGCAAGGACGGCAACGCCGACGGGAAGACCCTCATCGAAGCCCTCGACGCCATCCTCCCGCCGTCCAGACCCACCGACAAGGCTCTTCGACTGCCGCTCCAGGACGTCTACAAGATCGGCGGCATCGGCACCGTTCCCGTCGGCCGCGTCGAGACGGGCATCCTGAAACCCGGTATGCTGGTGACCTTCGCACCGGCGGCTCTGACGACGGAGGTAAAGTCCGTGGAGATGCATCACGAGGCCCTGACCGAGGCCCTGCCCGGGGACAACGTCGGGTTCAACGTGAAGAACATCTCCGTGAAGGAGCTGCGCCGCGGTTACGTCGCCGGGGACTCAAAGAACCAGCCTCCGAGAGGCGCGGCCGATTTCACGGCCCAAGTAATCGTCCTTAATCATCCGGGTCAGATAAGCAACGGGTACACGCCCGTCCTTGACTGCCACACGGCTCACATCGCGTGCAAATTCGCCGAGATCAAGGAGAAGTGCGACCGTCGTACGGGCAAGACGACGGAGGAGAACCCGAAGAGCATCAAGAGCGGGGACGCGGCTATCGTCATGCTCCAGCCGACGAAGCCGATGTGCGTCGAGGCTTTCCAGGAGTTCCCGCCGTTGGGACGTTTCGCCGTCCGGGAC
+Ichneumonidae           GCCGAAAGAGAGCGTGGAATAACAATCGATATTGCAATGTGGAAATTTGAAACAGCCAAATATTACATAACCATAATCGATGCACCGGGACATCGCGACTTTATAAAAAATATGATAACCGGAACAAGCCAAGCAGATTGCGCTGTCCTCATAGTCGCTGCCGGAATCGGTGAATTTGAGGCTGGAATATCGAAAAACGGACAAACACGCGAGCATGCTCTGCTCGCATTCACTCTTGGTGTCAAACAGCTCATAGTCGGTGTCAATAAAATGGACATGACCGAGCCACCATACTCCGAGACACGTTTCGAAGAAATAAAGAAGGAAGTTTCGTCCTACATAAAGAAAATCGGTTACAACACGTCATCGGTCGCTTTTGTGCCGATTTCTGGTTGGCACGGTGACAATATGCTCGAATCGTCACCCAAAACAGCTTGGTACAAGGGCTGGAAAGTTGAACGCAAAGATGGTAACGGCGAGGGTAAAACTTTGATCGAGGCACTTGATGCTATTTTACCGCCGTCACGTCCAACCGATAAGGCACTTCGTTTACCTCTTCAAGATGTGTACAAAATTGGTGGTATCGGCACTGTGCCAGTTGGTCGAGTCGAGACCGGGATACTCAAACCAGGTATGTTGGTGACATTTGCCCCAGCCGCTTTGACAACGGAAGTTAAATCCGTGGAAATGCATCATGAGGCATTGACAGTCGCCATGCCCGGTGACAATGTTGGATTTAATGTCAAAAACATATCAGTCAAGGAATTACGTCGGGGCTATGTTGCCGGAGATTCAAAAAATCAGCCACCTCGTGGTGCATCGGATTTCACCGCACAGGTTATCGTGCTCAATCATCCGGGACGGATAAGCAACGGTTACACGCCCGTTCTCGATTGTCATACGGCTCACATAGCTTGCAAATTTGCCGAGATAAAGGAAAAATGTGATCGTCGTACTGGCAAAACAACTGAGGAAAATCCAAAGAGCATAAAAAGCGGTGATGCTGCTATGGTCGTTCTCCAACCCACCAAGCCAATGTGTGTCGAGGCTTCCAAGGAATTCCCGCCCTTAGGACGTTTC------------
+Cynipoidea              GCCGAACGTGAACGTGGTATCACCATTGACATTGCTCTTTGGAAATTCGAAACAGCGAAATATTATGTAACCATCATTGATGCACCGGGACATCGTGATTTCATAAAAAACATGATCACTGGAACAAGTCAAGCTGATTGTGCAGTTTTGATAGTGGCAGCGGGAATTGGAGAATTCGAAGCTGGAATTTCAAAGAATGGTCAAACTCGTGAACATGCTCTTTTGGCTTTCACTCTGGGAGTCAAACAATTGATTGTTGGTGTCAACAAAATGGATATGACCGATCCACCATATTCCGAAAGTCGATTTGAAGAAATTAAGAAAGAGGTTTCATCATACATCAAGAAAATTGGCTACAATACAGCTTCGGTTGCTTTTGTTCCTATTTCTGGATGGCATGGAGATAACATGTTGGAACCTTCTCCAAAAACTCCTTGGTACAAGGGATGGAAGGTCGAACGTAAAGATGGAAATGCNGATGGAAAAACATTNATTGAGTCTCTGGATGCTATTCTGCCTCCATCTCGACCAACTGATAAGGCCCTGANACTTCCTCTTCAAGATGTCTACAANATTGGAGGAATTGGAACTGTCCCAGTTGGACGAGTTGAGACTGGAATTTTGAAACCAGGTAT-------------------------------------------------------------------------------------GGGGACAACGTTGGTTTCAACGTGAAAAATATTTCAGTAAAAGAACTACGACGTGGATACGTTGCTGGAGATTCAAAGAACCAGCCTCCCAGAGGAGCAGCTGATTTTACTGCTCAGGTGATTGTTCTCAATCATCCTGGTCAAATCAGCAATGGATATACCCCAGTGTTGGATTGTCACACGGCTCATATTGCCTGCAAATTTGCTGAAATCAAGGAAAAATGCGACCGTCGAACTGGAAAAACTACAGAGGAAAATCCAAAAAGTATCAAAAGTGGAGATGCTGCTATAGTGATGCTGCAACCGACCAAGCCGATGTGTGTGGAAGCATTCCAGGAATTTCCACCTCTGGGAAGA---------------
+ApoideaA                GCTGAACGCGAGCGCGGCATCACCATCGACATCGCTTTATGGAAATTCGAAACTGCCAAGTACTACGTGACCATCATCGACGCCCCGGGTCATCGAGATTTCATCAAAAACATGATCACCGGCACGAGTCAGGCCGATTGCGCGGTATTGATCGTCGCGGCCGGCATCGGCGAGTTCGAGGCCGGGATCTCGAAGAACGGACAAACTCGGGAGCACGCGTTGCTCGCGTTCACGCTCGGCGTTAAACAGCTTATCGTCGGCGTGAACAAGATGGACATGACCGACCCGCCGTACTCGGAAAGCCGTTTCGAGGAGATCAAGAAGGAGGTGTCCTCCTACATCAAGAAGATCGGGTACAACACCGCGTCCGTTGCGTTCGTCCCGATCTCCGGCTGGCACGGGGACAACATGCT-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TTGGGGACAACGTTGGTTTCAACGTGAAGAACATCTCCGTGAAGGAGCTGAGGCGCGGCTACGTGGCCGGCGACTCCAAGAACCAGCCGCCACGGGGGGCGGCCGACTTCACCGCCCAGGTGATCGTCCTGAATCACCCGGGCCAGATCAGCAGCGGCTACACGCCGGTCCTCGACTGCCACACCGCCCATATCGCGTGTAAGTTCGCCGAGATGAAAGAGAAGTGCGACCGTCGTACCGGCAAGACCACCGAGGAGAATCCGAACAGCATCAAGAGCGGCGATGCTGCGATCGTGTTGCTGCAGCCGACCAAGCCGATGTGCGTCGAGTCGTTCCAGGAGTTCCCGCCGCTCGGTCGCTTCGCCGTCCGCAAC
+ApoideaB                -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TGGGGACAATGTTGGTTTCAACGTGAAGAACATCTCCGTGAAGGAGCTGAGACGCGGCTACGTGGCCGGTGATTCGAAGAATCAGCCTCCGCGAGGGGCTGCCGACTTCACGGCCCAAGTGATCGTGCTGAACCATCCGGGGCAGATCAACAACGGGTACACGCCTGTGCTTGACTGCCACACCGCTCATATCGCGTGCAAATTTGCCGAGATAAAGGAGAAGTGTGACCGTCGTACCGGTAAAACGACCGAAGAGAATCCGAAGAGCATCAAGAGCGGAGACGCGGCCATCGTGCTGCTACAGCCGATGAAGCCGATGTGCGTCGAGGCGTTCCAGGAATTCCCGCCTCTGGGTCGCTTCGCTGTGCGCGAC
+ApoideaC                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Vespidae                GCTGAGCGYGARCGTGGTATCACSATAGACATCGCCCTTTGGAAATTCGAGACCGCCAAGTACTACGTGACGATCATCGATGCGCCTGGTCACCGTGATTTCATCAAGAATATGRTAACCGGTACGAGCCAGGCAGATTGCGCGGTCCTTATCGTGGCCGCCGGTATCGGCGAGTTCGAGGCTGGAATTTCGAAGAACGGTCAGACGCGCGAACACGCYTTGCTCGCGTTCACCCTCGGCGTCAAGCAGCTCATCGTCGGCGTCAACAAGATGGACATGACCGATCCGCCGTACTCGGAGAGTCGCTTCGAAGAAATCAAAAAGGAGGTGTCGTCTTACATCAAGAAGATCGGATACAACACGGCATCGGTCGCGTTCGTCCCGATTTCTGGCTGGCACGGTGACAACATGCTCGAGCCATCACCGAAAACTATCTGGTACAAGGGTTGGAAGGTCGAACGTAAGGACGGCAACGCCGACGGGAARACTCTGATCGAAGCACTCGACGCCATACTACCGCCATCCARACCAACCGACAAGGCACTTCGTCTGCCTCTTCAGGACGTCTACAAGATAGGTGGTATCGGCACCGTGCCCGTTGGTCGCGTCGAAACCGGCATCCTTAAACCAGGTATGCTGGTGACCTTCGCTCCGGCCGCGCTAACCACCGAAGTGAAATCCGTCGARATGCATCACGAGGCCTTGACGGAGGCCCTACCAGGCGACAACGTTGGCTTCAACGTTAAGAACATCTCGGTGAAGGAGTTGAGGCGCGGCTACGTCGCCGGCGATTCGAAGAATCAGCCGCCTCGCGGCGCGGCCGACTTCACCGCTCAGGTAATCGTACTGAATCATCCAGGACAGATCAGCAACGGATACACGCCCGTCCTCGACTGTCACACCGCTCACATCGCCTGCAAGTTCGCCGAGATAAAGGAGAAATGCGACCGTCGTACCGGTAAAACCACCGARGAGAATCCAAGAAGTATAAAGAGCGGGGACGCGGCCATCGTGATGTTGCAGCCGWCCAAGCCGATGTGCGTCGAGGCTTTCCAAGAGTTCCCGCCTCTTGGTCGTTTCGCCGTCCGCGAC
+Triassoxyela            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Asioxyela               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Nigrimonticola          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Gigantoxyelinae         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Spathoxyela             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyela_mesozoica         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Angaridyela             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyelotoma               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Undatoma                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Dahuratoma              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Mesolyda                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Turgidontes             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Aulidontes              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Protosirex              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Aulisca                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Anaxyela                ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Syntexyela              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Karatavites             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Stephanogaster          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Leptephialtites         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Cleistogaster           ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Sepulca                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Onochoius               ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Ghilarella              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Paroryssus              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Praeoryssus             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Mesorussus              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Trematothorax           ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Thoracotrema            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Prosyntexis             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Kulbastavia             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Brachysyntexis          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Symphytopterus          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Eoxyela                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Liadoxyela              ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Abrotoxyela             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Pseudoxyelocerus        ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Palaeathalia            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Ferganolyda             ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+PamphiliidaeUndesc      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Rudisiricius            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Sogutia                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Xyelula                 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Brigittepterus          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Grimmaratavites         ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+    ;
+
+end;
+
+
+begin mrbayes;
+
+       [5444 chars, 345 morphology with 8 deleted; 5099 basepairs; 2184 Ef1a and 2915 from Susanne]
+       charset MV=1-236 [236];
+       charset MS=237-353 [117];
+       charset 12S=354-556 [206];
+       charset 16S=557-778 [222];
+       charset 18S=779-1669 [891];
+       charset 28S=1670-2221 [552];
+       charset CO1=2222-3265 [1044];
+               charset CO1_12=2222-3265\3 2223-3265\3;
+               charset CO1_3=2224-3265\3;
+       charset Ef1aF2=3266-4357 [1092];
+               charset Ef1aF2_12=3266-4357\3 3267-4357\3;
+               charset Ef1aF2_3=3268-4357\3;
+       charset Ef1aF1=4358-5449 [1092];
+               charset Ef1aF1_12=4358-5449\3 4359-5449\3;
+               charset Ef1aF1_3=4360-5449\3;
+       charset Ef1a=3266-5449 [2184];
+       charset morph_ordered = 20 23 27 30 35 36 41 42 44 46 48 59 65 75 78 79 89 99 112 117 134
+                               146 157 159 171 185 191 192 193 196 218 [224] 228 229 230 237 263 266
+                               288 296 299 304 343 347 349;
+       charset morph_excluded= 96 136 212 216 217 218 219 220; [The last two chars are constant]
+       charset morph_constant= 277 331;
+
+       ctype ordered: morph_ordered;
+       exclude morph_excluded;
+       exclude morph_constant;
+
+       outgroup Orthoptera;
+       
+       taxset fossils= Triassoxyela Asioxyela Nigrimonticola Gigantoxyelinae Spathoxyela Xyela_mesozoica Angaridyela Xyelotoma Undatoma Dahuratoma Mesolyda Turgidontes Aulidontes Protosirex Aulisca Anaxyela Syntexyela Karatavites Stephanogaster Leptephialtites Cleistogaster Sepulca Onochoius Ghilarella Paroryssus Praeoryssus Mesorussus Trematothorax Thoracotrema Prosyntexis Kulbastavia Brachysyntexis Symphytopterus Eoxyela Liadoxyela Abrotoxyela Pseudoxyelocerus Palaeathalia Ferganolyda PamphiliidaeUndesc Rudisiricius Sogutia Xyelula Brigittepterus Grimmaratavites;    
+       taxset nomorphodata= Orthoptera Coleo_Adephaga Lepid_Papilionidae StephanidaeB Chalcidoidea ApoideaB ApoideaC;
+       taxset nomolecudata= Paremphytus Blasticotoma Strongylogaster Monophadnoides Metallus Taxonus Hoplocampa Nematinus Acordulecera Decameria Evanioidea;
+
+       constraint root = 1-.;
+       constraint Hymenoptera = 10-69;
+       constraint Holometabola = 3-69;
+       constraint HolometabolaWithFossils = 3-114;
+       constraint Pamphilioidea = 41-47;
+       constraint Siricoidea = 51-55;
+       constraint Apocrita = 58-69;
+       constraint Xyelidae = 10-11;
+       constraint Tenthredinidae = 15-40;
+       constraint Vespina = 57-69;
+       
+       partition without_CO1_3 = 7: MV MS, 12S 16S, 18S, 28S, CO1_12 CO1_3, Ef1aF1_12 Ef1aF2_12, Ef1aF1_3 Ef1aF2_3;
+       exclude CO1_3;
+       set partition=without_CO1_3;
+
+       [settings evol model]
+       lset applyto=(1) coding=variable rates=gamma; [morphology]
+       lset applyto=(2,3,5,6,7) nucmodel=4by4 nst=6 rates=gamma covarion=no; [GTR+G]
+       lset applyto=(4) nucmodel=4by4 nst=6 rates=gamma covarion=no; 
+       prset applyto=(4) statefreqpr=fixed(equal); [SYM+G]
+       
+       unlink statefreq=(all) revmat=(all) shape=(all) [pinvar=(all)];
+       prset applyto=(all) ratepr=variable;
+
+       calibrate
+               Triassoxyela=unif(228,242)
+               Asioxyela=unif(228,242)
+               Nigrimonticola=unif(152,163)
+               Gigantoxyelinae=unif(125,145)
+               Spathoxyela=unif(125,145)
+               Xyela_mesozoica=unif(125,145)
+               Angaridyela=unif(125,145)
+               Xyelotoma=unif(152,163)
+               Undatoma=unif(145,152)
+               Dahuratoma=unif(133,135)
+               Mesolyda=unif(152,163)
+               Turgidontes=unif(133,135)
+               Aulidontes=unif(152,163)
+               Protosirex=unif(152,163)
+               Aulisca=unif(152,163)
+               Anaxyela=unif(152,163)
+               Syntexyela=unif(152,163)
+               Karatavites=unif(152,163)
+               Stephanogaster=unif(152,163)
+               Leptephialtites=unif(152,163)
+               Cleistogaster=unif(168,191)
+               Sepulca=unif(152,163)
+               Onochoius=unif(125,145)
+               Ghilarella=unif(113,125)
+               Paroryssus=unif(152,163)
+               Praeoryssus=unif(152,163)
+               Mesorussus=unif(94,100)
+               Trematothorax=unif(125,145)
+               Thoracotrema=unif(113,125)
+               Prosyntexis=unif(80,86)
+               Kulbastavia=unif(152,163)
+               Brachysyntexis=unif(152,163)
+               Symphytopterus=unif(152,163)
+               Eoxyela=unif(168,191)
+               Liadoxyela=unif(168,191)
+               Abrotoxyela=unif(161,168)
+               Pseudoxyelocerus=unif(182,183)
+               Palaeathalia=unif(125,145)
+               Ferganolyda=unif(168,191)
+               PamphiliidaeUndesc=unif(161,168)
+               Rudisiricius=unif(161,168)
+               Sogutia=unif(174,201)
+               Xyelula=unif(182,183)
+               Brigittepterus=unif(182,183)
+               Grimmaratavites=unif(182,183)
+               ;
+               
+       [calibrate
+               Triassoxyela=fixed(235)
+               Asioxyela=fixed(235)
+               Nigrimonticola=fixed(157)
+               Gigantoxyelinae=fixed(135)
+               Spathoxyela=fixed(135)
+               Xyela_mesozoica=fixed(135)
+               Angaridyela=fixed(135)
+               Xyelotoma=fixed(157)
+               Undatoma=fixed(148)
+               Dahuratoma=fixed(134)
+               Mesolyda=fixed(157)
+               Turgidontes=fixed(134)
+               Aulidontes=fixed(157)
+               Protosirex=fixed(157)
+               Aulisca=fixed(157)
+               Anaxyela=fixed(157)
+               Syntexyela=fixed(157)
+               Karatavites=fixed(157)
+               Stephanogaster=fixed(157)
+               Leptephialtites=fixed(157)
+               Cleistogaster=fixed(179)
+               Sepulca=fixed(157)
+               Onochoius=fixed(135)
+               Ghilarella=fixed(119)
+               Paroryssus=fixed(157)
+               Praeoryssus=fixed(157)
+               Mesorussus=fixed(97)
+               Trematothorax=fixed(135)
+               Thoracotrema=fixed(119)
+               Prosyntexis=fixed(83)
+               Kulbastavia=fixed(157)
+               Brachysyntexis=fixed(157)
+               Symphytopterus=fixed(157)
+               Eoxyela=fixed(179)
+               Liadoxyela=fixed(179)
+               Abrotoxyela=fixed(164)
+               Pseudoxyelocerus=fixed(182)
+               Palaeathalia=fixed(135)
+               Ferganolyda=fixed(179)
+               PamphiliidaeUndesc=fixed(164)
+               Rudisiricius=fixed(164)
+               Sogutia=fixed(187)
+               Xyelula=fixed(182)
+               Brigittepterus=fixed(182)
+               Grimmaratavites=fixed(182)
+               ;]
+
+       delete Lepid_Micropterigidae;
+
+       [prset brlenspr=clock:uniform;]
+       prset brlenspr=clock:fossilization;
+       prset speciationpr=exp(20);
+       prset extinctionpr=beta(1,1);
+       prset fossilizationpr=beta(1,1);
+       prset sampleprob=0.0005;
+       prset samplestrat=diversity [1: 252 0];
+       [prset samplestrat=random 2: 252 0, 66 0;]
+       [prset treeagepr=offsetexp(315,396);]
+       prset topologypr=constraints(root, HolometabolaWithFossils);
+       calibrate root=offsetexp(315,396);
+       calibrate HolometabolaWithFossils=offsetexp(302,396);
+       prset nodeagepr=calibrated;
+
+       prset clockvarpr=igr;
+       prset igrvarpr=exp(37);
+       prset clockratepr=lognorm(-7.1,0.5);
+
+       [set usebeagle=yes;]
+
+       mcmcp nruns=4 temp=0.07 ngen=100000000 samplefr=1000 printfr=10000 diagnfr=50000;
+       
+       [exe hym.ckp;]
+       [mcmc;
+       sump burninfrac=0.4;
+       sumt burninfrac=0.4;
+
+       delete fossils;
+       sumt burninfrac=0.4 output=hym.nf;]
+
+end;
diff --git a/examples/primates.nex b/examples/primates.nex
new file mode 100644 (file)
index 0000000..05d8788
--- /dev/null
@@ -0,0 +1,22 @@
+#NEXUS\r
+\r
+[ Data from: Hayasaka, K., T. Gojobori, and S. Horai. 1988. Molecular phylogeny and evolution of primate mitochondrial DNA. Mol. Biol. Evol. 5:626-644. ]\r
+\r
+begin data;\r
+    dimensions ntax=12 nchar=898;\r
+    format datatype=dna interleave=no gap=-;\r
+    matrix\r
+Tarsius_syrichta    AAGTTTCATTGGAGCCACCACTCTTATAATTGCCCATGGCCTCACCTCCTCCCTATTATTTTGCCTAGCAAATACAAACTACGAACGAGTCCACAGTCGAACAATAGCACTAGCCCGTGGCCTTCAAACCCTATTACCTCTTGCAGCAACATGATGACTCCTCGCCAGCTTAACCAACCTGGCCCTTCCCCCAACAATTAATTTAATCGGTGAACTGTCCGTAATAATAGCAGCATTTTCATGGTCACACCTAACTATTATCTTAGTAGGCCTTAACACCCTTATCACCGCCCTATATTCCCTATATATACTAATCATAACTCAACGAGGAAAATACACATATCATATCAACAATATCATGCCCCCTTTCACCCGAGAAAATACATTAATAATCATACACCTATTTCCCTTAATCCTACTATCTACCAACCCCAAAGTAATTATAGGAACCATGTACTGTAAATATAGTTTAAACAAAACATTAGATTGTGAGTCTAATAATAGAAGCCCAAAGATTTCTTATTTACCAAGAAAGTA-TGCAAGAACTGCTAACTCATGCCTCCATATATAACAATGTGGCTTTCTT-ACTTTTAAAGGATAGAAGTAATCCATCGGTCTTAGGAACCGAAAA-ATTGGTGCAACTCCAAATAAAAGTAATAAATTTATTTTCATCCTCCATTTTACTATCACTTACACTCTTAATTACCCCATTTATTATTACAACAACTAAAAAATATGAAACACATGCATACCCTTACTACGTAAAAAACTCTATCGCCTGCGCATTTATAACAAGCCTAGTCCCAATGCTCATATTTCTATACACAAATCAAGAAATAATCATTTCCAACTGACATTGAATAACGATTCATACTATCAAATTATGCCTAAGCTT\r
+Lemur_catta         AAGCTTCATAGGAGCAACCATTCTAATAATCGCACATGGCCTTACATCATCCATATTATTCTGTCTAGCCAACTCTAACTACGAACGAATCCATAGCCGTACAATACTACTAGCACGAGGGATCCAAACCATTCTCCCTCTTATAGCCACCTGATGACTACTCGCCAGCCTAACTAACCTAGCCCTACCCACCTCTATCAATTTAATTGGCGAACTATTCGTCACTATAGCATCCTTCTCATGATCAAACATTACAATTATCTTAATAGGCTTAAATATGCTCATCACCGCTCTCTATTCCCTCTATATATTAACTACTACACAACGAGGAAAACTCACATATCATTCGCACAACCTAAACCCATCCTTTACACGAGAAAACACCCTTATATCCATACACATACTCCCCCTTCTCCTATTTACCTTAAACCCCAAAATTATTCTAGGACCCACGTACTGTAAATATAGTTTAAA-AAAACACTAGATTGTGAATCCAGAAATAGAAGCTCAAAC-CTTCTTATTTACCGAGAAAGTAATGTATGAACTGCTAACTCTGCACTCCGTATATAAAAATACGGCTATCTCAACTTTTAAAGGATAGAAGTAATCCATTGGCCTTAGGAGCCAAAAA-ATTGGTGCAACTCCAAATAAAAGTAATAAATCTATTATCCTCTTTCACCCTTGTCACACTGATTATCCTAACTTTACCTATCATTATAAACGTTACAAACATATACAAAAACTACCCCTATGCACCATACGTAAAATCTTCTATTGCATGTGCCTTCATCACTAGCCTCATCCCAACTATATTATTTATCTCCTCAGGACAAGAAACAATCATTTCCAACTGACATTGAATAACAATCCAAACCCTAAAACTATCTATTAGCTT\r
+Homo_sapiens        AAGCTTCACCGGCGCAGTCATTCTCATAATCGCCCACGGGCTTACATCCTCATTACTATTCTGCCTAGCAAACTCAAACTACGAACGCACTCACAGTCGCATCATAATCCTCTCTCAAGGACTTCAAACTCTACTCCCACTAATAGCTTTTTGATGACTTCTAGCAAGCCTCGCTAACCTCGCCTTACCCCCCACTATTAACCTACTGGGAGAACTCTCTGTGCTAGTAACCACGTTCTCCTGATCAAATATCACTCTCCTACTTACAGGACTCAACATACTAGTCACAGCCCTATACTCCCTCTACATATTTACCACAACACAATGGGGCTCACTCACCCACCACATTAACAACATAAAACCCTCATTCACACGAGAAAACACCCTCATGTTCATACACCTATCCCCCATTCTCCTCCTATCCCTCAACCCCGACATCATTACCGGGTTTTCCTCTTGTAAATATAGTTTAACCAAAACATCAGATTGTGAATCTGACAACAGAGGCTTA-CGACCCCTTATTTACCGAGAAAGCT-CACAAGAACTGCTAACTCATGCCCCCATGTCTAACAACATGGCTTTCTCAACTTTTAAAGGATAACAGCTATCCATTGGTCTTAGGCCCCAAAAATTTTGGTGCAACTCCAAATAAAAGTAATAACCATGCACACTACTATAACCACCCTAACCCTGACTTCCCTAATTCCCCCCATCCTTACCACCCTCGTTAACCCTAACAAAAAAAACTCATACCCCCATTATGTAAAATCCATTGTCGCATCCACCTTTATTATCAGTCTCTTCCCCACAACAATATTCATGTGCCTAGACCAAGAAGTTATTATCTCGAACTGACACTGAGCCACAACCCAAACAACCCAGCTCTCCCTAAGCTT\r
+Pan                 AAGCTTCACCGGCGCAATTATCCTCATAATCGCCCACGGACTTACATCCTCATTATTATTCTGCCTAGCAAACTCAAATTATGAACGCACCCACAGTCGCATCATAATTCTCTCCCAAGGACTTCAAACTCTACTCCCACTAATAGCCTTTTGATGACTCCTAGCAAGCCTCGCTAACCTCGCCCTACCCCCTACCATTAATCTCCTAGGGGAACTCTCCGTGCTAGTAACCTCATTCTCCTGATCAAATACCACTCTCCTACTCACAGGATTCAACATACTAATCACAGCCCTGTACTCCCTCTACATGTTTACCACAACACAATGAGGCTCACTCACCCACCACATTAATAACATAAAGCCCTCATTCACACGAGAAAATACTCTCATATTTTTACACCTATCCCCCATCCTCCTTCTATCCCTCAATCCTGATATCATCACTGGATTCACCTCCTGTAAATATAGTTTAACCAAAACATCAGATTGTGAATCTGACAACAGAGGCTCA-CGACCCCTTATTTACCGAGAAAGCT-TATAAGAACTGCTAATTCATATCCCCATGCCTGACAACATGGCTTTCTCAACTTTTAAAGGATAACAGCCATCCGTTGGTCTTAGGCCCCAAAAATTTTGGTGCAACTCCAAATAAAAGTAATAACCATGTATACTACCATAACCACCTTAACCCTAACTCCCTTAATTCTCCCCATCCTCACCACCCTCATTAACCCTAACAAAAAAAACTCATATCCCCATTATGTGAAATCCATTATCGCGTCCACCTTTATCATTAGCCTTTTCCCCACAACAATATTCATATGCCTAGACCAAGAAGCTATTATCTCAAACTGGCACTGAGCAACAACCCAAACAACCCAGCTCTCCCTAAGCTT\r
+Gorilla             AAGCTTCACCGGCGCAGTTGTTCTTATAATTGCCCACGGACTTACATCATCATTATTATTCTGCCTAGCAAACTCAAACTACGAACGAACCCACAGCCGCATCATAATTCTCTCTCAAGGACTCCAAACCCTACTCCCACTAATAGCCCTTTGATGACTTCTGGCAAGCCTCGCCAACCTCGCCTTACCCCCCACCATTAACCTACTAGGAGAGCTCTCCGTACTAGTAACCACATTCTCCTGATCAAACACCACCCTTTTACTTACAGGATCTAACATACTAATTACAGCCCTGTACTCCCTTTATATATTTACCACAACACAATGAGGCCCACTCACACACCACATCACCAACATAAAACCCTCATTTACACGAGAAAACATCCTCATATTCATGCACCTATCCCCCATCCTCCTCCTATCCCTCAACCCCGATATTATCACCGGGTTCACCTCCTGTAAATATAGTTTAACCAAAACATCAGATTGTGAATCTGATAACAGAGGCTCA-CAACCCCTTATTTACCGAGAAAGCT-CGTAAGAGCTGCTAACTCATACCCCCGTGCTTGACAACATGGCTTTCTCAACTTTTAAAGGATAACAGCTATCCATTGGTCTTAGGACCCAAAAATTTTGGTGCAACTCCAAATAAAAGTAATAACTATGTACGCTACCATAACCACCTTAGCCCTAACTTCCTTAATTCCCCCTATCCTTACCACCTTCATCAATCCTAACAAAAAAAGCTCATACCCCCATTACGTAAAATCTATCGTCGCATCCACCTTTATCATCAGCCTCTTCCCCACAACAATATTTCTATGCCTAGACCAAGAAGCTATTATCTCAAGCTGACACTGAGCAACAACCCAAACAATTCAACTCTCCCTAAGCTT\r
+Pongo               AAGCTTCACCGGCGCAACCACCCTCATGATTGCCCATGGACTCACATCCTCCCTACTGTTCTGCCTAGCAAACTCAAACTACGAACGAACCCACAGCCGCATCATAATCCTCTCTCAAGGCCTTCAAACTCTACTCCCCCTAATAGCCCTCTGATGACTTCTAGCAAGCCTCACTAACCTTGCCCTACCACCCACCATCAACCTTCTAGGAGAACTCTCCGTACTAATAGCCATATTCTCTTGATCTAACATCACCATCCTACTAACAGGACTCAACATACTAATCACAACCCTATACTCTCTCTATATATTCACCACAACACAACGAGGTACACCCACACACCACATCAACAACATAAAACCTTCTTTCACACGCGAAAATACCCTCATGCTCATACACCTATCCCCCATCCTCCTCTTATCCCTCAACCCCAGCATCATCGCTGGGTTCGCCTACTGTAAATATAGTTTAACCAAAACATTAGATTGTGAATCTAATAATAGGGCCCCA-CAACCCCTTATTTACCGAGAAAGCT-CACAAGAACTGCTAACTCTCACT-CCATGTGTGACAACATGGCTTTCTCAGCTTTTAAAGGATAACAGCTATCCCTTGGTCTTAGGATCCAAAAATTTTGGTGCAACTCCAAATAAAAGTAACAGCCATGTTTACCACCATAACTGCCCTCACCTTAACTTCCCTAATCCCCCCCATTACCGCTACCCTCATTAACCCCAACAAAAAAAACCCATACCCCCACTATGTAAAAACGGCCATCGCATCCGCCTTTACTATCAGCCTTATCCCAACAACAATATTTATCTGCCTAGGACAAGAAACCATCGTCACAAACTGATGCTGAACAACCACCCAGACACTACAACTCTCACTAAGCTT\r
+Hylobates           AAGCTTTACAGGTGCAACCGTCCTCATAATCGCCCACGGACTAACCTCTTCCCTGCTATTCTGCCTTGCAAACTCAAACTACGAACGAACTCACAGCCGCATCATAATCCTATCTCGAGGGCTCCAAGCCTTACTCCCACTGATAGCCTTCTGATGACTCGCAGCAAGCCTCGCTAACCTCGCCCTACCCCCCACTATTAACCTCCTAGGTGAACTCTTCGTACTAATGGCCTCCTTCTCCTGGGCAAACACTACTATTACACTCACCGGGCTCAACGTACTAATCACGGCCCTATACTCCCTTTACATATTTATCATAACACAACGAGGCACACTTACACACCACATTAAAAACATAAAACCCTCACTCACACGAGAAAACATATTAATACTTATGCACCTCTTCCCCCTCCTCCTCCTAACCCTCAACCCTAACATCATTACTGGCTTTACTCCCTGTAAACATAGTTTAATCAAAACATTAGATTGTGAATCTAACAATAGAGGCTCG-AAACCTCTTGCTTACCGAGAAAGCC-CACAAGAACTGCTAACTCACTATCCCATGTATGACAACATGGCTTTCTCAACTTTTAAAGGATAACAGCTATCCATTGGTCTTAGGACCCAAAAATTTTGGTGCAACTCCAAATAAAAGTAATAGCAATGTACACCACCATAGCCATTCTAACGCTAACCTCCCTAATTCCCCCCATTACAGCCACCCTTATTAACCCCAATAAAAAGAACTTATACCCGCACTACGTAAAAATGACCATTGCCTCTACCTTTATAATCAGCCTATTTCCCACAATAATATTCATGTGCACAGACCAAGAAACCATTATTTCAAACTGACACTGAACTGCAACCCAAACGCTAGAACTCTCCCTAAGCTT\r
+Macaca_fuscata      AAGCTTTTCCGGCGCAACCATCCTTATGATCGCTCACGGACTCACCTCTTCCATATATTTCTGCCTAGCCAATTCAAACTATGAACGCACTCACAACCGTACCATACTACTGTCCCGAGGACTTCAAATCCTACTTCCACTAACAGCCTTTTGATGATTAACAGCAAGCCTTACTAACCTTGCCCTACCCCCCACTATCAATCTACTAGGTGAACTCTTTGTAATCGCAACCTCATTCTCCTGATCCCATATCACCATTATGCTAACAGGACTTAACATATTAATTACGGCCCTCTACTCTCTCCACATATTCACTACAACACAACGAGGAACACTCACACATCACATAATCAACATAAAGCCCCCCTTCACACGAGAAAACACATTAATATTCATACACCTCGCTCCAATTATCCTTCTATCCCTCAACCCCAACATCATCCTGGGGTTTACCTCCTGTAGATATAGTTTAACTAAAACACTAGATTGTGAATCTAACCATAGAGACTCA-CCACCTCTTATTTACCGAGAAAACT-CGCAAGGACTGCTAACCCATGTACCCGTACCTAAAATTACGGTTTTCTCAACTTTTAAAGGATAACAGCTATCCATTGACCTTAGGAGTCAAAAACATTGGTGCAACTCCAAATAAAAGTAATAATCATGCACACCCCCATCATTATAACAACCCTTATCTCCCTAACTCTCCCAATTTTTGCCACCCTCATCAACCCTTACAAAAAACGTCCATACCCAGATTACGTAAAAACAACCGTAATATATGCTTTCATCATCAGCCTCCCCTCAACAACTTTATTCATCTTCTCAAACCAAGAAACAACCATTTGGAGCTGACATTGAATAATGACCCAAACACTAGACCTAACGCTAAGCTT\r
+M_mulatta           AAGCTTTTCTGGCGCAACCATCCTCATGATTGCTCACGGACTCACCTCTTCCATATATTTCTGCCTAGCCAATTCAAACTATGAACGCACTCACAACCGTACCATACTACTGTCCCGGGGACTTCAAATCCTACTTCCACTAACAGCTTTCTGATGATTAACAGCAAGCCTTACTAACCTTGCCCTACCCCCCACTATCAACCTACTAGGTGAACTCTTTGTAATCGCGACCTCATTCTCCTGGTCCCATATCACCATTATATTAACAGGATTTAACATACTAATTACGGCCCTCTACTCCCTCCACATATTCACCACAACACAACGAGGAGCACTCACACATCACATAATCAACATAAAACCCCCCTTCACACGAGAAAACATATTAATATTCATACACCTCGCTCCAATCATCCTCCTATCTCTCAACCCCAACATCATCCTGGGGTTTACTTCCTGTAGATATAGTTTAACTAAAACATTAGATTGTGAATCTAACCATAGAGACTTA-CCACCTCTTATTTACCGAGAAAACT-CGCGAGGACTGCTAACCCATGTATCCGTACCTAAAATTACGGTTTTCTCAACTTTTAAAGGATAACAGCTATCCATTGACCTTAGGAGTCAAAAATATTGGTGCAACTCCAAATAAAAGTAATAATCATGCACACCCCTATCATAATAACAACCCTTATCTCCCTAACTCTCCCAATTTTTGCCACCCTCATCAACCCTTACAAAAAACGTCCATACCCAGATTACGTAAAAACAACCGTAATATATGCTTTCATCATCAGCCTCCCCTCAACAACTTTATTCATCTTCTCAAACCAAGAAACAACCATTTGAAGCTGACATTGAATAATAACCCAAACACTAGACCTAACACTAAGCTT\r
+M_fascicularis      AAGCTTCTCCGGCGCAACCACCCTTATAATCGCCCACGGGCTCACCTCTTCCATGTATTTCTGCTTGGCCAATTCAAACTATGAGCGCACTCATAACCGTACCATACTACTATCCCGAGGACTTCAAATTCTACTTCCATTGACAGCCTTCTGATGACTCACAGCAAGCCTTACTAACCTTGCCCTACCCCCCACTATTAATCTACTAGGCGAACTCTTTGTAATCACAACTTCATTTTCCTGATCCCATATCACCATTGTGTTAACGGGCCTTAATATACTAATCACAGCCCTCTACTCTCTCCACATGTTCATTACAGTACAACGAGGAACACTCACACACCACATAATCAATATAAAACCCCCCTTCACACGAGAAAACATATTAATATTCATACACCTCGCTCCAATTATCCTTCTATCTCTCAACCCCAACATCATCCTGGGGTTTACCTCCTGTAAATATAGTTTAACTAAAACATTAGATTGTGAATCTAACTATAGAGGCCTA-CCACTTCTTATTTACCGAGAAAACT-CGCAAGGACTGCTAATCCATGCCTCCGTACTTAAAACTACGGTTTCCTCAACTTTTAAAGGATAACAGCTATCCATTGACCTTAGGAGTCAAAAACATTGGTGCAACTCCAAATAAAAGTAATAATCATGCACACCCCCATCATAATAACAACCCTCATCTCCCTGACCCTTCCAATTTTTGCCACCCTCACCAACCCCTATAAAAAACGTTCATACCCAGACTACGTAAAAACAACCGTAATATATGCTTTTATTACCAGTCTCCCCTCAACAACCCTATTCATCCTCTCAAACCAAGAAACAACCATTTGGAGTTGACATTGAATAACAACCCAAACATTAGACCTAACACTAAGCTT\r
+M_sylvanus          AAGCTTCTCCGGTGCAACTATCCTTATAGTTGCCCATGGACTCACCTCTTCCATATACTTCTGCTTGGCCAACTCAAACTACGAACGCACCCACAGCCGCATCATACTACTATCCCGAGGACTCCAAATCCTACTCCCACTAACAGCCTTCTGATGATTCACAGCAAGCCTTACTAATCTTGCTCTACCCTCCACTATTAATCTACTGGGCGAACTCTTCGTAATCGCAACCTCATTTTCCTGATCCCACATCACCATCATACTAACAGGACTGAACATACTAATTACAGCCCTCTACTCTCTTCACATATTCACCACAACACAACGAGGAGCGCTCACACACCACATAATTAACATAAAACCACCTTTCACACGAGAAAACATATTAATACTCATACACCTCGCTCCAATTATTCTTCTATCTCTTAACCCCAACATCATTCTAGGATTTACTTCCTGTAAATATAGTTTAATTAAAACATTAGACTGTGAATCTAACTATAGAAGCTTA-CCACTTCTTATTTACCGAGAAAACT-TGCAAGGACCGCTAATCCACACCTCCGTACTTAAAACTACGGTTTTCTCAACTTTTAAAGGATAACAGCTATCCATTGGCCTTAGGAGTCAAAAATATTGGTGCAACTCCAAATAAAAGTAATAATCATGTATACCCCCATCATAATAACAACTCTCATCTCCCTAACTCTTCCAATTTTCGCTACCCTTATCAACCCCAACAAAAAACACCTATATCCAAACTACGTAAAAACAGCCGTAATATATGCTTTCATTACCAGCCTCTCTTCAACAACTTTATATATATTCTTAAACCAAGAAACAATCATCTGAAGCTGGCACTGAATAATAACCCAAACACTAAGCCTAACATTAAGCTT\r
+Saimiri_sciureus    AAGCTTCACCGGCGCAATGATCCTAATAATCGCTCACGGGTTTACTTCGTCTATGCTATTCTGCCTAGCAAACTCAAATTACGAACGAATTCACAGCCGAACAATAACATTTACTCGAGGGCTCCAAACACTATTCCCGCTTATAGGCCTCTGATGACTCCTAGCAAATCTCGCTAACCTCGCCCTACCCACAGCTATTAATCTAGTAGGAGAATTACTCACAATCGTATCTTCCTTCTCTTGATCCAACTTTACTATTATATTCACAGGACTTAATATACTAATTACAGCACTCTACTCACTTCATATGTATGCCTCTACACAGCGAGGTCCACTTACATACAGCACCAGCAATATAAAACCAATATTTACACGAGAAAATACGCTAATATTTATACATATAACACCAATCCTCCTCCTTACCTTGAGCCCCAAGGTAATTATAGGACCCTCACCTTGTAATTATAGTTTAGCTAAAACATTAGATTGTGAATCTAATAATAGAAGAATA-TAACTTCTTAATTACCGAGAAAGTG-CGCAAGAACTGCTAATTCATGCTCCCAAGACTAACAACTTGGCTTCCTCAACTTTTAAAGGATAGTAGTTATCCATTGGTCTTAGGAGCCAAAAACATTGGTGCAACTCCAAATAAAAGTAATA---ATACACTTCTCCATCACTCTAATAACACTAATTAGCCTACTAGCGCCAATCCTAGCTACCCTCATTAACCCTAACAAAAGCACACTATACCCGTACTACGTAAAACTAGCCATCATCTACGCCCTCATTACCAGTACCTTATCTATAATATTCTTTATCCTTACAGGCCAAGAATCAATAATTTCAAACTGACACTGAATAACTATCCAAACCATCAAACTATCCCTAAGCTT\r
+    ;\r
+end;\r
diff --git a/examples/replicase.nex b/examples/replicase.nex
new file mode 100644 (file)
index 0000000..4825a07
--- /dev/null
@@ -0,0 +1,21 @@
+#NEXUS\r
+\r
+[Bacteriphage RNA sequences from the Huelsenbeck lab]\r
+\r
+begin data;\r
+       dimensions ntax=9 nchar=720;\r
+       format datatype=rna interleave=no gap=- missing=?;\r
+       matrix\r
+       [       1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50]\r
+       FR      GGC AAC GGU --- GUG UUU ACU GUU CCG AAG AAC AAU AAA AUA GAU CGG GCU GCU UGC AAA GAG CCU GAU AUG AAU AUG UAC UUA CAG AAA GGG GUC GGC GGU UUC AUC CGU CGC CGC CUU AAG ACU GUG GGU AUA GAC UUG AAC GAU CAA ACG AUC AAU CAA CGC CUG GCU CAA CAA GGU AGC CGU GAU GGG UCU UUG GCG ACG AUA GAC UUA UCG UCU GCU UCU GAC UCC AUC AGC GAC CGC CUA GUG UGG AGU UUU CUC CCA CCU GAG CUA UAU UCA UAU CUC GAC AUG AUU CGA AGC CAC UAC GGU UAC GUA --- AAU GGC AAG AUG AUU CGU UGG GAA CUA UUU UCG ACG AUG GGU AAU GGG UUC ACC UUU GAA CUA GAG UCC AUG AUU UUC UGG GCU AUA GUC AGG GCU ACU CAG AUC CAU UUU CGU --- AAC ACC GGA ACC AUU GGC AUC UAU GGG GAC GAU AUU AUA UGC CCC ACA GAG AUU GCA CCU CGC GUG CUG GAA GCA CUG AGC UUC UAC GGU UUC AAA CCG AAU CUA CGA AAG ACG --- UUC ACG UCC GGC UCU UUU CGC GAG AGC UGC GGC GCG CAC UAU UUC CGU GGU GUC GAU GUU AAA CCA UUU UAU AUC AAG AAA CCA AUC ACU GAC CUA UUC UCC CUA AUG CUU AUA CUU AAC CGU AUA CGC GGA UGG GGG GUA GUC AAC GGA AUA GCA GAC CCA CGC CUC\r
+       MS2     GGG AAC GGA --- GUG UUU ACA GUU CCG AAG AAU AAU AAA AUA GAU CGG GCU GCC UGU AAG GAG CCU GAU AUG AAU AUG UAC CUC CAG AAA GGG GUC GGU GCU UUC AUC AGA CGC CGG CUC AAA UCC GUU GGU AUA GAC CUG AAU GAU CAA UCG AUC AAC CAG CGU CUG GCU CAG CAG GGC AGCGUAGAUGGUUCGCUUGCGACGAUAGACUUAUCGUCUGCAUCCGAUUCCAUCUCCGAUCGCCUGGUGUGGAGUUUUCUCCCACCUGAGCUAUAUUCAUAUCUCGAUCGUAUCCGCUCACACUACGGA---GUA---GAUGGCGAGACGAUACGAUGGGAACUAUUUUCCACAAUGGGAAAUGGGUUCACAUUUGAGCUAGAGUCCAUGAUAUUCUGGGCAAUAGUCAAAGCGACCCAAAUCCAUUUUGGU---AACGCCGGAACCAUAGGCAUCUACGGGGACGAUAUUAUAUGUCCCAGUGAGAUUGCACCCCGUGUGCUAGAGGCACUUGCCUACUACGGUUUUAAACCGAAUCUUCGUAAAACG---UUCGUGUCCGGGCUCUUUCGCGAGAGCUGCGGCGCGCACUUUUACCGUGGUGUCGAUGUCAAACCGUUUUACAUCAAGAAACCUGUUGACAAUCUCUUCGCCCUGAUGCUGAUAUUAAAUCGGCUACGGGGUUGGGGAGUUGUCGGAGGUAUGUCAGAUCCACGCCUC\r
+       GA      GGC AAC GGU --- UUG UUU UCU GUU CCG AAG AAC AAU AAA AUA GAU CGG GCU GCC UGU AAG GAG CCU GAU AUG AAU AUG UAC CUU CAG AAG GGG GCG GGA UCU UUU AUA AGA AAA CGC CUU CGC UCC GUC GGU AUA GAU CUU AAC GAU CAG ACG CGC AAU CAG GAA UUA GCC CGA CUU GGC AGCAUUGAUGGUUCGCUCGCUACUAUUGAUCUUAGUAGCGCUAGCGAUUCCAUCUCUGACCGUCUUGUCUGGGAUCUACUUCCGCCGCACGUUUAUUCAUACCUCGCUCGUAUCCGAACAUCGUUCACUAUGAUC---GAUGGGCGUUUACAUAAGUGGGGUCUAUUUUCUACCAUGGGUAAUGGCUUCACGUUCGAACUCGAGUCCAUGAUCUUUUGGGCUUUAAGCAAGAGCAUUAUGCUGUCCAUGGGUGUU---ACUGGCUCAUUAGGCAUCUACGGUGAUGAUAUAAUCGUCCCCGUUGAGUGUCGUCCAACUCUCCUUAAGGUACUAUCCGCUGUAAACUUUCUUCCUAAUGAGGAGAAAACA---UUUACAACGGGUUACUUUCGUGAAAGUUGUGGUGCCCACUUCUUCAAAGAUGCCGACAUGAAACCUUUUUACUGCAAGCGGCCAAUGGAAACCCUUCCCGAUGUCAUGUUGCUAUGCAACAGGAUAAGAGGUUGGCAGACCGUUGGUGGAAUGUCAGAUCCGCGACUC\r
+       SP      UCA --- AAU AAA GCA GUC ACU GUU CCA AAG AAC AGU AAA ACU GAU CGC UGU AUU GCU AUC GAG CCC GGC UGG AAU AUG UUU UUC CAG UUA GGC GUC GGU GCA GUG CUA CGC GAU AGG UUG CGU UUA UGG AAG AUU GAU CUU AAU GAC CAA UCG ACC AAU CAA CGC CUC GCG CGU GAU GGG UCUCUGCUAAAUCAUUUAGCUACCAUAGACUUAUCUGCAGCCAGCGAUUCAAUCAGCCUUAAGCUUGUUGAGUUGCUCAUGCCCCCUGAAUGGUAUGACCUUCUAACGGAUCUCCGAUCCGAUGAAGGAAUACUGCCUGACGGGCGAGUUGUGACCUAUGAGAAAAUAUCCUCCAUGGGUAAUGGCUACACUUUCGAACUCGAGUCGCUUAUUUUUGCGGCUAUCGCUCGAAGUGUGUGCGAGUUACUGGAAAUUGACCAAUCUACUGUUAGCGUGUACGGGGAUGAUAUAAUCAUCGAUACCCGUGCCGCAGCUCCAUUAAUGGAUGUCUUUGAGUACGUCGGGUUCACUCCUAACAGAAAGAAAACG---UUCUGCGAUGGACCCUUCCGCGAAUCGUGCGGUAAGCACUGGUUCCAAGGGGUAGAUGUAACGCCCUUUUACAUACGACGACCAAUACGUUGCCUAGCCGAUAUGAUACUUGUAUUAAAUAGUAUCUAUAGGUGGGGCACUGUUGAUGGCAUAUGGGAUCCUAGAGCA\r
+       NL95    UCG --- AAU AAA GCA GUC ACU GUU CCA AAG AAC AGU AAA ACU GAU CGC UGC AUU GCU AUC GAG CCC GGC UGG AAU AUG UUU UUC CAG UUA GGC GUC GGU GCU GUG CUC CGU GAU CGG UUG CGC CUU UGG CAU AUU GAU CUC AAU GAU CAA UCU GUU AAU CAG CGC CUC GCA CGU GAU GCA UCGCAGUUGGACCAUUUGGCCACUGUCGAUUUAUCAGCAGCAAGCGAUUCGAUAAGCUUACGGCUUGUUGAACUGCUAAUGCCGCCUGCUUGGUUUGAUCUCCUGACCGAUCUCCGAUCGGACCAGGGAAUCCUGCCUGACGGGCGUGUCGUUACUUACGAGAAAAUAUCCUCCAUGGGUAAUGGCUACACUUUUGAGCUAGAGUCGUUAAUUUUCGCGGCUCUCGCCAGAAGUGUGUGCGAGUUAUUGGACCUUGACCAGUCAACUGUCAGCGUGUACGGUGAUGAUAUAAUCAUCGAUUCACGUGCCGCUGAUGUCCUUAUGGCGGUUUUCGAGUAUGUUGGGUUUACGCCUAAUCGAAAGAAAACU---UUCAUUAAGGGCCCCUUUAGAGAGUCGUGCGGAAAGCACUGGCACUCCGGGGUUGACGUAACGCCCUUUUACAUACGCCGCCCAAUCCGCUGCCUAGCCGACAUGAUACUUGUAUUGAACAGUAUCUACCGGUGGGGUACGAUUGACGGUGUGUGGGAUCCUAGGGUA\r
+       M11     CCU UUC AAU AAA GCA GUU ACU GUA CCA AAG AAC AGU AAA ACU GAU CGC UGU AUA GCC AUC GAA CCU GGC UGG AAU AUG UUU UUC CAG CUA GGU AUC GGU GGU GUU AUA CGC GAA AAG UUG CGU UUG UGG GGC AUC GAU CUG AAU GAU CAG ACG AUU AAC CAA ACG CGC GCA UAU UUA GGC AGCCGUGAUGAUAAUCUCGCCACGGUGGAUCUCUCAAGAGCUAGCGAUACUAUUUCGCUUGCCCUUGUUGAGCUCCUUAUGCCUCCUGAGUGGUUUAAGGUCCUGUUGGCCUUAAGAUCACCCAAGGGCAUCUUGCCAGAUGGUACCGUCAUUACUUAUGAGAAAAUAUCCUCAAUGGGUAAUGGCUAUACCUUCGAGCUUGAGUCGCUUAUAUUUGCGGCUCUUGCUCGGUCUUUAUGCGAAUUACUGGGCUUACGACCGUCAGAUGUUACGGUCUAUGGCGAUGACAUAAUAUUGCCAUCAGACGCGUGCAGUCCUCUAGUUGAAGUUUUCUCCUAUGUUGGUUUUCGUACCAACAAGAAGAAAACG---UUUUCUAGUGGACCGUUCCGAGAGUCGUGCGGAAAGCACUACUUUUUGGGCGUUGACGUCACACCUUUCUACAUACGUCGCCGUAUAGUGAGUCCCUCCGAUCUCAUACUGGUUUUGAACCAGAUGUAUCGUUGGGCCACAAUUGACGGCGUAUGGGAUCCUAGGGUA\r
+       MX1     CCU UUC AAU AAA GCA GUU ACU GUA CCA AAG AAC AGU AAA ACU GAU CGC UGC AUC GCU AUC GAG CCA GGC UGG AAU AUG UUU UUC CAG UUG GGC AUU GGU GGC GUA AUU CGC GAA AAG UUG CAC UUG UGG AAU AUC GAC CUG AAU GAU CAG ACG AUU AAC CAG GUG CGC GCA UAU UCA GGC AGCUGUAGCAAUGAACUUGCUACAGUGGAUCUCUCGAGCGCGAGUGAUACUAUUUCGCUUGCGCUCGUUGAGCUCCUGCUACCCCCUGCGUGGUUUAAAGUCCUUACGGACCUUAGGUCACGAAGGGGUAUGUUGCCAGACGGUAGAAUCAUUACCUAUGAGAAAAUUUCCUCAAUGGGUAACGGUUUCACCUUCGAGCUCGAGUCGCUUAUAUUUGCAGCUCUUGCUCGGUCUUUAUGCGAGUUACUGAACUUACAACCGUCGAGUGUCACGGUCUAUGGCGAUGAUAUUAUAUUGCCAUCAGACGCGUGCAGCUCGUUGAUUGAAGUUUUCUCCUACGUAGGUUUUAGAACCAACGAGAAGAAGACC---UUUUUCGACGGGCCGUUCCGAGAGUCGUGCGGAAAGCACUACUUUAUGGGCGUUGACGUCACACCUUUCUACAUACGCCACCGUAUAGUGAGUCCCUCUGAUCUCAUACUGGUUUUGAACCAGAUGUAUCGUUGGGCCACGAUUGAUGGCGUAUGGGAUCCUAGGGUA\r
+       QB      CCU UUU AAU AAA GCA GUU ACU GUA CCU AAG AAC AGU AAG ACA GAU CGU UGU AUU GCU AUC GAA CCU GGU UGG AAU AUG UUU UUC CAA CUG GGU AUC GGU GGC AUU CUA CGC GAU CGG UUG CGU UGC UGG GGU AUC GAU CUG AAU GAU CAG ACG AUA AAU CAG CGC CGC GCU CAC GAA GGC UCCGUUACUAAUAACUUAGCAACGGUUGAUCUCUCAGCGGCAAGCGAUUCUAUAUCUCUUGCCCUCUGUGAGCUCUUAUUGCCCCUAGGCUGGUUUGAGGUUCUUAUGGACCUCAGAUCACCUAAGGGGCGAUUGCCUGACGGUAGUGUUGUUACCUACGAGAAGAUUUCUUCUAUGGGUAACGGUUACACAUUCGAGCUCGAGUCGCUUAUUUUUGCUUCUCUCGCUCGUUCCGUUUGUGAGAUACUGGACUUAGACUCGUCUGAGGUCACUGUUUACGGAGACGAUAUUAUUUUACCGUCCUGUGCAGUCCCUGCCCUCCGGGAAGUUUUUAAGUAUGUUGGUUUUACGACCAAUACUAAAAAGACU---UUUUCCGAGGGGCCGUUCAGAGAGUCGUGCGGCAAGCACUACUAUUCUGGCGUAGAUGUUACUCCCUUUUACAUACGUCACCGUAUAGUGAGUCCUGCCGAUUUAAUACUGGUUUUGAAUAACCUAUAUCGGUGGGCCACAAUUGACGGCGUAUGGGAUCCUAGGGCC\r
+       PP7     GAC AGC --- CGG UUC GAU UUU GUC GCU AAG ACC GCG AAG GCG GUU CGC UUC AUC GCU AUG GAG CCA GAA CUU AAC AUG CUG CUG CAG AAA UCU GUA GGA GAC ACG AUA AGG GCU GCU CUG CGG AAA GCG GGU AUC GAU CUC AAU ACC CAG CGA CUA AAU CAA GAU CUU GCG UAC CAC GGA UCCGUUUUUCGGAAUCUCGGUACGAUAGAUCUGUCUAGCGCUUCCGAUACGUUAAGCAUUGAACUCGUGCGGCAGUACCUGCCGAAGCGGUUUCUCCGCUAUGUAUUGGAUCUCCGAACCCCCUACACGAGUGUA---GGUGGUAAGAAGCACAGGCUCGAGAAGGUCGCUUCGAUGGGCAACGGGUUCAUUUUUGAACUCCAGAGCCUCAUCUACGCAGCCUUCGCGCAUGCCAUGACGCUAGUAGUAGGAGGAAGAGAAUGCGACAUAGCCAUUUACGGCGAUGAUAUCAUCGUCAGUGAAUGCGUAGUAGAGCCUCUGAUGCAGUUCCUCGAAUGGCAUGGGUUCUGCCCCAAUCUCGAUAAGAGUUAUUGGGGAGGGGAUCCAUUCCGCGAGUCCUGCGGGAAGCACUACUUCGCUGGUCGCGACGUUACCCCUGUCUACGUGAAGGGGGCCCUGGAUAACCUACCUGCCCUUUUCCGUCUCUUCAACUCGUUGAAGCGAUGGGAGGAGCAAACAGGUAUCCGGAUCCCUGACACG\r
+       ;\r
+end;\r
+\r
diff --git a/examples/sceloporus.nex b/examples/sceloporus.nex
new file mode 100644 (file)
index 0000000..e8ecc1a
--- /dev/null
@@ -0,0 +1,146 @@
+#NEXUS \r
+\r
+[ Data from: Leache, A. D., and D. G. Mulcahy. 2007. Phylogeny, divergence times and species limits of spiny lizards (Sceloporus magister species group) in western North American deserts and Baja California. Mol. Ecol. 16:5216-5233 ]\r
+\r
+BEGIN DATA;\r
+       DIMENSIONS  NTAX=123 NCHAR=1606;\r
+       FORMAT DATATYPE=DNA  MISSING=? GAP=- ;\r
+MATRIX\r
+\r
+AZYuJAS289     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACGTA--TTTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-T-ATGCCAA-ACACTAAAAATTAAACCATACCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAATAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??????????????????????????????????????????ATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTAGTAATTTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTATAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTTATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAACATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAGTAATCATCATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAATCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAACCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTT?????????????????????????????   [1592]\r
+AZYuJAS290     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-CTATGCCAA-ACACTAAAAATTAAACCATATCCTGGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACGCTAATCACAGCAATATATTCACTAAACATATTCCTAATCACACAACGAAACAAATTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZlaJAS294     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGATTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCCTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATAGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATTATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACGCTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+AZcoTBP271     ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ATCCTCCTAAAACTAGGAGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATTTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATAGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGAGCAATAATTCTGATAATCGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAACCTAACCAACATGGCATTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTTAACTGATCCACCCCAACAATTCTACTAACAGGCCTGGGAACACTAATCACAGCAATATATTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAACATTACCGACCCAACCCACTCACGAGAACATCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATCATAAAACCAGCCCTAATTTCAGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAACCCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTT???????   [1606]\r
+AZcoGM1054     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZcoDGM994     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZgiP26438     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTTGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZgrGM1012     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZgrGM1013     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZgrGM1024     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1594]\r
+AZlaDGM856     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTA-CCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCACTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATAGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATTATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACGCTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAA???   [1592]\r
+AZmaDGM984     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAAATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTA-AATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATCCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATCTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACGCTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTCATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+AZmaDGM992     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAGCCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTGGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAATTAATTTTAAACACG?TCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCACTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+AZmaRM4401     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAGTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTA--TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTATACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTGAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTAACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCTTACTCATCAGTCAGCCACATAGGCCTAGTAATCTTAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGAGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTTATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATAGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGCCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZmaRM4402     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAGTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTA--TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTATACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTGAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTAACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCTTACTCATCAGTCAGCCACATAGGCCTAGTAATCTTAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGAGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTTATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATAGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGCCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATACAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZmaRM4403     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAGTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTA--TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTATACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTGAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTAACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCTTACTCATCAGTCAGCCACATAGGCCTAGTAATCTTAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGAGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTTATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATAGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGCCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZmoGM1045     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAACTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZmoDGM492     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZmoDGM699     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTA--TTTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-T-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAATAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTAGTAATTTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTATAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTTATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAACATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAATCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAACCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZmoDGM704     TCTCCACTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTTC-TTCTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGCTAGAAT-T-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATGCTCCACGATAAACCTTACCAGTCTTTGCCCGT-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGGAAAATAGTAGGTGTAAAAGCC-CAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-CAGCGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGAGGTTATGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCCTTTATGATTCTAGCACTATGGGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGAGCAATAATTCTGATAATCGCACACGGACTCACCTCATCCATACTATTCTGCTTGGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTCCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAACCTAACCAACATGGCATTACCGCCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAGTCACACAGCGAAACAAACTACCAATAAACATCAACATTACTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATGCATATAACACCCCTAATCCTAATTATCATAAAACCAGCCCTAATTTCAGGCCTCATAAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATCCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+AZmoRM4394     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGAACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCCAACCTA--TTTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-T-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAATAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG?TCCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTAGTAATTTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTATAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTTATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAACATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAATCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+AZpiKWS238     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TCTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATATATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATATTCCACGATAAACCTGACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGGGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+AZyuDGM826     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TCTTAAAGCTTGACTTAGTTATGATTTTA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTATTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAGAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCCTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAGTCTCAGCCTGCCTTATCCAAACACCATGAAGCTTCACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1593]\r
+AZyuDGM838     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCCAGCCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ACGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACCAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTAGTAATCATTATTTCACTATTCAACTGATCCACTCCAACAATTCTACTAACAGGCCTAGGAACGCTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAGCACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACC???????????????   [1593]\r
+AZyuDGM852     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TCTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTATTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAGAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTATAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGTGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAGTCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGCCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAA???   [1593]\r
+AZyuDGM858     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TCTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTATTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAGAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCCTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAGTCTCAGCCTGCCTTATCCAAACACCATGAAGCTTCACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACC???????????????   [1593]\r
+AZyuDGM865     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAGCCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ACGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACCAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAAGCCTAGGAACGCTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAGCACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+CAfrP25750     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTGT-TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CACTTTTAAAAAT--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCATGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCGAAACTCTATTATCCTTTTATAATTCTAGCACTATGAGGTATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCCATAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCGATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAACCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+CAimDGM534     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCGGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-GCACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAATCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGGTATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACG??CCTCCTAAAACTAGGCGGTTATGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCTTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAA???   [1593]\r
+CAimDGM558     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAGCCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTGGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTTATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTCATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTTATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCGCTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAA???   [1593]\r
+CAimDGM694     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCCAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATGCGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTCGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGGGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAA???   [1593]\r
+CAimKWS170     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAGCCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTGGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTTATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTCATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTTATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAA???   [1593]\r
+CAinCRF530     TCCTCATTCCAGTGAAA-ATGCCCTAG-CATAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGTAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-TACACCCAACCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CACTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCATGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAACTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTGTTAGCAAATCTAACCAATATAGCACTGCCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATCCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGACAATAAACATCAGCATTGCTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1591]\r
+CAinoDGM74     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG?TTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAinCRF529     TCCTCATTCCAGTGAAA-ATGCCCTAG-CATAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGTAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-TACACCCAACCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CACTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCATGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAACTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTGTTAGCAAATCTAACCAATATAGCACTGCCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGACAATAAACATCAGCATTGCTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTA??????????   [1591]\r
+CAkeDS2SP7     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACGAAGAACTGCTAATTCCTTCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAkeP26556     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATTCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAla78323      TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATACCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGGGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATCCTTCTTACAGACCAAGAGGTGTTTTGAACACGAAGAACTGCTAATTCCTTCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAlaDAW220     ????????????TGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAG??????????????????????????????????????????ATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTTTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACGAAGAACTGCTAATTCCTTCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAlaM14610     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACGAAGAACTGCTAATTCCTTCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAlaM23289     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   [1592]\r
+CAmoJQR132     TCCTCATTCCAGTGAAA-ATGCCCTAG-TATAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGTAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-TACACCCAACCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CACTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCATGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAACTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTGTTAGCAAATCTAACCAATATAGCACTGCCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCATTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGACAATAAACATCAGCATTGCTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1591]\r
+CArvJOS138     ??CTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCGGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-GCACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAATCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGGTATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTATGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCAAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+CArvESA441     ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ATCCTCCTAAAACTAGGCGGTTATGGCATTATACGTATTACAATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAGACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCAATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCTTCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGCCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCAACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1606]\r
+CAsaBUR167     ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ATCCTCCTAAAACTAGGTGGTTATGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATCACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1606]\r
+CAsaMCFMAG     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACAGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTACTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATCGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACAGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAATACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAsarnMCC      ??CTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCGGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-CTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGGGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-GCACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAATCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGGTATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGTGGTTATGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATCACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+CAsa150079     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAGTTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGGGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAsa150088     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGGGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATTTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTT??????   [1592]\r
+CAsa179886     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAGCA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGGGCTGTAATTCTGATAATCGCCCACGGACTTACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACGCCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAsaM19838     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAATTAATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACGAAGAACTGCTAATTCCTTCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+CAsdDGM691     TCCTCATTCCAGTGAAAAATGCCCTAG-AGCAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTATTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTATGGCATTATACGTATTACAATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAGACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCAATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCTTCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCAGCCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAACCACACAACGAAACAAACTACCAATAAACATCAGCATTACCAACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+CAsdDGM748     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAAGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAACTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCCTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTCGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGGGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+CAsdSWT701     ??CTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAGCCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTGGACGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGGTATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATTCTAGCACTATGAGGCATCGTTATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTCATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTTATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCGCTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAGCCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+MXBCDGM474     TCCTCATTCCAGTGAAAAATGCCCCAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCCAACCCA--TCTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-T-ATGCCAA-ACACTAAAAACTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAATCAAA-TATTTTTAAAAAT--AGGCAATTTGACCCACGAAAACTAAGGAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTAGGAGGTTATGGAATTATACGAATTACCATATCACTAACCCCAATAACCCCAAAACTCTACTATCCCTTTATAGTTCTAGCATTATGGGGCGTCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTATTCATCAGTTAGCCACATGGGCTTAGTAATCTCAGCCTGCCTTATCCAGACACCCTGAAGCTTCACAGGAGCAATAATTCTAATAATCGCCCATGGACTCACCTCATCAATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGATTATTAGCTAATTTAACCAATATAGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGTCCCCACAATTCTACTGACAGGTCTAGGAACACTAATCACAGCAATATATTCACTAAACATATTCCTAACCACACAACGAAACAAACTAACAATAAACATAAGCATTACCGACCCAACCCACTCACGAGAACACCTCCTAATAACCATACACATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTA-CAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATCCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCGGACCTCTTACTTTTAAAGG   [1591]\r
+MXBCDGM475     TCCTCATTCCAGTGAAAAATGCCCCAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCCAACCCA--TCTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-T-ATGCCAA-ACACTAAAAACTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAATCAAA-TATTTTTAAAAAT--AGGCAATTTGACCCACGAAAACTAAGGAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAGTTAATTTTAAACACGATCCTCCTAAAACTAGGAGGTTATGGAATTATACGAATTACCATATCATTAGCCCCAATAACCCCAAAACTCTACTATCCCTTTATAGTTCTAGCATTATGGGGCGTCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTATTCATCAGTTAGCCACATGGGCTTAGTAATCTCAGCCTGCCTTATCCAGACACCCTGAAGCTTCACAGGAGCAATAATTCTAATAATCGCCCATGGACTCACCTCATCAATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCTAATTTAACCAATATAGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCGTCCCCACAATTCTACTGACAGGTCTAGGAACACTAATCACAGCAATATATTCACTAAACATATTCCTAACCACACAACGAAACAAACTAACAATAAACATAAGCATTACCGACCCAACCCACTCACGAGAACACCTCCTAATAACCATACACATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTA-CAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATCCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCGGACCTCTTACTTTTAAAGG   [1591]\r
+MXBCDGM486     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAAACGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACG?TCCTCCTAAAACTAGGCGGTTACGGCATTATACGTATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCTTTTATGATCCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAATTGCACACGGACTCACCTCATCCATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCATACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTGGCCAACCTAACCAACATGGCACTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATTACACAACGAAACAAACTACCAATAAATATCAGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGTAGTGGCCCTAAAAACAGAAGTTCAATTCTTCTTTCGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+MXchRM4860     TCCCCATTCCAGTGAAA-ACGCCCTAG-CACAGTACAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAACAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACCGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTGGGGGGTTATGGTATTATACGAATTACCATATCATTAGCCCCAGTAACCCAAAAACTCTACTACCCCTTTATAATTCTAGCACTATGAGGTATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCATTAATTGCCTATTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAATTCTGATAATTGCCCACGGACTCACCTCATCCATATTATTCTGCCTAGCAAACACAAACTATGAACGAACACACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGATTATTAGCAAACCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAGCTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTATTAACAGGCCTAGGAACACTAATCACAGCAATATATTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATATGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAACCCTAATTTCAGGCCTGATCAGCTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACATACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+MXduA83134     ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ATCCTCCTAAAACTGGGGGGTTATGGTATTATACGAATTACCATATCATTAGCCCCAGTAACCCAAAAACTCTACTACCCCTTTATAATCCTAGCACTATGAGGTATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCATTAATTGCCTATTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAATTCTGATAATTGCCCACGGACTCACCTCATCCATATTATTCTGCCTAGCAAACACAAACTATGAACGAACACACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGATTATTAGCAAACCTAACCAATATGGCACTACCACCATCCATCAACCTTATGGGAGAGCTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTATTAACAGGCCTAGGAACACTAATCACAGCAATATATTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATATGCATTACCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATTTCAGGCCTGATCAGCTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACATACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1606]\r
+MXsoM14488     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATATTAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACG??????????????????????????????????????????????????????????????????AAACTTTACTACCCCTTTATGATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTACTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTAATAGTTGCACACGGACTCACCTCATCAATACTATTCTGCTTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGGCTACTAGCCAATCTAACCAACATGGCACTACCACCATCCATTAACCTCATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAGCATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAGCACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTT??????   [1594]\r
+MXsoP26449     TCCTCATTCCAGTGAAAAATGCCCTAT-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTACTTTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAAGGGCCCAAAGCAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-GTGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTGTAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-CAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACG?TCCTCCTAAAACTAGGGGGTTACGGCATTATACGCATTACCATATCATTGACCCCAATAACCCCAAAACTTTACTACCCCTTTATGATTCTAGCACTATGGGGCATCGTAATAACAAGCTCAATCTGCATACGACAGACAGACCTAAAATCACTAATTGCCTATTCATCAGTTAGCCACATGGGCCTAGTAATCTCAGCCTGCCTTATCCAAACACCATGAAGCTTTACAGGGGCAATAATTCTGATAGTTGCACACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTCACACGAGGTTTTCAACTCATTCTTCCACTAATATCCACCTGATGACTACTAGCCAATCTAACCAACATGGCATTACCACCATCCATTAACCTTATGGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCGACAATTCTACTAACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAACATTACCGACCCGACCCATTCACGAGAACACCTTCTAATAACCATACATATAATACCCCTAATCCTAATTATCATAAAACCAACCCTAATCTCAGGCCTTATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACGAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACC???????????????   [1594]\r
+MXso210345     ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ATCCTCCTAAAACTAGGGGGCTACGGCATTATACGTATTACCATATCATTAGCCCCAATAACCCCAAAACTTTACTACCCCTTTATAATTCTAGCACTATGGGGCATCGTAATAACAAGCTCAATCTGTATACGACAAACAGACCTAAAATCACTAATTGCCTATTCATCAGTCAGCCACATGGGCCTAGTAATCTCAGCCTGTCTTATCCAAACGCCATGAAGCTTTACAGGTGCAATAATTCTAATAGTTGCACACGGAATCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCAACACCCGAACAATAATTCTTACACGAGGTTTTCAACTTATTCTTCCACTAATATCCACCTGATGACTACTAGCCAACCTAACCAACATGGCATTACCACCATCCATTAACCTCATAGGTGAACTGGTAATCATTATTTCATTATTCAACTGATCCACCCCAACAATTCTACTGACAGGCCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCCTAATCACACAACGAAACAAACTACCAATAAACATCAACATTACCGACCCGACCCACTCACGAGAGCACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATCATAAAACCAGCCCTAATCTCGGGCCTTATTAAC???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   [1606]\r
+NMdoTWR230     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATACCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMedDGM938     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMhiU48819     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGTAAAAATGGAGCAGGTATCAGGCACAACTAATAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCTAACCCAC-TTTTAAAGCTTGACTTAGTTATGATTTAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGACACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGACGTAAAACAAAGGATAGATGAAACCAAACCATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACTCTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTTACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGTAAAAGCC-CAACAGCTAAAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAATA-TAACGGCACGGTACAATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTTAATTTTAAACACG?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   [1594]\r
+NMluGM947      TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAACATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMluDGM948     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMsiDGM891     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMsoDGM900     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMsoDGM904     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMsoDGM905     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NMvaDGM924     TCCTCGTTCCAGTGAAAAATGCCCTAG-CACAGTACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTCTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTAT-TTTTAAAGCTTGACTTAGTTATGATTCAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAGCCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTTCACTACTAGAATATCCGCCAGAAGACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCACGGTACTATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTCCTAAAACTTGGAGGTTATGGTATTATACGAATTACCATATCATTAACCCCAATAACCCAAAAACTCTACTACCCATTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGCTTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCAATAGTTCTGATAATTGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAACTATGAACGAACCCACACCCGAACAATAATTCTAACACGAGGTTTTCAACTCATCCTTCCACTAATATCAACCTGATGATTATTAGCAAATCTAACCAATATGGCACTACCACCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCAACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATACTCACTAAACATATTCTTAATTACACAACGAAACAAACTAGCAATAAACATAAGCATTTCCGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTAATTATTATGAAACCAGCCCTAATTTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTATTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+NVchDGM612     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+NVch162077     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+NVclDGM296     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTA--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-T-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAATAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTAGTAATTTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTGATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTTATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAACATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTAGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAATCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAACCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+NVclDGM678     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACAGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAGAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAACCCCCATAACCCCAAAACTCTACTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATCGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAATACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCGAGAACTGCTAATTCCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+NVesDGM210     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG????TCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATTAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+NVlyDGM610     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATACCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGTCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+NVwaDGM608     TCCTCATTCCAGTGAAAAATGCCCTAG-AACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAATCTG--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAAATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTAGGAGGTTATGGCATTATACGAATTACCATGTTACTAGCCCCAATAACCCCAAAACTCTATTACCCTTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTCCAACTCATTCTTCCACTAATATCGACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGATAATCATTATTTCACTATTCAACTGATCCACCCTTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACCGACCCAACCCACTCACGAGAACACCTTCTAATAACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTemGM1058     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAGTCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTgrDGM156     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTgrDGM169     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTgrDGM175     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTkaGM1034     TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTsnDM142      TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTsnDG043      TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTsnnDGM645    TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTwsGM261      TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCACATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA--TACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATAGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1591]\r
+UTwsGM263      TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGGAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTwsnDGM751    TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACG??CCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+UTwsJRM4437    TCCTCATTCCAGTGAAAAATGCCCTAG-CACAGCACAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCAATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCTAACCTC--TTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCTGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGAGCCCAAAGCAGCAGAAACTCGGCGTAAATAGTGGTTAGAAT-C-ATGCCAA-ACACTAAAAATTAAACCATATCCTAACCGTAAAACAAAGGATAGATGAAACCAAA-CATTTTTAAAAAC--AGGCAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATAAGATATTACACTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAGTCTTTGCCCAA-TCAGCCTATATACCGCCGTCACCAACCTACCTCATGAGAGAAAAATAGTAGGTGCAAAAGCC-TAACAGCTAGAACGTCAGGTCAAGGTGTAGCTAATAGACTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTACCATGAAATTTCTACCCAAAGGAGGATTTAATAGTAAAATTAATAAGAAAATTAATTTTAAACACGATCCTACTAAAACTAGGAGGTTATGGCATTATACGAATTACCATATTATTAGCCCCAATAACCCCAAAACTCTATTACCCCTTTATAATTCTAGCACTATGAGGCATCGTAATAACAAGCTCAATCTGCATACGACAAACAGATCTAAAATCACTAATTGCTTACTCATCAGTTAGCCACATGGGCCTGGTAATCTCAGCCTGCCTTATCCAAACACCCTGAAGCTTCACAGGAGCTGTAATTCTGATAATCGCCCACGGACTCACCTCATCCATACTATTCTGCCTAGCAAACACAAATTATGAACGAACCCACACCCGAACAATAATTCTCACACGTGGTTTTCAACTCATTCTTCCACTAATATCAACCTGATGACTATTAGCAAATCTAACCAATATAGCACTACCCCCATCCATCAACCTTATAGGAGAACTGGTAATCATTATTTCACTATTCAACTGATCCACCCCTACAATTCTACTAACAGGTCTAGGAACACTAATCACAGCAATATATTCATTAAACATATTCCTAACCACACAACGAAACAAACTGGCAATAAACATCAGCATTACTGACCCAACCCATTCACGAGAACACCTTCTAATGACCATACATATAACACCCCTAATCCTCATTATTATAAAACCAGCCCTAATCTCAGGCCTGATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAGACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCTGTTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+hunsiM376      TCCTCATACCAGTGAAAAATGCCCTTA-CACAGTACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAATTTTC-CTTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--CCGGCGTAAATAGTGGCTAGAAT-CTGTACCAATACATTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACTACA-CATTTTTAATAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCTA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCGTGAGAGAAAAACAGTAAGTACAAAAGTTTTAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAGGAGATGGGCTACATTTTTTAAGATAAAATA--TACGGCATGGTACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTCTAAAGCTTGGAGGATATGGAATTATACGAATTACAATATCACTAACCCCAATCACACCAAAACTATATTACCCATTTATAATTCTTGCATTGTGAGGCATCGTCATAACAAGCTCAATTTGCATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCATATGGGGCTAGTAATCACAGCATGTCTAATCCAGACACCATGAAGCTTTACAGGGGCAATAATCCTAATAATTGCACACGGACTAACCTCATCAATATTATTCTGCCTAGCAAACACAAATTACGAACGAACCCACACCCGAACAATAATCATTGCCCGCGGCTTCCAACTTATTCTCCCACTAATGTCAACATGATGACTCTTAGCAAACCTAACCAATATAGCCCTACCACCATCAATTAACCTAATAGGAGAACTTATCATCATCATCTCATTATTTAACTGATCAAACCCAACAATCTTATTAACTGGATTAGGAACACTTATCACAGCAATTTACTCACTCAACATATTCCTAATTACCCAACGAAACAAAATCCCAACCAACATTACCTTCACTGACCCGACCCACACACGAGAACATCTCCTAATAATATTACACCTAGCCCCCTTGGCCCTCATTATTATGAAACCAGCCCTAATTTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGGAGTTAAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCTTACAACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAG?   [1593]\r
+hunsiM377      TCCTCATACCAGTGAAAAATGCCCTTA-CACAGTACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAATTTTC-CTTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--CCGGCGTAAATAGTGGCTAGAAT-CTGTACCAATACATTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACTACA-CATTTTTAATAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCTA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCGTGAGAGAAAAACAGTAAGTACAAAAGTTTTAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAATA--TACGGCATGGTACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTCTAAAGCTTGGAGGATATGGAATTATACGAATTACAATATCACTAACCCCAATCACACCAAAACTATATTACCCATTTATAATTCTTGCATTGTGAGGCATCGTCATAACAAGCTCAATTTGCATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCATATGGGGCTAGTAATCGCAGCATGTCTAATCCAGACACCATGAAGCTTTACAGGGGCAATAATCCTAATAATTGCACACGGATTAACCTCATCAATATTATTCTGCCTAGCAAACACAAATTACGAACGAACCCACACCCGAACAATAATCATTGCCCGCGGCTTCCAACTTATTCTCCCACTAATGTCAACATGATGACTCTTAGCAAACCTAACCAATATAGCCCTACCACCATCAATTAACCTAATAGGAGAACTTATCATCATCATCTCATTATTTAACTGATCAAACCCAACAATCTTATTAACTGGATTAGGAACACTTATCACAGCAATTTACTCACTCAACATATTCCTAATTACCCAACGAAACAAAATCCCAACCAACATTACCTTCACTGACCCGACCCACACACGAGAACATCTCCTAATAATATTACACCTAGCCCCCTTGGCCCTCATTATTATGAAACCAGCCCTAATTTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGGAGTTAAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCTTACAACTGAAGTTAAAATCCTCAGACCTCTTAC?????????   [1593]\r
+hunsiRWM619    TCCTCATACCAGTGAAAAATGCCCTTA-CACAGTACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAATTTTC-CTTTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGTTAGAAT-CTGTGCCAATACATTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACTATG-CATTTTTAATAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCTA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCGTGAGAGAAAAACAGTAAGTACAAAAGTTTTAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--TACGGCACGGTACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTCTAAAGCTTGGAGGATATGGAATTATACGAATTACAATATCACTAACCCCAATCACACCAAAACTATATTACCCATTTATAATTCTTGCATTATGAGGCATCGTCATAACAAGCTCAATTTGTATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCATATAGGACTAGTAATCGCAGCATGTCTAATCCAAACACCATGAAGCTTTACAGGAGCAATAATCCTAATAATTGCACACGGATTAACCTCATCAATATTATTCTGCCTAGCAAACACAAATTACGAGCGAACCCACACCCGAACAATAATCATTGCCCGCGGCTTCCAACTTATTCTCCCACTAATGTCAACATGATGACTCTTAGCAAACCTAACCAATATAGCCCTACCACCATCAATTAACCTAATAGGAGAACTTATTATCATCATCTCATTATTTAACTGATCAAACCCAACAATCTTATTAACTGGGTTAGGAACACTTATCACAGCAATTTACTCACTCAACATATTCCTAATTACCCAACGAAACAAAATCCCAACCAACATTATCTTCACCGACCCGACCCACACACGAGAACACCTCCTAATAATACTACACCTAGCCCCCTTAGCCCTTATTATTATGAAACCAGCCCTAATCTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGGAGTTAAATTCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTTCAGATACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1593]\r
+lickGM378      TCCTCATGCCAGTGAGAAATGCCCTAA-AACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAGGCTTTGCCACACCCACACGGGTCATCAGCAGTGATAAACATTAAGCAATGAGCGATATATACCAAACCA---CTTTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGTAGCAGAT--TCGGCGTAAATAGTGGTTAGAAT-TCATACCAACACATTAAAAACTAAACCACATCCTAACCGTAAAACACAGGATATATGAAATCACA-CATTTTTAATAAG--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTACACCACCAAAATATCCGCCAGAAAATTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGATAAACCAAACCAATCTTTGCCTGT-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAGCAGTAAGTACAAAAGTTCTAACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--TACGGCATGGTACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAAATAACAAGAAAGTTAATTTTAAACACGATCCTTCTAAAACTTGGAGGTTATGGTATTATACGAATTACAATATCACTAACCCCAATAACACCAAAACTATGCTACCCATTTATAATTCTCGCATTATGGGGAATTGTCATAACAAGTTCAATCTGCATACGACAGACAGACCTTAAATCACTAATTGCCTACTCATCAGTTAGCCATATAGGACTAGTAATCACAGCATGCCTAATCCAAACACCTTGAAGCTTTACAGGGGCAATAATCCTAATAATTGCACACGGCCTAACCTCATCTATACTATTCTGCCTAGCAAACACAAACTACGAACGAACACACACCCGAACAATAGTTATTGCTCGCGGTTTCCAACTTATTCTACCATTAATATCAACATGGTGACTGATGGCAAATTTGACCAACATAGCCCTACCACCATCAATCAACCTTATGGGTGAACTTATTATCATTGTCTCCTTGTTTAACTGATCAAACCCGACAATCCTACTAACAGGCCTAGGAACACTCATCACAGCAATATACTCACTAAACATATTCCTAATTACACAACGAAACAAAATACCAACAAACATTAATTTAACTGACCCAACCCACACACGAGAACATCTCCTAATAATTTTACACTTAACCCCTCTAATCCTAATTATCATAAAACCCGCCCTCATCTCAGGCTTAATCAATTGTTAGTATAGTTTAACAAAAACACTAGGCAGTGGCCCTAAAAATAGGAGTTAAACCCTTCTTACGAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCCCACCACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAG?   [1592]\r
+lineatulus     ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????TATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTTCTA-CAACTAATACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCACGGTACTATGAAATTTTTACCCAAAGGAGGATTTAATAGTAAAATTAACAAGAAAGTT??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   [1602]\r
+orcuOM14377    ??????TACCAGTGAAAAATGCCCTTA-CACAGTACAAACGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAATTTTC-CTCTAAAGCTTGACTTAGTTATGATTAGA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGTTAGAAT-CTATACCAGTATGTTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACCACA-CATTCTTAACAAT--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTAAGTACAAAAGTTTCAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--TACGGCACGGTACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTCTGAAATTAGGGGGTTATGGAATTATACGAATTACAATATCACTAACCCCAATCACCCCAAAGCTATATTACCCATTTATAATTCTCGCACTATGGGGCATTGTCATAACAAGCTCGATTTGCATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCATATGGGGCTAGTAGTTGCAGCATGTCTAATCCAAACACCATGAAGCTTCACAGGGGCAATAATCCTAATAATCGCACACGGACTAACCTCGTCCATACTATTCTGCCTAGCAAACACAAACTACGAACGGACCCACACCCGAACAATAGTCATTGCCCGTGGCTTCCAACTTATTCTACCACTAATATCAACATGATGACTCTTAGCAAACCTAACCAATATGGCCCTACCACCATCAATCAACCTAATAGGAGAACTTATTATCATTATCTCATTATTCAACTGATCGGGCCCAACAATTTTATTGACTGGATTAGGAACACTTATTACAGCAACATACTCACTCAACATATTCCTAATCACCCAACGAAACAAAATACCAACCAACATTAACCTCACCGACCCAACCCACACACGAGAACACCTCCTAATAATGCTACACTTAGCCCCCCTAGTTCTTATTATCATAAAACCAGCCCTAATCTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTGATTCTTCTTACAAACCAAGAGGTGTTT-GAACACCAAGAACTGCTAATTTCTGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+orcuOM14453    ??????TACCAGTGAAAAATGCCCTTA-CACAGTACAAACGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-TACACCAAATCT---TCCTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGTTAGAAT-CTTTACCAATATGTTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACCACA-CATTCTTAACAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCCCGCTAAACCCGACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTAAGTACAAAAGTTTCAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--TACGGCACGGTACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTCTAAAATTAGGGGGTTATGGAATTATACGAATTACAATATCACTAACCCCAATCACCCCAAAGCTATATTACCCATTTATAATTCTTGCACTATGGGGCATTGTCATAACAAGCTCGATTTGCATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCACATGGGACTAGTAGTTGCAGCATGTCTAATCCAAACACCATGAAGCTTCACAGGGGCAATAATCCTAATAATCGCACACGGACTAACCTCGTCCATACTATTCTGCCTAGCAAACACAAACTACGAACGGACCCACACCCGAACAATAGTCATTGCCCGTGGCTTCCAACTTATTCTACCACTAATATCAACATGATGACTCTTAGCAAACCTAACCAATATGGCCCTACCACCATCAATCAACCTAATAGGAGAACTTATTATCATTATCTCATTATTCAACTGATCGGGCCCAACAATTTTATTGACTGGATTAGGAACACTTATTACAGCAATATACTCACTCAACATATTCCTAATCACCCAACGAAACAAAATACCAACCAACATTAACCTCACCGACCCAACCCACACACGAGAACACCTCCTAATAATGCTACACTTAGCCCCCCTAGTTCTTATTATTATAAAACCAGCCCTAATCTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAATTCTTCTTACAAACCAAGAGGTGTTT-GAACACCAAGAACTGCTAATTTCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1590]\r
+orcuOM14673    ??????TGCCAGTGAAAAATGCCCTTA-CACAGTACAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCAAATTT---CCCTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGTTAGAAT-CTATACCAATATGTTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACCACA-CACTTTTAACAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTAAGTACAAAAGTTTCAACAACTAAGACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--TACGGCATGGTACTATGAAACTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTCTAAAATTAGGGGGTTACGGAATCATACGAATTACAATATCATTAACCCCAATCACCCCAAAGCTATACTATCCATTTATAATTCTTGCATTATGGGGCATCATCATAACAAGCTCAATTTGCATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCATATAGGATTAGTAATCGCAGCATGTCTAATCCAAACACCATGAAGCTTCACAGGGGCAATAATCCTAATAATTGCACACGGGTTAACATCGTCCATACTATTCTGCCTAGCAAACACAAACTACGAACGAACCCACACCCGAACAATAGTCATTGCCCGTGGCTTCCAACTTATTCTTCCACTAATATCAACATGGTGGCTCTTAGCAAACCTAACCAATATAGCCCTACCGCCATCAATCAATCTAATAGGAGAACTTATTATCATTATCTCATTATTCAACTGATCAAGCCCAACAATCTTATTGACTGGATTAGGAACACTTATTACAGCAATATACTCACTCAACATATTCCTAATCACCCAACGAAACAAAATACCAACCAACATTAACCTCACCGACCCAACCCATACACGAGAACATCTACTAATAATACTACACTTAGCCCCCCTAGTTCTTATTATTGTAAAACCAGCCCTAATTTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAGAAACAGAAGTTGAACTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTTCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1591]\r
+orcuRWM798     ??????TCCCAGTGAAAAATGCCCTTA-CACAGTACAAACGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAATATT--TACTAAAGCTTGACTTAGTTATGATTAAA-CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGCTAGAAT-CTATACCAATATGTTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACCACA-CACTCTTAACAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTAAGTACAAGAGTCTCAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--TACGGCATGGCACTATGAAATTTCTACCTGAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGGTTCTTCTGAAATTGGGGGGTTATGGAATTATACGAATTACAATATCACTAACCCCAATCACCCCAAAGCTATATTATCCATTTATAATTCTTGCGCTATGGGGCATCGTCATAACAAGCTCAATTTGCATACGACAAACAGACCTTAAATCACTAATCGCCTACTCATCAGTTAGCCATATAGGACTAGTAATTGCAGCATGTCTAATCCAAACACCATGAAGCTTCACAGGGGCAATAATCCTGATAATTGCACACGGACTAACCTCATCCATACTATTCTGCCTAGCAAACACAAACTACGAACGGACCCACACTCGAACAATAGTCATTGCCCGTGGCTTTCAACTTATTCTCCCACTAATATCAACATGATGACTCTTAGCAAACCTAACCAACATGGCCCTACCACCATCAATCAACCTAATAGGAGAACTTATTATCATTATCTCATTATTTAACTGATCAGGACCAACAATCTTACTAACTGGATTAGGAACACTTATTACAGCAATATATTCACTCAACATATTCCTAATCACACAACGAAACAAAATACCAGCCAACATTAACCTCACCGACCCGACCCACACACGAGAACACCTCCTAATAATATTACACTTAGCCCCCCTAGTCCTTATTATTATAAAACCAGCCCTAATCTCAGGACTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAGAAACAGAAGTTCAATTCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTTCATCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+orcuS201108    TCCTCATACCAGTGAAAAATGCCCTTA-CACAGTACAAATGGAGCAGGTATCAGGCACAACTACCAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAATTT---TACTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGTTAGAAT-CTATACCAATACGTTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACCACA-CACTTTTAACAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTAAGTACAAAAGTTTCAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCATGGTACTATGAAATTTCTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACG?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   [1591]\r
+orcuS201124    TCCTCATACCAGTGAAAAATGCCCTTA-CACAGTACAAATGGAGCAGGTATCAGGCACAACTACCAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAACTT---TACTAAAGCTTGACTTAGTTATGATTAAA-TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAA--TCGGCGTAAATAGTGGTTAGAAT-CTATACCAATACGTTAAAAACTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAACCACA-CACTTTTAACAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTTCATACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCCGACCAATCTTTGCCCAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTAAGTACAAAAGTTTCAATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCATGGTACTATGAAATTTCTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACG?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????   [1591]\r
+zostZ16290     TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAATAT---TCTTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-GCACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTCGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAACCTAATGGGTGAACTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTGCTGATCCGACCCACACACGAGAGCACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1592]\r
+zosV161292     TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAATATTC---TTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-GCACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTCGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAACCTAATGGGTGAACTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTACTGATCCGACCCACACACGAGAGCACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1592]\r
+zosV161293     TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAATATTC---TTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-GCACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTCGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAACCTAATGGGTGAACTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTACTGATCCGACCCACACACGAGAGCACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1592]\r
+zosV161311     TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAATAT---TCTTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-ACACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTCGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAACCTAATGGGTGAACTTATCATCATTGTATCACTATTCAATTGATCACCGCCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTGCTGATCCGACCCACACACGAGAGCACCTTCTTATAACGCTCCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1592]\r
+zosWM1890      TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAATATTC---TTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-ACACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTACTAAAACTTGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGACTAGTAATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGGCTACTAGCAAACCTAACCAATATAGCACTTCCCCCGTCAATCAACCTAATGGGTGAGCTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTGCTGATCCGACCCACACACGAGAGCACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+zosGM364       TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAGTAT---TCTTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-ACACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTCGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGTCTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAACCTAATGGGTGAACTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTGCTGATCCGACCCACACACGAGAACACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1592]\r
+zosGM365       TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAATATTC---TTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-ACACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTTGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGGGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGACTAGTAATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACGATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCGTCAATCAACCTAATGGGTGAGCTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTGCTGATCCGACCCACACACGAGAGCACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAATATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTATGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTCCTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1592]\r
+zosGM387       TCCTCATTCCAGTGAAATGTGCCCTAA-CACAGTATAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGTCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CATACCAAATAT---TCTTAAAGCTTGACTTAGTTATGATTAAACCTGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-TATCACCCTCACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAGATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACTGTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTATAACTAATACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCACGGTACTATGAAATTTTTACCCAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTACTAAAACTCGGGGGCTACGGCATCATACGAATTACAATATCATTAACCCCAATAACCCCTAAATTATATTACCCGTTTATAATTCTTGCACTATGAGGTATCGTAATAACAAGTTCAGTTTGTATGCGCCAAACAGACCTAAAATCACTAATCGCCTACTCATCCGTTAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGTTTCACAGGAGCAATAATCCTAATAATTGCCCACGGCCTCACTTCATCCATACTATTTTGCCTAGCAAACACAAACTACGAACGGACCCACACCCGAACAATAGTCCTTGCCCGAGGATTCCAACTTATCCTTCCACTGATGTCAGCCTGATGACTACTAGCGAACCTAACCAATATAGCACTCCCCCCATCAATCAATCTGATAGGAGAACTTATTATCATTGTATCACTATTCAACTGATCGACACCAACAATTATACTCACAGGATTAGGAACACTAATTACAGCAATATACTCATTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTACTGATCCAACACACACACGAGAACACCTTCTCATAACACTTCACTTAGCCCCCTTAATTCTTATTATTATAAAACCAGCCCTAATCTCAGGCCTAATCAGCTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATCCTTCTTACAAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAG?   [1593]\r
+zosGM393       TCCTCATTCCAGTGAAATGTGCCCTAA-CACAGTATAAATGGAGCAGGTATCAGGCACAATTACTAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGTCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CATACCAAATAT---TCTTAAAGCTTGACTTAGTTATGATTAAACCTGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-TATCACCCTTACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAGATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACTGTACTAGAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAATACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCACGGTACTATGAAATTTTTACCCAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACG?????ACTAAAACTCGGGGGCTACGGCATCATACGAATTACAATATCATTAACCCCAATAACCCCTAAATTATATTACCCATTTATAATTCTCGCACTATGAGGTATCGTAATAACAAGTTCAGTTTGTATGCGCCAAACAGACCTGAAATCACTAATCGCCTACTCATCCGTCAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGTTTCACAGGAGCAATAATCCTAATAATTGCCCACGGCCTCACTTCATCCATACTATTTTGCCTAGCAAACACAAACTACGAACGGACCCACACCCGAACAATAGTCCTTGCCCGAGGATTCCAACTTATCCTTCCACTGATGTCAGCCTGATGACTACTAGCGAACCTAACCAATATAGCACTCCCCCCATCAATCAATCTGATAGGAGAACTTATTATCATTGTATCACTATTCAACTGATCGACACCAACAATTATACTTACAGGATTAGGAACCCTAATTACAGCAATATACTCATTAAACATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTACTGATCCAACACACACACGAGAACACCTCCTCATAACACTTCACTTAGCCCCCCTAATTCTTATTATTATAAAACCGGCCCTAGTCTCAGGCCTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATCCTTCTTACAAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCTACTACTGAAGTTAAAATCCTCAGACCCCTTACTTTTAAAGG   [1593]\r
+zosRO332       TCCTCATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAGACACCAAGCTTTGCCACACCCACACGGGCCACCAGCAGTGATAGACATTAAGCAATAAGCGAA-CATACCAAGTATTC---TTAAAGCTTGACTTAGTTATGATTGAACCAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-ACACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTATTATACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--TACGGCACGGTACTATGAAATTTTTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTTTGCTAAAACTCGGAGGTTACGGCATTATACGAATTACGATATCATTAACCCCAATAACCCCTAAACTATACTACCCATTTATAATCCTTGCACTATGAGGCATTGTAATAACAAGCTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCCGTCAGTCACATAGGTCTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGCTTCACAGGAGCAATAATCCTAATAATCGCCCACGGCCTCACCTCATCCATGCTATTTTGCTTAGCAAATACAAACTACGAACGAACCCACACTCGAACAATAGTTATTGCTCGAGGATTCCAACTTATTCTTCCACTAATATCAGCCTGATGACTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAACCTAATGGGTGAACTTATCATCATTGTATCACTATTCAATTGATCACCACCAACAATTATACTAACAGGACTAGGAACACTAATTACAGCAATATATTCACTAAATATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTGCTGATCCGACCCACACACGAGAACACCTTCTTATAACGCTTCACTTAGCCCCACTAATCCTCATTATCATAAAACCAGCCCTAATCTCAGGCCTGATTAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACGAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+zosOM37006     ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ATTTTACTAAAACTCGGGGGCTACGGCATCATACGAATTACAATATCATTAACCCCAATAACCCCTAAATTATATTACCCATTTATAATTCTTGCACTATGAGGTATCGTAATAACAAGTTCAGTTTGTATGCGCCAAACAGACCTAAAATCACTAATCGCCTACTCATCCATTAGTCACATAGGACTAGTCATCACAGCATGCCTTATCCAAACACCATGAAGTTTCACAGGAGCAATAATCCTAATAATTGCCCACGGCCTCACTTCATCCATACTATTTTGCCTAGCAAACACAAACTACGAACGGACCCACACCCGAACAATAGTCCTTGCCCGAGGATTCCAACTTATCCTTCCACTGATGTCAGCCTGATGACTACTAGCGAATCTAACCAATATAGCACTCCCCCCATCAATCAATCTGATAGGAGAACTTATTATCATTGTATCACTATTCAACTGATCAACACCAACAATTATACTTACAGGATTAGGAACCCTAATTACAGCAATATACTCATTAAACATATTTCTAATTACCCAACGAAATAAACTACCAACAAACATCAACATTACTGATCCAACACACACACGAGAACACCTTCTCATAACACTTCACTTAGCCCCCCTAATTCTTATTATTATAAAACCGGCCCTAATCTCAGGCCTAATCAGCTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAATCCTTCTTACAAACCGAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1606]\r
+zosWM1601      TCCACATTCCAGTGAAATATGCCCTAA-CACAGTATAAACGGAGCAGGTATCAGGCACAATTACTAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGTCCTCAGCAGTGATAAACATTAAGCAATAAGCGAA-CATACCAAATAT---TCTTAAAGCTTGACTTAGTTATGATTAAACCTGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGACTCTCGGCGTAAATAGTGGCTAGAAT-T-ACACCCACACATTAAAAATTAAACCATATCCTAACCGTAAAACACAGGATAAATGAAAACAAA-CATTTTTAACAAC--TGGAGATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATACGATATTACTGTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCATACCGGATTAGAGGAGCCTGTCCTATAATCGATACTCCACGCTAAACCTCACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAATCTACCTCATGAGAGAAAAATAGTAGATACAACAGTT-CTACAACTAATACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCACGGTACTATGAAATTTTTACCCAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTACTAAAACTCGGGGGCTACGGCATCATACGAATCACAATATCATTAACCCCAATAACCCCTAAATTATATTACCCATTTATAATTCTTGCATTATGAGGTATCGTAATAACAAGTTCAATTTGTATGCGCCAAACAGACCTAAAATCACTAATTGCCTACTCCTCCGTTAGTCACATAGGACTAGTCATCACAGCATGCCTCATCCAAACACCATGAAGTTTCACAGGAGCAATAATCCTAATAATTGCCCACGGCCTCACTTCATCCATACTATTTTGCCTAGCAAACACAAACTACGAACGAACCCACACCCGAACAATAATCCTTGCCCGAGGATTCCAACTTATCCTTCCACTGATATCAACCTGATGATTACTAGCAAACCTAACCAATATAGCACTTCCCCCATCAATCAATCTAATAGGAGAACTTATTATCATTGTATCACTATTCAACTGATCAGCCCCAACAATTATACTTACAGGATTAGGAACACTAATTACAGCAATATACTCACTAAACATATTTCTAATTACCCAACGAAACAAACTACCAACAAACATCAACATTACTGATCCAACACACACACGAGAACATCTTCTCATAACACTTCACTTAGCCCCACTTATCCTTATTATTATAAAACCCGCCCTAATCTCAGGCCTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACAAACCAAGGGGTGTTTCGAACACCAAGAACTGCTAATTCCAGCTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1592]\r
+clarkii        TCCACACTCCAGTGAATACAGCCCTAG--CCAGCATAAATGGAGCAGGTATCAGGCACAACTACTAGCCCAAGACACCAAGCTATGCCACACCCACACGGGCCATCAGCAGTGATAGACATTAAGCAATAAGCGAA-CACACCAAA-------TTTAAAGCTTGACTTAGTTATGATTAA--TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGAAGCAGATTTTCGGCGTAAATCGTGGCTAGAATAT--TACCACAACATTAAAAACTAAACCATAGCCTAACCGTAAAACACAGGCTAAATGAAACCAAA-CATTTTTAACAAT--AGGCAGTTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTATACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCCCCACACCGACTTAGAGGAGCCTGTCCTGTAATCGATACCCCACGCTAAACCTCACCAGTCTTTGCCCAG-TCAGCCTATATACCGCCGTCGTCAACCTACCTCATGAGAGAACAACAGTAAGTACAAAAGTT-AAACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGTAGAGATGGGCTACATTTTTTAAGATAAAACA-CAACGGCACGGTACTATGAAACTCCTACCAGAAGGCGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATCCTACTTAAACTTGGGGGTTACGGTATTATACGTATCACAATATCCCTGACCCCTATGACCCAAAAACTATACTATCCATTTATAATCCTAGCACTATGGGGAATTGTTATAACAAGTTCAATCTGCATACGACAAACAGACCTAAAATCACTAATTGCCTACTCATCAGTTAGCCACATAGGACTAGTCATCACGGCCTGCCTAATCCAAACACCATGAAGCTTTACAGGGGCCATAATCCTGATGATCGCACACGGCCTCACCTCATCAATACTATTCTGCCTAGCGAATACAAACTATGAACGAACACACACCCGAACAATAATCCTCGCCCGGGGCTTCCAAATTATTCTACCCCTTATATCAACCTGATGGCTCCTAGCAAATTTAACCAACATAGCACTGCCACCTTCAATTAACCTAATAGGAGAACTCCTTATTATTATTTCACTATTCAACTGGTCCAGCCCGACAATCCTACTAACAGGGCTAGGAACTCTTATCACAGCAACATACTCACTCCACATATTCCTTACTACCCAACGAAACAAACTACCAACAAACATCAGCCTTTCAGACCCCACACACACACGAGAACACCTCCTAATAATACTCCACCTAGCCCCACTAACACTTATCATTATAAAACCCGCCCTAATCTCAGGCTTAGTCAACTGTTAGTATAGTTTAATAAAAACATTAGGCAGTGGCCCTAAAAATAGAAGTTTAATCCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCTTAACACTGAAGTTAAAATCCTCAGACCTC?????????????   [1586]\r
+edwardti80     CCCGCACACCAGTGAAA-ATGCCCTAA-TATAGTATAAATGGAGCAGGTATCAGGCACATTTATTAGCCCAAGACACCAAGCTATGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAG-TATACAAA-------CTTTAAAGCTTGACTTAGTTATGATTAA--CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCGAAGCAGCAGCC-CCCGGCGTAAATAGTGACTAGAAT-AATTACCGATATATTAAAAACTAAACTCCAGCCTAACCGTAAAACACAGGCTAAATGAAACCAAA-CATTTTTAACAAC--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATAGTATCCCACTAAAATATCCGCCAGAAAACTACGAGCGAAGAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCACACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCTCACCAATCTTTGCCAAG-TCAGCCTATATACCGCCGTCGACAACCTACCTCATGAGAGAAAAACAGTAAGTACAAAAGTC-CAATAACTAGAACGTCAGGTCAAGGTGTAGCTAATAGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCACGGTACTATGAAACTTCTACCCAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAATACGATTCTTCTAAAACTAGGGGGTTACGGCACTATACGAATCACAATATTACTTACCCCAATAACCCAAAAACTATACTACCCATTTATGATTTTAGCATTATGGGGCATCGTCATAACAAGCTCAATCTGCCTACGACAAACAGACCTAAAGTCCCTTATCGCCTACTCATCAGTCAGCCACATAGGACTTGTCATCGCAGCATGCCTAATCCAAACACCATGAAGCTTTACAGGTGCCATAATACTAATAATCGCCCACGGCCTCACTTCCTCTATACTATTCTGCCTAGCAAACACAAACTATGAGCGAACCCACACCCGAACAATAATTATTGCCCGCGGCTTCCAACTCATTCTTCCACTCATATCAACCTGATGACTTCTAGCAAATCTAACTAATATGGCCCTACCCCCATCAATTAACCTAATAGGAGAATTACTGATTATTGTATCACTATTCAATTGATCTAGCCCAACAATGTTACTAACAGGATTAGGTACACTAATCACGGCAATATACTCTCTCAACATATTCCTTATCACCCAACGAAATAAACCACCAACAAACATCCATCTAATCAGCCCAACCCACGCACGAGAACACCTCCTAATAATACTTCATTTAGCCCCCCTAATCCTTATTATTATAAAACCCGCCCTAATCTCTGGACTCATCAACTGTTAGTATAGTTTAACAAAAACATTAGACAGTGGCCCTAAAAACAGAAGTTAAATTCTTCTTACAAACCAAGAGGTGTTT-GAACACCAAGAACTGCTAATTCTTATCACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1584]\r
+smaragdnus     TCTGCATACCAGTGAAACATGCCCTAATCACAGTACAAATGGAGCAGGTATCAGGCGCATCCACTAGCCCAAAACACCAAGCTCTGCCACACCCACACGGGTCATCAGCAGTGATTAACATTAAGCAATAAGCGAACCACACCAAA-------TTTAAAGCTTGACTTAGTTATGATTACA--AGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCATAT-CTCGGCGTAAATAGTGGCTAGAAT-A-ACACCAA-ACATTAAAAGCTAAACCATATTCTAACCGTAAAACACAGGATAAATGAAACCAAA-CACTTTTAACAGC--AGGTAATTTGATCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTATACTACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCACACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCTCACCAATCTTTGCCAAA-TCAGCCTATATACCGCCGTCGCCAACCTACCTCATGAGAGAAAAACAGTGAGTTCAAAAGTC-CAACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGGAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCATGGTACTATGAAACTTCTACCAAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTCCTAAAATTAGGCGGCTACGGCATTATACGAATCACAATATCACTAACCCCTCTAACTCCAAAACTATACTACCCATTTTTAATTCTCGCACTATGGGGCATTGTCATAACAAGTTCAATCTGCCTACGACAAACAGACCTAAAATCCCTTATTGCTTACTCATCAGTAAGCCACATAGGGCTAGTAATCGCAGCCTGTCTAATCCAAACACCATGAAGCTTCACCGGAGCCATAATACTAATAATTGCACACGGCCTGACTTCTTCAATACTATTCTGCTTGGCAAACACAAACTACGAACGAACCCACACCCGAACAATAATTATTGCCCGGGGCTTCCAACTCATTTTTCCACTTATAACAGCCTGATGGCTTCTAGCAAACCTAACCAATATAGCCCTACCCCCATCAATCAACCTAATAGGAGAACTATTCATTATTGTATCATTATTCAACTGGTCTAACCTAACAATATTGCTAACAGGCCTAGGCACACTAATTACAGCAATATACTCCCTTAACATGTTCCTTACAACTCAACGAAATAAACTCCCAATAGATATTCACATTACACATCCAACCCACACACGAGAACACCTTCTAATAATACTTCACCTAGCCCCACTAATTCTTATTATTATAAAACCAGCCCTAGTCTCCGGACTAATCAACTGTTAGTATAGTTTAACAAAAACACTAGGCAGTGGCCCTAAAAACAGAAGTTTAACCCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTACTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1586]\r
+graciosus      TCCACATACCAGTGAAAAATGCCCCAA-CACAGCACAAATGGAGCAGGTATCAGGCACCACCATAAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAA-CACACCAA--------TTTAAAGCTTGACTTAGTTATGATTAA--TAGGGCTGGTTAACCTCGTGCCAGCCACCGCGGTTATACGAAGGGCCCAAAATAGCAGAC-CCCGGCGTAAATAGTGGCTAGAAT-AATTACTAGTATATTAAAAATCAAACTATAGCCTAACCGTAAAACACAGGCTAAATGAAACCAAA-CATTTTTAACAAC--AGGTAATTTGATCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTACACTACTAAAATATCCGCCAGAAGATTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGCGCTCCACACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCTCACCAGTCTTTGCCAAATTCAGCCTATATACCGCCGTCGCCAACCTACCTTATGAAAGAAAAATAGTAAGTACAAAAGTC-TAACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGTAGAGATGGGCTACATTTTTTAAGATAAAATATTAACGGCACGGTATTATGAAACTCCTACCCAAAGGTGGATTTAATAGTAAAACTAACAAGAAAGTTAGTTTTAAACCCGATCCTACTGAAACTCGGAGGCTATGGCATTATACGAATCACAACACTATTAAACCCCATTAACCAAAAATTGTATTTTCCACTTATAATCCTTGCACTATGAGGTATCATTATAACAAGCTCAATCTGCATGCGACAAACTGACCTAAAATCCCTTATTGCCTATTCATCAGTAAGCCATATAGGACTTGTCATCGCCGCCTGCCTGATTCAAACACCATGAAGCTTTACCGGGGCCATTATATTAATAATTGCACACGGCCTTACTTCCTCTATACTATTTTGCCTAGCAAATACAAATTATGAACGAACCAACACTCGAACAATAATCCTTGCACGCGGCTTCCAATTAATTTTTCCACTAATGTCAACCTGGTGGCTTCTAGCAAATCTAACAAATATAGCCATGCCCCCATCAATTAACTTAATAGGAGAGCTCACAATCATGGTTTCCCTATTCAATTGAGCTAGCCCCACCATTCTATTAACCGGACTCGGAACATTAATTACAGCCATATATTCACTTCACATATTTACTACCACCCAACGAAACAAATTACCAACCAACACCTATCTAACCGACCCTGCCCACACACGAGAGCACCTTCTTATAATACTTCACTTGGTTCCAATAATTCTCCTTATTACAAAACCAGCCCTAATTTCAGGACTAATTAACTGTTAGTATAGTTTAACAAAA-CATTAGGCAGTGGCCCTAAAAATAGAAGTTCAACCCTTCTTACAAACCAAGAGGTGTTT-GTACACCAAGAACTGCTAATTCTTACCACTGAAGTTAAATTCCTCAGACCTCTTACTTTTAAAGG   [1586]\r
+grammicus      TCCACACCCCAGTGAATCATGCCCTAA-TAAAGCACAAATGGAGCAGGTATCAGGCACAACCATTAGCCCAAAACACCAAGCTCTGCCACACCCACACGGGCCTTCAGCAGTGATAAACATTAAGCAATAAGCGAC--ACACCAA--------TTTAAAGCTTGACTTAGTTATGATTAA--CAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGTAGACCATCGGCGTAAATAGTGGCTAGAATACTGAACCGATACGTTAAAAATTAAACCATACCCTAACCGTAAAACACAGGCTAGATGAAACCAAG-CATTTTTAACAAC--GGGTAGTTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTACAGCACTAAAATATCCGCCAGAAAATTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCACCTCGACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCTCACCAATCTTTGCCTAA-TCAGCCTATATACCGCCGTCGTCAACCTACCTCATGAGAGAAGAGTAGTAAGTACAAGAGTT-TAATAACTAGAACGTCAGGTCAAGGTGTAGCTAATAGAGTGGAAGAGATGGGCTACATTTTTTAATATAAAACA-TAACGGCACGGTATTATGAAACTTTTACCTAAAGGAGGATTTAACAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATTCTTTTAAAACTTGGAGGTTATGGCATTATACGAATCACAACATCCCTAATACCAATAACCCCAAAACTATATTACCCGTTTATAATTCTAGCACTATGAGGAATCATTATGGCCAGTTCGATCTGTATACGACAAACAGACCTAAAATCACTCATTGCCTACTCATCTGTTAGCCACATAGGCCTAGTAATTGCAGCCTGCCTAATCCAAACACCRTGAAGCTTTACAGGAGCTATAATTCTGATAATTGCACATGGCCTCACTTCATCAATACTATTCTGCTTAGCAAACACAAACTACGAACGAACTCACACCCGAACTATAGTGCTTGCCCGAGGCTTACAAATTATTTTCCCACTAATATCTACCTGGTGACTTATAGCAAATTTAACCAACATAGCATTACCCCCATCAATTAATTTAATAGGTGAACTACTCATCATTGTTTCACTATTTAACTGATCTAGCCCAACAATTTTATTAACAGGACTAGGTACACTAATTACAGCAATATATTCACTTCACATATTCCTCACCACCCAACAAAATAAACTACCAACAAACATCAACCTTTCTAGCCCAACCCATACACGAGAACACCTATTAATAATACTACACCTAGCCCCACTAATACTCATTATCACAAAACCCGCCCTAATTTCAGGCTTAATCAACTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTCAACCCTTCTTACAAACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCTTACTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1587]\r
+maculosus      TCTACACTCCAGTGAAA-ATGCCCCA--CACAGTACAAACGGAGCAGGTATCAGGCACAAACATTAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGTTCACAGCAGTGATAAACATTAAGCAATGAGCGAC--ACACAAA-------CCATAAAGCTTGACTTAGTTATGATTAA--CAGGACCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGTCCAAAGCAGCAGAC-CACGGCGTAAATAGTGACTAGAAT-A-AAACCAAAATACTAAAAACTAAACCCAAACCTAACAGTAAAATATAGGCTAAATGAAATCAAA-CATTTTTAGCATT--AGGTAGTTTGAATCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTAGTAAATATGATATTATATTACATAAATATCCGCCAGAAAATTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCACACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGATAAACCTCACCAATCTTTGCCCCA-TCAGCCTATATACCGCCGTCGACAACTTACCTCATGAGAGCCTAACAGTAAGTAAAAAAGTT-TAACAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAGTGGAAGAGATGGGCTACATTTTTTAAAATAAAACA--AACGGCATGGCATTATGAAACTAATACCTAAAGGAGGATTTAATAGTAAAATTAACAAGAAAATTAATTTTAAACCCGGTCTTACTAAAACTAGGGGGGTACGGTATTATACGAATCACAATATTATTATCCCCACTGACCTCAAAACTTTATTACCCGTTCCTAGTTTTAGCGCTATGAGGTATTGTAATGACAAGTTCAATCTGCTTACGACAAACTGACCTAAAATCCCTCATTGCCTACTCGTCTGTAAGCCACATAGGTCTTGTAATCATAGCATGCCTTATTCAAACCCCATGAAGTTTTACTGGTGCACTAATACTAATGATTGCACATGGCCTTACTTCCTCTATATTATTCTGCTTGGCCAATACAAACTATGAGCGCACCCACACACGAACAATATTATTTGCTCGAGGTTTTCAACTTATTCTTCCACTTATAACCACATGATGACTTCTAGCAAACCTGACTAATATGGCCCTACCACCATCAATCAACCTTATAGGAGAACTACTTATTATTGTATCACTATTCAACTGATCTAACCTAACGATTCTACTCACAGGTCTAGGAACACTAATTACAGCAATATATTCACTTCATATATTTTTAACTACTCAACGAAACAAACTACCCGCCAATATTATCCTAACTGACCCCTCTCACACACGAGAACACCTTCTTATAATTCTTCACCTAGCCCCGCTGATTTTAATCATTTTAAAACCCGCCCTTATCTCGGGCTTAATTAACTGTTAATATAGTTTAACAAAAACATTAGGTAGTGGCCCTAAAAACAGAAGTTTAACTCTTCTTATAAACCGAGAGGTGTCTTGAACACCAAGAACTGCTAATTCTTACAACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1582]\r
+bicanthlis     TCCACATCCCAGTGAAATATGCCCTAA-CATAGTACAAATGGAGCAGGTATCAGGCACAACCATAAGCCAAAAACACCAAGCTTTGCCACACCCACACGGGTCATCAGCAGTGATAAACATTAAGCAATAAGCGAA--TCACCAAA--------TTAAAGCTTGACTTAGTTATGATTAA--TAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGAAGGGCCCAAAACAGCAGATTCTCGGTGTAAAAAGTGGCTAGAAT-ACTTACCCCAACATTAAAAACTAAACCATATCCTAACCGTAAAACATAGGCTAAATGAAATCAAA-TATTTTTAATAAT--AGGTAATTTGAACCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTATTATACTAAAATATCCACCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCCCCAAACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCTCACCAATCTTTGCCCAA-CCAGCCTATATACCGCCGTCGTCAACCTACCTCATGAGAGAAGAATAGTAAGTTCAAGAGTT--AATAACTAAAACGTCAGGTCAAGGTGTAGCTAATAGAATGGTAGAGATGGGCTACATTTTTTAATATAAAACA-CAACGGCATGGTACTATGAAACTTCTACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAGTTAATTTTAAACACGATCCTACTAAAACTAGGGGGCTACGGCATTATACGAATTACAATGTCACTCACCCCTCTTACCCCAAAACTTTATTACCCATTTATAATTCTTGCACTATGGGGCATTATTATAACAAGCTCCATCTGCATGCGACAAACAGACCTAAAATCCTTAATTGCTTATTCATCAGTTAGCCACATAGGGTTGGTAATCGCAGCTTGCCTAATCCAAACACCATGAAGCTTCACAGGCGCCATAATCTTAATAATTGCCCACGGCCTTACTTCATCAATACTATTCTGCCTAGCAAACACAAACTACGAACGAACACACACCCGAACAATAGTACTCGCCCGAGGTTTTCAAATTATTTTACCCCTCATGTCAACCTGATGACTTCTAGCAAACCTAACTAATATAGCACTACCACCATCAATTAATTTAATAGGAGAACTCCTCATTATTATTTCACTATTCAACTGATCAAACCTAACAATTTTATTAACAGGACTAGGTACACTAATTACAGCAATATACTCTCTTCATATGTTTATTACCACCCAACGAAATAAGCTTCCAATAAGTATTCACTTCACTAACCCTACTCACACACGAGAACATCTCCTAATAATTTTACACCTAGCTCCCCTAATGCTAATTATCTTTAAACCTGCCCTAATCTCAGGCTTAATCAATTGTTAGTATAGTTTAACAAAAACATTAGGCAGTGGCCCTAAAAACAGAAGTTTAACCCTTCTTACAAACCAAGAGGTGTTTTGAACACCAAGAACTGCTAATTCTTACCACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1585]\r
+torquatus      TCTACACACCAGTGAAACATGCCCTAA--ATAGCACAAACGGAGCAGGTATCAGGCACAACTATTAGCCCAAAACACCAAGCTTTGCCACACCCACACGGGCCATCAGCAGTGATAAACATTAAGCAATAAGCGAT--ACACCAAAT-------TTAAAGCTTGACTTAGTTATGATTAAT-AAGGGCCGGTAAACCTCGTGCCAGCCACCGCGGTTATACGACGGGCCCAAAGCAGCAGACTCTCGGCGTAAATCGTGGCTAGAATAC-TTACCAACACATTAAAAACTAAACCATACCCTAACCGTAAAACACAGGCTAAATGAAACCAAA-CATTTTTAACAAT--AGGTAATTTGACCCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTTAATATGATATTATAACACTAAAATATCCGCCAGAAAACTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCACACCGACTTAGAGGAGCCTGTCCTATAATCGATACCCCACGCTAAACCTCACCAATCTTTGCCCCC-TCAGCCTATATACCGCCGTCGTCAACATACCTCGTGAGAGAAAAACAGTAAGTGTAAAAGTT-CAATAACTAAAACGTCAGGTCAAGGTGTAGCTTATGGAATGGAAGAGATGGGCTACATTTTTTAAGATAAAACA--CACGGCATGGTACTATGAAACTT-TACCTAAAGGAGGATTTAATAGTAAAACTAACAAGAAAATTAATTTTAAACACGATTCTCCTAAAACTCGGAGGCTACGGCATTATACGCATCACAATATCACTAACCCCTATTACCCCAAAACTCTATTACCCATTTATAATCCTTGCATTATGGGGCATTGTTATAACAAGTTCAATTTGCATGCGACAAACAGACCTAAAATCACTTATCGCCTACTCATCAGTCAGCCACATGGGCTTAGTCATCGCAGCATGCCTAATCCAAACACCATGAAGCTTTACAGGCGCTATAATCCTAATAATCGCACACGGCCTTACCTCATCAATATTATTCTGTCTAGCTAACACAAACTACGAGCGAACTCACACCCGAACAATAATACTGGCCCGCGGCTTCCAAATTATCCTTCCACTTATGTCAACCTGGTGGCTCCTAGCGAACTTAACCAACATAGCACTACCCCCATCAATTAATCTAATAGGAGAACTTCTTATCATTATTTCACTATTCAACTGATCTAACCCGACAATTTTAATGACAGGACTAGGAACACTAATTACAGCAGTATACTCACTCCACATGTTCCTTATTACCCAACGAAATAAACTACCAACAAGCATTAATTTTTCTGACCCATCTCACACACGAGAACACCTCCTAATAATTCTTCACCTGGCCCCACTAACACTTATTATTGCAAAACCCGCCCTTATCTCAGGCCTGATCAACTGTTAGTATAGTTTAATAAAAACATTAGGCAGTGGCCCTAAAAATAGAAGTTCAACCCTTCTTACAGACCAAGGGGTGTTTTGAACACCAAGAACTGCTAATTCTTACTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1585]\r
+variabilis     TCCACATACCAGTGAAATATGCCCAAA-CATAGTA-AAACGGAGCAGGTATCAGGCACGAAATTCAGCCCAAAACACCAAGCTATGCCACACCCACACGGGCCCACAGCAGTGATAAACATTAAGCAATGAGCGAA-CA------GTACA--CCTTAAAGCTCGACTTAGTTATGATTTA--CAGGGCCGGTCAACCTCGTGCCAGCCACCGCGGTTATACGAGGGGCCCAAAGCAGCAGAT-TTCGGCGTAAATCGTGACTAGAAT-TTATCCTA--AAACTAAAGAATAAACCATAACCTAACCGTAAAACACAGGTTAAATGAAACCAGC-CATCTTTATCTACCAAGGAGATTTGACTCACGAAAACTAAGAAACAAACTAGGATTAGATACCCTACTATGCTTAGTCGTAAATATGACATAATACTACACCAATGTCCGCCAGAAAATTACGAGCGAAAAGCTTAAAACTCAAAGGACTTGGCGGTGCTCCACACCAACTTAGAGGAGCCTGTCCTATAATCGATACTCCACGATAAACCCCTCCAATTTTTGCCAAATCCAGCCTATATACCGCCGTCGCCAACTTACCCCATGAGGGATAAATAGTAAGTATAATAGTT-TGACA-CTAAAACGTCAGGTCAAGGTGTAGCTAATAAATTGGAAGAGATGGGCTACATTTTTTAGATTACAAAA-CTACGGCATGGCACTATGAAATTGGTGCCTAAAGGAGGATTTAACAGTAAGACTAGTAAGAAAACTAGCCTTAAACATGATCCTACTAAAACTTGGAGGATACGGCATTATTCGAATTACAGTATTACTAAGCCCAATCAACCATAAACTATACTACCCATTTATTATTCTCGCACTATGAGGCATCGTAATAACCAGCTCAATCTGTTTACGACAAACTGATCTAAAATCATTAATCGCATATTCCTCTGTAAGCCACATAGGACTTGTCATTATAGCCTGCCTTATTCAAACACCCTGAAGTTTCACAGGGGCTATTGTATTAATAGTTGCACACGGACTAACCTCATCCATACTATTCTGTTTAGCAAACACCAATTACGAACGAACACACACCCGAACTCTCGTCCTAGCCCGAGGCTTTCAACTTATTTTTCCACTTATAACAGCCTGATGACTACTAGCAAATTTAACCAACATGGCACTTCCACCCTCCATTAACCTAATAGGAGAATTATTCGTCATCATTTCTATATTCAACTGATCAAACCTAACAATTCTACTAACAGGACTTGGCACACTAATTACAGCCATATATTCTCTACACATGTTCCTAATAACCCAACGAAATAAACTACCAACCAACATCAAACTAACCTCTCCCACCCACACACGAGAACACCTATTAATATTACTTCACCTCTCCCCATTAATTTTACTAATCATAAAACCAGCCTTAATCTCAGGCATCATCAACTGTTAGCATAGTTTAACAAAAACATTAGGCCGTGACCCTAAAAACAGAAGATCATTCCTTCTTGCAAACCGAGAGGTGTTT-GAACACCAAGAACTGCTAATTCTTACTACTGAAGTTAAAATCCTCAGACCTCTTACTTTTAAAGG   [1584]\r
+;\r
+END;\r
+\r
+\r
+BEGIN mrbayes;\r
+       exclude 27-30 136-155 181-184 268-271 626-628 700-704;  \r
+       lset nst=6 rates=gamma;\r
+       prset brlenspr=uncons:gammadir(1,1,0.7,0.5);\r
+       [prset brlenspr=uncons:invgamdir(3,2,1,1);]\r
+       mcmc ngen=5000000;\r
+       sump;\r
+       sumt;\r
+END;\r
+\r
diff --git a/src/CompileInstructions.txt b/src/CompileInstructions.txt
new file mode 100644 (file)
index 0000000..14017d1
--- /dev/null
@@ -0,0 +1,196 @@
+\r
+Content\r
+=======\r
+\r
+1) How to compile MrBayes from source\r
+2) Configuration options\r
+3) Troubleshooting for Mac\r
+4) Tips for Windows\r
+5) Further references\r
+\r
+\r
+How to compile MrBayes from source\r
+==================================\r
+\r
+Pre-requirements:\r
+* gcc (or other C compiler)\r
+* autotools (autoconf, automake, etc)\r
+* optional: MPI compiler and library\r
+* optional: BEAGLE library\r
+\r
+Compilation: \r
+To compile MrBayes in UNIX-like environments, first navigate to the folder containing\r
+the source code, then execute the following commands in your terminal (without '>'):\r
+\r
+> autoconf\r
+> ./configure \r
+> make\r
+\r
+The compilation will produce an executable in the source directory with the name "mb". \r
+To start the program, simply type\r
+\r
+> ./mb\r
+\r
+For more convenient access to the program, you may want to install it in your path, in\r
+which case you can invoke the program from any directory by simply typing\r
+\r
+> mb\r
+\r
+If you wish to make the program available to all users in this way, you can use\r
+\r
+> sudo make install\r
+\r
+after having compiled the program.\r
+\r
+\r
+Configuration options\r
+=====================\r
+\r
+1) BEAGLE\r
+MrBayes 3.2 uses the BEAGLE library by default. You should install the library from \r
+"https://code.google.com/p/beagle-lib", or disable the use of the library with option\r
+"--with-beagle=no", i.e. \r
+\r
+> ./configure --with-beagle=no\r
+\r
+Note: without BEAGLE library MrBayes may run slower. For more instructions, please see\r
+https://code.google.com/p/beagle-lib/\r
+\r
+2) SSE code\r
+All main-stream modern processors have support for SSE instructions which are utilized \r
+by default by MrBayes 3.2 in order to substantially speed up execution. If you \r
+experience problems with the SSE code, you can disable the use of SSE code with option \r
+"--enable-sse=no", i.e.\r
+\r
+> ./configure --enable-sse=no\r
+\r
+If you use SSE code, you may encounter problems with older compilers. Specifically,\r
+if you are getting errors about undefined references to "posix_memalign", you should\r
+update your compiler. You should have libc library of at least version 2.1.91 for the \r
+SSE code to compile.\r
+\r
+3) MPI version\r
+To make use of MPI code to parallelize MrBayes computations across several processors\r
+or CPU cores, you should invoke the configure script with option "--enable-mpi=yes".\r
+The MPI code can be used together with the BEAGLE library and the SSE code. Your \r
+computer also needs to have an MPI implementation installed, for instance OpenMPI or \r
+MPICH, and the environment needs to be set up to run MPI programs. To install an MPI \r
+version of MrBayes with BEAGLE and SSE, use:\r
+\r
+> autoconf\r
+> ./configure --enable-mpi=yes\r
+> make\r
+\r
+The resulting program will be called mb. A typical run might be started with a command\r
+like:\r
+\r
+> mpirun -np 8 mb data.nex > output.txt &\r
+\r
+This will run MrBayes on eight processors or cores (-np 8), using the data file\r
+"data.nex" as input. The output will not be printed to screen but to the file\r
+"output.txt" (> output.txt). The ampersand (&) causes the control to return immediately\r
+to the console, while the job will continue running in the background.\r
+\r
+To examine the most recent output from the run, you might e.g. use the tail command of\r
+UNIX like this:\r
+\r
+> tail -f output.txt\r
+\r
+This will print the lines onto the screen as they get added to the file "output.txt".\r
+To stop the output, simply press ctrl-C (this will stop the output from the tail\r
+command, it will not stop the MrBayes run).\r
+\r
+4) Debugging\r
+For testing or developing purpose, you may need to compile a debugging version by \r
+invoking the configure script with the option "--enable-debug=yes", i.e.\r
+\r
+> ./configure --enable-debug=yes\r
+\r
+\r
+Troubleshooting for Mac\r
+=======================\r
+\r
+Problem: > autoconf: command not found\r
+\r
+Solution: Xcode 4.5 or later no longer ships with autotools, including autoconf that \r
+is used by MrBayes and most other open-source Unix software packages.\r
+To install these tools, we recommend using HomeBrew, see below.\r
+\r
+Problem: The compilation process hangs on model.c. For instance, this happens when \r
+using the compiler that ships with Xcode 4.6 (in the command line tools).\r
+\r
+Solution: Install newer command line tools (e.g., in Xcode 5 or higher), or install a \r
+different gcc version for Mac using HomeBrew, see below.\r
+\r
+-----------------------\r
+To install missed Unix tools, we recommend using HomeBrew (http://brew.sh). Follow the\r
+instructions on HomeBrew's homepage to install it on Mac.\r
+Other options include MacPorts (http://www.macports.org), GNU (http://www.gnu.org),\r
+and Open MPI (http://open-mpi.org).\r
+\r
+To install autoconf and automake after having installed HomeBrew, use:\r
+\r
+> brew install autoconf\r
+> brew install automake\r
+\r
+To install the most recent version of openmpi, use:\r
+\r
+> brew install openmpi\r
+\r
+Simply, you can directly install MrBayes using HomeBrew:\r
+\r
+> brew tap homebrew/science\r
+> brew install mrbayes\r
+\r
+The dependent formulas will be installed simultaneously. To enable MPI and BEAGLE, use:\r
+\r
+> brew install mrbayes --with-beagle --with-mpi\r
+\r
+To uninstall mrbayes, use:\r
+\r
+> brew uninstall mrbayes\r
+\r
+To install an alternative gcc (not recommended), use the following commands:\r
+\r
+> brew install gcc\r
+\r
+After installation, you might need to redirect the symbolic gcc link in /usr/bin/ to the\r
+new version of gcc. For instance, you can use the following commands:\r
+\r
+> sudo mv -i /usr/bin/gcc /usr/bin/gcc-old\r
+> sudo ln -s /usr/local/bin/gcc-4.9 /usr/bin/gcc\r
+\r
+\r
+Tips for Windows\r
+================\r
+To compile MrBayes in Windows is relatively not straightforward. You can use Microsoft \r
+Visual Studio to open and build one of the projects in the "projects" folder, after\r
+downloading all the files from SourceForge (e.g., Download Snapshot).\r
+http://sourceforge.net/p/mrbayes/code/HEAD/tree/\r
+\r
+Here we introduce another way to compile using MinGW (http://www.mingw.org/). You need\r
+to download the installer "mingw-get-setup.exe" and install it in Windows. Then open \r
+"MinGW Installation Manager" you just installed. Click the square before "mingw32-base" \r
+under "Basic Setup" and choose "Mark for Installation", then choose "Apply Changes" from\r
+the "Installation" menu. \r
+\r
+Additionally, add "C:\MinGW\bin" (path to your MinGW installation) to your system path\r
+in setting "Environment Variables" (please Google :))\r
+\r
+Open Command Prompt (cmd.exe), "cd" to the src folder you just downloaded, e.g., \r
+\r
+> cd Downloads\MrBayes\trunk\src\r
+\r
+and use the following command to compile:\r
+\r
+> gcc -O3 -DNDEBUG -o mb bayes.c command.c model.c mcmc.c likelihood.c proposal.c sumpt.c utils.c best.c mbbeagle.c -lm\r
+\r
+An executable named "mb.exe" will be generated in the same folder, if everything\r
+goes smoothly. You may want to edit the fist few lines in bayes.h to define/undef\r
+some macros (SSE_ENABLED, etc).\r
+\r
+\r
+Further references\r
+==================\r
+\r
+See the manual for more compilation/installation instructions.\r
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644 (file)
index 0000000..5a9e404
--- /dev/null
@@ -0,0 +1,31 @@
+SRCDIR       = @srcdir@
+RM           = rm
+CC           = @CC@
+CFLAGS       = @CFLAGS@ -DUSECONFIG_H
+LDFLAGS      = @LDFLAGS@ -lm
+INSTALL      = @INSTALL@
+prefix      ?= @prefix@
+exec_prefix ?= @exec_prefix@
+BINDIR      ?= @bindir@
+
+SRC       = bayes.c command.c model.c mcmc.c likelihood.c proposal.c sumpt.c utils.c mbbeagle.c best.c
+OBJECTS   = bayes.o command.o model.o mcmc.o likelihood.o proposal.o sumpt.o utils.o mbbeagle.o best.o
+PROGS     = mb
+
+all: $(PROGS)
+
+mb: $(OBJECTS)
+       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+install: $(PROGS)
+       mkdir -p $(BINDIR)
+       $(INSTALL) -m 755 $(PROGS) $(BINDIR)
+
+clean:
+       $(RM) -f *.o *~ mb
+
+distclean: clean
+       $(RM) -rf Makefile config.log config.status config.h *.cache
+
+showdep:
+       @$(CC) -MM $(SRC)
diff --git a/src/bayes.c b/src/bayes.c
new file mode 100644 (file)
index 0000000..0c4ec75
--- /dev/null
@@ -0,0 +1,1000 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "command.h"
+#include "model.h"
+#include "sumpt.h"
+#include "utils.h"
+
+       const char* const svnRevisionBayesC = "$Rev: 1068 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+extern const char* const svnRevisionBestC;
+extern const char* const svnRevisionCommandC;
+extern const char* const svnRevisionLikeliC;
+extern const char* const svnRevisionMbbeagleC;
+extern const char* const svnRevisionMcmcC;
+extern const char* const svnRevisionModelC;
+extern const char* const svnRevisionProposalC;
+extern const char* const svnRevisionSumptC;
+extern const char* const svnRevisionUtilsC;
+
+#ifdef HAVE_LIBREADLINE
+#include <readline/readline.h>
+#include <readline/history.h>
+static char **readline_completion(const char *, int, int);
+#endif
+
+/* local prototypes */
+int  CommandLine (int argc, char **argv);
+void GetTimeSeed (void);
+int  InitializeMrBayes (void);
+void PrintHeader (void);
+int  ReinitializeMrBayes (void);
+
+/* global variables, declared in this file */
+BitsLong    bitsLongWithAllBitsSet;      /* BitsLong with all bits set, for bit ops       */
+ModelParams defaultModel;                /* Default model; vals set in InitializeMrBayes  */
+int         defTaxa;                     /* flag for whether number of taxa is known      */
+int         defChars;                    /* flag for whether number of chars is known     */
+int         defMatrix;                   /* flag for whether matrix is successfull read   */
+int         defPartition;                /* flag for whether character partition is read  */
+int         defPairs;                    /* flag for whether pairs are read               */
+Doublet     doublet[16];                 /* holds information on states for doublets      */
+int         fileNameChanged;             /* has file name been changed ?                  */
+RandLong    globalSeed;                  /* seed that is initialized at start up          */
+char        **modelIndicatorParams;      /* model indicator params                        */
+char        ***modelElementNames;        /* names for component models                    */
+int         nBitsInALong;                /* number of bits in a BitsLong                  */
+int         nPThreads;                   /* number of pthreads to use                     */
+int         numUserTrees;                /* number of defined user trees                  */
+int         readComment;                 /* should we read comment (looking for &) ?      */
+int         readWord;                    /* should we read word next ?                    */
+RandLong    runIDSeed;                   /* seed used only for determining run ID [stamp] */
+RandLong    swapSeed;                    /* seed used only for determining which to swap  */
+int         userLevel;                   /* user level                                    */
+PolyTree    *userTree[MAX_NUM_USERTREES];/* array of user trees                           */
+char        workingDir[100];             /* working directory                             */
+
+#if defined (MPI_ENABLED)
+int         proc_id;                     /* process ID (0, 1, ..., num_procs-1)                        */
+int         num_procs;                   /* number of active processors                                */
+MrBFlt      myStateInfo[7];              /* likelihood/prior/heat/ran/moveInfo vals of me              */
+MrBFlt      partnerStateInfo[7];         /* likelihood/prior/heat/ran/moveInfo vals of partner         */
+#endif
+
+#if defined (FAST_LOG)
+CLFlt       scalerValue[400];
+CLFlt       logValue[400];
+#endif
+/* Define to use a log lookup for 4by4 nucleotide data (actually SLOWER than normal code on intel processors) */
+
+
+int main (int argc, char *argv[])
+{
+    int i;
+
+#   if defined (MPI_ENABLED)
+    int     ierror;
+#   endif
+
+#   if defined (WIN_VERSION)
+    HANDLE scbh;
+    BOOL ok;
+    DWORD lastError;
+    COORD largestWindow;
+    CONSOLE_SCREEN_BUFFER_INFO csbi;
+    int currBottom;
+    char poltmp[256];
+
+    scbh = GetStdHandle(STD_OUTPUT_HANDLE);
+    GetConsoleScreenBufferInfo(scbh, &csbi);
+    currBottom      = csbi.srWindow.Bottom;
+    largestWindow   = GetLargestConsoleWindowSize(scbh);
+
+    /* Allow for screen buffer 3000 lines long and 140 characters wide */
+    csbi.dwSize.Y = 3000;
+    csbi.dwSize.X = 140;
+
+    SetConsoleScreenBufferSize(scbh, csbi.dwSize);
+    /* Allow for maximum possible screen height */
+    csbi.srWindow.Left      = 0; /* no change relative to current value */
+    csbi.srWindow.Top       = 0; /* no change relative to current value */
+    csbi.srWindow.Right     = 0; /* no change relative to current value */
+    csbi.srWindow.Bottom    = largestWindow.Y - currBottom -10; /**/
+    ok = SetConsoleWindowInfo(scbh, FALSE, &csbi.srWindow);
+    if (ok == FALSE)
+        {
+        lastError = GetLastError();
+        GetConsoleScreenBufferInfo(scbh, &csbi);
+        sprintf(poltmp, "\nlastError = %d", lastError);
+        // printf (poltmp);
+        }
+#   endif
+
+    /* calculate the size of a long - used by bit manipulation functions */
+    nBitsInALong = sizeof(BitsLong) * 8;
+    for (i=0; i<nBitsInALong; i++)
+        SetBit(i, &bitsLongWithAllBitsSet);
+
+#   if defined (__MWERKS__) & defined (MAC_VERSION)
+    /* Set up interface when using the Metrowerks compiler. This
+       should work for either Macintosh or Windows. */
+    SIOUXSetTitle("\pMrBayes v3.2");
+    SIOUXSettings.fontface         = 0;  /* plain=0; bold=1 */
+    SIOUXSettings.setupmenus       = 0;
+    SIOUXSettings.autocloseonquit  = 1;
+    SIOUXSettings.asktosaveonclose = 0;
+    SIOUXSettings.rows             = 60;
+    SIOUXSettings.columns          = 90;
+#   endif
+    
+#   if defined (MPI_ENABLED)
+    ierror = MPI_Init(&argc, &argv);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem initializing MPI\n", spacer);
+        exit (1);
+        }
+    ierror = MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem getting the number of processors\n", spacer);
+        exit (1);
+        }
+    ierror = MPI_Comm_rank(MPI_COMM_WORLD, &proc_id);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem getting processors rank\n", spacer);
+        exit (1);
+        }
+#   endif
+    
+#   ifdef HAVE_LIBREADLINE
+    rl_attempted_completion_function = readline_completion;
+#   endif
+    /* Set up parameter table. */
+    SetUpParms ();
+    
+    /* initialize seed using current time */
+    GetTimeSeed ();
+    
+    /* Initialize the variables of the program. */
+    InitializeMrBayes ();
+    
+    /* Print the nifty header. */
+    PrintHeader ();
+    
+    /* Go to the command line, process any arguments passed to the program
+       and then wait for input. */
+    i = CommandLine (argc, argv);
+    
+#   if defined (MPI_ENABLED)
+    MPI_Finalize();
+#   endif
+    
+    if (i == ERROR)
+        return (1);
+    else
+        return (0);
+}
+
+
+int CommandLine (int argc, char **argv)
+{
+    int     i, message, nProcessedArgs;
+    char    cmdStr[CMD_STRING_LENGTH];
+#   ifdef HAVE_LIBREADLINE
+#       ifndef MPI_ENABLED
+    char    *cmdStrP;
+#       endif
+#   endif
+#   if defined (MPI_ENABLED)
+    int     ierror;
+#   endif
+
+    for (i=0;i<CMD_STRING_LENGTH;i++) cmdStr[i]='\0';
+    
+    /* wait for user-input commands */
+    nProcessedArgs = 1; /* first argument is program name and needs not be processed */
+    if (nProcessedArgs < argc)
+        {
+        mode = NONINTERACTIVE;  /* when a command is passed into the program, the default is to exit without listening to stdin */
+        autoClose = YES;
+        autoOverwrite = YES;
+        noWarn = YES;
+        quitOnError = YES;
+        }
+    for (;;)
+        {
+        if (nProcessedArgs < argc) 
+            {
+            /* we are here only if a command that has been passed
+               into the program remains to be processed */
+            if (nProcessedArgs == 1 && (strcmp(argv[1],"-i") == 0 || strcmp(argv[1],"-I") == 0))
+                {
+                mode = INTERACTIVE;
+                autoClose = NO;
+                autoOverwrite = YES;
+                noWarn = NO;
+                quitOnError = NO;
+                }
+            else
+                sprintf (cmdStr, "Execute %s", argv[nProcessedArgs]);
+            nProcessedArgs++;
+            }
+        else
+            {
+            /* first check if we are in noninteractive mode and quit if so */
+            if (mode == NONINTERACTIVE)
+                {
+                MrBayesPrint ("%s   Tasks completed, exiting program because mode is noninteractive\n", spacer);
+                MrBayesPrint ("%s   To return control to the command line after completion of file processing, \n", spacer);
+                MrBayesPrint ("%s   set mode to interactive with 'mb -i <filename>' (i is for interactive)\n", spacer);
+                MrBayesPrint ("%s   or use 'set mode=interactive'\n\n", spacer);
+                return (NO_ERROR);
+                }
+            /* normally, we simply wait at the prompt for a
+               user action */
+#   if defined (MPI_ENABLED)
+            if (proc_id == 0)
+                {
+                /* do not use readline because OpenMPI does not handle it */
+                MrBayesPrint ("MrBayes > ");
+                fflush (stdin);
+                if (fgets (cmdStr, CMD_STRING_LENGTH - 2, stdin) == NULL)
+                    {
+                    if (feof(stdin))
+                        MrBayesPrint ("%s   End of File encountered on stdin; quitting\n", spacer);
+                    else
+                        MrBayesPrint ("%s   Could not read command from stdin; quitting\n", spacer);
+                    strcpy (cmdStr,"quit;\n");
+                    }
+                }
+            ierror = MPI_Bcast (&cmdStr, CMD_STRING_LENGTH, MPI_CHAR, 0, MPI_COMM_WORLD);
+            if (ierror != MPI_SUCCESS)
+                {
+                MrBayesPrint ("%s   Problem broadcasting command string\n", spacer);
+                }
+#   else
+#       ifdef HAVE_LIBREADLINE
+            cmdStrP = readline("MrBayes > ");
+            if (cmdStrP!=NULL) 
+                    {
+                    strncpy (cmdStr,cmdStrP,CMD_STRING_LENGTH - 2);
+                    if (*cmdStrP) 
+                        add_history (cmdStrP);
+                    free (cmdStrP);
+                    }
+            else /* fall through to if (feof(stdin))..*/
+#       else
+            MrBayesPrint ("MrBayes > ");
+            fflush (stdin);
+            if (fgets (cmdStr, CMD_STRING_LENGTH - 2, stdin) == NULL)
+#       endif
+                {
+                if (feof(stdin))
+                    MrBayesPrint ("%s   End of File encountered on stdin; quitting\n", spacer);
+                else
+                    MrBayesPrint ("%s   Could not read command from stdin; quitting\n", spacer);
+                strcpy (cmdStr,"quit;\n");
+                }
+#   endif
+            }
+        i = 0;
+        while (cmdStr[i] != '\0' && cmdStr[i] != '\n')
+            i++;
+        cmdStr[i++] = ';';
+        cmdStr[i] = '\0';
+        MrBayesPrint ("\n");
+        if (cmdStr[0] != ';')
+            {
+            /* check that all characters in the string are valid */
+            if (CheckStringValidity (cmdStr) == ERROR)
+                {
+                MrBayesPrint ("   Unknown character in command string\n\n");
+                }
+            else
+                {
+                expecting = Expecting(COMMAND);
+                message = ParseCommand (cmdStr);
+
+                if (message == NO_ERROR_QUIT)
+                    return (NO_ERROR);
+
+                if (message == ERROR && quitOnError == YES)
+                    {
+                    MrBayesPrint ("%s   Will exit with signal 1 (error) because quitonerror is set to yes\n", spacer);
+                    MrBayesPrint ("%s   If you want control to be returned to the command line on error,\n", spacer);
+                    MrBayesPrint ("%s   use 'mb -i <filename>' (i is for interactive) or use 'set quitonerror=no'\n\n", spacer);
+                    return (ERROR);
+                    }
+
+#   if defined (MPI_ENABLED)
+                ierror = MPI_Barrier (MPI_COMM_WORLD);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    MrBayesPrint ("%s   Problem at command barrier\n", spacer);
+                    }
+#   endif
+
+                MrBayesPrint ("\n");
+                }
+            }
+        }
+}
+
+
+#ifdef HAVE_LIBREADLINE
+extern char *command_generator(const char *text, int state);
+
+char **readline_completion (const char *text, int start, int stop)
+{
+    char **matches = (char **) NULL;
+
+#   ifdef COMPLETIONMATCHES
+    if (start == 0)
+            matches = rl_completion_matches (text, command_generator);
+#   endif
+
+    return (matches);   
+}
+#endif
+
+
+unsigned FindMaxRevision (unsigned amount, ...)
+{
+    const char* cur;
+    char tmp[20];
+    unsigned val,i,max;
+    
+    va_list vl;
+    va_start(vl,amount);
+    max=0;
+    for (i=0;i<amount;i++)
+        {
+        cur=va_arg(vl,const char*);
+        sscanf(cur,"%s %d",tmp,&val);
+        max=(max>val)?max:val;
+        }
+    va_end(vl);
+    return max;
+}
+
+
+void GetTimeSeed (void)
+{
+    time_t      curTime;
+
+#   if defined (MPI_ENABLED)
+    int         ierror;
+    
+    if (proc_id == 0)
+        {
+        curTime = time(NULL);
+        globalSeed  = (RandLong)curTime;
+        if (globalSeed < 0)
+            globalSeed = -globalSeed;
+        }
+    ierror = MPI_Bcast(&globalSeed, 1, MPI_LONG, 0, MPI_COMM_WORLD);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem broadcasting seed\n", spacer);
+        }
+        
+    if (proc_id == 0)
+        {
+        /* Note: swapSeed will often be same as globalSeed */
+        curTime = time(NULL);
+        swapSeed  = (RandLong)curTime;
+        if (swapSeed < 0)
+            swapSeed = -swapSeed;
+        }
+    ierror = MPI_Bcast(&swapSeed, 1, MPI_LONG, 0, MPI_COMM_WORLD);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem broadcasting swap seed\n", spacer);
+        }
+
+    if (proc_id == 0)
+        {
+        /* Note: runIDSeed will often be same as globalSeed */
+        curTime = time(NULL);
+        runIDSeed  = (RandLong)curTime;
+        if (runIDSeed < 0)
+            runIDSeed = -runIDSeed;
+        }
+    ierror = MPI_Bcast(&runIDSeed, 1, MPI_LONG, 0, MPI_COMM_WORLD);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem broadcasting run ID seed\n", spacer);
+        }
+
+#   else
+    curTime = time(NULL);
+    globalSeed  = (RandLong)curTime;
+    if (globalSeed < 0)
+        globalSeed = -globalSeed;
+        
+    /* Note: swapSeed will often be the same as globalSeed */
+    curTime = time(NULL);
+    swapSeed  = (RandLong)curTime;
+    if (swapSeed < 0)
+        swapSeed = -swapSeed;
+
+    /* Note: runIDSeed will often be the same as globalSeed */
+    curTime = time(NULL);
+    runIDSeed  = (RandLong)curTime;
+    if (runIDSeed < 0)
+        runIDSeed = -runIDSeed;
+        
+#   endif
+}
+
+
+int InitializeMrBayes (void)
+{
+    /* this function initializes the program; only call it at the start of execution */
+    
+    int     i, j, growthFxn[6];
+
+    nBitsInALong         = sizeof(BitsLong) * 8;     /* global variable: number of bits in a BitsLong */
+    userLevel            = STANDARD_USER;            /* default user level                            */
+
+    readWord             = NO;                       /* should we read a word next ?                  */
+    readComment          = NO;                       /* should we read comments? (used by tree cmd)   */
+    fileNameChanged      = NO;                       /* file name changed ? (used by a few commands)  */
+    echoMB               = YES;                      /* flag used by Manual to control printing       */
+
+#   if defined (MPI_ENABLED)
+    sprintf (manFileName, "commref_mb%sp.txt", VERSION_NUMBER);  /* name of command reference file    */
+#   else
+    sprintf (manFileName, "commref_mb%s.txt", VERSION_NUMBER);   /* name of command reference file    */
+#   endif
+
+    for (i=0; i<NUM_ALLOCS; i++)                     /* set allocated memory to NO                    */
+        memAllocs[i] = NO;              
+    logToFile = NO;                                  /* should screen output be logged to a file      */
+    strcpy(logFileName, "log.out");                  /* name of the log file                          */
+    logFileFp = NULL;                                /* file pointer to log file                      */
+    replaceLogFile = YES;                            /* should logfile be replace/appended to         */
+    autoClose = NO;                                  /* set default autoclose                         */
+    autoOverwrite = YES;                             /* set default autoOverwrite                     */
+    noWarn = NO;                                     /* set default                                   */
+    quitOnError = NO;                                /* set default quitOnError                       */
+    inferAncStates = NO;                             /* set default inferAncStates                    */
+    inferSiteOmegas = NO;                            /* set default inferSiteOmegas                   */
+    inferSiteRates = NO;                             /* set default inferSiteRates                    */
+    inferPosSel = NO;                                /* set default inferPosSel                       */
+    inComment = NO;                                  /* not in comment                                */
+    numComments = 0;                                 /* no comments encountered yet                   */
+    mode = INTERACTIVE;                              /* set default mode                              */
+    numOpenExeFiles = 0;                             /* no execute files open yet                     */
+    scientific = YES;                                /* print to file using scientific format?        */
+    precision = 6;                                   /* set default precision                         */
+    showmovesParams.allavailable = NO;               /* do not show all available moves               */
+    strcpy(workingDir,"");                           /* working directory                             */
+#   if defined (BEAGLE_ENABLED)
+#       if defined (WIN_VERSION)
+    tryToUseBEAGLE = NO;                             /* try to use the BEAGLE library (NO until SSE code works in Win) */
+#       else
+    tryToUseBEAGLE = NO;                             /* try to use the BEAGLE library if not Win (NO untill SSE single prec. works) */
+#       endif
+    beagleScalingScheme = MB_BEAGLE_SCALE_ALWAYS;    /* use BEAGLE always scaling                     */
+    beagleFlags = BEAGLE_FLAG_PROCESSOR_CPU;         /* default to generic CPU                        */
+    beagleResourceNumber = 99;                       /* default to auto-resource selection            */
+    // SSE instructions do not work in Windows environment
+    // beagleFlags |= BEAGLE_FLAG_VECTOR_SSE;        /* default to SSE code                           */
+    beagleResource = NULL;
+    beagleResourceCount = 0;                         /* default has no list */
+    beagleInstanceCount = 0;                         /* no BEAGLE instances */
+    beagleScalingFrequency = 1000;  
+#   endif
+#   if defined (THREADS_ENABLED)
+    tryToUseThreads = NO;                            /* try to use pthread with BEAGLE library        */
+#   endif
+
+    /* set the proposal information */
+    SetUpMoveTypes ();
+
+    /* Set up rates for standard amino acid models, in case we need them. */
+    if (SetAARates () == ERROR)
+        return (ERROR);
+           
+    /* set up doublet information */
+    doublet[ 0].first  = 1;   doublet[ 0].second = 1;
+    doublet[ 1].first  = 1;   doublet[ 1].second = 2;
+    doublet[ 2].first  = 1;   doublet[ 2].second = 4;
+    doublet[ 3].first  = 1;   doublet[ 3].second = 8;
+    doublet[ 4].first  = 2;   doublet[ 4].second = 1;
+    doublet[ 5].first  = 2;   doublet[ 5].second = 2;
+    doublet[ 6].first  = 2;   doublet[ 6].second = 4;
+    doublet[ 7].first  = 2;   doublet[ 7].second = 8;
+    doublet[ 8].first  = 4;   doublet[ 8].second = 1;
+    doublet[ 9].first  = 4;   doublet[ 9].second = 2;
+    doublet[10].first  = 4;   doublet[10].second = 4;
+    doublet[11].first  = 4;   doublet[11].second = 8;
+    doublet[12].first  = 8;   doublet[12].second = 1;
+    doublet[13].first  = 8;   doublet[13].second = 2;
+    doublet[14].first  = 8;   doublet[14].second = 4;
+    doublet[15].first  = 8;   doublet[15].second = 8;
+
+#   if defined (FAST_LOG)
+    /* set up log table */
+    for (i=0; i<400; i++)
+        {
+        scalerValue[i] = (CLFlt) ldexp (1.0, 1-i);  /* offset 1 needed to deal with scaler == 1.0 */
+        logValue[i] = (CLFlt) log (scalerValue[i]);     
+        }
+#   endif
+
+    /* user trees */
+    for (i=0; i<MAX_NUM_USERTREES; i++)
+        userTree[i] = NULL;
+
+    /* parameter values */
+    paramValues = NULL;
+    intValues = NULL;
+    
+    /* Prior model settings */
+    defaultModel.dataType = DNA;                        /* datatype                                     */
+    defaultModel.coding = 0;                            /* ascertainment bias                           */
+    strcpy(defaultModel.codingString, "All");           /* ascertainment bias string                    */
+    strcpy(defaultModel.nucModel, "4by4");              /* nucleotide model                             */
+    strcpy(defaultModel.nst, "1");                      /* number of substitution types                 */
+    strcpy(defaultModel.aaModelPr, "Fixed");            /* amino acid model prior                       */
+    for (i=0; i<10; i++)
+        defaultModel.aaModelPrProbs[i] = 0.0;
+    strcpy(defaultModel.aaModel, "Poisson");            /* amino acid model                             */
+    strcpy(defaultModel.parsModel, "No");               /* do not use parsimony model                   */
+    strcpy(defaultModel.geneticCode, "Universal");      /* genetic code                                 */
+    strcpy(defaultModel.ploidy, "Diploid");             /* ploidy level                                 */
+    strcpy(defaultModel.omegaVar, "Equal");             /* omega variation                              */
+    strcpy(defaultModel.ratesModel, "Equal");           /* rates across sites model                     */
+    defaultModel.numGammaCats = 4;                      /* number of categories for gamma approximation */
+    strcpy(defaultModel.useGibbs,"No");                 /* do not use Gibbs sampling of rate cats by default */
+    defaultModel.gibbsFreq = 100;                       /* default Gibbs sampling frequency of rate cats*/
+    defaultModel.numBetaCats = 5;                       /* number of categories for beta approximation  */
+    strcpy(defaultModel.covarionModel, "No");           /* use covarion model? (yes/no)                 */
+    strcpy(defaultModel.augmentData, "No");             /* should data be augmented                     */
+    strcpy(defaultModel.tRatioPr, "Beta");              /* prior for ti/tv rate ratio                   */
+    defaultModel.tRatioFix = 1.0;
+    defaultModel.tRatioDir[0] = 1.0;
+    defaultModel.tRatioDir[1] = 1.0;
+    strcpy(defaultModel.revMatPr, "Dirichlet");         /* prior for GTR model (nucleotides)            */
+    for (i=0; i<6; i++)
+        {
+        defaultModel.revMatFix[i] = 1.0;
+        defaultModel.revMatDir[i] = 1.0;
+        }
+    defaultModel.revMatSymDir = 1.0;                    /* default prior for GTR mixed model            */
+    strcpy (defaultModel.aaRevMatPr, "Dirichlet");      /* prior for GTR model (proteins)               */
+    for (i=0; i<190; i++)
+        {
+        defaultModel.aaRevMatFix[i] = 1.0;
+        defaultModel.aaRevMatDir[i] = 1.0;
+        }
+    strcpy(defaultModel.omegaPr, "Dirichlet");          /* prior for omega                              */
+    defaultModel.omegaFix = 1.0;
+    defaultModel.omegaDir[0] = 1.0;
+    defaultModel.omegaDir[1] = 1.0;
+    strcpy(defaultModel.ny98omega1pr, "Beta");          /* prior for class 1 omega (Ny98 model)         */
+    defaultModel.ny98omega1Fixed = 0.1;
+    defaultModel.ny98omega1Beta[0] = 1.0;
+    defaultModel.ny98omega1Beta[1] = 1.0;
+    strcpy(defaultModel.ny98omega3pr, "Exponential");   /* prior for class 3 omega (Ny98 model)        */
+    defaultModel.ny98omega3Fixed = 2.0;
+    defaultModel.ny98omega3Uni[0] = 1.0;
+    defaultModel.ny98omega3Uni[1] = 50.0;
+    defaultModel.ny98omega3Exp = 1.0;
+    strcpy(defaultModel.m3omegapr, "Exponential");      /* prior for all three omegas (M3 model)        */
+    defaultModel.m3omegaFixed[0] = 0.1;
+    defaultModel.m3omegaFixed[1] = 1.0;
+    defaultModel.m3omegaFixed[2] = 2.0;
+    strcpy(defaultModel.m10betapr, "Uniform");          /* prior for omega variation (M10 model)        */
+    strcpy(defaultModel.m10gammapr, "Uniform");
+    defaultModel.m10betaUni[0] = 0.0;
+    defaultModel.m10betaUni[1] = 20.0;
+    defaultModel.m10betaExp = 1.0;
+    defaultModel.m10betaFix[0] = 1.0;
+    defaultModel.m10betaFix[1] = 1.0;
+    defaultModel.m10gammaUni[0] = 0.0;
+    defaultModel.m10gammaUni[1] = 20.0;
+    defaultModel.m10gammaExp = 1.0;
+    defaultModel.m10gammaFix[0] = 1.0;
+    defaultModel.m10gammaFix[1] = 1.0;
+    defaultModel.numM10GammaCats = 4;
+    defaultModel.numM10BetaCats = 4;
+    strcpy(defaultModel.codonCatFreqPr, "Dirichlet");   /* prior for selection cat frequencies         */
+    defaultModel.codonCatFreqFix[0] = 1.0/3.0;
+    defaultModel.codonCatFreqFix[1] = 1.0/3.0;
+    defaultModel.codonCatFreqFix[2] = 1.0/3.0;
+    defaultModel.codonCatDir[0] = 1.0;
+    defaultModel.codonCatDir[1] = 1.0;
+    defaultModel.codonCatDir[2] = 1.0;
+    strcpy(defaultModel.stateFreqPr, "Dirichlet");      /* prior for character state frequencies        */
+    strcpy(defaultModel.stateFreqsFixType, "Equal");
+    for (i=0; i<200; i++)
+        {
+        defaultModel.stateFreqsFix[i] = 0.0;   
+        defaultModel.stateFreqsDir[i] = 1.0;
+        }    
+    defaultModel.numDirParams = 0;
+    strcpy(defaultModel.shapePr, "Exponential");        /* prior for gamma/lnorm shape parameter        */
+    defaultModel.shapeFix = 0.5;
+    defaultModel.shapeUni[0] = MIN_SHAPE_PARAM;
+    defaultModel.shapeUni[1] = MAX_SHAPE_PARAM;
+    defaultModel.shapeExp = 1.0;
+    strcpy(defaultModel.pInvarPr, "Uniform");           /* prior for proportion of invariable sites     */
+    defaultModel.pInvarFix = 0.1;
+    defaultModel.pInvarUni[0] = 0.0;
+    defaultModel.pInvarUni[1] = 1.0;
+    strcpy(defaultModel.adGammaCorPr, "Uniform");       /* prior for correlation param of adGamma model */
+    defaultModel.corrFix = 0.0;
+    defaultModel.corrUni[0] = -1.0;
+    defaultModel.corrUni[1] = 1.0;
+    strcpy(defaultModel.covSwitchPr, "Uniform");        /* prior for switching rates of covarion model  */
+    defaultModel.covswitchFix[0] = 1.0;
+    defaultModel.covswitchFix[1] = 1.0;
+    defaultModel.covswitchUni[0] = 0.0;
+    defaultModel.covswitchUni[1] = 100.0;
+    defaultModel.covswitchExp = 1.0;
+    strcpy(defaultModel.symPiPr, "Fixed");              /* prior for pi when unidentifiable states used */
+    defaultModel.symBetaFix = -1.0;
+    defaultModel.symBetaUni[0] = 0.0;
+    defaultModel.symBetaUni[1] = 20.0;
+    defaultModel.symBetaExp = 2;
+    strcpy(defaultModel.brownCorPr, "Fixed");           /* prior on correlation of brownian model       */
+    defaultModel.brownCorrFix = 0.0;
+    defaultModel.brownCorrUni[0] = -1.0;
+    defaultModel.brownCorrUni[1] = 1.0;
+    strcpy(defaultModel.brownScalesPr, "Gammamean");    /* prior on scales of brownian model            */
+    defaultModel.brownScalesFix = 10.0;
+    defaultModel.brownScalesUni[0] = 0.0;
+    defaultModel.brownScalesUni[1] = 100.0;
+    defaultModel.brownScalesGamma[0] = 1.0;
+    defaultModel.brownScalesGamma[1] = 10.0;
+    defaultModel.brownScalesGammaMean = 10.0;
+    strcpy(defaultModel.topologyPr, "Uniform");         /* prior for tree topology                      */
+    defaultModel.topologyFix = -1;                      /* user tree index to use for fixed topology    */
+    defaultModel.activeConstraints = NULL;              /* which constraints are active                 */
+    strcpy(defaultModel.brlensPr, "Unconstrained");     /* prior on branch lengths                      */
+    defaultModel.brlensFix = -1;                        /* user tree index to use for fixed brlens      */
+    defaultModel.brlensUni[0] = BRLENS_MIN;
+    defaultModel.brlensUni[1] = 10.0;
+    defaultModel.brlensExp    = 10.0;
+    defaultModel.brlens2Exp[0]= 100.0;                  /* 1st param of twoExp prior (for internal branches) */
+    defaultModel.brlens2Exp[1]= 10.0;                   /* 2nd param of twoExp prior (for external branches) */
+    defaultModel.brlensDir[0] = 1.0;                    /* 1st param of GammaDir prior   */
+//  defaultModel.brlensDir[0] = 3.0;                    /* 1st param of invGamDir prior  */
+    defaultModel.brlensDir[1] = 0.1;                    /* 2nd param of GammaDir prior   */
+//  defaultModel.brlensDir[1] = 20.0;                   /* 2nd param of invGamDir prior  */
+    defaultModel.brlensDir[2] = 1.0;                    /* 3rd param of Dirichlet priors */
+    defaultModel.brlensDir[3] = 1.0;                    /* 4th param of Dirichlet priors */
+    
+    strcpy(defaultModel.unconstrainedPr, "GammaDir");   /* prior on branches if unconstrained           */
+    strcpy(defaultModel.clockPr, "Uniform");            /* prior on branch lengths if clock enforced    */
+    defaultModel.treeAgePr.prior = standardGamma;       /* calibration prior on tree age */
+    strcpy(defaultModel.treeAgePr.name, "Gamma(1.00,1.00)");
+    defaultModel.treeAgePr.priorParams[0] = 1.0;
+    defaultModel.treeAgePr.priorParams[1] = 1.0;
+    defaultModel.treeAgePr.priorParams[2] = -1.0;
+    defaultModel.treeAgePr.LnPriorProb = &LnPriorProbGamma_Param_Mean_Sd;
+    defaultModel.treeAgePr.LnPriorRatio = &LnProbRatioGamma_Param_Mean_Sd;
+    defaultModel.treeAgePr.min = 0.0;
+    defaultModel.treeAgePr.max = POS_INFINITY;
+    strcpy(defaultModel.clockRatePr, "Fixed");          /* prior on base subst. rate for clock trees    */
+    defaultModel.clockRateNormal[0] = 1.0;
+    defaultModel.clockRateNormal[1] = 1.0;
+    defaultModel.clockRateLognormal[0] = 0.0;           /* mean 0.0 on log scale corresponds to mean rate 1.0 */
+    defaultModel.clockRateLognormal[1] = 0.7;           /* double or half the rate in one standard deviation  */
+    defaultModel.clockRateGamma[0] = 1.0;
+    defaultModel.clockRateGamma[1] = 1.0;
+    defaultModel.clockRateExp = 1.0;
+    defaultModel.clockRateFix = 1.0;
+    strcpy(defaultModel.speciationPr, "Exponential");   /* prior on speciation rate (net diversification) */
+    defaultModel.speciationFix = 0.1;
+    defaultModel.speciationUni[0] = 0.0;
+    defaultModel.speciationUni[1] = 10.0;
+    defaultModel.speciationExp = 10.0;
+    strcpy(defaultModel.extinctionPr, "Beta");          /* prior on extinction rate (turnover)          */
+    defaultModel.extinctionFix = 0.5;
+    defaultModel.extinctionBeta[0] = 1;
+    defaultModel.extinctionBeta[1] = 1;
+    strcpy(defaultModel.fossilizationPr, "Beta");       /* prior on fossilization rate (sampling proportion) */
+    defaultModel.fossilizationFix = 0.5;
+    defaultModel.fossilizationBeta[0] = 1;
+    defaultModel.fossilizationBeta[1] = 1;
+    strcpy(defaultModel.sampleStrat, "Random");         /* taxon sampling strategy                      */
+    defaultModel.sampleProb = 1.0;                      /* extant taxon sampling fraction               */
+    defaultModel.sampleFSNum = 0;                       /* number of fossil slice sampling events       */
+
+    strcpy(defaultModel.popSizePr, "Gamma");            /* prior on coalescence population size         */
+    defaultModel.popSizeFix = 100.0;                    /* N_e = 100 */
+    defaultModel.popSizeUni[0] = 0.0;
+    defaultModel.popSizeUni[1] = 1000.0;
+    defaultModel.popSizeNormal[0] = 100.0;
+    defaultModel.popSizeNormal[1] = 30.0;
+    defaultModel.popSizeLognormal[0] = 4.6;             /* mean on log scale corresponds to N_e = 100.0 */
+    defaultModel.popSizeLognormal[1] = 0.4;             /* factor 10 in one standard deviation          */
+    defaultModel.popSizeGamma[0] = 1.0;                 /* exponential with mean 1/10 = 0.1 */
+    defaultModel.popSizeGamma[1] = 10.0;
+    strcpy(defaultModel.popVarPr, "Equal");             /* prior on pop. size variation across tree     */
+    strcpy(defaultModel.growthPr, "Fixed");             /* prior on coalescence growth rate prior       */
+    defaultModel.growthFix = 0.0;
+    defaultModel.growthUni[0] = 0.0;
+    defaultModel.growthUni[1] = 100.0;
+    defaultModel.growthExp = 1.0;
+    defaultModel.growthNorm[0] = 0.0;
+    defaultModel.growthNorm[1] = 1.0;
+    strcpy(defaultModel.nodeAgePr, "Unconstrained");    /* prior on node depths                       */
+    strcpy(defaultModel.clockVarPr, "Strict");          /* prior on clock rate variation              */
+    strcpy(defaultModel.cppRatePr, "Exponential") ;     /* prior on rate of CPP for relaxed clock     */
+    defaultModel.cppRateExp = 0.1;
+    defaultModel.cppRateFix = 1.0;
+    strcpy(defaultModel.cppMultDevPr, "Fixed");         /* prior on standard dev. of lognormal of rate multipliers of CPP rel clock */
+    defaultModel.cppMultDevFix = 0.4;
+    strcpy(defaultModel.tk02varPr, "Exponential");      /* prior on nu parameter for BM rel clock     */
+    defaultModel.tk02varExp = 1.0;
+    defaultModel.tk02varFix = 1.0;
+    defaultModel.tk02varUni[0] = 0.0;
+    defaultModel.tk02varUni[1] = 5.0;
+    strcpy(defaultModel.igrvarPr, "Exponential");       /* prior on variance increase parameter for IGR rel clock */
+    defaultModel.igrvarExp = 10.0;
+    defaultModel.igrvarFix = 0.1;
+    defaultModel.igrvarUni[0] = 0.0;
+    defaultModel.igrvarUni[1] = 0.5;
+    strcpy(defaultModel.mixedvarPr, "Exponential");     /* prior on var parameter for mixed rel clock */
+    defaultModel.mixedvarExp = 10.0;
+    defaultModel.mixedvarFix = 0.1;
+    defaultModel.mixedvarUni[0] = 0.0;
+    defaultModel.mixedvarUni[1] = 5.0;
+    strcpy(defaultModel.ratePr, "Fixed");               /* prior on rate for a partition              */
+    defaultModel.ratePrDir = 1.0;
+    strcpy(defaultModel.generatePr, "Fixed");           /* prior on rate for a gene (multispecies coalescent) */
+    defaultModel.generatePrDir = 1.0;
+
+    defaultModel.nStates = 4;                           /* number of states for partition             */
+
+    /* Report format settings */
+    strcpy(defaultModel.tratioFormat, "Ratio");         /* default format for tratio                  */
+    strcpy(defaultModel.revmatFormat, "Dirichlet");     /* default format for revmat                  */
+    strcpy(defaultModel.ratemultFormat, "Scaled");      /* default format for ratemult                */
+    strcpy(defaultModel.treeFormat, "Brlens");          /* default format for trees                   */
+    strcpy(defaultModel.inferAncStates, "No");          /* do not infer ancestral states              */
+    strcpy(defaultModel.inferPosSel, "No");             /* do not infer positive selection            */
+    strcpy(defaultModel.inferSiteOmegas, "No");         /* do not infer site omega vals               */
+    strcpy(defaultModel.inferSiteRates, "No");          /* do not infer site rates                    */
+
+    /* Allocate and initialize model indicator parameter names */
+    modelIndicatorParams = (char **) SafeCalloc (3, sizeof (char *));
+    modelIndicatorParams[0] = "aamodel";
+    modelIndicatorParams[1] = "gtrsubmodel";
+    modelIndicatorParams[2] = "";
+
+    /* Aamodel */
+    modelElementNames = (char ***) SafeCalloc (3, sizeof (char **));
+    modelElementNames[0] = (char **) SafeCalloc (12, sizeof (char *));
+    modelElementNames[0][0]  = "Poisson";
+    modelElementNames[0][1]  = "Jones";
+    modelElementNames[0][2]  = "Dayhoff";
+    modelElementNames[0][3]  = "Mtrev";
+    modelElementNames[0][4]  = "Mtmam";
+    modelElementNames[0][5]  = "Wag";
+    modelElementNames[0][6]  = "Rtrev";
+    modelElementNames[0][7]  = "Cprev";
+    modelElementNames[0][8]  = "Vt";
+    modelElementNames[0][9]  = "Blosum";
+    modelElementNames[0][10] = "LG";
+    modelElementNames[0][11] = "";
+
+    /* Gtrsubmodel */
+    modelElementNames[1] = (char **) SafeCalloc (204, sizeof (char *));
+    for (i=0; i<203; i++)
+        {
+        modelElementNames[1][i]  = (char *) SafeCalloc (7, sizeof (char));
+        FromIndexToGrowthFxn(i, growthFxn);
+        for (j=0; j<6; j++)
+            modelElementNames[1][i][j] = '1' + growthFxn[j];
+        modelElementNames[1][i][j] = '\0';
+        }
+    modelElementNames[1][203]  = "";
+
+    /* Termination */
+    modelElementNames[2]    = (char **) SafeCalloc (1, sizeof(char *));
+    modelElementNames[2][0] = "";
+
+    /* initialize user trees */
+    for (i=0; i<MAX_NUM_USERTREES; i++)
+        userTree[i] = NULL;
+    numUserTrees = 0;
+
+    /* Reset translate table */
+    ResetTranslateTable();
+
+    /* finally reset everything dependent on a matrix being defined */
+    return (ReinitializeMrBayes ());
+    
+}
+
+
+void PrintHeader (void)
+{
+    char arch[4];
+#   ifndef RELEASE
+    unsigned rev = FindMaxRevision (10, svnRevisionBayesC,svnRevisionBestC,svnRevisionCommandC,svnRevisionLikeliC,svnRevisionMbbeagleC,
+                                        svnRevisionMcmcC,svnRevisionModelC,svnRevisionProposalC,svnRevisionSumptC,svnRevisionUtilsC);
+#   endif
+
+    strcpy(arch,(sizeof(void*)==4)?"x86":"x64");
+
+    MrBayesPrint ("\n\n");
+#   ifdef RELEASE
+    MrBayesPrint ("                            MrBayes v%s %s\n\n", VERSION_NUMBER,arch);
+#   else
+    MrBayesPrint ("                        MrBayes v%s(r%d) %s\n\n", VERSION_NUMBER,rev,arch);
+#   endif
+    MrBayesPrint ("                      (Bayesian Analysis of Phylogeny)\n\n");
+#   if defined (MPI_ENABLED)
+    MrBayesPrint ("                             (Parallel version)\n");
+    MrBayesPrint ("                         (%d processors available)\n\n", num_procs);
+#   endif
+    MrBayesPrint ("              Distributed under the GNU General Public License\n\n\n");
+    MrBayesPrint ("               Type \"help\" or \"help <command>\" for information\n");
+    MrBayesPrint ("                     on the commands that are available.\n\n");
+    MrBayesPrint ("                   Type \"about\" for authorship and general\n");
+    MrBayesPrint ("                       information about the program.\n\n\n");
+}
+
+
+int ReinitializeMrBayes (void)
+{
+    /* this function resets everything dependent on a matrix */
+    
+    int             i;
+    
+    /* reinitialize indentation */
+    strcpy (spacer, "");                             /* holds blanks for indentation                  */
+
+    /* reset all taxa flags */
+    ResetTaxaFlags();
+
+    /* reset all characters flags */
+    ResetCharacterFlags();
+
+    /* chain parameters */
+    chainParams.numGen = 1000000;                    /* number of MCMC cycles                         */
+    chainParams.sampleFreq = 500;                    /* frequency to sample chain                     */
+    chainParams.printFreq = 1000;                    /* frequency to print chain                      */
+    chainParams.swapFreq = 1;                        /* frequency of attempting swap of states        */
+    chainParams.numSwaps = 1;                        /* number of swaps to try each time              */
+    chainParams.isSS = NO;
+    chainParams.startFromPriorSS = NO;
+    chainParams.numStepsSS = 50;
+    chainParams.burninSS = -1;
+    chainParams.alphaSS = 0.4;
+    chainParams.backupCheckSS = 0;
+    chainParams.mcmcDiagn = YES;                     /* write MCMC diagnostics to file ?              */
+    chainParams.diagnFreq = 5000;                    /* diagnostics frequency                         */
+    chainParams.minPartFreq = 0.10;                  /* min partition frequency for diagnostics       */
+    chainParams.allChains = NO;                      /* calculate diagnostics for all chains ?        */
+    chainParams.allComps = NO;                       /* do not calc diagn for all run comparisons     */
+    chainParams.relativeBurnin = YES;                /* use relative burnin?                          */
+    chainParams.burninFraction = 0.25;               /* default burnin fraction                       */
+    chainParams.stopRule = NO;                       /* should stopping rule be used?                 */
+    chainParams.stopVal = 0.05;                      /* convergence diagnostic value to reach         */
+    chainParams.numRuns = 2;                         /* number of runs                                */
+    chainParams.numChains = 4;                       /* number of chains                              */
+    chainParams.chainTemp = 0.1;                     /* chain temperature                             */
+    chainParams.redirect = NO;                       /* should printf be to stdout                    */
+    strcpy(chainParams.chainFileName, "temp");       /* chain file name for output                    */
+    chainParams.chainBurnIn = 0;                     /* chain burn in length                          */
+    chainParams.numStartPerts = 0;                   /* number of perturbations to starting tree      */
+    strcpy(chainParams.startTree, "Current");        /* starting tree for chain (random/current)      */
+    strcpy(chainParams.startParams, "Current");      /* starting params for chain (reset/current)     */
+    chainParams.saveBrlens = YES;                    /* should branch lengths be saved                */
+    chainParams.weightScheme[0] = 0.0;               /* percent chars to decrease in weight           */
+    chainParams.weightScheme[1] = 0.0;               /* percent chars to increase in weight           */
+    chainParams.weightScheme[2] = 1.0;               /* weight increment                              */
+    chainParams.calcPbf = NO;                        /* should we calculate the pseudo-BF?            */
+    chainParams.pbfInitBurnin = 100000;              /* initial burnin for pseudo BF                  */
+    chainParams.pbfSampleFreq = 10;                  /* sample frequency for pseudo BF                */
+    chainParams.pbfSampleTime = 2000;                /* how many cycles to calcualate site prob.      */
+    chainParams.pbfSampleBurnin = 2000;              /* burnin period for each site for pseudo BF     */
+    chainParams.userDefinedTemps = NO;               /* should we use the users temperatures?         */
+    for (i=0; i<MAX_CHAINS; i++)
+        chainParams.userTemps[i] = 1.0;              /* user-defined chain temperatures               */
+    chainParams.swapAdjacentOnly = NO;               /* swap only adjacent temperatures               */
+    chainParams.printMax = 8;                        /* maximum number of chains to print to screen   */
+    chainParams.printAll = YES;                      /* whether to print heated chains                */
+    chainParams.treeList = NULL;                     /* vector of tree lists for saving trees         */
+    chainParams.saveTrees = NO;                      /* save tree samples for later removal?          */
+    chainParams.tFilePos = NULL;                     /* position for reading trees for removal        */
+    chainParams.runWithData = YES;                   /* whether to run with data                      */
+    chainParams.orderTaxa = NO;                      /* should taxa be ordered in output trees?       */
+    chainParams.append = NO;                         /* append to previous analysis?                  */
+    chainParams.autotune = YES;                      /* autotune?                                     */
+    chainParams.tuneFreq = 100;                      /* autotuning frequency                          */
+    chainParams.checkPoint = YES;                    /* should we checkpoint the run?                 */
+    chainParams.checkFreq = 2000;                    /* check-pointing frequency                      */
+    chainParams.diagnStat = AVGSTDDEV;               /* mcmc diagnostic to use                        */
+
+    /* sumt parameters */
+    strcpy(sumtParams.sumtFileName, "temp");         /* input name for sumt command                   */
+    strcpy(sumtParams.sumtConType, "Halfcompat");    /* type of consensus tree output                 */
+    sumtParams.calcTreeprobs = YES;                  /* should individual tree probs be calculated    */
+    sumtParams.showSumtTrees = NO;                   /* should the individual tree probs be shown     */
+    sumtParams.printBrlensToFile = NO;               /* should brlens be printed to file              */
+    sumtParams.brlensFreqDisplay = 0.50;             /* threshold for printing brlens to file         */
+    sumtParams.numTrees = 1;                         /* number of trees to summarize                  */
+    sumtParams.numRuns = 2;                          /* number of analyses to summarize               */
+    sumtParams.orderTaxa = YES;                      /* order taxa in trees ?                         */
+    sumtParams.minPartFreq = 0.10;                   /* minimum part. freq. for overall diagnostics   */
+    sumtParams.table = YES;                          /* display table of part. freq.?                 */
+    sumtParams.summary = YES;                        /* display overall diagnostics?                  */
+    sumtParams.showConsensus = YES;                  /* display consensus tree(s)?                    */
+    sumtParams.consensusFormat = FIGTREE;            /* format of consensus tree                      */
+    strcpy (sumtParams.sumtOutfile, "temp");         /* output name for sumt command                  */
+    sumtParams.HPD = YES;                            /* use Highest Posterior Density?                */
+
+    /* sump parameters */
+    strcpy(sumpParams.sumpFileName, "temp");         /* input name for sump command                   */
+    strcpy (sumpParams.sumpOutfile, "temp");         /* output name for sump command                  */
+    sumpParams.numRuns = 2;                          /* number of analyses to summarize               */
+    sumpParams.HPD = YES;                            /* use Highest Posterior Density?                */
+    sumpParams.minProb = 0.05;                       /* min. prob. of models to include in summary    */
+
+    /* sumss parameters */
+    sumssParams.numRuns= 2;                          /* number of independent analyses to summarize   */
+    sumssParams.allRuns = YES;                       /* should data for all runs be printed (yes/no)? */
+    sumssParams.stepToPlot = 0;                      /* Which step to plot in the step plot, 0 means burnin */
+    sumssParams.askForMorePlots = YES;               /* Should user be asked to plot for different discardfraction (y/n)?  */
+    sumssParams.discardFraction = 0.8;               /* Proportion of samples discarded when ploting step plot.*/
+    sumssParams.smoothing = 0;                       /* An integer indicating number of neighbors to average over
+                                                        when dooing smoothing of curvs on plots */
+    /* comparetree parameters */
+    strcpy(comptreeParams.comptFileName1, "temp.t"); /* input name for comparetree command            */
+    strcpy(comptreeParams.comptFileName2, "temp.t"); /* input name for comparetree command            */
+    strcpy(comptreeParams.comptOutfile, "temp.comp");/* output name for comparetree command           */
+    comptreeParams.minPartFreq = 0.0;                /* minimum frequency of partitions to include    */
+
+    /* plot parameters */
+    strcpy(plotParams.plotFileName, "temp.p");       /* input name for plot command                   */
+    strcpy(plotParams.parameter, "lnL");             /* plotted parameter plot command                */
+    strcpy(plotParams.match, "Perfect");             /* matching for plot command                     */
+    
+    return (NO_ERROR);
+}
+
diff --git a/src/bayes.h b/src/bayes.h
new file mode 100644 (file)
index 0000000..c2716ae
--- /dev/null
@@ -0,0 +1,1700 @@
+#ifndef __BAYES_H__
+#define __BAYES_H__
+
+#include <assert.h>
+#include <ctype.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <memory.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+
+#ifdef USECONFIG_H
+#   include "config.h"
+#elif !defined (XCODE_VERSION) /* some defaults that would otherwise be guessed by configure */
+#   define PACKAGE_NAME "mrbayes"
+#   define PACKAGE_VERSION "3.2"
+#   undef  HAVE_LIBREADLINE
+#   define UNIX_VERSION 1
+#   define SSE_ENABLED  1
+#   undef  MPI_ENABLED
+#   undef  BEAGLE_ENABLED
+#   undef  FAST_LOG
+#endif
+
+#if defined (MPI_ENABLED)
+#include "mpi.h"
+#endif
+
+#if defined (BEAGLE_ENABLED)
+#include "libhmsbeagle/beagle.h"
+#endif
+
+/* uncomment the following line when releasing, also modify the VERSION_NUMBER below */
+#define RELEASE
+#ifdef RELEASE
+#define VERSION_NUMBER  "3.2.6"
+#else
+#define VERSION_NUMBER  "3.2.7-svn"
+#endif
+
+#if !defined (UNIX_VERSION) && !defined (WIN_VERSION) && !defined (MAC_VERSION)
+#  ifdef __MWERKS__
+#    define MAC_VERSION
+#  elif defined __APPLE__
+#    define MAC_VERSION
+#  else
+#    define WIN_VERSION
+#  endif
+#endif
+
+#if defined (WIN_VERSION)
+#   include <windows.h>
+#   include <winbase.h>
+#endif
+
+/* Previous problems with bitfield operations may have been caused by several things. One potential
+   problem has been that MrBayes has used signed ints or signed longs for the bit operations, and
+   not all compilers perform bitfield operations on signed ints and longs in the expected manner
+   for unsigned ints and longs. Actually, the ANSI standard does not specify how to implement
+   bit operations on signed operands.
+   
+   Another problem is that some bitshift operations in MrBayes have been performed on an integer
+   constant "1". This is probably interpreted by most compilers as a signed int and the result of
+   the bitshift operation is therefore also a signed int. When a signed int has had a different
+   number of bits than the type specified as SafeLong, this may also have resulted in errors on
+   some systems.
+   Both of these problems are fixed now by using unsigned longs for the bitfield operations and
+   by setting the "1" value needed by some bitfield functions using a variable defined as the same
+   type as the bitfield containers themselves. Furthermore, I have separated out the cases where
+   a signed long is required or is more appropriate than the container type of bitfields.
+
+   FR 2013-07-06
+ */
+typedef unsigned long BitsLong;
+typedef long RandLong;
+
+#define MRBFLT_MAX DBL_MAX  /* maximum possible value that can be stored in MrBFlt */
+#define MRBFLT_MIN DBL_MIN  /* minimum possible value that can be stored in MrBFlt */
+#define MRBFLT_NEG_MAX (-DBL_MAX)  /* maximum possible negative value that can be stored in MrBFlt */
+typedef double MrBFlt;      /* double used for parameter values and generally for floating point values, 
+                               if set to float MPI would not work becouse of use MPI_DOUBLE */
+typedef float CLFlt;        /* single-precision float used for cond likes (CLFlt) to increase speed and reduce memory requirement */
+                            /* set CLFlt to double if you want increased precision */
+                            /* NOTE: CLFlt = double not compatible with SSE_ENABLED */
+
+/* Define a compiler and vector size for the SSE code */
+#if defined (SSE_ENABLED)
+#  define FLOATS_PER_VEC 4
+#  if defined (WIN_VERSION)
+#    define MS_VCPP_SSE
+#    include <xmmintrin.h>
+#  else
+#    define GCC_SSE
+#    undef ICC_SSE
+#    include <xmmintrin.h>
+#  endif
+#endif
+
+/* For comparing floating points: two values are the same if the absolute difference is less then
+   this value.
+*/
+#ifndef ETA
+#define ETA (1E-30)
+#endif
+
+/* This defined DEBUG() is not used anywhere
+#if defined (DEBUGOUTPUT)
+#define DEBUG(fmt, arg) printf("%s:%d ",__FILE__,__LINE__); printf(fmt,arg);
+#endif
+*/
+
+/* TEMPSTRSIZE determines size of temporary sprintf buffer (for SafeSprintf) */
+/* A patch was sent in by Allen Smith for SafeSprintf, but I could not get
+   it compiled on SGI IRIX 6.5 (too old?) with _xpg5_vsnprintf undefined.
+   The code below is a hack so SafeSprintf never has to reallocate memory.
+*/
+#ifdef __sgi
+#define TEMPSTRSIZE 1000
+#else
+#define TEMPSTRSIZE 200
+#endif
+
+/* NO_ERROR is defined in bayes.h (as 0) and also in WinError.h (as 0L)
+ ERROR is defined in bayes.h (as 1) and also in WinGDI.h (as 0). we use the bayes.h value */
+#undef  NO_ERROR
+#undef  ERROR
+#define NO_ERROR                0
+#define ERROR                   1
+#define NO_ERROR_QUIT           2
+#define ABORT                   3
+#define SKIP_COMMAND            4
+
+#undef  FALSE
+#undef  TRUE
+#define FALSE                   0
+#define TRUE                    1
+
+#define NO                      0
+#define YES                     1
+
+#define UP                      0
+#define DOWN                    1
+
+#define UPPER                   0
+#define MIDDLE                  1
+#define LOWER                   2
+
+#define NONINTERACTIVE          0
+#define INTERACTIVE             1
+
+#define STANDARD_USER           1
+#define DEVELOPER               3
+
+#define DIFFERENT               0
+#define SAME                    1
+#define CONSISTENT_WITH         2
+
+#define LINETERM_UNIX           0
+#define LINETERM_MAC            1
+#define LINETERM_DOS            2
+
+#define SCREENWIDTH             60
+#define SCREENWIDTH2            61
+
+#define AVGSTDDEV               0
+#define MAXSTDDEV               1
+
+#define NONE                    0
+#define DNA                     1
+#define RNA                     2
+#define PROTEIN                 3
+#define RESTRICTION             4
+#define STANDARD                5
+#define MIXED                   6
+#define CONTINUOUS              7
+
+#define AAMODEL_POISSON         0
+#define AAMODEL_JONES           1
+#define AAMODEL_DAY             2
+#define AAMODEL_MTREV           3
+#define AAMODEL_MTMAM           4
+#define AAMODEL_WAG             5
+#define AAMODEL_RTREV           6
+#define AAMODEL_CPREV           7
+#define AAMODEL_VT              8
+#define AAMODEL_BLOSUM          9
+#define AAMODEL_LG              10
+#define AAMODEL_EQ              11
+#define AAMODEL_GTR             12 /* aa models with free parameters must be listed last */
+
+#define NUCMODEL_4BY4           0
+#define NUCMODEL_DOUBLET        1
+#define NUCMODEL_CODON          2
+#define NUCMODEL_AA             3
+
+#define NST_MIXED              -1  /* anything other than 1, 2, or 6 */
+
+#define MISSING                 10000000
+#define GAP                     10000001
+
+#define UNORD                   0
+#define ORD                     1
+#define DOLLO                   2
+#define IRREV                   3
+
+#define IN_CMD                  0
+#define IN_FILE                 1
+
+#define NOTHING                 0
+#define COMMAND                 1
+#define PARAMETER               2
+#define EQUALSIGN               3
+#define COLON                   4
+#define SEMICOLON               5
+#define COMMA                   6
+#define POUNDSIGN               7
+#define QUESTIONMARK            8
+#define DASH                    9
+#define LEFTPAR                 10
+#define RIGHTPAR                11
+#define LEFTCOMMENT             12
+#define RIGHTCOMMENT            13
+#define ALPHA                   14
+#define NUMBER                  15
+#define RETURNSYMBOL            16
+#define ASTERISK                17
+#define BACKSLASH               18
+#define FORWARDSLASH            19
+#define EXCLAMATIONMARK         20
+#define PERCENT                 21
+#define QUOTATIONMARK           22
+#define WEIRD                   23
+#define UNKNOWN_TOKEN_TYPE      24
+#define LEFTCURL                25
+#define RIGHTCURL               26
+#define DOLLAR                  27
+#define AMPERSAND               28
+#define VERTICALBAR             29
+
+#define MAX_Q_RATE              100.0f
+#define MIN_SHAPE_PARAM         0.00001f
+#define MAX_SHAPE_PARAM         100.0f
+#define MAX_SITE_RATE           10.0f
+#define MAX_GAMMA_CATS          20
+#define MAX_GAMMA_CATS_SQUARED  400
+#define BRLENS_MIN              0.00000001f  // 1E-8f
+#define BRLENS_MAX              100.0f
+/* BRLENS_MIN must be bigger than TIME_MIN */
+#define TIME_MIN                1.0E-11f
+#define TIME_MAX                100.0f
+#define RELBRLENS_MIN           0.00000001f  // 1E-8f
+#define RELBRLENS_MAX           100.0f
+#define KAPPA_MIN               0.001f
+#define KAPPA_MAX               1000.0f
+#define GROWTH_MIN              0.000001f
+#define GROWTH_MAX              1000000.0f
+#define RATE_MIN                0.000001f
+#define RATE_MAX                100.0f
+#define CPPRATEMULTIPLIER_MIN   0.001f
+#define CPPRATEMULTIPLIER_MAX   1000.0f
+#define SYMPI_MIN               0.000001f
+#define SYMPI_MAX               100.0f
+#define ALPHA_MIN               0.0001f
+#define ALPHA_MAX               10000.0f
+#define DIR_MIN                 0.000001f
+#define PI_MIN                  0.000001f
+#define OFFSETEXPLAMBDA_MIN     0.000001f
+#define OFFSETEXPLAMBDA_MAX     100000.0f
+#define TREEHEIGHT_MIN          0.00000001f
+#define TREEHEIGHT_MAX          1000.0f
+#define TREEAGE_MIN             0.00000001f
+#define TREEAGE_MAX             1000000.0f
+#define CPPLAMBDA_MIN           0.00001f
+#define CPPLAMBDA_MAX           100.0f
+#define TK02VAR_MIN             0.000001f
+#define TK02VAR_MAX             10000.0f
+#define IGRVAR_MIN              0.000001f
+#define IGRVAR_MAX              10000.0f
+#define MIXEDVAR_MIN            0.000001f
+#define MIXEDVAR_MAX            10000.0f
+#define OMEGA_MIN               0.001f
+#define OMEGA_MAX               1000.0f
+
+#define POS_MIN                 1E-25f
+#define POS_MAX                 1E25f
+#define POS_INFINITY            1E25f
+#define NEG_INFINITY            -1000000.0f
+#define POSREAL_MIN             1E-25f
+#define POSREAL_MAX             1E25f
+
+#define CMD_STRING_LENGTH       100000
+
+#define pos(i,j,n)              ((i)*(n)+(j))
+
+#define NUM_ALLOCS               100
+
+#define ALLOC_MATRIX             0
+#define ALLOC_CHARINFO           2
+#define ALLOC_CHARSETS           3
+#define ALLOC_TAXA               4
+#define ALLOC_TMPSET             5
+#define ALLOC_PARTITIONS         6
+#define ALLOC_PARTITIONVARS      7
+#define ALLOC_TAXASETS           8
+#define ALLOC_CONSTRAINTS        9
+#define ALLOC_USERTREE           10
+#define ALLOC_SUMTPARAMS         11
+#define ALLOC_TERMSTATE          12
+#define ALLOC_ISPARTAMBIG        13
+#define ALLOC_AVAILNODES         25
+#define ALLOC_AVAILINDICES       26
+#define ALLOC_CURLNL             28
+#define ALLOC_CURLNPR            29
+#define ALLOC_CHAINID            30
+#define ALLOC_PARAMS             31
+#define ALLOC_TREE               32
+#define ALLOC_NODES              33
+#define ALLOC_LOCTAXANAMES       34
+#define ALLOC_COMPMATRIX         39
+#define ALLOC_NUMSITESOFPAT      40
+#define ALLOC_COMPCOLPOS         41
+#define ALLOC_COMPCHARPOS        42
+#define ALLOC_ORIGCHAR           43
+#define ALLOC_PARAMVALUES        46
+#define ALLOC_MCMCTREES          47
+#define ALLOC_MOVES              48
+#define ALLOC_PRELIKES           52
+#define ALLOC_SITEJUMP           54
+#define ALLOC_MARKOVTIS          55
+#define ALLOC_RATEPROBS          56
+#define ALLOC_STDTYPE            57
+#define ALLOC_PACKEDTREES        58
+#define ALLOC_SUMPSTRING         62
+#define ALLOC_SUMPINFO           63
+#define ALLOC_SWAPINFO           64
+#define ALLOC_SYMPIINDEX         65
+#define ALLOC_POSSELPROBS        66
+#define ALLOC_PBF                68
+#define ALLOC_LOCALTAXONCALIBRATION  69
+#define ALLOC_SPR_PARSSETS       72
+#define ALLOC_PFCOUNTERS         74
+#define ALLOC_FILEPOINTERS       75
+#define ALLOC_STATS              76
+#define ALLOC_DIAGNTREE          77
+#define ALLOC_USEDMOVES          82
+#define ALLOC_MODEL              83
+#define ALLOC_STDSTATEFREQS      84
+#define ALLOC_PRINTPARAM         85
+#define ALLOC_TREELIST           86
+#define ALLOC_TFILEPOS           87
+#define ALLOC_BEST               88
+#define ALLOC_SPECIESPARTITIONS  89
+#define ALLOC_SS                 90
+#define ALLOC_SAMPLEFOSSILSLICE  91
+
+#define LINKED                  0
+#define UNLINKED                1
+
+/*paramType*/
+#define NUM_LINKED              31
+#define P_TRATIO                0
+#define P_REVMAT                1
+#define P_OMEGA                 2
+#define P_PI                    3
+#define P_SHAPE                 4
+#define P_PINVAR                5
+#define P_CORREL                6
+#define P_SWITCH                7
+#define P_RATEMULT              8
+#define P_TOPOLOGY              9
+#define P_BRLENS                10
+#define P_SPECRATE              11
+#define P_EXTRATE               12
+#define P_FOSLRATE              13
+#define P_POPSIZE               14
+#define P_AAMODEL               15
+#define P_BRCORR                16
+#define P_BRSIGMA               17
+#define P_GROWTH                18
+#define P_CPPMULTDEV            19
+#define P_CPPRATE               20
+#define P_CPPEVENTS             21
+#define P_TK02VAR               22
+#define P_TK02BRANCHRATES       23
+#define P_IGRVAR                24
+#define P_IGRBRANCHRATES        25
+#define P_CLOCKRATE             26
+#define P_SPECIESTREE           27
+#define P_GENETREERATE          28
+#define P_MIXEDVAR              29
+#define P_MIXEDBRCHRATES        30
+/* NOTE: If you add another parameter, change NUM_LINKED */
+
+// #define CPPm                 0       /* CPP rate multipliers */
+// #define CPPi                 1       /* CPP independent rates */
+#define RCL_TK02                0
+#define RCL_IGR                 1       /* type of mixed relaxed clock model */
+
+#define MAX_NUM_USERTREES       200     /* maximum number of user trees MrBayes will read */
+#define MAX_CHAINS              256     /* maximum numbder of chains you can run actually only half of it becouse of m->lnLike[MAX_CHAINS] */
+
+// #define PARAM_NAME_SIZE      400
+
+typedef void * VoidPtr;
+typedef int (*CmdFxn)(void);
+typedef int (*ParmFxn)(char *, char *);
+
+/* typedef for a ln prior prob fxn */
+typedef MrBFlt (*LnPriorProbFxn)(MrBFlt val, MrBFlt *priorParams);
+
+/* typedef for a ln prior prob ratio fxn */
+typedef MrBFlt (*LnPriorRatioFxn)(MrBFlt newVal, MrBFlt oldVal, MrBFlt *priorParams);
+
+typedef struct
+    {
+    MrBFlt          sum;            /* sum of standard deviations */
+    MrBFlt          max;            /* maximum standard deviation */
+    MrBFlt          numPartitions;
+    MrBFlt          numSamples;
+    MrBFlt          avgStdDev;
+    MrBFlt          **pair;
+    } STATS;
+
+/* enumeration for calibration prior type */
+enum CALPRIOR
+    {
+    unconstrained,
+    fixed,
+    uniform,
+    offsetExponential,
+    truncatedNormal,
+    logNormal,
+    offsetLogNormal,
+    standardGamma,
+    offsetGamma 
+    };
+
+enum ConstraintType
+    {
+    PARTIAL,
+    NEGATIVE,
+    HARD
+    };
+
+enum CodingType
+    {
+    ALL                 = 0,
+    NOABSENCESITES      = 1,
+    NOPRESENCESITES     = 2,
+    VARIABLE            = 3,
+    NOSINGLETONPRESENCE = 4,
+    NOSINGLETONABSENCE  = 8,
+    NOSINGLETONS        = 12,
+    INFORMATIVE         = 15
+    };
+
+/* typedef for calibration */
+typedef struct calibration
+    {
+    char                name[100];
+    enum CALPRIOR       prior;
+    MrBFlt              priorParams[3];
+    LnPriorProbFxn      LnPriorProb;
+    LnPriorRatioFxn     LnPriorRatio;
+    MrBFlt              min;
+    MrBFlt              max;
+    }
+    Calibration;
+
+/* typedef for tree (topology) list element */
+typedef struct element
+    {
+    struct element *next;
+    int             *order;
+    } TreeListElement;
+
+/* typedef for list of trees (topologies) */
+typedef struct
+    {
+    TreeListElement *first;
+    TreeListElement *last;
+    } TreeList;
+
+/* typedef for packed tree */
+typedef struct
+    {
+    int     *order;
+    MrBFlt  *brlens;
+    } PackedTree;
+
+/* typedef for binary tree node */
+/* NOTE: Any variable added here must also be copied in CopyTrees */
+typedef struct node
+    {
+    char            *label;                 /*!< name of node if tip                        */
+    struct node     *left, *right, *anc;    /*!< pointers to adjacent nodes                 */
+    int             memoryIndex;            /*!< memory index (do not change)               */
+    int             index;                  /*!< index to node (0 to numLocalTaxa for tips) */
+    int             upDateCl;               /*!< cond likes need update?                    */
+    int             upDateTi;               /*!< transition probs need update?              */
+    int             scalerNode;             /*!< is node scaling cond likes?                */
+    int             isLocked;               /*!< is node locked?                            */
+    int             lockID;                 /*!< id of lock                                 */
+    int             isDated;                /*!< is node dated (calibrated)?                */
+    int             marked, x, y;           /*!< scratch variables                          */
+    MrBFlt          d;                      /*!< scratch variable                           */
+    BitsLong        *partition;             /*!< pointer to bitfield describing splits      */
+    MrBFlt          length;                 /*!< length of pending branch                   */
+    MrBFlt          nodeDepth;              /*!< node depth (height)                        */
+    MrBFlt          age;                    /*!< age of node                                */
+    Calibration     *calibration;           /*!< pointer to calibration data                */
+    }
+    TreeNode;
+
+/* typedef for binary tree */
+typedef struct 
+    {
+    char            name[100];          /*!< name of tree                                 */
+    int             memNodes;           /*!< number of allocated nodes (do not exceed!)   */
+    int             nNodes;             /*!< number of nodes in tree (including lower root in rooted trees) */
+    int             nIntNodes;          /*!< number of interior nodes in tree (excluding lower root in rooted trees) */  
+    int             isRooted;           /*!< is tree rooted?                              */
+    int             isClock;            /*!< is tree clock?                               */
+    int             isCalibrated;       /*!< is tree calibrated?                          */
+    int             nRelParts;          /*!< number of relevant partitions                */
+    int             *relParts;          /*!< pointer to relevant partitions               */
+    int             checkConstraints;   /*!< does tree have constraints?                  */
+    int             nConstraints;       /*!< number of constraints                        */
+    int             *constraints;       /*!< pointer to constraints                       */
+    int             nLocks;             /*!< number of constrained (locked) nodes         */
+    TreeNode        **allDownPass;      /*!< downpass array of all nodes                  */
+    TreeNode        **intDownPass;      /*!< downpass array of interior nodes (including upper but excluding lower root in rooted trees) */
+    TreeNode        *root;              /*!< pointer to root (lower root in rooted trees) */
+    TreeNode        *nodes;             /*!< array containing the nodes                   */
+    BitsLong        *bitsets;           /*!< pointer to bitsets describing splits         */
+    BitsLong        *flags;             /*!< pointer to cond like flags                   */
+    int             fromUserTree;       /*!< YES is set for the trees whoes branch lengthes are set from user tree(as start tree or fix branch length prior), NO otherwise */       
+    }
+    Tree;
+
+/* typedef for node in polytomous tree */
+typedef struct pNode
+    {
+    char            label[100];         /*!< name of node if terminal                     */
+    struct pNode    *left, *sib, *anc;  /*!< pointers to adjacent nodes                   */
+    int             x, y, mark;         /*!< scratch variables                            */
+    int             partitionIndex;     /*!< partition index in sumt (scratch)            */
+    int             index;              /*!< index of node (if < numLocalTaxa = local taxon index) */
+    int             memoryIndex;        /*!< immutable index of memory position           */
+    int             isLocked;           /*!< is the node locked?                          */
+    int             lockID;             /*!< id of lock                                   */
+    int             isDated;            /*!< is node dated?                               */
+    MrBFlt          length;             /*!< age of node                                  */
+    MrBFlt          depth;              /*!< depth (height) of node                       */
+    MrBFlt          age;                /*!< age of node                                  */
+    MrBFlt          support, f;         /*!< scratch variables                            */
+    BitsLong        *partition;         /*!< pointer to partition (split) bitset          */
+    Calibration     *calibration;       /*!< pointer to dating of node                    */
+    }
+    PolyNode;
+
+/* typedef for polytomous tree */
+typedef struct 
+    {
+    char            name[100];           /*!< name of tree                                */
+    int             memNodes;            /*!< number of allocated nodes; do not exceed!   */
+    int             nNodes;              /*!< number of nodes in tree                     */
+    int             nIntNodes;           /*!< number of interior nodes in tree            */
+    PolyNode        **allDownPass;       /*!< downpass array over all nodes               */
+    PolyNode        **intDownPass;       /*!< downpass array over interior nodes          */
+    PolyNode        *root;               /*!< pointer to root (lower for rooted trees     */
+    PolyNode        *nodes;              /*!< array holding the tree nodes                */  
+    BitsLong        *bitsets;            /*!< bits describing partitions (splits)         */
+    int             nBSets;              /*!< number of effective branch length sets      */
+    int             nESets;              /*!< number of breakpoint rate sets              */
+    char            **bSetName;          /*!< names of effective branch length sets       */
+    char            **eSetName;          /*!< names of breakpoint rate sets               */
+    int             **nEvents;           /*!< number of branch events of bp rate set      */
+    MrBFlt          ***position;         /*!< position of branch events                   */
+    MrBFlt          ***rateMult;         /*!< parameter of branch events                  */
+    MrBFlt          **effectiveBrLen;    /*!< effective branch lengths of ebl set         */
+    int             brlensDef;           /*!< are brlens defined ?                        */
+    int             isRooted;            /*!< is tree rooted?                             */
+    int             isClock;             /*!< is tree clock?                              */
+    int             isCalibrated;        /*!< is tree calibrated?                         */
+    int             isRelaxed;           /*!< is tree relaxed?                            */
+    MrBFlt          clockRate;           /*!< clock rate                                  */
+    int             popSizeSet;          /*!< does tree have a population size set?       */
+    MrBFlt          *popSize;            /*!< the population size                         */
+    char            *popSizeSetName;     /*!< name of the population size set             */
+    }
+    PolyTree;
+
+/* struct for holding model parameter info for the mcmc run */
+typedef struct param
+    {
+    int             index;              /* index to the parameter (0, 1, 2, ...)          */
+    int             paramType;          /* the type of the parameter                      */
+    int             paramId;            /* unique ID for parameter x prior combination    */
+    MrBFlt          *values;            /* main values of parameter                       */
+    MrBFlt          *subValues;         /* subvalues of parameter                         */
+    int             *intValues;         /* integer values (model index/growth fxn)        */
+    int             nValues;            /* number of values                               */
+    int             nSubValues;         /* number of subvalues                            */
+    int             nIntValues;         /* number of intvalues                            */
+    MrBFlt          min;                /* minimum value of parameter                     */
+    MrBFlt          max;                /* maximum value of parameter                     */
+    int             *relParts;          /* pointer to relevant divisions                  */
+    int             nRelParts;          /* number of relevant divisions                   */
+    int             upDate;             /* update flag (for copying)                      */
+    struct param    **subParams;        /* pointers to subparams (for topology)           */
+    int             nSubParams;         /* number of subparams                            */
+    Tree            **tree;             /* pointer to tree ptrs (for brlens & topology)   */
+    int             treeIndex;          /* index to first tree in mcmcTree                */
+    int             hasBinaryStd;       /* has binary standard chars                      */
+    int             *sympiBsIndex;      /* pointer to sympi bsIndex (std chars)           */
+    int             *sympinStates;      /* pointer to sympi nStates (std chars)           */
+    int             *sympiCType;        /* pointer to sympi cType (std chars)             */
+    int             nSympi;             /* number of sympis                               */
+    int             printParam;         /* whether parameter should be printed            */
+    int             nPrintSubParams;    /* number of subparams that should be printed     */
+    char            *paramHeader;       /* a string holding header for param values       */
+    char            *name;              /* string holding name of parameter               */
+    char            *paramTypeName;     /* pointer to description of parameter type       */
+    int             checkConstraints;   /* is tree parameter constrained?                 */
+    int             fill;               /* flags whether the parameter should be filled   */
+    int             nStdStateFreqs;     /* number of std state frequencies                */
+    MrBFlt          *stdStateFreqs;     /* pointer to std state frequencies               */
+    int             **nEvents;          /* number of branch events for Cpp model          */
+                                        /* nEvents[0..2*numCains][0..numNodes=2*numTaxa]  */
+    MrBFlt          ***position;        /* event positions for Cpp relaxed clock model    */
+    MrBFlt          ***rateMult;        /* rate multipliers for Cpp relaxed clock model   */
+    int             affectsLikelihood;  /* does parameter directly influence likelihood?  */
+    MrBFlt*         priorParams;        /* pointer to the prior parameters                */
+    LnPriorProbFxn  LnPriorProb;        /* ln prior prob function                         */
+    LnPriorRatioFxn LnPriorRatio;       /* ln prior prob ratio function                   */
+    } Param;
+
+#if defined(THREADS_ENABLED)
+#include <pthread.h>
+
+typedef struct s_launch_struct 
+    {
+    int chain;
+    int division;
+    MrBFlt* lnL;                    
+    } LaunchStruct; 
+#endif
+
+/* parameter ID values */
+/* identifies unique model parameter x prior combinations */
+#define TRATIO_DIR                      1
+#define TRATIO_FIX                      2
+#define REVMAT_DIR                      3
+#define REVMAT_FIX                      4
+#define OMEGA_DIR                       5
+#define OMEGA_FIX                       6
+#define SYMPI_UNI                       7
+#define SYMPI_UNI_MS                    8
+#define SYMPI_EXP                       9
+#define SYMPI_EXP_MS                    10
+#define SYMPI_FIX                       11
+#define SYMPI_FIX_MS                    12
+#define SYMPI_EQUAL                     13
+#define PI_DIR                          14
+#define PI_USER                         15
+#define PI_EMPIRICAL                    16
+#define PI_EQUAL                        17
+#define PI_FIXED                        18
+#define SHAPE_UNI                       19
+#define SHAPE_EXP                       20
+#define SHAPE_FIX                       21
+#define PINVAR_UNI                      22
+#define PINVAR_FIX                      23
+#define CORREL_UNI                      24
+#define CORREL_FIX                      25
+#define SWITCH_UNI                      26
+#define SWITCH_EXP                      27
+#define SWITCH_FIX                      28
+#define RATEMULT_DIR                    29
+#define RATEMULT_FIX                    30
+#define TOPOLOGY_NCL_UNIFORM            31
+#define TOPOLOGY_NCL_CONSTRAINED        32
+#define TOPOLOGY_NCL_FIXED              33
+#define TOPOLOGY_NCL_UNIFORM_HOMO       34
+#define TOPOLOGY_NCL_UNIFORM_HETERO     35
+#define TOPOLOGY_NCL_CONSTRAINED_HOMO   36
+#define TOPOLOGY_NCL_CONSTRAINED_HETERO 37
+#define TOPOLOGY_NCL_FIXED_HOMO         38
+#define TOPOLOGY_NCL_FIXED_HETERO       39
+#define TOPOLOGY_CL_UNIFORM             40
+#define TOPOLOGY_CL_CONSTRAINED         41
+#define TOPOLOGY_CL_FIXED               42
+#define TOPOLOGY_CCL_UNIFORM            43
+#define TOPOLOGY_CCL_CONSTRAINED        44
+#define TOPOLOGY_CCL_FIXED              45
+#define TOPOLOGY_PARSIMONY_UNIFORM      46
+#define TOPOLOGY_PARSIMONY_CONSTRAINED  47
+#define TOPOLOGY_PARSIMONY_FIXED        48
+#define BRLENS_UNI                      49
+#define BRLENS_EXP                      50
+#define BRLENS_GamDir                   51
+#define BRLENS_iGmDir                   52
+#define BRLENS_twoExp                   53
+#define BRLENS_FIXED                    54
+#define BRLENS_CLOCK_UNI                55
+#define BRLENS_CLOCK_COAL               56
+#define BRLENS_CLOCK_BD                 57
+#define BRLENS_CLOCK_FIXED              58
+#define BRLENS_CLOCK_SPCOAL             59
+#define BRLENS_CLOCK_FOSSIL             60
+#define BRLENS_PARSIMONY                61
+#define SPECRATE_UNI                    62
+#define SPECRATE_EXP                    63
+#define SPECRATE_FIX                    64
+#define EXTRATE_BETA                    65
+#define EXTRATE_FIX                     66
+#define FOSLRATE_BETA                   67
+#define FOSLRATE_FIX                    68
+#define POPSIZE_UNI                     69
+#define POPSIZE_GAMMA                   70
+#define POPSIZE_FIX                     71
+#define POPSIZE_NORMAL                  72
+#define POPSIZE_LOGNORMAL               73
+#define AAMODEL_FIX                     74
+#define AAMODEL_MIX                     75
+#define GROWTH_UNI                      76
+#define GROWTH_EXP                      77
+#define GROWTH_FIX                      78
+#define GROWTH_NORMAL                   79
+#define OMEGA_BUD                       80
+#define OMEGA_BUF                       81
+#define OMEGA_BED                       82
+#define OMEGA_BEF                       83
+#define OMEGA_BFD                       84
+#define OMEGA_BFF                       85
+#define OMEGA_FUD                       86
+#define OMEGA_FUF                       87
+#define OMEGA_FED                       88
+#define OMEGA_FEF                       89
+#define OMEGA_FFD                       90
+#define OMEGA_FFF                       91
+#define OMEGA_ED                        92
+#define OMEGA_EF                        93
+#define OMEGA_FD                        94
+#define OMEGA_FF                        95
+#define OMEGA_10UUB                     96
+#define OMEGA_10UUF                     97
+#define OMEGA_10UEB                     98
+#define OMEGA_10UEF                     99
+#define OMEGA_10UFB                     100
+#define OMEGA_10UFF                     101
+#define OMEGA_10EUB                     102
+#define OMEGA_10EUF                     103
+#define OMEGA_10EEB                     104
+#define OMEGA_10EEF                     105
+#define OMEGA_10EFB                     106
+#define OMEGA_10EFF                     107
+#define OMEGA_10FUB                     108
+#define OMEGA_10FUF                     109
+#define OMEGA_10FEB                     110
+#define OMEGA_10FEF                     111
+#define OMEGA_10FFB                     112
+#define OMEGA_10FFF                     113
+#define CPPRATE_FIX                     114
+#define CPPRATE_EXP                     115
+#define CPPMULTDEV_FIX                  116
+#define TK02VAR_FIX                     117
+#define TK02VAR_EXP                     118
+#define TK02VAR_UNI                     119
+#define TOPOLOGY_RCL_UNIFORM            120
+#define TOPOLOGY_RCL_CONSTRAINED        121
+#define TOPOLOGY_RCL_FIXED              122
+#define TOPOLOGY_RCCL_UNIFORM           123
+#define TOPOLOGY_RCCL_CONSTRAINED       124
+#define TOPOLOGY_RCCL_FIXED             125
+#define TOPOLOGY_SPECIESTREE            126
+#define CPPEVENTS                       127
+#define TK02BRANCHRATES                 128
+#define TOPOLOGY_FIXED                  129
+#define IGRVAR_FIX                      130
+#define IGRVAR_EXP                      131
+#define IGRVAR_UNI                      132
+#define IGRBRANCHRATES                  133
+#define CLOCKRATE_FIX                   134
+#define CLOCKRATE_NORMAL                135
+#define CLOCKRATE_LOGNORMAL             136
+#define CLOCKRATE_GAMMA                 137
+#define CLOCKRATE_EXP                   138
+#define SPECIESTREE_UNIFORM             139
+#define GENETREERATEMULT_DIR            140
+#define GENETREERATEMULT_FIX            141
+#define REVMAT_MIX                      142
+#define MIXEDVAR_FIX                    143
+#define MIXEDVAR_EXP                    144
+#define MIXEDVAR_UNI                    145
+#define MIXEDBRCHRATES                  146
+
+#if defined (BEAGLE_ENABLED)
+#define MB_BEAGLE_SCALE_ALWAYS          0
+#define MB_BEAGLE_SCALE_DYNAMIC         1
+#if defined (_DEBUG)
+#define MB_PRINT_DYNAMIC_RESCALE_FAIL_STAT
+#endif
+#endif
+
+/* typedef for a MoveFxn */
+typedef int (MoveFxn)(Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+
+/* typedef for an ApplicFxn */
+typedef int (ApplicFxn)(Param *param);
+
+/* typedef for an AutotuneFxn */
+typedef void (AutotuneFxn)(MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *tuningParameter, MrBFlt minTuning, MrBFlt maxTuning);
+
+/* struct holding info on each move type that the program handles */
+typedef struct
+    {
+    MoveFxn      *moveFxn;           /* pointer to the move function                 */
+    ApplicFxn    *isApplicable;      /* pointer to function determining whether move is applicable to a parameter */
+    int          nApplicable;        /* number of relevant params                    */
+    int          applicableTo[40];   /* pointer to ID of relevant params             */
+    char         *name;              /* name of the move type                        */
+    char         *shortName;         /* abbreviated name of the move type            */
+    char         *paramName;         /* name of subparameter if complex parameter    */
+    int          subParams;          /* are we changing subparams (brlens of topol.) */
+    char         *tuningName[5];     /* name of tuning params                        */
+    char         *shortTuningName[5];/* short name of tuning params                  */
+    MrBFlt       relProposalProb;    /* default relative proposal probability        */
+    int          numTuningParams;    /* number of tuning parameters                  */
+    MrBFlt       tuningParam[5];     /* default tuning parameters for the proposal   */
+    MrBFlt       minimum[5];         /* minimum values for tuning params             */
+    MrBFlt       maximum[5];         /* maximum values for tuning params             */
+    int          parsimonyBased;     /* this move is based on parsimony (YES/NO)     */
+    int          level;              /* user level of this move                      */
+    AutotuneFxn  *Autotune;          /* pointer to the autotuning function           */
+    MrBFlt       targetRate;         /* default target acceptance rate for autotuning */
+    } MoveType;
+
+/* max number of move types */
+#define NUM_MOVE_TYPES 100
+
+/* struct holding info on each move */
+/* Note: This allows several different moves to affect the same parameter */
+/* It also allows the same move to affect different parameters as before */
+/* This is also a good place to keep the proposal probs */
+typedef struct
+    {
+    char        *name;              /* name of the move                             */
+    MoveType    *moveType;          /* pointer to the move type                     */
+    MoveFxn     *moveFxn;           /* pointer to the move function                 */
+    Param       *parm;              /* ptr to parameter the move applies to         */
+    MrBFlt      *relProposalProb;   /* the relative proposal probability            */
+    MrBFlt      *cumProposalProb;   /* the cumulative proposal probability          */
+    int         *nAccepted;         /* number of accepted moves                     */
+    int         *nTried;            /* number of tried moves                        */
+    int         *nBatches;          /* counter for autotuning rounds                */
+    int         *nTotAccepted;      /* total number of accepted moves               */
+    int         *nTotTried;         /* total number of tried moves                  */
+    MrBFlt      *targetRate;        /* target acceptance rate for autotuning        */
+    MrBFlt      *lastAcceptanceRate;/* acceptance rate in last complete batch       */
+    MrBFlt      **tuningParam;      /* tuning parameters for the move               */
+    } MCMCMove;
+
+typedef int (*LikeDownFxn)(TreeNode *, int, int);
+typedef int (*LikeRootFxn)(TreeNode *, int, int);
+typedef int (*LikeScalerFxn)(TreeNode *, int, int);
+typedef int (*LikeFxn)(TreeNode *, int, int, MrBFlt *, int);
+typedef int (*TiProbFxn)(TreeNode *, int, int);
+typedef int (*LikeUpFxn)(TreeNode *, int, int);
+typedef int (*PrintAncStFxn)(TreeNode *, int, int);
+typedef int (*StateCodeFxn) (int);
+typedef int (*PrintSiteRateFxn) (TreeNode *, int, int);
+typedef int (*PosSelProbsFxn) (TreeNode *, int, int);
+typedef int (*SiteOmegasFxn) (TreeNode *, int, int);
+
+typedef struct cmdtyp           
+    {
+    int         cmdNumber;
+    char        *string;
+    int         specialCmd;
+    CmdFxn      cmdFxnPtr;
+    short       numParms;
+    short       parmList[50];
+    int         expect;
+    char        *cmdDescription;
+    int         cmdUse;
+    int         hiding;
+    }
+    CmdType;
+    
+typedef struct parm
+    {
+    char        *string;    /* parameter name */
+    char        *valueList; /* list of values that could be input */
+    ParmFxn     fp;         /* function pointer */
+    }
+    ParmInfo, *ParmInfoPtr;
+
+typedef struct model
+    {
+    int         dataType;          /* data type for partition                      */
+    int         nStates;           /* number of states for this type of data       */
+    int         codon[64];         /* gives protein ID for each codon              */
+    int         codonNucs[64][3];  /* gives triplet for each codon                 */
+    int         codonAAs[64];      /* gives protein ID for implemented code        */
+    
+    char        nucModel[100];     /* nucleotide model used                        */
+    char        nst[100];          /* number of substitution types                 */
+    char        parsModel[100];    /* use the (so-called) parsimony model          */
+    char        geneticCode[100];  /* genetic code used                            */
+    int         coding;            /* type of patterns encoded                     */
+    char        codingString[100]; /* string describing type of patterns encoded   */
+    char        ploidy[100];       /* ploidy level                                 */
+    char        omegaVar[100];     /* type of omega variation model                */
+    char        ratesModel[100];   /* rates across sites model                     */
+    int         numGammaCats;      /* number of categories for gamma approximation */
+    char        useGibbs[100];     /* flags whether Gibbs sampling of discrete gamma is used */
+    int         gibbsFreq;         /* frequency of Gibbs resampling of discrete gamma */
+
+    int         numBetaCats;       /* number of categories for beta approximation  */
+    int         numM10GammaCats;   /* number of cats for gamma approx (M10 model)  */
+    int         numM10BetaCats;    /* number of cats for beta approx (M10 model)   */
+    char        covarionModel[100];/* use covarion model? (yes/no)                 */
+    char        augmentData[100];  /* should data be augmented                     */
+
+    char        tRatioPr[100];     /* prior for ti/tv rate ratio                   */
+    MrBFlt      tRatioFix;   
+    MrBFlt      tRatioDir[2];      
+    char        revMatPr[100];     /* prior for GTR model                          */
+    MrBFlt      revMatFix[6];
+    MrBFlt      revMatDir[6];
+    MrBFlt      revMatSymDir;      /* prior for mixed GTR subspace model           */
+    char        aaModelPr[100];    /* prior for amino acid model                   */
+    char        aaModel[100];
+    MrBFlt      aaModelPrProbs[10];
+    char        aaRevMatPr[100];   /* prior for aa GTR model                       */
+    MrBFlt      aaRevMatFix[190];
+    MrBFlt      aaRevMatDir[190];
+    char        omegaPr[100];      /* prior for omega                              */
+    MrBFlt      omegaFix;
+    MrBFlt      omegaDir[2];
+    char        ny98omega1pr[100]; /* prior for class 1 omega (Ny98 model)         */
+    MrBFlt      ny98omega1Fixed;
+    MrBFlt      ny98omega1Beta[2];
+    char        ny98omega3pr[100]; /* prior for class 3 omega (Ny98 model)         */
+    MrBFlt      ny98omega3Fixed;
+    MrBFlt      ny98omega3Uni[2];
+    MrBFlt      ny98omega3Exp;
+    char        m3omegapr[100];    /* prior for all three omegas (M3 model)        */
+    MrBFlt      m3omegaFixed[3];
+    char        m10betapr[100];    /* prior for omega variation (M10 model)        */
+    char        m10gammapr[100];
+    MrBFlt      m10betaExp;
+    MrBFlt      m10betaUni[2];
+    MrBFlt      m10betaFix[2];
+    MrBFlt      m10gammaExp;
+    MrBFlt      m10gammaUni[2];
+    MrBFlt      m10gammaFix[2];
+    char        codonCatFreqPr[100];  /* prior for selection cat frequencies       */
+    MrBFlt      codonCatFreqFix[3];
+    MrBFlt      codonCatDir[3];
+    char        stateFreqPr[100];  /* prior for character state frequencies        */
+    MrBFlt      stateFreqsFix[200];
+    MrBFlt      stateFreqsDir[200];
+    char        stateFreqsFixType[100];
+    int         numDirParams;
+    char        shapePr[100];      /* prior for gamma/lnorm shape parameter        */
+    MrBFlt      shapeFix;
+    MrBFlt      shapeUni[2];
+    MrBFlt      shapeExp;
+    char        pInvarPr[100];     /* prior for proportion of invariable sites     */
+    MrBFlt      pInvarFix;
+    MrBFlt      pInvarUni[2];
+    char        adGammaCorPr[100]; /* prior for correlation param of adGamma model */
+    MrBFlt      corrFix;
+    MrBFlt      corrUni[2];
+    char        covSwitchPr[100];  /* prior for switching rates of covarion model  */
+    MrBFlt      covswitchFix[2];
+    MrBFlt      covswitchUni[2];
+    MrBFlt      covswitchExp;
+    char        symPiPr[100];      /* prior for pi when unidentifiable states used */
+    MrBFlt      symBetaFix;
+    MrBFlt      symBetaUni[2];
+    MrBFlt      symBetaExp;
+    char        ratePr[100];       /* prior on rate for a partition                */
+    MrBFlt      ratePrDir;
+    char        generatePr[100];   /* prior on rate for a gene (one or more partitions) */
+    MrBFlt      generatePrDir;
+    char        brownCorPr[100];   /* prior for correlation of Brownian model      */
+    MrBFlt      brownCorrFix;
+    MrBFlt      brownCorrUni[2];
+    char        brownScalesPr[100];  /* prior for scales of Brownian model         */
+    MrBFlt      brownScalesFix;
+    MrBFlt      brownScalesUni[2];
+    MrBFlt      brownScalesGamma[2];
+    MrBFlt      brownScalesGammaMean;
+
+    char        topologyPr[100];   /* prior for tree topology                      */
+    int         topologyFix;       /* user tree index for fixed topology           */
+    int         *activeConstraints;  /* which constraints are active?              */
+    int         numActiveConstraints;
+    int         numActiveLocks;
+    char        brlensPr[100];     /* prior on branch lengths                      */
+    int         brlensFix;         /* user tree index for fixed brlens             */
+    MrBFlt      brlensUni[2];
+    MrBFlt      brlensExp;
+    MrBFlt      brlens2Exp[2];
+    MrBFlt      brlensDir[4];
+    MrBFlt      brlensGamma[2];
+    char        speciesTreeBrlensPr[100];  /* prior on branch lengths of species tree       */
+    char        unconstrainedPr[100];  /* prior on branch lengths if unconstrained          */
+    char        clockPr[100];          /* prior on branch if clock enforced                 */
+    char        clockVarPr[100];       /* prior on clock rate variation (strict, cpp, tk02, igr, ...) */
+    char        nodeAgePr[100];        /* prior on node depths (unconstrained, constraints) */
+    char        speciationPr[100];     /* prior on speciation rate (net diversification)    */
+    MrBFlt      speciationFix;
+    MrBFlt      speciationUni[2];
+    MrBFlt      speciationExp;
+    char        extinctionPr[100];     /* prior on relative extinction rate (turnover)      */
+    MrBFlt      extinctionFix;
+    MrBFlt      extinctionBeta[2];
+    char        fossilizationPr[100];  /* prior on fossilization rate (sampling proportion) */
+    MrBFlt      fossilizationFix;
+    MrBFlt      fossilizationBeta[2];
+    char        sampleStrat[100];      /* taxon sampling strategy (for b-d process)         */
+    int         sampleFSNum;           /* number of fossil slice sampling events (s)        */
+    MrBFlt     *sampleFSTime;          /* fossil slice sampling times (t_i,   i=1,..,s)     */
+    MrBFlt     *sampleFSProb;          /* fossil slice sampling probs (rho_i, i=1,..,s)     */
+    MrBFlt      sampleProb;            /* extant taxon sampling fraction (rho)              */
+    Calibration treeAgePr;             /* prior on tree age for uniform clock trees         */
+    char        clockRatePr[100];      /* prior on base substitution rate of tree for clock trees */
+    MrBFlt      clockRateNormal[2];
+    MrBFlt      clockRateLognormal[2];
+    MrBFlt      clockRateGamma[2];
+    MrBFlt      clockRateExp;
+    MrBFlt      clockRateFix;
+    char        popSizePr[100];        /* prior on population size                      */
+    MrBFlt      popSizeFix;
+    MrBFlt      popSizeUni[2];
+    MrBFlt      popSizeLognormal[2];
+    MrBFlt      popSizeGamma[2];
+    MrBFlt      popSizeNormal[2];
+    char        popVarPr[100];         /* prior on pop. size variation across tree      */
+    char        growthPr[100];         /* prior on coalescence growth rate              */
+    MrBFlt      growthFix;
+    MrBFlt      growthUni[2];
+    MrBFlt      growthExp;
+    MrBFlt      growthNorm[2];
+    char        cppRatePr[100];        /* prior on CPP rate                             */
+    MrBFlt      cppRateFix;
+    MrBFlt      cppRateExp;
+    char        cppMultDevPr[100];     /* prior on CPP rate multiplier Lognormal variance */
+    MrBFlt      cppMultDevFix;
+    char        tk02varPr[100];        /* prior on TK02 lognormal rate variance         */
+    MrBFlt      tk02varFix;
+    MrBFlt      tk02varUni[2];
+    MrBFlt      tk02varExp;
+    char        igrvarPr[100];         /* prior on IGR gamma distribution variance      */
+    MrBFlt      igrvarFix;
+    MrBFlt      igrvarUni[2];
+    MrBFlt      igrvarExp;
+    char        mixedvarPr[100];       /* prior on mixed relaxed clock rate variance    */
+    MrBFlt      mixedvarFix;
+    MrBFlt      mixedvarUni[2];
+    MrBFlt      mixedvarExp;
+
+    char        tratioFormat[30];      /* format used to report tratio                  */
+    char        revmatFormat[30];      /* format used to report revmat                  */
+    char        ratemultFormat[30];    /* format used to report ratemult                */
+    char        treeFormat[30];        /* format used to report trees/topologies        */
+    char        inferAncStates[5];     /* should ancestral states be inferred (Yes/No)? */
+    char        inferSiteOmegas[5];    /* should site omega vals be inferred (Yes/No)?  */
+    char        inferSiteRates[5];     /* should site rates be inferred (Yes/No)?       */
+    char        inferPosSel[5];        /* should site selection be inferred (Yes/No)?   */
+    } Model, ModelParams;
+
+typedef struct chain
+    {
+    int         numGen;                /* number of MCMC cycles                         */
+    int         sampleFreq;            /* frequency to sample chain                     */
+    int         printFreq;             /* frequency to print chain                      */
+    int         swapFreq;              /* frequency to attempt swap of states           */
+    int         numRuns;               /* number of runs                                */
+    int         numChains;             /* number of chains                              */
+    int         isSS;                  /* do we do Steppingstone Sampling               */
+    int         startFromPriorSS;      /* If Yes SS is moving from Prior to Posterior   */
+    int         numStepsSS;            /* Number of steps in SS                         */
+    int         burninSS;              /* Fixed burnin for SS                           */
+    MrBFlt      alphaSS;               /* Beta values are distributed according to quantiles of Beta(alphaSS,1.0) distribution */
+    int         backupCheckSS;         /* Frequency of checkpoints backup               */
+    MrBFlt      chainTemp;             /* chain temperature                             */
+    int         userDefinedTemps;      /* should we use the users temperatures?         */
+    MrBFlt      userTemps[MAX_CHAINS]; /* user-defined chain temperatures               */
+    char        chainFileName[100];    /* chain file name for output                    */
+    int         chainBurnIn;           /* chain burn in length                          */
+    int         numStartPerts;         /* number of perturbations to starting tree      */
+    char        startTree[100];        /* starting tree for chain (current/random)      */
+    char        startParams[100];      /* starting values for chain (current/reset)     */
+    int         saveBrlens;            /* should branch lengths be saved                */
+    MrBFlt      weightScheme[3];       /* percent chars to increase/decrease in weight  */
+    int         calcPbf;               /* should we calculate the pseudo Bayes factor   */
+    int         pbfInitBurnin;         /* initial burnin when calculating pseudo BF     */
+    int         pbfSampleFreq;         /* sample frequency for pseudo BF                */
+    int         pbfSampleTime;         /* how many cycles to calcualate site prob.      */
+    int         pbfSampleBurnin;       /* burnin period for each site for pseudo BF     */
+    int         swapAdjacentOnly;      /* whether we only swap adjacent temperatures    */
+    int         redirect;              /* should output go to stdout                    */
+    int         allChains;             /* should stats be output for all chains?        */
+    int         numSwaps;              /* number of swaps to try each time              */
+    int         mcmcDiagn;             /* should mcmc diagnostics be output?            */
+    int         diagnFreq;             /* mcmc diagnostics frequency                    */
+    int         diagnStat;             /* statistic to use for mcmc diagnostics         */
+    int         relativeBurnin;        /* should a relative burnin be used ?            */
+    MrBFlt      burninFraction;        /* the sample fraction to discard as burnin      */
+    int         allComps;              /* top conv diagnosis for all pairs?             */
+    MrBFlt      minPartFreq;           /* minimum partition frequency for conv diagn    */
+    MrBFlt      stopVal;               /* top conv diagn value to reach before stopping */
+    int         stopRule;              /* use stop rule?                                */
+    STATS       *stat;                 /* ptr to structs with mcmc diagnostics info     */
+    Tree        *dtree;                /* pointing to tree used for conv diagnostics    */
+    TreeList    *treeList;             /* vector of tree lists for saving trees         */
+    int         saveTrees;             /* save tree samples for later removal?          */
+    int         stopTreeGen;           /* generation after which no trees need be saved */
+    fpos_t      *tFilePos;             /* position for reading trees for removal        */
+    int         printMax;              /* maximum number of chains to print             */
+    int         printAll;              /* whether to print all or only cold chains      */
+    int         checkPoint;            /* should we use check-pointing?                 */
+    int         checkFreq;             /* check-pointing frequency                      */
+    int         runWithData;           /* should we run with or without data?           */
+    int         orderTaxa;             /* order taxa before printing tree to file?      */
+    int         append;                /* order taxa before printing tree to file?      */
+    int         autotune;              /* autotune tuning parameters of proposals ?     */
+    int         tuneFreq;              /* autotuning frequency                          */
+    } Chain;
+
+typedef struct modelinfo
+    {
+    /* General model information */
+    int         dataType;                   /* data type for partition                  */
+    int         nucModelId;                 /* structure of nucleotide model            */
+    int         nst;                        /* # substitution types                     */
+    int         aaModelId;                  /* amino acid model type                    */
+    int         parsModelId;                /* is parsimony model used YES/NO           */
+
+    /* Specific model information */
+    int         numGammaCats;               /* number of gamma cats (1 if inapplic.)    */
+    int         numBetaCats;                /* number of beta cats (1 if inapplic.)     */
+    int         numOmegaCats;               /* number of omega cats (1 if inapplic.)    */
+    int         numTiCats;                  /* number of cats needing different tis     */
+    int         numModelStates;             /* number of states including hidden ones   */
+    int         numStates;                  /* number of observable discrete states     */
+
+    /* Model parameter pointers */
+    Param       *tRatio;                    /* ptr to tRatio used in model              */
+    Param       *revMat;                    /* ptr to revMat used in model              */
+    Param       *omega;                     /* ptr to omega used in model               */
+    Param       *stateFreq;                 /* ptr to statFreq used in model            */
+    Param       *shape;                     /* ptr to shape used in model               */
+    Param       *pInvar;                    /* ptr to pInvar used in model              */
+    Param       *correlation;               /* ptr to correlation used in model         */
+    Param       *switchRates;               /* ptr to switchRates (off<->on)            */
+    Param       *rateMult;                  /* ptr to parition rateMult used in model   */
+    Param       *geneTreeRateMult;          /* ptr to gene tree rateMult used in model  */
+    Param       *speciationRates;           /* ptr to speciationRates used in model     */
+    Param       *extinctionRates;           /* ptr to extinctionRates used in model     */
+    Param       *fossilizationRates;        /* ptr to fossilizationRates                */
+    Param       *popSize;                   /* ptr to population size used in model     */
+    Param       *growthRate;                /* ptr to growth rate used in model         */
+    Param       *topology;                  /* ptr to topology used in model            */
+    Param       *brlens;                    /* ptr to brlens (and tree) used in model   */
+    Param       *speciesTree;               /* ptr to species tree used in model        */
+    Param       *aaModel;                   /* ptr to amino acid matrix used            */
+    Param       *cppMultDev;                /* ptr to cpp ratemult lognormal variance   */
+    Param       *cppRate;                   /* ptr to CPP rate used in model            */
+    Param       *cppEvents;                 /* ptr to CPP events                        */
+    Param       *tk02var;                   /* ptr to variance for TK02 relaxed clock   */
+    Param       *tk02BranchRates;           /* ptr to branch rates for TK02 relaxed clock */
+    Param       *igrvar;                    /* ptr to gamma var for IGR relaxed clock   */
+    Param       *igrBranchRates;            /* ptr to branch rates for IGR relaxed clock*/
+    Param       *mixedvar;                  /* ptr to var for mixed relaxed clock       */
+    Param       *mixedBrchRates;            /* ptr to branch rates for mixed relaxed clock */
+    Param       *clockRate;                 /* ptr to clock rate parameter              */
+
+    /* Information about characters and transformations */
+    int         numChars;                   /* number of compressed characters          */
+    int         numUncompressedChars;       /* number of uncompressed characters        */
+    int         numDummyChars;              /* number of dummy characters               */
+    int         compMatrixStart;            /* start column in compressed matrix        */
+    int         compMatrixStop;             /* stop column in compressed matrix         */
+    int         compCharStart;              /* start char among compressed chars        */
+    int         compCharStop;               /* stop char among compressed chars         */
+    int         parsMatrixStart;            /* start column in parsimony matrix         */
+    int         parsMatrixStop;             /* stop collumn in parsimony matrix         */
+    int         nParsIntsPerSite;           /* # parsimony ints per character           */  
+    int         nCharsPerSite;              /* number chars per site (eg 3 for codon)   */
+    int         rateProbStart;              /* start of rate probs (for adgamma)        */
+                
+     /* Variables for eigen decompositions */
+    int         cijkLength;                 /* stores length of cijk vector                 */
+    int         nCijkParts;                 /* stores number of cijk partitions (1 except for omega/covarion models) */
+    int         upDateCijk;                 /* whether cijk vector needs to be updated      */
+
+    /* Variables for standard model */
+    int         *tiIndex;                   /* index to trans probs for each compressed char*/
+    int         *bsIndex;                   /* index to stat freqs for each compressed char */
+    int         *nStates;                   /* # states of each compressed char             */
+    int         *cType;                     /* whether char is ord, unord or irrev          */
+    int         *weight;                    /* prior weight of each compressed char         */
+    int         isTiNeeded[20];             /* marks whether a trans prob matrix is needed  */
+
+    /* Gibbs sampling of gamma site rate parameters */
+    CLFlt       ***catLike;                 /* likelihood for Gibbs sampling of gamma       */
+    CLFlt       ***catLnScaler;             /* scaler for Gibbs sampling of gamma           */
+    int         gibbsGamma;                 /* flags whether Gibbs sampling of discrete gamma is used */
+    int         gibbsFreq;                  /* frequency of Gibbs resampling of discrete gamma */
+    
+    /* Variables for parsimony sets and parsimony calculations */
+    MrBFlt      parsTreeLength[MAX_CHAINS*2];   /* parsimony tree lengths for chains        */
+    BitsLong    **parsSets;                 /* parsimony sets                               */
+    int         numParsSets;                /* number of parsimony sets                     */
+    CLFlt       *parsNodeLens;              /* parsimony node lengths                       */
+    int         numParsNodeLens;            /* number of parsimony node lengths             */
+
+    /* Miscellaneous parameters */
+    int         mark;                       /* scratch parameter                            */
+    int         parsimonyBasedMove;         /* is parsimony-based move used (YES/NO)        */
+
+    /* Variables for conditional likelihoods */
+    int         upDateCl;                   /* flags whether update of cond likes needed    */
+    int         upDateAll;                  /* flags whether update of entire tree is needed*/
+    int         *isPartAmbig;               /* is tip partially ambiguous?                  */
+    int         **termState;                /* index arrays for terminal branch shortcuts   */
+    CLFlt       *invCondLikes;              /* space for the invariable cond likes          */
+    CLFlt       **condLikes;                /* space for the cond likes                     */
+    CLFlt       **tiProbs;                  /* space for the ti probs                       */
+    CLFlt       **scalers;                  /* space for the node and site scalers          */
+    CLFlt       **clP;                      /* handy pointers to cond likes for ti cats     */
+#if defined (SSE_ENABLED)
+    __m128      **clP_SSE;                  /* handy pointers to cond likes, SSE version    */
+    int         numSSEChars;                /* number of compact SSE character groups       */
+    CLFlt       *lnL_SSE;                   /* temp storage for log site likes              */
+    CLFlt       *lnLI_SSE;                  /* temp storage for log site invariable likes   */
+#endif
+    MrBFlt      **cijks;                    /* space for cijks                              */
+    int         **condLikeIndex;            /* index to cond like space for nodes & chains  */
+    int         *condLikeScratchIndex;      /* index to scratch space for node cond likes   */
+    int         **nodeScalerIndex;          /* index to scaler space for nodes & chains     */
+    int         *nodeScalerScratchIndex;    /* index to scratch space for node scalers      */
+    int         **scalersSet;               /* flags whether scalers are set                */
+    int         *scalersSetScratch;         /* scratch flag for whether scalers are set     */
+    int         *siteScalerIndex;           /* index to site scaler space for chains        */
+    int         siteScalerScratchIndex;     /* index to scratch space for site scalers      */
+    int         **tiProbsIndex;             /* index to ti probs for branches & chains      */
+    int         *tiProbsScratchIndex;       /* index to scratch space for branch ti probs   */
+    int         *cijkIndex;                 /* index to cijks for chains                    */
+    int         cijkScratchIndex;           /* index to scratch space for cijks             */
+    int         numCondLikes;               /* number of cond like arrays                   */
+    int         numScalers;                 /* number of scaler arrays                      */
+    int         numTiProbs;                 /* number of ti prob arrays                     */
+    int         condLikeLength;             /* length of cond like array (incl. ti cats)    */
+    int         tiProbLength;               /* length of ti prob array                      */
+    MrBFlt      lnLike[MAX_CHAINS];         /* log like for chain                           */
+    CLFlt       *ancStateCondLikes;         /* ancestral state cond like array              */
+
+    /* Likelihood function pointers */
+    LikeDownFxn         CondLikeDown;       /* function for calculating partials            */
+    LikeRootFxn         CondLikeRoot;       /* function for calculating partials at root    */
+    LikeScalerFxn       CondLikeScaler;     /* function for scaling partials                */
+    LikeFxn             Likelihood;         /* function for getting cond likes for tree     */
+    TiProbFxn           TiProbs;            /* function for calculating transition probs    */
+    LikeUpFxn           CondLikeUp;         /* final-pass calculation of cond likes         */
+    PrintAncStFxn       PrintAncStates;     /* function for sampling ancestral states       */
+    StateCodeFxn        StateCode;          /* function for getting states from codes       */
+    PrintSiteRateFxn    PrintSiteRates;     /* function for samling site rates              */
+    PosSelProbsFxn      PosSelProbs;        /* function for sampling pos. selection probs   */
+    SiteOmegasFxn       SiteOmegas;         /* function for sampling site omega values      */
+
+    /* Report variables */
+    int         printAncStates;             /* should ancestral states be printed (YES/NO)  */
+    int         printSiteRates;             /* should site rates be printed (YES/NO)        */
+    int         printPosSel;                /* should selection be printed (YES/NO)         */
+    int         printSiteOmegas;            /* should site omegas be printed (YES/NO)       */
+
+    /* likelihood calculator flags */
+    int         useBeagle;                  /* use Beagle for this partition?               */
+    int         useSSE;                     /* use SSE for this partition?                  */
+
+#if defined (BEAGLE_ENABLED)
+    /* Beagle variables */
+    int         useBeagleResource;          /* try to use this BEAGLE resource number       */
+    MrBFlt*     branchLengths;              /* array of branch lengths for Beagle           */
+    MrBFlt*     inRates;                    /* array of category rates for Beagle           */
+    int*        tiProbIndices;              /* array of trans prob indices for Beagle       */
+    MrBFlt*     logLikelihoods;             /* array of log likelihoods from Beagle         */
+    int         beagleInstance;             /* beagle instance for division                 */
+    MrBFlt*     inWeights;                  /* array of weights for Beagle root likelihood  */
+    int*        bufferIndices;              /* array of partial indices for root likelihood */
+    int*        eigenIndices;               /* array of eigen indices for root likelihood   */
+    int*        childBufferIndices;         /* array of child partial indices (unrooted)    */
+    int*        childTiProbIndices;         /* array of child ti prob indices (unrooted)    */
+    int*        cumulativeScaleIndices;     /* array of cumulative scale indices            */
+    int         rescaleBeagleAll;           /* set to rescale all nodes                     */
+    int*        rescaleFreq;                /* rescale frequency for each chain's tree      */
+    int         rescaleFreqOld;             /* holds rescale frequency of current state     */
+    int         recalculateScalers;         /* shoud we recalculate scalers for current state YES/NO */
+    int*        succesCount;                /* count number of succesful computation since last reset of scalers */
+    int**       isScalerNode;               /* for each node and chain set to YES if scaled node */
+    int*        isScalerNodeScratch;        /* scratch space to hold isScalerNode of proposed state*/
+    long*       beagleComputeCount;         /* count of number of calls to likelihood       */
+#endif
+
+    } ModelInfo;
+
+typedef struct sumt
+    {
+    int        *absentTaxa;            /* information on absent taxa                    */
+    int         brlensDef;             /* branch lengths defined?                       */
+    char        sumtFileName[100];     /* name of input file                            */
+    char        sumtOutfile[120];      /* name of output file                           */
+    char        curFileName[120];      /* name of file being processed                  */
+    int         burnin;                /* actual burnin when parsing tree files         */
+    char        sumtConType[100];      /* consensus tree type                           */
+    int         calcTreeprobs;         /* should the individual tree probs be calculated*/
+    int         showSumtTrees;         /* should the individual tree probs be shown     */
+    int         printBrlensToFile;     /* should branch lengths be printed to file      */
+    MrBFlt      brlensFreqDisplay;     /* threshold for printing branch lengths to file */
+    int         numRuns;               /* number of independent analyses to summarize   */
+    int         numTrees;              /* number of tree params to summarize            */
+    int         orderTaxa;             /* order taxa in trees?                          */
+    MrBFlt      minPartFreq;           /* minimum part. freq. for overall diagnostics   */
+    int         table;                 /* show table of partition frequencies?          */
+    int         summary;               /* show summary diagnostics ?                    */
+    int         showConsensus;         /* show consensus trees ?                        */
+    int         consensusFormat;       /* format of consensus tree                      */
+    PolyTree   *tree;                  /* for storing tree read from file               */
+    int        *order;                 /* for storing topology read from file           */
+    int         orderLen;              /* length of order array                         */
+    int         numTreesInLastBlock;   /* number of trees in last block                 */
+    int         numTreesEncountered;   /* number of trees encounted in total            */
+    int         numTreesSampled;       /* number of sampled trees in total              */
+    int         isRooted;              /* is sumt tree rooted ?                         */
+    int         isRelaxed;             /* is sumt tree a relaxed clock tree ?           */
+    int         isClock;               /* is sumt tree a clock tree ?                   */
+    int         isCalibrated;          /* is sumt tree calibrated ?                     */
+    int         nESets;                /* number of event sets                          */
+    int         nBSets;                /* number of branch rate sets                    */
+    char      **bSetName;              /* name of effective branch length sets          */
+    char      **eSetName;              /* name of event sets                            */
+    int         popSizeSet;            /* do sumt trees have population size set?       */
+    char       *popSizeSetName;        /* name of population size set                   */
+    int         BitsLongsNeeded;       /* number of safe longs needed for taxon bits    */
+    int         runId;                 /* id of run being processed                     */
+    int         numTaxa;               /* number of sumt taxa                           */
+    char      **taxaNames;             /* names of sumt taxa                            */
+    int        *numFileTrees;          /* number of trees per file                      */
+    int        *numFileTreesSampled;   /* number of trees sampled per file              */
+    int         HPD;                   /* use highest posterior density?                */
+    } Sumt;
+
+/* formats for consensus trees */
+#define SIMPLE      0
+#define FIGTREE     1
+
+typedef struct comptree
+    {
+    char        comptFileName1[120];   /* name of first input file                      */
+    char        comptFileName2[120];   /* name of second input file                     */
+    char        comptOutfile[120];     /* name of output file                           */
+    int         burnin;                /* actual burnin used when parsing tree files    */
+    MrBFlt      minPartFreq;           /* use partitions with frequency >= minPartFreq  */
+    } Comptree;
+
+typedef struct sump
+    {
+    char        sumpFileName[100];     /* name of input file                            */
+    char        sumpOutfile[120];      /* name of output file                           */
+    //int       plot;                  /* output plot (y/n)?                            */
+    int         table;                 /* output table (y/n)?                           */
+    int         margLike;              /* output marginal likelihood (y/n)?             */
+    int         numRuns;               /* number of independent analyses to summarize   */
+    int         allRuns;               /* should data for all runs be printed (yes/no)? */
+    int         HPD;                   /* use highest posterior density?                */
+    MrBFlt      minProb;               /* cut-off for model probabilities to show       */
+    } Sump;
+
+typedef struct sumss
+    {
+    //int       plot;                  /* output plot (y/n)?                            */
+    int         numRuns;               /* number of independent analyses to summarize   */
+    int         allRuns;               /* should data for all runs be printed (yes/no)? */
+    int         stepToPlot;            /* Which step to plot in the step plot           */
+    int         askForMorePlots;       /* Should user be asked to plot for different discardfraction (y/n)?  */
+    int         smoothing;             /* An integer indicating number of neighbors to average over when dooing smoothing of curvs on plots */
+    MrBFlt      discardFraction;       /* Proportion of samples discarded when ploting step plot.*/
+    } Sumss;
+
+typedef struct plot
+    {
+    char        plotFileName[120];     /* name of input file                            */
+    char        parameter[100];        /* parameter(s) to be plotted                    */
+    char        match[100];            /* whether the match needs to be perfect         */
+    } Plot;
+
+typedef struct
+    {
+    int         numTrees;              /* number of trees to reassemble                 */
+    int         numRuns;               /* number of runs to reassemble                  */
+    } ReassembleInfo;
+
+typedef struct doublet
+    {
+    BitsLong    first, second;
+    } Doublet;
+
+typedef struct matrix
+    {
+    BitsLong *origin;
+    int rowSize;
+    int nRows;
+    int column;
+    int row;
+    } Matrix;
+
+typedef struct charinfo
+    {
+    int dType;
+    int cType;
+    int nStates;
+    int constant[10];
+    int singleton[10];
+    int variable;
+    int informative;
+    } CharInfo;
+    
+typedef struct 
+    {
+    int         isExcluded;            /* is the character excluded                     */
+    int         numStates;             /* number of observed states for the character   */
+    int         charType;              /* type of character                             */
+    int         isMissAmbig;           /* is the character missing or ambiguous         */
+    int         ctype;                 /* ordering of character                         */
+    int         charId;                /* char ID index for doublet and codon models    */
+    int         pairsId;               /* char ID for doublets                          */
+    int         bigBreakAfter;         /* is there a large break after this character   */
+    }
+    CharInformation;
+
+typedef struct 
+    {
+    int         isDeleted;             /* is the taxon deleted                          */
+    int         charCount;             /* count holder                                  */
+    }
+    TaxaInformation;
+
+typedef struct
+    {
+    MrBFlt      curScore;
+    MrBFlt      minScore;
+    MrBFlt      totalScore;
+    MrBFlt      stopScore;
+    MrBFlt      warp;
+    TreeNode    **leaf;
+    TreeNode    **vertex;
+    }
+    TreeInfo;
+
+typedef struct
+    {
+    int     allavailable;
+    }
+    ShowmovesParams;
+
+typedef struct
+    {
+    int     numNames;
+    char    **names;
+    }
+    NameSet;
+
+/* global variables */
+extern int              abortMove;                              /* flag determining whether to abort move        */
+extern int              *activeParams[NUM_LINKED];              /* a table holding the parameter status          */
+extern int              *activeParts;                           /* partitions changes should apply to            */
+extern int              autoClose;                              /* autoclose                                     */
+extern int              autoOverwrite;                          /* Overwrite or append outputfiles when nowarnings=yes */
+extern int              chainHasAdgamma;                        /* indicates if chain has adgamma HMMs           */
+extern Chain            chainParams;                            /* holds parameters for Markov chain             */
+extern CharInformation  *charInfo;                              /* holds critical information about characters   */
+extern char             **charSetNames;                         /* holds names of character sets                 */
+extern int              *compCharPos;                           /* char position in compressed matrix            */
+extern int              *compColPos;                            /* column position in compressed matrix          */
+extern BitsLong         *compMatrix;                            /* compressed character matrix                   */
+extern int              compMatrixRowSize;                      /* row size of compressed matrix                 */
+extern Comptree         comptreeParams;                         /* holds parameters for comparetree command      */
+extern char             **constraintNames;                      /* holds names of constraints                    */
+extern BitsLong         **definedConstraint;                    /* holds information about defined constraints   */
+extern BitsLong         **definedConstraintTwo;                 /* bitfields representing second taxa sets of defined constraints (for PARTIAL constraints) */
+extern BitsLong         **definedConstraintPruned;              /* bitfields representing taxa sets of defined constraints after delited taxa are removed */
+extern BitsLong         **definedConstraintTwoPruned;           /* bitfields representing second taxa sets of defined constraints after delited taxa are removed (for PARTIAL constraints) */
+extern int              dataType;                               /* type of data                                  */
+extern Calibration      defaultCalibration;                     /* default model settings                        */
+extern ModelParams      defaultModel;                           /* default model settings                        */
+extern int              defChars;                               /* flag for whether number of characters is known*/
+extern int              defMatrix;                              /* flag for whether matrix is successfull read   */
+extern int              defPairs;                               /* flag for whether constraints on tree are read */
+extern int              defPartition;                           /* flag for whether character partition is read  */
+extern int              defTaxa;                                /* are taxon labels defined ?                    */
+extern Doublet          doublet[16];                            /* holds information on states for doublets      */
+extern int              echoMB;                                 /* flag used by Manual to prevent echoing        */
+extern BitsLong         expecting;                              /* variable denoting expected token type         */
+extern int              fileNameChanged;                        /* has file name been changed?                   */
+extern int              foundNewLine;                           /* whether a new line has been found             */
+extern char             gapId;                                  /* gap character Id                              */
+extern RandLong         globalSeed;                             /* seed that is initialized at start up          */
+extern char             **headerNames;                          /* string to hold headers in sump and plot       */
+extern int              inComment;                              /* flag for whether input stream is commented    */
+extern int              inferAncStates;                         /* should ancestral states be inferred (y/n)     */
+extern int              inferSiteOmegas;                        /* should site omega values be inferred (y/n)    */
+extern int              inferSiteRates;                         /* should site rates be inferred (y/n)           */
+extern int              inferPosSel;                            /* should positive selection be inferred (y/n)   */
+extern char             inputFileName[100];                     /* input (NEXUS) file name                       */
+extern int              inTreesBlock;                           /* are we in the sumt block                      */
+extern int              inValidCommand;                         /* a useful flag set whenever you enter a cmd    */
+extern int              isInAmbig, isInPoly;                    /* flags whether we are within () or {}          */
+extern int              isMixed;                                /* flags whether dataset is mixed                */
+extern int              inMrbayesBlock;                         /* flag for whether we are in a mrbayes block    */
+extern int              *intValues;                             /* integer values of parameters                  */
+extern int              isTaxsetDef;                            /* is a taxon set defined                        */
+extern int              isTranslateDef;                         /* is a translation block defined                */
+extern int              isTranslateDiff;                        /* is translate different from current taxaset?  */
+extern int              *linkTable[NUM_LINKED];                 /* how parameters are linked across parts        */
+extern int              localOutGroup;                          /* outgroup for non-excluded taxa                */
+extern char             **localTaxonNames;                      /* points to names of non-excluded taxa          */
+extern FILE             *logFileFp;                             /* file pointer to log file                      */
+extern char             logFileName[100];                       /* name of the log file                          */
+extern int              logToFile;                              /* should screen output be logged to a file      */
+extern char             manFileName[100];                       /* name of man file                              */
+extern char             matchId;                                /* mach character Id                             */
+extern int              *matrix;                                /* matrix containing original data               */
+extern int              matrixHasPoly;                          /* flag for whether matrix has polymorphisms     */
+extern int              memAllocs[NUM_ALLOCS];                  /* allocated memory flags                        */
+extern int              mode;                                   /* mode of program (interactive/noninteractive)  */
+extern char             **modelIndicatorParams;                 /* model indicator params                        */
+extern char             ***modelElementNames;                   /* names for component models                    */
+extern MCMCMove         **moves;                                /* vector of applicable moves                    */
+extern MoveType         moveTypes[NUM_MOVE_TYPES];              /* holds information on the move types           */
+extern char             missingId;                              /* missing character Id                          */
+extern Tree             **mcmcTree;                             /* pointers to mcmc trees                        */
+extern Model            *modelParams;                           /* holds model params for partitions             */
+extern ModelInfo        *modelSettings;                         /* stores important info on model params         */
+extern int              nBitsInALong;                           /* number of bits in a BitsLong                  */
+extern Calibration      *nodeCalibration;                       /* holds information about node calibrations     */
+extern int              noWarn;                                 /* no warnings on overwriting files              */
+extern int              nPThreads;                              /* number of pthreads to use                     */
+extern int              numActiveLocks;                         /* number of active, locked nodes                */
+extern int              numApplicableMoves;                     /* number of moves applicable to parameters      */
+extern int              numChar;                                /* number of characters in character matrix      */
+extern int              numCharSets;                            /* holds number of character sets                */
+extern int              numComments;                            /* number of nested comments                     */
+extern int              numCompressedChars;                     /* number of compressed characters               */
+extern int              numCurrentDivisions;                    /* number of partitions of data                  */
+extern int              numDefinedConstraints;                  /* number of constraints defined                 */
+extern enum ConstraintType  *definedConstraintsType;            /* Store type of constraint                      */
+extern int              numDefinedPartitions;                   /* number of partitions defined                  */
+extern int              numDefinedSpeciespartitions;            /* number of species partitions defined          */
+extern int              numGlobalChains;                        /* number of global chains                       */
+extern int              numLocalTaxa;                           /* number of non-excluded taxa                   */
+extern int              numLocalChar;                           /* number of non-excluded characters             */
+extern int              numMoveTypes;                           /* the number of move types                      */
+extern int              numOpenExeFiles;                        /* number of execute files open                  */
+extern int              numParams;                              /* number of parameters in model                 */
+extern int              numDivisions;                           /* number of current divisions                   */
+extern int              numPrintParams;                         /* number of substitution model parameters to print */
+extern int              numPrintTreeParams;                     /* number of tree model parameters to print      */
+extern CLFlt            *numSitesOfPat;                         /* no. sites of each pattern                     */
+extern int              numSpecies;                             /* number of species in current speciespartition */
+extern int              numTaxa;                                /* number of taxa in character matrix            */
+extern int              numTaxaSets;                            /* holds number of taxa sets                     */
+extern int              numTopologies;                          /* number of topologies for one chain and state  */
+extern int              numTranslates;                          /* number of taxa in active translate block      */
+extern int              numTrees;                               /* number of trees for one chain and state       */
+extern int              numUserTrees;                           /* number of defined user trees                  */
+extern int              *numVars;                               /* number of variables in setting arrays         */
+extern int              *origChar;                              /* index from compressed char to original char   */
+extern int              outGroupNum;                            /* number of outgroup taxon                      */
+extern ParmInfo         paramTable[];                           /* information on parameters                     */
+extern MrBFlt           *paramValues;                           /* values of parameters                          */
+extern int              **partitionId;                          /* holds information about defined partitions    */
+extern char             **partitionNames;                       /* hold names of partitions (first is "default") */
+extern MrBFlt           *parameterValues;                       /* vector holding sump or plot parameters        */
+extern Param            *params;                                /* vector of parameters in model                 */
+extern int              partitionNum;                           /* index of current partition                    */
+extern Plot             plotParams;                             /* holds parameters for plot command             */
+extern int              precision;                              /* precision of samples and summary stats        */
+extern int              *printAncStates;                        /* divisions to print anc states for             */
+extern int              quitOnError;                            /* quit on error?                                */
+extern int              readComment;                            /* should we read comment (looking for &)?       */
+extern int              readWord;                               /* should we read a word next?                   */
+extern ReassembleInfo   reassembleParams;                       /* holds parameters for reassemble command       */
+extern int              replaceLogFile;                         /* should logfile be replace/appended to         */
+extern RandLong         runIDSeed;                              /* seed used only for generating run ID [stamp]  */
+extern BitsLong         bitsLongWithAllBitsSet;                 /* a BitsLong with all bits set, for bit ops     */
+extern int              setUpAnalysisSuccess;                   /* Set to YES if analysis is set without error   */
+extern int              scientific;                             /* use scientific format for samples ?           */
+extern ShowmovesParams  showmovesParams;                        /* holds parameters for Showmoves command        */
+extern char             spacer[10];                             /* holds blanks for printing indentations        */
+extern NameSet          *speciesNameSets;                       /* hold species name sets, one for each speciespartition */
+extern int              **speciespartitionId;                   /* holds info about defined speciespartitions    */
+extern char             **speciespartitionNames;                /* hold names of speciespartitions (first is "default") */
+extern int              speciespartitionNum;                    /* index of current species partition            */
+extern char             stamp[11];                              /* holds a unique identifier for each analysis   */
+extern RandLong         swapSeed;                               /* seed used only for determining which to swap  */
+extern int              state[MAX_CHAINS];                      /* state of chain                                */
+extern MrBFlt           *stdStateFreqs;                         /* std char state frequencies                    */
+extern int              *stdType;                               /* compressed std char type: ord, unord, irrev   */
+extern Sump             sumpParams;                             /* holds parameters for sump command             */
+extern char             sumpToken[];                            /* string holding a .p file token                */
+extern char             *sumpTokenP;                            /* pointer to a .p file token                    */
+extern Sumt             sumtParams;                             /* holds parameters for sumt command             */
+extern Sumss            sumssParams;                            /* holds parameters for sumss command            */
+extern int              stdStateFreqsRowSize;                   /* row size for stdStateFreqs                    */
+extern int              *sympiIndex;                            /* sympi state freq index for multistate chars   */
+extern TaxaInformation  *taxaInfo;                              /* holds critical information about taxa         */
+extern char             **taxaNames;                            /* holds name of taxa                            */
+extern char             **taxaSetNames;                         /* holds names of taxa sets                      */
+extern BitsLong         **taxaSet;                              /* holds information about defined taxasets      */
+extern int              *tempActiveConstraints;                 /* info on the active constraints in prset       */
+extern int              *tempLinkUnlink[NUM_LINKED];            /* for changing parameter linkage                */
+extern int              *tempLinkUnlinkVec;                     /* for changing parameter linkage                */
+extern MrBFlt           *tempNum;                               /* vector of numbers used for setting arrays     */
+extern int              *tempSet;                               /* temporarily holds defined character set       */
+extern int              theAmbigChar;                           /* int containing ambiguous character            */
+extern int              *tiIndex;                               /* compressed std char ti index                  */
+extern Calibration      *tipCalibration;                        /* holds tip calibrations                        */
+extern char             **transFrom;                            /* translation block information                 */
+extern char             **transTo;                              /* translation block information                 */
+extern int              userBrlensDef;                          /* are the branch lengths on user tree defined   */
+extern int              userLevel;                              /* the level of the user                         */
+extern PolyTree         *userTree[];                            /* array of user trees                           */
+extern char             workingDir[100];                        /* working directory                             */
+#if defined (BEAGLE_ENABLED)
+extern int              tryToUseBEAGLE;                         /* try to use the BEAGLE library                 */
+extern long             beagleFlags;                            /* BEAGLE requirement flags                      */
+extern int              beagleResourceNumber;                   /* BEAGLE resource number                        */
+extern int*             beagleResource;                         /* BEAGLE resource list                          */
+extern int              beagleResourceCount;                    /* BEAGLE resource list length                   */
+extern int              beagleInstanceCount;                    /* total number of BEAGLE instances              */
+extern int              beagleScalingScheme;                    /* BEAGLE dynamic scaling                        */
+extern int              beagleScalingFrequency;                 /* BEAGLE rescaling frequency                    */
+extern int              recalcScalers;                      /* shoud we recalculate scalers for one of divisions for current state YES/NO */
+#endif
+#if defined (THREADS_ENABLED)
+extern int              tryToUseThreads;                        /* try to use pthreads with BEAGLE library       */
+#endif
+
+/* Aamodel parameters */
+extern MrBFlt           aaJones[20][20];             /* rates for Jones model                        */
+extern MrBFlt           aaDayhoff[20][20];           /* rates for Dayhoff model                      */
+extern MrBFlt           aaMtrev24[20][20];           /* rates for mtrev24 model                      */
+extern MrBFlt           aaMtmam[20][20];             /* rates for mtmam model                        */
+extern MrBFlt           aartREV[20][20];             /* rates for rtREV model                        */
+extern MrBFlt           aaWAG[20][20];               /* rates for WAG model                          */
+extern MrBFlt           aacpREV[20][20];             /* rates for aacpREV model                      */
+extern MrBFlt           aaVt[20][20];                /* rates for VT model                           */
+extern MrBFlt           aaBlosum[20][20];            /* rates for Blosum62 model                     */
+extern MrBFlt           aaLG[20][20];                /* rates for LG model                           */
+extern MrBFlt           jonesPi[20];                 /* stationary frequencies for Jones model       */
+extern MrBFlt           dayhoffPi[20];               /* stationary frequencies for Dayhoff model     */
+extern MrBFlt           mtrev24Pi[20];               /* stationary frequencies for mtrev24 model     */
+extern MrBFlt           mtmamPi[20];                 /* stationary frequencies for mtmam model       */
+extern MrBFlt           rtrevPi[20];                 /* stationary frequencies for rtREV model       */
+extern MrBFlt           wagPi[20];                   /* stationary frequencies for WAG model         */
+extern MrBFlt           cprevPi[20];                 /* stationary frequencies for aacpREV model     */
+extern MrBFlt           vtPi[20];                    /* stationary frequencies for VT model          */
+extern MrBFlt           blosPi[20];                  /* stationary frequencies for Blosum62 model    */
+extern MrBFlt           lgPi[20];                    /* stationary frequencies for LG model          */
+
+#if defined (PRINT_DUMP)
+FILE                    *dumpFile;                   /* for debugging logs */
+#endif
+
+#if defined (MPI_ENABLED)
+extern int              proc_id;                                /* process ID (0, 1, ..., num_procs-1)                        */
+extern int              num_procs;                              /* number of active processors                                */
+extern MrBFlt           myStateInfo[7];                         /* likelihood/prior/heat/ran/moveInfo vals of me              */
+extern MrBFlt           partnerStateInfo[7];                    /* likelihood/prior/heat/ran/moveInfo vals of partner         */
+#endif
+
+#if defined (FAST_LOG)
+extern CLFlt            scalerValue[];
+extern CLFlt            logValue[];
+#endif
+
+#endif  /* __BAYES_H__ */
diff --git a/src/best.c b/src/best.c
new file mode 100644 (file)
index 0000000..80ece57
--- /dev/null
@@ -0,0 +1,1788 @@
+/*
+ *  Best 2.2
+ *
+ *  This file contains the functions 
+ *  for calculating the probability of 
+ *  gene trees given the species tree 
+ *  and the prior probability of the 
+ *  species tree
+ *
+ *  Liang Liu
+ *  Department of Statistics
+ *  The Ohio State University
+ *  Columbus, Ohio
+ *  
+ *  liuliang@stat.ohio-state.edu
+ */
+
+#include    "bayes.h"
+#include    "best.h"
+#include    "command.h"
+#include    "mcmc.h"
+#include    "model.h"
+#include    "proposal.h"
+#include    "utils.h"
+
+const char* const svnRevisionBestC = "$Rev: 1040 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+
+/****************************** Local functions converted by Fredrik from BEST code *****************************/
+int         CompareDepths (const void *x, const void *y);
+int         CompareDoubles (const void *x, const void *y);
+int         CompareNodes (const void *x, const void *y);
+int         CompareNodesByX (const void *x, const void *y);
+int         GetSpeciesTreeFromMinDepths (Tree* speciesTree, double *depthMatrix);
+int         GetDepthMatrix(Tree * speciesTree, double *depthMatrix);
+int         GetMeanDist (Tree *speciesTree, double *depthMatrix, double *mean);
+int         GetMinDepthMatrix (Tree **geneTrees, int numGeneTrees, double *depthMatrix);
+void        LineagesIn (TreeNode* geneTreeNode, TreeNode* speciesTreeNode);
+double      LnPriorProbGeneTree (Tree *geneTree, double mu, Tree *speciesTree, double *popSizePtr);
+double      LnProposalProbSpeciesTree (Tree *speciesTree, double *depthMatrix, double expRate);
+void        MapGeneTreeToSpeciesTree (Tree *geneTree, Tree *speciesTree);
+int         ModifyDepthMatrix (double expRate, double *depthMatrix, RandLong *seed);
+
+/* Global BEST variables */
+BitsLong    **speciesPairSets;
+double      *depthMatrix;
+
+/* Allocate variables used by best code during mcmc */
+void AllocateBestChainVariables (void)
+{
+    int     i, j, index, numUpperTriang, nLongsNeeded;
+
+    // Free if by mistake variables are already allocated
+    if (memAllocs[ALLOC_BEST] == YES)
+        FreeBestChainVariables ();
+
+    // Allocate space for upper triangular pair sets
+    numUpperTriang     = (numSpecies * (numSpecies-1)) / 2;
+    nLongsNeeded       = ((numSpecies - 1) / nBitsInALong) + 1;
+    speciesPairSets    = (BitsLong **) SafeCalloc (numUpperTriang, sizeof(BitsLong *));
+    speciesPairSets[0] = (BitsLong *)  SafeCalloc (numUpperTriang*nLongsNeeded, sizeof(BitsLong));
+    for (i=1; i<numUpperTriang; i++)
+        speciesPairSets[i] = speciesPairSets[0] + i*nLongsNeeded;
+
+    // Set upper triangular pair partitions once and for all
+    index = 0;
+    for (i=0; i<numSpecies; i++) {
+        for (j=i+1; j<numSpecies; j++) {
+            SetBit(i, speciesPairSets[index]);
+            SetBit(j, speciesPairSets[index]);
+            index++;
+            }
+        }
+
+    /* allocate species for depthMatrix */
+    depthMatrix = SafeCalloc (numUpperTriang, sizeof(double));
+
+    memAllocs[ALLOC_BEST] = YES;
+}
+
+
+/** Compare function (Depth struct) for qsort */
+int CompareDepths (const void *x, const void *y) {
+
+    if ((*((Depth *)(x))).depth < (*((Depth *)(y))).depth)
+        return -1;
+    else if ((*((Depth *)(x))).depth > (*((Depth *)(y))).depth)
+        return 1;
+    else
+        return 0;
+}
+
+
+/** Compare function (doubles) for qsort */
+int CompareDoubles (const void *x, const void *y) {
+
+    if (*((double *)(x)) < *((double *)(y)))
+        return -1;
+    else if (*((double *)(x)) > *((double *)(y)))
+        return 1;
+    else
+        return 0;
+}
+
+
+/** Compare function (TreeNode struct) for qsort */
+int CompareNodes (const void *x, const void *y) {
+
+    if ((*((TreeNode **)(x)))->nodeDepth < (*((TreeNode**)(y)))->nodeDepth)
+        return -1;
+    else if ((*((TreeNode **)(x)))->nodeDepth > (*((TreeNode**)(y)))->nodeDepth)
+        return 1;
+    else
+        return 0;
+}
+
+
+/** Compare function (TreeNode struct; sort by x, then by nodeDepth) for qsort */
+int CompareNodesByX (const void *x, const void *y) {
+
+    if ((*((TreeNode **)(x)))->x < (*((TreeNode**)(y)))->x)
+        return -1;
+    else if ((*((TreeNode **)(x)))->x > (*((TreeNode**)(y)))->x)
+        return 1;
+    else {
+        if ((*((TreeNode **)(x)))->nodeDepth < (*((TreeNode**)(y)))->nodeDepth)
+            return -1;
+        else if ((*((TreeNode **)(x)))->nodeDepth > (*((TreeNode**)(y)))->nodeDepth)
+            return 1;
+        else
+            return 0;
+        }
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   FillSpeciesTreeParams: Fill in species trees (start value)
+|
+------------------------------------------------------------------*/
+int FillSpeciesTreeParams (RandLong *seed, int fromChain, int toChain)
+{
+    int         i, k, chn, numGeneTrees, freeBestChainVars;
+    Param       *p;
+    Tree        *speciesTree, **geneTrees;
+
+    // Allocate space for global best model variables used in this function, in case they are not allocated
+    if (memAllocs[ALLOC_BEST] == NO)
+        {
+        freeBestChainVars = YES;
+        AllocateBestChainVariables();
+        }
+    else
+        freeBestChainVars = NO;
+
+    // Use global variable numTopologies to calculate number of gene trees
+    // There is one topology for the species tree, the other ones are gene trees
+    // The number of current divisions is not safe because one gene tree can have
+    // several partitions, for instance if we assign the different genes on the
+    // mitochondrion different substitution models, or if we assign different rates
+    // to the codon site positions in a sequence
+    numGeneTrees = numTopologies - 1;
+    geneTrees   = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree*));
+
+    // Build species trees for state 0
+    for (chn=fromChain; chn<toChain; chn++)
+        {
+        for (k=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->paramType == P_SPECIESTREE)
+                {
+                // Find species tree and gene trees
+                speciesTree = GetTree(p, chn, 0);
+                for (i=0; i<p->nSubParams; i++)
+                    geneTrees[i] = GetTree(p->subParams[i], chn, 0);
+
+                // Get minimum depth matrix for species tree
+                GetMinDepthMatrix (geneTrees, numGeneTrees, depthMatrix);
+
+                // Get a species tree from min depth matrix
+                GetSpeciesTreeFromMinDepths(speciesTree, depthMatrix);
+
+                assert (IsSpeciesTreeConsistent(speciesTree, chn) == YES);
+                
+                // Label the tips
+                if (LabelTree (speciesTree, speciesNameSets[speciespartitionNum].names) == ERROR)
+                    {
+                    FreeBestChainVariables();
+                    return (ERROR);
+                    }
+                }
+            }
+        }
+
+    // Free gene trees
+    free (geneTrees);
+
+    // Free best model variables if appropriate
+    if (freeBestChainVars == YES)
+        FreeBestChainVariables();
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *seed); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   FreeBestChainVariables: Free best variables used during an mcmc
+|   run.
+|
+------------------------------------------------------------------*/
+void FreeBestChainVariables(void)
+{
+    if (memAllocs[ALLOC_BEST] == YES) {
+        free (speciesPairSets[0]);
+        free (speciesPairSets);
+        speciesPairSets = NULL;
+        }
+
+    free (depthMatrix);
+    depthMatrix = NULL;
+
+    memAllocs[ALLOC_BEST] = NO;
+}
+
+
+/**---------------------------------------------------------------------
+|
+|   GetDepthMatrix:
+|
+|   This algorithm calculates the upper triangular depth matrix for the
+|   species tree. Time complexity O(n^2).
+|
+|   @param      speciesTree     The species tree (in)
+|   @param      depthMatrix     The minimum depth matrix, upper triangular array (out)
+|   @returns    Returns ERROR or NO_ERROR
+----------------------------------------------------------------------*/
+int GetDepthMatrix (Tree *speciesTree, double *depthMatrix) {
+
+    int         i, left, right, numUpperTriang, index, nLongsNeeded, freeBitsets;
+    double      maxDepth;
+    TreeNode    *p;
+
+    // Make sure we have bitfields allocated and set
+    freeBitsets = NO;
+    if (speciesTree->bitsets == NULL)
+        {
+        AllocateTreePartitions(speciesTree);
+        freeBitsets = YES;
+        }
+    else
+        {
+        ResetTreePartitions(speciesTree);   // just in case
+        freeBitsets = NO;
+        }
+
+    // Calculate number of values in the upper triangular matrix
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+
+    // Number of longs needed in a bitfield representing a species set
+    nLongsNeeded   = ((numSpecies -1) / nBitsInALong) + 1;
+
+    // Set all cells to max
+    maxDepth = speciesTree->root->left->nodeDepth;  // root depth
+    for (i=0; i<numUpperTriang; i++)
+        depthMatrix[i] = maxDepth;
+
+    // Loop over interior nodes
+    for (i=0; i<speciesTree->nIntNodes; i++)
+        {
+        p = speciesTree->intDownPass[i];
+        for (left = FirstTaxonInPartition(p->left->partition, nLongsNeeded); left < numSpecies; left = NextTaxonInPartition(left, p->left->partition, nLongsNeeded))
+            {
+            for (right = FirstTaxonInPartition(p->right->partition, nLongsNeeded); right < numSpecies; right = NextTaxonInPartition(right, p->right->partition, nLongsNeeded))
+                {
+                index = UpperTriangIndex(left, right, numSpecies);
+                depthMatrix[index] = p->nodeDepth;
+                }
+            }
+        }
+
+    // Free partitions if appropriate
+    if (freeBitsets == YES)
+        FreeTreePartitions(speciesTree);
+
+    return (NO_ERROR);
+}
+
+
+/**---------------------------------------------------------------------
+|
+|   GetMeanDist
+|
+|   This algorithm calculates the mean distance between a distance matrix
+|   and the minimum depths that define a species tree.
+|
+|   @param      speciesTree     The species tree (in)
+|   @param      minDepthMatrix  The minimum depth matrix, upper triangular array (in)
+|   @param      mean            The mean distance (out)
+|   @returns    Returns ERROR or NO_ERROR
+----------------------------------------------------------------------*/
+int GetMeanDist (Tree *speciesTree, double *minDepthMatrix, double *mean) {
+
+    int         i, left, right, index, nLongsNeeded, freeBitsets;
+    double      dist, minDist=0.0, distSum;
+    TreeNode    *p;
+
+    // Make sure we have bitfields allocated and set
+    freeBitsets = NO;
+    if (speciesTree->bitsets == NULL)
+        {
+        AllocateTreePartitions(speciesTree);
+        freeBitsets = YES;
+        }
+    else
+        {
+        ResetTreePartitions(speciesTree);   // just in case
+        freeBitsets = NO;
+        }
+
+    // Number of longs needed in a bitfield representing a species set
+    nLongsNeeded   = ((numSpecies -1) / nBitsInALong) + 1;
+
+    // Loop over interior nodes
+    distSum = 0.0;
+    for (i=0; i<speciesTree->nIntNodes; i++)
+        {
+        p = speciesTree->intDownPass[i];
+        p->x = 0;
+        while ((left=FirstTaxonInPartition(p->left->partition, nLongsNeeded)) < numSpecies)
+            {
+            while ((right=FirstTaxonInPartition(p->right->partition, nLongsNeeded)) < numSpecies)
+                {
+                p->x++;
+                index = UpperTriangIndex(left, right, numSpecies);
+                dist = depthMatrix[index] - p->nodeDepth;
+                if (p->x == 1)
+                    minDist = dist;
+                else if (dist < minDist)
+                    minDist = dist;
+                ClearBit(right, p->right->partition);
+                }
+            ClearBit(left, p->left->partition);
+            }
+        distSum += minDist;
+        }
+
+    (*mean) = distSum / speciesTree->nIntNodes;
+
+    // Reset partitions that were destroyed above or free partitions, as appropriate
+    if (freeBitsets == YES)
+        FreeTreePartitions(speciesTree);
+    else
+        ResetTreePartitions(speciesTree);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *minDepthMatrix); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/**---------------------------------------------------------------------
+|
+|   GetMinDepthMatrix: converted from GetMinDists.
+|
+|   This algorithm scans the gene trees and calculates the minimum depth
+|   (height) separating species across gene trees. The complexity of the
+|   original algorithm was O(mn^3), where m is the number of gene trees and
+|   n is the number of taxa in each gene tree. I think this algorithm has
+|   complexity that is better on average, but the difference is small.
+|
+|   I have rewritten the algorithm also to show alternative techniques that
+|   could be used in this and other BEST algorithms.
+|
+|   @param      geneTrees       The gene trees (in)
+|   @param      depthMatrix     The minimum depth matrix, upper triangular array (out)
+|   @returns    Returns ERROR or NO_ERROR
+----------------------------------------------------------------------*/
+int GetMinDepthMatrix (Tree **geneTrees, int numGeneTrees, double *depthMatrix) {
+
+    int         i, j, w, nLongsNeeded, numUpperTriang, index, trace=0;
+    double      maxDepth;
+    TreeNode    *p;
+    BitsLong    **speciesSets;
+
+    // Allocate space for species partitions
+    nLongsNeeded   = ((numSpecies -1) / nBitsInALong) + 1;   // number of longs needed in a bitfield representing a species set
+    speciesSets    = (BitsLong **) SafeCalloc ((2*(size_t)numLocalTaxa-1), sizeof(BitsLong *));
+    speciesSets[0] = (BitsLong *)  SafeCalloc ((2*(size_t)numLocalTaxa-1)*nLongsNeeded, sizeof(BitsLong));
+    for (i=1; i<2*numLocalTaxa-1; i++)
+        speciesSets[i] = speciesSets[0] + i*nLongsNeeded;
+
+    // Set tip species partitions once and for all
+    for (i=0; i<numLocalTaxa; i++)
+        SetBit(speciespartitionId[i][speciespartitionNum]-1, speciesSets[i]);
+
+    // Set initial max depth for upper triangular matrix
+    numUpperTriang = (numSpecies * (numSpecies - 1)) / 2;
+    maxDepth       = geneTrees[0]->root->left->nodeDepth;
+    for (i=0; i<numUpperTriang; i++)
+        depthMatrix[i] = maxDepth;
+
+    // Now we are ready to cycle over gene trees
+    for (w=0; w<numGeneTrees; w++)
+        {
+        if (trace) {
+            printf ("\nGene %d\n",w);
+            ShowTree(geneTrees[w]);
+            }
+
+        // Set species sets for interior nodes. O(n)
+        for (i=0; i<geneTrees[w]->nIntNodes; i++) {
+            p = geneTrees[w]->intDownPass[i];
+            for (j=0; j<nLongsNeeded; j++)
+                speciesSets[p->index][j] = speciesSets[p->left->index][j] | speciesSets[p->right->index][j];       
+            }
+
+        // Now order the interior nodes in terms of node depth. We rely on the fact that the
+        // ordered sequence is a valid downpass sequence. O(log n).
+        qsort((void *)(geneTrees[w]->intDownPass), (size_t)(geneTrees[w]->nIntNodes), sizeof(TreeNode *), CompareNodes);
+
+        // Finally find the minimum for each cell in the upper triangular matrix
+        // This is the time critical step with complexity O(n^3) in the simplest
+        // algorithm version. This algorithm should do a little better in most cases.
+        for (i=0; i<numUpperTriang; i++) {
+            
+            // Find shallowest node that has the pair
+            for (j=0; j<geneTrees[w]->nIntNodes; j++) {
+                p = geneTrees[w]->intDownPass[j];
+                
+                // Because nodes are ordered in time, if this test is true then we cannot beat the minimum
+                if (p->nodeDepth > depthMatrix[i])
+                    break;
+
+                // Check whether the node is a candidate minimum for the species pair
+                // If the test is true, we know from the test above that p->nodeDepth is
+                // either a tie or the new minimum
+                if (IsPartNested(speciesPairSets[i], speciesSets[p->index], nLongsNeeded) == YES) {
+                    depthMatrix[i] = p->nodeDepth;
+                    break;
+                    }
+                }
+            }
+        }   // Next gene tree
+
+    if (trace)
+        {
+        index = 0;
+        printf ("Mindepth matrix\n");
+        for (i=0;i<numSpecies;i++) {
+            for (j=0; j<i; j++)
+                printf ("         ");
+            for (j=i+1;j<numSpecies;j++) {
+                printf ("%.6f ",depthMatrix[index]);
+                index++;
+                }
+            printf ("\n");
+            }
+        printf ("\n");
+        }
+
+    free (speciesSets[0]);
+    free (speciesSets);
+
+    return (NO_ERROR);
+}
+
+
+/**---------------------------------------------------------------------
+|
+|   GetSpeciesTreeFromMinDepths: converted from GetConstraints, Startsptree,
+|   and MaximumTree.
+|
+|   This is a clustering algorithm based on minimum depths for species pairs.
+|   It reduces an n choose 2 upper triangular min depth matrix to an array
+|   of n-1 node depths, which fit onto a tree.
+|
+|   @param      speciesTree     The species tree to be filled  (out)
+|   @param      depthMatrix     The min depth matrix, upper triangular array (in)
+|   @returns    Returns NO_ERROR if success, ERROR if negative brlens occur
+----------------------------------------------------------------------*/
+int GetSpeciesTreeFromMinDepths (Tree* speciesTree, double *depthMatrix) {
+
+    int         i, j, numUpperTriang, nLongsNeeded, index, nextNodeIndex;
+    Depth       *minDepth;
+    PolyTree    *polyTree;
+    PolyNode    *p, *q, *r, *u, *qPrev, *rPrev;
+
+    nLongsNeeded    = ((numSpecies - 1) / nBitsInALong) + 1;
+    numUpperTriang  = numSpecies*(numSpecies - 1) / 2;
+    minDepth        = (Depth *) SafeCalloc (numUpperTriang, sizeof(Depth));
+
+    // Convert depthMatrix to an array of Depth structs
+    index = 0;
+    for (i=0; i<numSpecies; i++) {
+        for (j=i+1; j<numSpecies; j++) {
+            minDepth[index].depth   = depthMatrix[index];
+            minDepth[index].pairSet = speciesPairSets[index];
+            index++;
+            }
+        }
+
+    // Sort the array of distance structs (O(log n^2))
+    qsort((void *)(minDepth), (size_t)(numUpperTriang), sizeof(Depth), CompareDepths);
+
+    // The algorithm below reduces the upper triangular matrix (n choose 2) to an n-1
+    // array in O(n^2log(n)) time. We build the tree at the same time, since we can
+    // find included pairs in the tree in log(n) time. We use a polytomous tree for this.
+    
+    // Allocate space for polytomous tree and set up partitions
+    polyTree = AllocatePolyTree(numSpecies);
+    AllocatePolyTreePartitions(polyTree);
+
+    // Build initial tree (a bush)
+    polyTree->isRooted = YES;
+    polyTree->isClock = YES;
+    polyTree->root = &polyTree->nodes[2*numSpecies-2];
+    for (i=0; i<numSpecies; i++) {
+        p = &polyTree->nodes[i];
+        p->index = i;
+        p->depth = 0.0;
+        p->left = NULL;
+        if (i<numSpecies-1)
+            p->sib = &polyTree->nodes[i+1];
+        else
+            p->sib = NULL;
+        p->anc = polyTree->root;
+        }
+    p = polyTree->root;
+    p->index = 2*numSpecies - 2;
+    p->left = &polyTree->nodes[0];
+    p->sib = NULL;
+    p->anc = NULL;
+    p->depth = -1.0;
+    polyTree->nNodes = numSpecies + 1;
+    polyTree->nIntNodes = 1;
+    GetPolyDownPass(polyTree);
+    ResetPolyTreePartitions(polyTree);      /* set bitsets (partitions) for initial tree */
+
+    // Resolve bush using sorted depth structs
+    nextNodeIndex = numSpecies;
+    for (i=0; i<numUpperTriang; i++) {
+            
+        // Find tip corresponding to first taxon in pair
+        p = &polyTree->nodes[FirstTaxonInPartition(minDepth[i].pairSet, nLongsNeeded)];
+        
+        // Descend tree until we find a node within which the pair set is nested
+        do  {
+            p = p->anc;
+            }
+        while (!IsPartNested(minDepth[i].pairSet, p->partition, nLongsNeeded));
+
+        if (p->left->sib->sib != NULL) {
+            // This node is still a polytomy
+            
+            // Find left and right descendants of new node
+            qPrev = NULL;
+            for (q=p->left; IsSectionEmpty(q->partition, minDepth[i].pairSet, nLongsNeeded); q=q->sib)
+                qPrev = q;
+            rPrev = q;
+            for (r=q->sib;  IsSectionEmpty(r->partition, minDepth[i].pairSet, nLongsNeeded); r=r->sib)
+                rPrev = r;
+            
+            // Introduce the new node
+            u = &polyTree->nodes[nextNodeIndex];
+            u->index = nextNodeIndex;
+            nextNodeIndex++;
+            polyTree->nIntNodes++;
+            polyTree->nNodes++;
+            u->left = q;
+            u->anc = p;
+            if (p->left == q)
+                p->left = u;
+            else
+                qPrev->sib = u;
+            // former upstream sibling to r should point to r->sib
+            if (rPrev == q)
+                u->sib = r->sib;
+            else
+                rPrev->sib = r->sib;
+            if (q->sib == r)
+                u->sib = r->sib;
+            else
+                u->sib = q->sib;
+            u->depth = minDepth[i].depth;   // because minDepth structs are sorted, we know this is the min depth
+            assert (u->depth > 0.0);
+
+            // Create new taxon set with bitfield operations
+            for (j=0; j<nLongsNeeded; j++)
+                u->partition[j] = q->partition[j] | r->partition[j];
+
+            // Patch the tree together with the new node added
+            q->sib  = r;
+            r->sib = NULL;
+            q->anc = u;
+            r->anc = u;
+            }
+        else if (p == polyTree->root && p->depth < 0.0) {
+            // This is the first time we hit the root of the tree && it is resolved
+            p->depth = minDepth[i].depth;
+            assert (p->depth > 0.0);
+            }
+        // other cases should not be added to tree
+        }
+
+    // Make sure we have a complete species tree
+    assert (polyTree->nIntNodes == numSpecies - 1);
+
+    // Set traversal sequences
+    GetPolyDownPass(polyTree);
+
+    // Set branch lengths from node depths (not done automatically for us)
+    // Make sure all branch lengths are nonnegative (we can have 0.0 brlens, they
+    // should not be problematic in a species tree; they occur when there are
+    // ties in the min depth matrix that have not been modified by the move)
+    for (i=0; i<polyTree->nNodes; i++) {
+        p = polyTree->allDownPass[i];
+        if (p->anc == NULL)
+            p->length = 0.0;
+        else
+            p->length = p->anc->depth - p->depth;
+        if (p->length < 0.0) {
+            FreePolyTree(polyTree);
+            free (minDepth);
+            return (ERROR); 
+            }           
+        }
+
+    // Copy to species tree from polytomous tree
+    CopyToSpeciesTreeFromPolyTree (speciesTree, polyTree);
+
+    // Free locally allocated variables
+    FreePolyTree(polyTree);
+    free (minDepth);
+
+    return(NO_ERROR);
+}
+
+
+/**---------------------------------------------------------------------------------------
+|
+|   IsSpeciesTreeConsistent: Called when user tries to set a species tree or when
+|      attempting to use a species tree from a check point as starting value.
+|
+-----------------------------------------------------------------------------------------*/
+int IsSpeciesTreeConsistent (Tree *speciesTree, int chain)
+{
+    int     i, answer, numGeneTrees, numUpperTriang, freeBestVars;
+    double  *speciesTreeDepthMatrix;
+    Tree    **geneTrees;
+
+    answer = NO;
+
+    freeBestVars = NO;
+    if (memAllocs[ALLOC_BEST] == NO)
+        {
+        AllocateBestChainVariables();
+        freeBestVars = YES;
+        }
+
+    numGeneTrees = numTrees - 1;
+    geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree *));
+    for (i=0; i<numTrees-1; i++)
+        geneTrees[i] = GetTreeFromIndex(i, chain, state[chain]);
+
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+    speciesTreeDepthMatrix = (double *) SafeCalloc (numUpperTriang, sizeof(double));
+
+    GetMinDepthMatrix(geneTrees, numGeneTrees, depthMatrix);
+    GetDepthMatrix(speciesTree, speciesTreeDepthMatrix);
+
+    for (i=0; i<numUpperTriang; i++)
+        {
+        if (depthMatrix[i] < speciesTreeDepthMatrix[i])
+            break;
+        }
+
+    if (i == numUpperTriang)
+        answer = YES;
+    else
+        answer = NO;
+
+    if (answer == NO)
+        ShowNodes(speciesTree->root, 0, YES);
+
+    if (freeBestVars == YES)
+        FreeBestChainVariables();
+
+    free (speciesTreeDepthMatrix);
+    free (geneTrees);
+
+    return answer;
+}
+
+
+/**---------------------------------------------------------------------------------------
+|
+|   LineagesIn: Recursive function to get number of gene tree lineages coming into each
+|      branch of the species tree (in ->x of speciestree nodes). We also assign each gene
+|      tree lineage to the corresponding species tree lineage (in ->x of genetree nodes).
+|      Finally, number of coalescent events is recorded (in ->y of speciestree nodes).
+|      Time complexity is O(n).
+|
+-----------------------------------------------------------------------------------------*/
+void LineagesIn (TreeNode *geneTreeNode, TreeNode *speciesTreeNode)
+{
+    int nLongsNeeded;
+    
+    if (geneTreeNode->nodeDepth < speciesTreeNode->nodeDepth) {
+        // climb up species tree
+        if (speciesTreeNode->left == NULL) {
+            assert (geneTreeNode->left == NULL);
+            speciesTreeNode->x++;
+            }
+        else {
+            nLongsNeeded = (numSpecies - 1) / nBitsInALong + 1;
+            speciesTreeNode->x++;
+            if (IsPartNested(geneTreeNode->partition, speciesTreeNode->left->partition, nLongsNeeded) == YES)
+                LineagesIn (geneTreeNode, speciesTreeNode->left);
+            else if (IsPartNested(geneTreeNode->partition, speciesTreeNode->right->partition, nLongsNeeded) == YES)
+                LineagesIn (geneTreeNode, speciesTreeNode->right);
+            }
+        }
+    else {
+        // climb up gene tree
+        if (geneTreeNode->left != NULL)
+            LineagesIn(geneTreeNode->left, speciesTreeNode);
+        if (geneTreeNode->right != NULL)
+            LineagesIn(geneTreeNode->right, speciesTreeNode);
+        if (geneTreeNode->left == NULL) {
+            speciesTreeNode->x++;
+            assert (speciesTreeNode->left == NULL);
+            }
+        else {
+            speciesTreeNode->y++;
+            }
+        geneTreeNode->x = speciesTreeNode->index;
+        }
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   LnSpeciesTreeProb: Wrapper for LnJointGeneTreeSpeciesTreePr to
+|       free calling functions from retrieving gene and species trees.
+|
+------------------------------------------------------------------*/
+double LnSpeciesTreeProb(int chain)
+{
+    int         i, numGeneTrees;
+    double      lnProb;
+    Tree        **geneTrees, *speciesTree;
+    ModelInfo   *m;
+
+    m = &modelSettings[0];
+
+    speciesTree = GetTree(m->speciesTree, chain, state[chain]);
+
+    numGeneTrees = m->speciesTree->nSubParams;
+    geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree *));
+
+    for (i=0; i<m->speciesTree->nSubParams; i++)
+        geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]);
+
+    lnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, speciesTree, chain);
+
+    free (geneTrees);
+
+    return lnProb;
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   LnJointGeneTreeSpeciesTreePr: Converted from LnJointGenetreePr,
+|   SPLogLike, SPLogPrior.
+|
+|   In this function we calculate the entire probability of the species
+|   tree, including its probability given its priors, and the probability
+|   of the gene trees given the species tree.
+|
+------------------------------------------------------------------*/
+double LnJointGeneTreeSpeciesTreePr(Tree **geneTrees, int numGeneTrees, Tree *speciesTree, int chain)
+{
+    double      lnPrior, lnLike, clockRate, mu, *popSizePtr, sR, eR, sF;
+    int         i;
+    ModelInfo   *m;
+    ModelParams *mp;
+
+    // Get model info for species tree
+    m = &modelSettings[speciesTree->relParts[0]];
+
+    // Get model params for species tree
+    mp = &modelParams[speciesTree->relParts[0]];
+
+    // Get popSize ptr
+    popSizePtr = GetParamVals(m->popSize, chain, state[chain]);
+
+    // Get clock rate
+    if (speciesTree->isCalibrated == YES)
+        clockRate = *GetParamVals(m->clockRate, chain, state[chain]);
+    else
+        clockRate = 1.0;
+
+    // Calculate probability of gene trees given species tree
+    // ShowNodes(speciesTree->root, 0, YES);
+    lnLike = 0.0;
+    mu = clockRate;
+    for (i=0; i<numGeneTrees; i++) {
+        lnLike += LnPriorProbGeneTree(geneTrees[i], mu, speciesTree, popSizePtr);
+        }
+
+    // Calculate probability of species tree given its priors
+    if (strcmp(mp->speciesTreeBrlensPr, "Birthdeath") == 0) {
+        sR = *GetParamVals(m->speciationRates, chain, state[chain]);
+        eR = *GetParamVals(m->extinctionRates, chain, state[chain]);
+        sF = mp->sampleProb;
+        lnPrior = 0.0;
+        LnBirthDeathPriorPr(speciesTree, clockRate, &lnPrior, sR, eR, mp->sampleStrat, sF);
+        }
+    else
+        lnPrior = 0.0;
+
+    // The population size is taken care of elsewhere
+
+    return lnLike + lnPrior;
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   LnPriorProbGeneTree: Calculate the prior probability of a gene
+|   tree.
+|
+------------------------------------------------------------------*/
+double LnPriorProbGeneTree (Tree *geneTree, double mu, Tree *speciesTree, double *popSizePtr)
+{ 
+    int         i, k, index, nEvents, trace=0;
+    double      N, lnProb, ploidyFactor, theta, timeInterval;
+    TreeNode    *p, *q=NULL, *r;
+    ModelParams *mp;
+
+    // Get model params
+    mp = &modelParams[speciesTree->relParts[0]];
+
+    // Find ploidy setting
+    if (strcmp(mp->ploidy, "Diploid") == 0)
+        ploidyFactor = 4.0;
+    else if (strcmp(mp->ploidy, "Haploid") == 0)
+        ploidyFactor = 2.0;
+    else /* if (strcmp(mp->ploidy, "Zlinked") == 0) */
+        ploidyFactor = 3.0;
+
+    // Initialize species tree with theta in d
+    for (i=0; i<speciesTree->nNodes-1; i++) {
+        p = speciesTree->allDownPass[i];
+        if (strcmp(mp->popVarPr, "Equal") != 0)
+            N = popSizePtr[p->index];
+        else
+            N = popSizePtr[0];
+        p->d = ploidyFactor * N * mu;
+        }
+    
+    // Map gene tree to species tree
+    MapGeneTreeToSpeciesTree(geneTree, speciesTree);
+
+    // Sort gene tree interior nodes first by speciestree branch on which they coalesce, then in time order
+    qsort((void *)(geneTree->intDownPass), (size_t)(geneTree->nIntNodes), sizeof(TreeNode *), CompareNodesByX);
+
+    // Debug output of qsort result
+    if (trace) {
+        printf ("index -- x -- nodeDepth for gene tree\n");
+        for (i=0; i<geneTree->nIntNodes; i++)
+            printf ("%d -- %d -- %e\n", geneTree->intDownPass[i]->index, geneTree->intDownPass[i]->x, geneTree->intDownPass[i]->nodeDepth);
+        }
+
+    // Now calculate probability after making sure species tree nodes appear in index order
+    // (the order does not have to be a correct downpass sequence)
+    for (i=0; i<speciesTree->memNodes; i++)
+        {
+        p = &(speciesTree->nodes[i]);
+        speciesTree->allDownPass[p->index] = p;
+        }
+    index = 0;
+    lnProb = 0.0;
+    for (i=0; i<speciesTree->nNodes-1; i++) {
+
+        p = speciesTree->allDownPass[i];
+
+        // Get theta
+        theta = p->d;
+
+        // Get number of events
+        nEvents = p->y;
+
+        // Calculate probability
+        lnProb += nEvents * log (2.0 / theta);
+
+        for (k=p->x; k > p->x - p->y; k--) {
+
+            q = geneTree->intDownPass[index];
+            assert (q->x == p->index);
+
+            if (k == p->x)
+                timeInterval = q->nodeDepth - p->nodeDepth;
+            else {
+                r = geneTree->intDownPass[index-1];
+                timeInterval = q->nodeDepth - r->nodeDepth;
+            }
+
+            lnProb -= (k * (k - 1) * timeInterval) / theta;
+            index++;
+            }
+
+        if (p->x - p->y > 1) {
+
+            if (nEvents == 0)
+                timeInterval = p->anc->nodeDepth - p->nodeDepth;
+            else
+                timeInterval = p->anc->nodeDepth - q->nodeDepth;
+
+            assert (p->anc->anc != NULL);
+            assert (timeInterval >= 0.0);
+
+            k = p->x - p->y;
+            lnProb -= (k * (k - 1) * timeInterval) / theta;
+            }
+        }
+
+    // Restore downpass sequences (probably not necessary for gene tree, but may be if some
+    // code relies on intDownPass and allDownPass to be in same order)
+    GetDownPass(speciesTree);
+    GetDownPass(geneTree);
+
+    // Free space
+    FreeTreePartitions(speciesTree);
+    FreeTreePartitions(geneTree);
+
+    return lnProb;
+}
+
+
+/**---------------------------------------------------------------------
+|
+|   LnProposalProbSpeciesTree:
+|
+|   This algorithm calculates the probability of proposing a particular
+|   species tree given a distance matrix modified using a scheme based on
+|   truncated exponential distributions with rate expRate.
+|
+|   @param      speciesTree     The species tree (in)
+|   @param      depthMatrix     The minimum depth matrix, upper triangular array (in)
+|   @param      expRate         Rate of truncated exponential distribution
+|   @returns    Returns probability of proposing the species tree
+----------------------------------------------------------------------*/
+double LnProposalProbSpeciesTree (Tree *speciesTree, double *depthMatrix, double expRate)
+{
+    int         i, left, right, index, nLongsNeeded, freeBitsets;
+    double      dist, normConst=1.0, negLambdaX=0.0, eNegLambdaX, density, prob,
+                sumDensRatio, prodProb, lnProb;
+    TreeNode    *p;
+
+    // Make sure we have bitfields allocated and set
+    freeBitsets = NO;
+    if (speciesTree->bitsets == NULL)
+        freeBitsets = YES;
+    else
+        freeBitsets = NO;
+    AllocateTreePartitions(speciesTree);
+
+    // Number of longs needed in a bitfield representing a species set
+    nLongsNeeded   = ((numSpecies -1) / nBitsInALong) + 1;
+
+    // Loop over interior nodes
+    lnProb = 0.0;
+    for (i=0; i<speciesTree->nIntNodes; i++)
+        {
+        p = speciesTree->intDownPass[i];
+        p->x = 0;
+        sumDensRatio = 0.0;
+        prodProb = 1.0;
+        for (left = FirstTaxonInPartition(p->left->partition, nLongsNeeded); left < numSpecies; left = NextTaxonInPartition(left, p->left->partition, nLongsNeeded))
+            {
+            for (right = FirstTaxonInPartition(p->right->partition, nLongsNeeded); right < numSpecies; right = NextTaxonInPartition(right, p->right->partition, nLongsNeeded))
+                {
+                p->x++;
+                index         = UpperTriangIndex(left, right, numSpecies);  assert (index < numSpecies*(numSpecies - 1) / 2);
+                dist          = depthMatrix[index] - p->nodeDepth;          // distance between depth matrix entry and actual species-tree node
+                normConst     = 1.0 - exp(-expRate * depthMatrix[index]);   // normalization constant because of truncation of exp distribution
+                negLambdaX    = - expRate * dist;
+                eNegLambdaX   = exp(negLambdaX);
+                density       = expRate * eNegLambdaX / normConst;      // density for x == dist, f(dist)
+                prob          = (1.0 - eNegLambdaX) / normConst;        // cumulative prob for x <= dist, F(dist)
+                sumDensRatio += density / prob;                         // warning: if dist==0, prob is ZERO!
+                prodProb     *= prob;
+                }
+            }
+        if (p->x == 1)
+            lnProb += log(expRate) + negLambdaX - log(normConst);
+        else
+            lnProb += log(sumDensRatio * prodProb);
+        }
+
+    // to avoid lnProposalProb is NaN at initial steps
+    if (lnProb != lnProb)  lnProb = 0.0;
+    
+    // Free partitions if appropriate
+    if (freeBitsets == YES)
+        FreeTreePartitions(speciesTree);
+
+    return (lnProb);
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   MapGeneTreeToSpeciesTree: Fold gene tree into species tree. We
+|      are going to use ->x of gene tree to give index of the
+|      corresponding node in the species tree. ->x in the species
+|      tree will give the number of lineages into the corresponding
+|      branch, and ->y will give the number of coalescent events on
+|      that branch.
+|
+------------------------------------------------------------------*/
+void MapGeneTreeToSpeciesTree (Tree *geneTree, Tree *speciesTree)
+{ 
+    int         i, j, nLongsNeeded, trace=0;
+    TreeNode    *p;
+
+    // Initialize species partitions for both gene tree and species tree
+    // This will set the partitions to reflect the partitions in the tree itself,
+    // which is OK for the species tree, but we want the gene tree partitions to
+    // reflect the species partitions and not the gene partitions, so we need to
+    // set them here
+    AllocateTreePartitions(geneTree);
+    AllocateTreePartitions(speciesTree);
+    nLongsNeeded = (numSpecies - 1) / nBitsInALong + 1;
+    for (i=0; i<geneTree->nNodes-1; i++) {
+        p = geneTree->allDownPass[i];
+        ClearBits(p->partition, nLongsNeeded);
+        if (p->left == NULL)
+            SetBit(speciespartitionId[p->index][speciespartitionNum]-1, p->partition);
+        else {
+            for (j=0; j<nLongsNeeded; j++)
+                p->partition[j] = p->left->partition[j] | p->right->partition[j];
+            }
+        }
+    // Species tree partitions already set by call to AllocateTreePartitions
+
+    // Reset ->x and ->y of species tree (->x of gene tree does not need to be initialized)
+    for (i=0; i<speciesTree->nNodes; i++)
+        {
+        p = speciesTree->allDownPass[i];
+        p->x = 0;
+        p->y = 0;
+        }
+
+    // Call recursive function to match gene tree and species tree
+    LineagesIn(geneTree->root->left, speciesTree->root->left);
+
+    if (trace) {
+        printf ("index -- x -- y   for species tree\n");
+        for (i=0; i<speciesTree->nNodes-1; i++)
+            printf ("%-2d -- %d -- %d\n", speciesTree->allDownPass[i]->index, speciesTree->allDownPass[i]->x, speciesTree->allDownPass[i]->y);
+        }
+
+    if (trace) {
+        printf ("index -- x -- nodeDepth for gene tree\n");
+        for (i=0; i<geneTree->nIntNodes; i++)
+            printf ("%-2d -- %d -- %e\n", geneTree->intDownPass[i]->index, geneTree->intDownPass[i]->x, geneTree->intDownPass[i]->nodeDepth);
+        }
+
+    // Free space
+    FreeTreePartitions(speciesTree);
+    FreeTreePartitions(geneTree);
+}
+
+
+/**---------------------------------------------------------------------
+|
+|   ModifyDepthMatrix:
+|
+|   This algorithm uses a truncated exponential distribution to modify
+|   a depth matrix.
+|
+|   @param      expRate         The rate of the exponential distribution (in)
+|   @param      depthMatrix     The minimum depth matrix to be modified, upper triangular array (in/out)
+|   @param      seed            Pointer to seed for random number generator (in/ut)
+|   @returns    Returns ERROR or NO_ERROR
+----------------------------------------------------------------------*/
+int ModifyDepthMatrix (double expRate, double *depthMatrix, RandLong *seed)
+{
+    int     i, numUpperTriang;
+    double  u, interval, delta;
+
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+    for (i=0; i<numUpperTriang; i++)
+        {
+        interval = depthMatrix[i];
+        u = RandomNumber(seed);
+        delta = log (1.0 - u*(1.0 - exp(-expRate*interval))) / (-expRate);
+        assert (delta <= interval);
+        depthMatrix[i] -= delta;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   Move_GeneTree1: Propose a new gene tree using ExtSPRClock
+|
+|   @param param            The parameter (gene tree) to change
+|   @param chain            The chain number
+|   @param seed             Pointer to the seed of the random number gen.
+|   @param lnPriorRatio     Pointer to the log prior ratio (out)
+|   @param lnProposalRatio  Pointer to the log proposal (Hastings) ratio (out)
+|   @param mvp              Pointer to tuning parameter(s)
+------------------------------------------------------------------*/
+int Move_GeneTree1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i, numGeneTrees, numUpperTriang;
+    double          newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb,
+                    *oldMinDepths, *modMinDepths, forwardLambda, backwardLambda, mean;
+    Tree            *newSpeciesTree, *oldSpeciesTree, **geneTrees;
+    ModelInfo       *m;
+
+    // Calculate number of gene trees
+    numGeneTrees = numTopologies - 1;
+
+    // Get model settings
+    m = &modelSettings[param->relParts[0]];
+
+    // Get species tree (this trick is possible because we always copy tree params)
+    newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]);
+    oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1);
+
+    // Get gene trees
+    geneTrees = (Tree **) SafeCalloc (2*numGeneTrees, sizeof(Tree *));
+    for (i=0; i<m->speciesTree->nSubParams; i++) {
+        geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]);
+        }
+
+    // Allocate space for depth matrix copy
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+    oldMinDepths   = (double *) SafeCalloc (2*numUpperTriang, sizeof(double));
+    modMinDepths   = oldMinDepths + numUpperTriang;
+
+    // Get min depth matrix for old gene trees
+    GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix);
+
+    // Save a copy
+    for (i=0; i<numUpperTriang; i++)
+        oldMinDepths[i] = depthMatrix[i];
+
+    // Get forward lambda
+    GetMeanDist(oldSpeciesTree, depthMatrix, &mean);
+    // if (mean < 1E-6) mean = 1E-6;
+    forwardLambda = 1.0 / mean;
+
+    // Calculate joint probability of old gene trees and old species tree
+    oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain);
+
+    // Modify the picked gene tree using code from a regular MrBayes move
+    Move_ExtSPRClock(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp);
+
+    // Update the min depth matrix
+    GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix);
+
+    // Copy the min depth matrix
+    for (i=0; i<numUpperTriang; i++)
+        modMinDepths[i] = depthMatrix[i];
+
+    // Modify the min depth matrix
+    ModifyDepthMatrix (forwardLambda, modMinDepths, seed);
+
+    // Get a new species tree
+    if (GetSpeciesTreeFromMinDepths (newSpeciesTree, modMinDepths) == ERROR) {
+        abortMove = YES;
+        free (geneTrees);
+        free (oldMinDepths);
+        return (NO_ERROR);
+        }
+    
+    // Calculate joint probability of new gene trees and new species tree
+    newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain);
+
+    // Get backward lambda
+    GetMeanDist(newSpeciesTree, depthMatrix, &mean);
+    // if (mean < 1E-6) mean = 1E-6;
+    backwardLambda = 1.0 / mean;
+
+    // Get proposal probability of old species tree
+    backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, oldMinDepths, backwardLambda);
+
+    // Get proposal probability of new species tree
+    forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda);
+
+    // Update prior ratio taking species tree into account
+    (*lnPriorRatio) += (newLnProb - oldLnProb);
+        
+    // Update proposal ratio based on this move
+    (*lnProposalRatio) += (backwardLnProposalProb - forwardLnProposalProb);
+
+    // Free allocated memory
+    free (geneTrees);
+    free (oldMinDepths);
+
+    return (NO_ERROR);
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   Move_GeneTree2: Propose a new gene tree using NNIClock
+|
+|   @param param            The parameter to change
+|   @param chain            The chain number
+|   @param seed             Pointer to the seed of the random number gen.
+|   @param lnPriorRatio     Pointer to the log prior ratio (out)
+|   @param lnProposalRatio  Pointer to the log proposal (Hastings) ratio (out)
+|   @param mvp              Pointer to tuning parameter(s)
+------------------------------------------------------------------*/
+int Move_GeneTree2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i, numGeneTrees, numUpperTriang;
+    double          newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb,
+                    *oldMinDepths, *modMinDepths, forwardLambda, backwardLambda, mean;
+    Tree            *newSpeciesTree, *oldSpeciesTree, **geneTrees;
+    ModelInfo       *m;
+
+    // Calculate number of gene trees
+    numGeneTrees = numTopologies - 1;
+
+    // Get model settings
+    m = &modelSettings[param->relParts[0]];
+
+    // Get species tree (this trick is possible because we always copy tree params)
+    newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]);
+    oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1);
+
+    // Get gene trees
+    geneTrees = (Tree **) SafeCalloc (2*numGeneTrees, sizeof(Tree *));
+    for (i=0; i<m->speciesTree->nSubParams; i++) {
+        geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]);
+        }
+
+    // Allocate space for depth matrix copy
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+    oldMinDepths   = (double *) SafeCalloc (2*numUpperTriang, sizeof(double));
+    modMinDepths   = oldMinDepths + numUpperTriang;
+
+    // Get min depth matrix for old gene trees
+    GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix);
+
+    // Save a copy
+    for (i=0; i<numUpperTriang; i++)
+        oldMinDepths[i] = depthMatrix[i];
+
+    // Get forward lambda
+    GetMeanDist(oldSpeciesTree, depthMatrix, &mean);
+    // if (mean < 1E-6) mean = 1E-6;
+    forwardLambda = 1.0 / mean;
+
+    // Calculate joint probability of old gene trees and old species tree
+    oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain);
+
+    // Modify the picked gene tree using code from a regular MrBayes move (no tuning parameter, so passing on mvp is OK)
+    Move_NNIClock(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp);
+
+    // Update the min depth matrix
+    GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix);
+
+    // Copy the min depth matrix
+    for (i=0; i<numUpperTriang; i++)
+        modMinDepths[i] = depthMatrix[i];
+
+    // Modify the min depth matrix
+    ModifyDepthMatrix (forwardLambda, modMinDepths, seed);
+
+    // Get a new species tree
+    if (GetSpeciesTreeFromMinDepths (newSpeciesTree, modMinDepths) == ERROR) {
+        abortMove = YES;
+        free (geneTrees);
+        free (oldMinDepths);
+        return (NO_ERROR);
+        }
+    
+    // Calculate joint probability of new gene trees and new species tree
+    newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain);
+
+    // Get backward lambda
+    GetMeanDist(newSpeciesTree, depthMatrix, &mean);
+    // if (mean < 1E-6) mean = 1E-6;
+    backwardLambda = 1.0 / mean;
+
+    // Get proposal probability of old species tree
+    backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, oldMinDepths, backwardLambda);
+
+    // Get proposal probability of new species tree
+    forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda);
+
+    // Update prior ratio taking species tree into account
+    (*lnPriorRatio) += (newLnProb - oldLnProb);
+        
+    // Update proposal ratio based on this move
+    (*lnProposalRatio) += (backwardLnProposalProb - forwardLnProposalProb);
+
+    // Free allocated memory
+    free (geneTrees);
+    free (oldMinDepths);
+
+    return (NO_ERROR);
+}
+
+
+/**-----------------------------------------------------------------
+|
+|   Move_GeneTree3: Propose a new gene tree using ParsSPRClock
+|
+|   @param param            The parameter to change
+|   @param chain            The chain number
+|   @param seed             Pointer to the seed of the random number gen.
+|   @param lnPriorRatio     Pointer to the log prior ratio (out)
+|   @param lnProposalRatio  Pointer to the log proposal (Hastings) ratio (out)
+|   @param mvp              Pointer to tuning parameter(s)
+------------------------------------------------------------------*/
+int Move_GeneTree3 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i, numGeneTrees, numUpperTriang;
+    double          newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb,
+                    *oldMinDepths, *modMinDepths, forwardLambda, backwardLambda, mean;
+    Tree            *newSpeciesTree, *oldSpeciesTree, **geneTrees;
+    ModelInfo       *m;
+
+    // Calculate number of gene trees
+    numGeneTrees = numTopologies - 1;
+
+    // Get model settings
+    m = &modelSettings[param->relParts[0]];
+
+    // Get species tree (this trick is possible because we always copy tree params)
+    newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]);
+    oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1);
+
+    // Get gene trees
+    geneTrees = (Tree **) SafeCalloc (2*numGeneTrees, sizeof(Tree *));
+    for (i=0; i<m->speciesTree->nSubParams; i++) {
+        geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]);
+        }
+
+    // Allocate space for depth matrix copy
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+    oldMinDepths   = (double *) SafeCalloc (2*numUpperTriang, sizeof(double));
+    modMinDepths   = oldMinDepths + numUpperTriang;
+
+    // Get min depth matrix for old gene trees
+    GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix);
+
+    // Save a copy
+    for (i=0; i<numUpperTriang; i++)
+        oldMinDepths[i] = depthMatrix[i];
+
+    // Get forward lambda
+    GetMeanDist(oldSpeciesTree, depthMatrix, &mean);
+    // if (mean < 1E-6) mean = 1E-6;
+    forwardLambda = 1.0 / mean;
+
+    // Calculate joint probability of old gene trees and old species tree
+    oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain);
+
+    // Modify the picked gene tree using code from a regular MrBayes move
+    Move_ParsSPRClock(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp);
+
+    // Update the min depth matrix
+    GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix);
+
+    // Copy the min depth matrix
+    for (i=0; i<numUpperTriang; i++)
+        modMinDepths[i] = depthMatrix[i];
+
+    // Modify the min depth matrix
+    ModifyDepthMatrix (forwardLambda, modMinDepths, seed);
+
+    // Get a new species tree
+    if (GetSpeciesTreeFromMinDepths (newSpeciesTree, modMinDepths) == ERROR) {
+        abortMove = YES;
+        free (geneTrees);
+        free (oldMinDepths);
+        return (NO_ERROR);
+        }
+   
+    // Calculate joint probability of new gene trees and new species tree
+    newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain);
+
+    // Get backward lambda
+    GetMeanDist(newSpeciesTree, depthMatrix, &mean);
+    // if (mean < 1E-6) mean = 1E-6;
+    backwardLambda = 1.0 / mean;
+
+    // Get proposal probability of old species tree
+    backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, oldMinDepths, backwardLambda);
+
+    // Get proposal probability of new species tree
+    forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda);
+
+    // Update prior ratio taking species tree into account
+    (*lnPriorRatio) += (newLnProb - oldLnProb);
+        
+    // Update proposal ratio based on this move
+    (*lnProposalRatio) += (backwardLnProposalProb - forwardLnProposalProb);
+
+    // Free allocated memory
+    free (geneTrees);
+    free (oldMinDepths);
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------------------------
+|
+|   Move_NodeSliderGeneTree: Move the position of one (root or nonroot) node in a
+|      gene tree inside a species tree.
+|
+-------------------------------------------------------------------------------------*/
+int Move_NodeSliderGeneTree (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, *nEvents;
+    MrBFlt      window, minDepth, maxDepth, oldDepth, newDepth,
+                oldLeftLength=0.0, oldRightLength=0.0, clockRate,
+                oldPLength=0.0, lambda=0.0, nu=0.0, igrvar=0.0,
+                *brlens=NULL, *tk02Rate=NULL, *igrRate=NULL, *popSizePtr;
+    TreeNode    *p, *q;
+    ModelInfo   *m;
+    Tree        *geneTree, *speciesTree;
+    Param       *subParm;
+
+    window = mvp[0]; /* window size */
+    m = &modelSettings[param->relParts[0]];
+
+    /* get gene tree and species tree */
+    geneTree    = GetTree (param, chain, state[chain]);
+    speciesTree = GetTree (m->speciesTree, chain, state[chain]);
+
+    /* get population size(s) */
+    popSizePtr = GetParamVals(m->popSize, chain, state[chain]);
+
+    /* get clock rate */
+    if (m->clockRate == NULL)
+        clockRate = 1.0;
+    else
+        clockRate = *GetParamVals(m->clockRate, chain, state[chain]);
+
+    /* pick a node to be changed */
+    p = geneTree->intDownPass[(int)(RandomNumber(seed)*geneTree->nIntNodes)];
+
+#   if defined (DEBUG_CSLIDER)
+    printf ("Before node slider (gene tree):\n");
+    printf ("Picked branch with index %d and depth %f\n", p->index, p->nodeDepth);
+    if (p->anc->anc == NULL)
+        printf ("Old clock rate: %f\n", clockRate);
+    ShowNodes (t->root, 0, t->isRooted);
+    getchar();
+#   endif
+
+    /* get gene tree prior prob before move */
+    (*lnPriorRatio) -= LnPriorProbGeneTree(geneTree, clockRate, speciesTree, popSizePtr);
+
+    /* store values needed later for prior calculation (relaxed clocks) */
+    oldPLength = p->length;
+    if (p->left != NULL)
+        {
+        oldLeftLength = p->left->length;
+        oldRightLength = p->right->length;
+        }
+    else
+        oldLeftLength = oldRightLength = 0.0;
+
+    /* find species tree branch to which the gene tree node belongs */
+    MapGeneTreeToSpeciesTree(geneTree, speciesTree);
+    q = NULL;
+    for (i=0; i<speciesTree->nNodes-1; i++)
+        {
+        q = speciesTree->allDownPass[i];
+        if (p->x == q->index)
+            break;
+        }
+    assert (q != NULL && p->x == q->index);
+
+    /* determine lower and upper bound */
+    minDepth = p->left->nodeDepth + POS_MIN;
+    if (p->right->nodeDepth + POS_MIN > minDepth)
+        minDepth = p->right->nodeDepth + POS_MIN;
+    if (q->nodeDepth + POS_MIN > minDepth)
+        minDepth = q->nodeDepth + POS_MIN;
+    if (p->anc->anc == NULL)
+        maxDepth = TREEHEIGHT_MAX;
+    else
+        maxDepth = p->anc->nodeDepth - POS_MIN;
+    
+    /* abort if impossible */
+    if (minDepth >= maxDepth)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    if (maxDepth-minDepth < window)
+        {
+        window = maxDepth-minDepth;
+        }
+
+    /* pick the new node depth */
+    oldDepth = p->nodeDepth;
+    newDepth = oldDepth + (RandomNumber(seed) - 0.5) * window;
+    
+    /* reflect the new node depth */
+    while (newDepth < minDepth || newDepth > maxDepth)
+        {
+        if (newDepth < minDepth)
+            newDepth = 2.0 * minDepth - newDepth;
+        if (newDepth > maxDepth)
+            newDepth = 2.0 * maxDepth - newDepth;
+        }
+    p->nodeDepth = newDepth;
+
+    /* determine new branch lengths around p and set update of transition probabilities */
+    if (p->left != NULL)
+        {
+        p->left->length = p->nodeDepth - p->left->nodeDepth;
+        assert (p->left->length >= POS_MIN);
+        p->left->upDateTi = YES;
+        p->right->length = p->nodeDepth - p->right->nodeDepth;
+        assert (p->right->length >= POS_MIN);
+        p->right->upDateTi = YES;
+        }
+    if (p->anc->anc != NULL)
+        {
+        p->length = p->anc->nodeDepth - p->nodeDepth;
+        assert (p->length >= POS_MIN);
+        p->upDateTi = YES;
+        }
+
+    /* set flags for update of cond likes from p and down to root */
+    q = p;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = 0.0;
+
+    /* calculate prior ratio */
+    (*lnPriorRatio) += LnPriorProbGeneTree (geneTree, clockRate, speciesTree, popSizePtr);
+
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        subParm = param->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+
+            /* proposal ratio */
+            if (p->left != NULL)
+                {
+                (*lnProposalRatio) += nEvents[p->left->index ] * log (p->left->length  / oldLeftLength);
+                (*lnProposalRatio) += nEvents[p->right->index] * log (p->right->length / oldRightLength);
+                }
+            if (p->anc->anc != NULL)
+                (*lnProposalRatio) += nEvents[p->index] * log (p->length / oldPLength);
+
+            /* prior ratio */
+            if (p->anc->anc == NULL) // two branches changed in same direction
+                (*lnPriorRatio) += lambda * (2.0 * (oldDepth - newDepth));
+            else if (p->left != NULL) // two branches changed in one direction, one branch in the other direction
+                (*lnPriorRatio) += lambda * (oldDepth - newDepth);
+            else /* if (p->left == NULL) */ // one branch changed
+                (*lnPriorRatio) += lambda * (newDepth - oldDepth);
+
+            /* update effective evolutionary lengths */
+            if (UpdateCppEvolLengths (subParm, p, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+
+            /* no proposal ratio effect */
+
+            /* prior ratio */
+            if (p->left != NULL)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->index], nu*oldLeftLength, tk02Rate[p->left->index]);
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->index], nu*oldRightLength, tk02Rate[p->right->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->index], nu*p->left->length, tk02Rate[p->left->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->index], nu*p->right->length, tk02Rate[p->right->index]);
+                }
+            if (p->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*oldPLength, tk02Rate[p->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*p->length, tk02Rate[p->index]);
+                }
+
+            /* update effective evolutionary lengths */
+            if (p->left != NULL)
+                {
+                brlens[p->left->index] = p->left->length * (tk02Rate[p->left->index]+tk02Rate[p->index])/2.0;
+                brlens[p->right->index] = p->right->length * (tk02Rate[p->right->index]+tk02Rate[p->index])/2.0;
+                }
+            if (p->anc->anc != NULL)
+                {
+                brlens[p->index] = p->length * (tk02Rate[p->index]+tk02Rate[p->anc->index])/2.0;
+                }
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+            if (p->left != NULL)
+                {
+                (*lnPriorRatio) -= LnProbGamma (oldLeftLength/igrvar, oldLeftLength/igrvar, igrRate[p->left->index ]);
+                (*lnPriorRatio) -= LnProbGamma (oldRightLength/igrvar, oldRightLength/igrvar, igrRate[p->right->index]);
+                (*lnPriorRatio) += LnProbGamma (p->left->length/igrvar, p->left->length/igrvar, igrRate[p->left->index ]);
+                (*lnPriorRatio) += LnProbGamma (p->right->length/igrvar, p->right->length/igrvar, igrRate[p->right->index]);
+                }
+            if (p->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbGamma (oldPLength/igrvar, oldPLength/igrvar, igrRate[p->index]);
+                (*lnPriorRatio) += LnProbGamma (p->length /igrvar, p->length /igrvar, igrRate[p->index]);
+                }
+
+            if (p->left != NULL)
+                {
+                brlens[p->left->index ] = igrRate[p->left->index ] * p->left->length;
+                brlens[p->right->index] = igrRate[p->right->index] * p->right->length;
+                }
+            if (p->anc->anc != NULL)
+                {
+                brlens[p->index] = igrRate[p->index] * p->length;
+                }
+            }
+        }
+    
+#   if defined (DEBUG_CSLIDER)
+    printf ("After node slider (gene tree):\n");
+    printf ("Old depth: %f -- New depth: %f -- LnPriorRatio %f -- LnProposalRatio %f\n",
+        oldDepth, newDepth, (*lnPriorRatio), (*lnProposalRatio));
+    ShowNodes (t->root, 0, t->isRooted);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+    
+}
+
+
+/*------------------------------------------------------------------
+|
+|   Move_SpeciesTree: Propose a new species tree
+|
+------------------------------------------------------------------*/
+int Move_SpeciesTree (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i, numGeneTrees, numUpperTriang;
+    double          newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb, *modMinDepths,
+                    forwardLambda, backwardLambda, lambdaDiv, mean;
+    Tree            *newSpeciesTree, *oldSpeciesTree, **geneTrees;
+    ModelInfo       *m;
+
+    /* get tuning parameter (lambda divider) */
+    lambdaDiv = mvp[0];
+
+    /* calculate number of gene trees */
+    numGeneTrees = param->nSubParams;
+
+    /* get model settings */
+    m = &modelSettings[param->relParts[0]];
+
+    /* get new and old species trees */
+    newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]);
+    oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1);
+
+    /* get gene trees */
+    geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree*));
+    for (i=0; i<param->nSubParams; i++)
+        geneTrees[i] = GetTree(param->subParams[i], chain, state[chain]);
+
+    /* get minimum depth matrix */
+    GetMinDepthMatrix(geneTrees, numGeneTrees, depthMatrix);
+
+    /* get forward lambda */
+    GetMeanDist(oldSpeciesTree, depthMatrix, &mean);
+    forwardLambda = 1.0 / (mean * lambdaDiv);
+
+    /* make a copy for modification */
+    numUpperTriang = numSpecies * (numSpecies - 1) / 2;
+    modMinDepths = (double *) SafeCalloc (numUpperTriang, sizeof(double));
+    for (i=0; i<numUpperTriang; i++)
+        modMinDepths[i] = depthMatrix[i];
+
+    /* modify minimum depth matrix */
+    ModifyDepthMatrix (forwardLambda, modMinDepths, seed);
+
+    /* construct a new species tree from the modified constraints */
+    if (GetSpeciesTreeFromMinDepths(newSpeciesTree, modMinDepths) == ERROR) {
+        abortMove = YES;
+        free (modMinDepths);
+        free (geneTrees);
+        return (NO_ERROR);
+        }
+
+    /* get lambda for back move */
+    GetMeanDist(newSpeciesTree, depthMatrix, &mean);
+    backwardLambda = 1.0 / (mean * lambdaDiv);
+
+    /* calculate proposal ratio */
+    backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, depthMatrix, backwardLambda);
+    forwardLnProposalProb  = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda);
+    (*lnProposalRatio) = backwardLnProposalProb - forwardLnProposalProb;
+
+#   if defined (BEST_MPI_ENABLED)
+    // Broadcast the proposed species tree to all processors if MPI version
+#   endif
+
+#   if defined (BEST_MPI_ENABLED)
+    // Let each processor calculate the ln probability ratio of its current gene tree(s)
+    //    given the new and old species tree in the MPI version
+
+    // Assemble the ln probability ratios across the processors and to lnPriorRatio
+#   else
+    /* calculate the ln probability ratio of the current gene trees
+       given the new and old species trees */
+    newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain);
+    oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain);
+#   endif
+
+    /* set (*lnPriorRatio) to ln probability ratio */
+    (*lnPriorRatio) = (newLnProb - oldLnProb);
+    
+    /* free allocated space */
+    free (modMinDepths);
+    free (geneTrees);
+
+    return (NO_ERROR);
+}
+
+
+/** Show upper triangular matrix */
+void ShowUpperTriangMatrix (double *values, int squareSize)
+{
+    int     i, j, index;
+
+    index = 0;
+    printf ("Upper triang matrix:\n");
+    for (i=0; i<squareSize; i++) {
+        for (j=0; j<i; j++)
+            printf ("         ");
+        for (j=i+1; j<squareSize; j++) {
+            printf ("%.6f ", values[index]);
+            index++;
+            }
+        printf ("\n");
+        }
+    printf ("\n");
+}
+
diff --git a/src/best.h b/src/best.h
new file mode 100644 (file)
index 0000000..eff735d
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __BEST_H__
+#define __BEST_H__
+
+/**************** typedefs used by Fredrik's code, derived from BEST code *******************/
+
+/* struct for constraints (similar to Distance in BEST code, except
+   that a bitfield is used to hold info on the taxon pair)           */
+typedef struct {
+    double      depth;
+    BitsLong*   pairSet;
+} Depth;
+
+/**************** Declaration of functions that are called from MrBayes **************/
+void    AllocateBestChainVariables (void);
+int     FillSpeciesTreeParams (RandLong* seed, int from, int to);
+void    FreeBestChainVariables (void);
+int     IsSpeciesTreeConsistent (Tree *speciesTree, int chain);
+double  LnSpeciesTreeProb (int chain);
+double  LnJointGeneTreeSpeciesTreePr (Tree **geneTrees, int numGeneTrees, Tree *speciesTree, int chain);
+int     Move_GeneTree1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_GeneTree2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_GeneTree3 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_NodeSliderGeneTree (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_SpeciesTree (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+void    ShowUpperTriangMatrix (double *values, int squareSize);
+
+/* NOTE: To add and set up more move functions, a struct needs to be added to SetUpMoveTypes in model.c */
+
+#endif  /* __BEST_H__ */
diff --git a/src/command.c b/src/command.c
new file mode 100644 (file)
index 0000000..96b86e3
--- /dev/null
@@ -0,0 +1,15097 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "command.h"
+#include "mbbeagle.h"
+#include "model.h"
+#include "mcmc.h"
+#include "sumpt.h"
+#include "utils.h"
+#if defined(__MWERKS__)
+#include "SIOUX.h"
+#endif
+
+const char* const svnRevisionCommandC = "$Rev: 1072 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+
+#define NUMCOMMANDS                     62    /* The total number of commands in the program  */
+#define NUMPARAMS                       276   /* The total number of parameters  */
+#define PARAM(i, s, f, l)               p->string = s;    \
+                                        p->fp = f;        \
+                                        p->valueList = l; \
+                                        p++;
+#define HIDE                            0
+#define SHOW                            1
+
+/* Debugging options */
+#undef SHOW_TOKENS
+#undef ECHO_PROCESSED_COMMANDS
+
+/* Local function prototypes */
+int      AddNameSet(NameSet **nameSetList, int numNameSets, char **nameSet, int numNames);
+int      AddToSet (int i, int j, int k, int id);
+int      AllocCharacters (void);
+int      AllocMatrix (void);
+int      AllocTaxa (void);
+char     ChangeCase (char c);
+int      CharacterCode (char ch, int *charCode, int chType);
+int      CharacterNumber (int charCode, int chType);
+int      CheckInitialPartitions (void);
+int      Dex (TreeNode *p);
+int      DoAbout (void);
+int      DoAcknowledgments (void);
+int      DoBeginParm (char *parmName, char *tkn);
+int      DoBreaks (void);
+int      DoBreaksParm (char *parmName, char *tkn);
+int      DoCalibrate (void);
+int      DoCalibrateParm (char *parmName, char *tkn);
+int      DoCharset (void);
+int      DoCharsetParm (char *parmName, char *tkn);
+int      DoCharStat (void);
+int      DoCitations (void);
+int      DoConstraint (void);
+int      DoConstraintParm (char *parmName, char *tkn);
+int      DoCtype (void);
+int      DoCtypeParm (char *parmName, char *tkn);
+int      DoDelete (void);
+int      DoDeleteParm (char *parmName, char *tkn);
+int      DoDimensions (void);
+int      DoDimensionsParm (char *parmName, char *tkn);
+int      DoDisclaimer (void);
+int      DoEndBlock (void);
+int      DoExecuteParm (char *parmName, char *tkn);
+int      DoExclude (void);
+int      DoExcludeParm (char *parmName, char *tkn);
+int      DoFormat (void);
+int      DoFormatParm (char *parmName, char *tkn);
+int      DoHelp (void);
+int      DoHelpParm (char *parmName, char *tkn);
+int      DoInclude (void);
+int      DoIncludeParm (char *parmName, char *tkn);
+int      DoLog (void);
+int      DoLogParm (char *parmName, char *tkn);
+int      DoManual (void);
+int      DoManualParm (char *parmName, char *tkn);
+int      DoMatrix (void);
+int      DoMatrixParm (char *parmName, char *tkn);
+int      DoNexusParm (char *parmName, char *tkn);
+int      DoOutgroup (void);
+int      DoOutgroupParm (char *parmName, char *tkn);
+int      DoPairs (void);
+int      DoPairsParm (char *parmName, char *tkn);
+int      DoPartition (void);
+int      DoPartitionParm (char *parmName, char *tkn);
+int      DoRestore (void);
+int      DoRestoreParm (char *parmName, char *tkn);
+int      DoSet (void);
+int      DoSetParm (char *parmName, char *tkn);
+int      DoShowBeagle (void);
+int      DoShowMatrix (void);
+int      DoShowUserTrees (void);
+int      DoSpeciespartition (void);
+int      DoSpeciespartitionParm (char *parmName, char *tkn);
+int      DoTaxaset (void);
+int      DoTaxasetParm (char *parmName, char *tkn);
+int      DoTaxaStat (void);
+int      DoTaxlabels (void);
+int      DoTaxlabelsParm (char *parmName, char *tkn);
+int      DoTranslate (void);
+int      DoTranslateParm (char *parmName, char *tkn);
+int      DoTree (void);
+int      DoTreeParm (char *parmName, char *tkn);
+int      DoUserTree (void);
+int      DoUserTreeParm (char *parmName, char *tkn);
+int      DoVersion (void);
+int      FindValidParam (char *tk, int *numMatches);
+int      FreeCharacters (void);
+int      FreeMatrix (void);
+int      FreeTaxa (void);
+int      GetNumPartDivisions (int n);
+int      GetUserHelp (char *helpTkn);
+int      IsAmbig (int charCode, int dType);
+int      IsMissing (int charCode, int dType);
+int      MBResID (char nuc);
+int      NucID (char nuc);
+void     PrintSettings (char *command);
+void     PrintYesNo (int yn, char s[4]);
+int      ProtID (char aa);
+int      SetPartition (int part);
+int      SetSpeciespartition (int part);
+int      SetTaxaFromTranslateTable (void);
+int      StandID (char nuc);
+void     WhatVariableExp (BitsLong exp, char *st);
+MrBFlt   WhichCont (int x);
+
+/* globals */
+int             autoClose;             /* autoclose                                     */
+int             autoOverwrite;         /* Overwrite or append outputfiles when nowarnings=yes */
+Calibration     *calibrationPtr;       /* ptr to calibration being set                  */
+CharInformation *charInfo;             /* holds critical information about characters   */
+BitsLong        **charSet;             /* holds information about defined charsets      */
+char            **charSetNames;        /* holds names of character sets                 */
+Comptree        comptreeParams;        /* holds parameters for comparetree command      */
+char            **constraintNames;     /* holds names of constraints                    */
+int             dataType;              /* type of data                                  */
+Calibration     defaultCalibration;    /* default calibration                           */
+BitsLong        **definedConstraint;          /* bitfields representing taxa sets of defined constraints                                             */
+BitsLong        **definedConstraintTwo;       /* bitfields representing second taxa sets of defined constraints (used for PARTIAL constraints)       */
+BitsLong        **definedConstraintPruned;    /* bitfields representing taxa sets of defined constraints after delited taxa are removed              */
+BitsLong        **definedConstraintTwoPruned; /* bitfields representing second taxa sets of defined constraints for PARTIAL constraints after delited*/
+                                              /* taxa are removed and for NEGATIVE constraint it contains complements of definedConstraintPruned     */
+int             echoMB;                /* flag used by Manual to prevent echoing        */
+BitsLong        expecting;             /* variable denoting expected token type         */
+int             foundNewLine;          /* whether a new line has been found             */
+int             inComment;             /* flag for whether input stream is commented    */
+int             inComparetreeCommand;  /* flag set whenever you enter comparetree cmd   */
+int             inferAncStates;        /* should ancestral states be inferred (y/n)     */
+int             inferSiteOmegas;       /* should site omegas be inferred (y/n)          */
+int             inferSiteRates;        /* should site rates be inferred (y/n)           */
+int             inMrbayesBlock;        /* flag for whether we are in a mrbayes block    */
+int             inSumtCommand;         /* flag set whenever you enter sumt cmd          */
+int             inTreesBlock;          /* flag for whether we are in a trees block      */
+int             inValidCommand;        /* a useful flag set whenever you enter a cmd    */
+int             isInAmbig, isInPoly;   /* flags whether we are within () or {}          */
+int             isTaxsetDef;           /* is a taxon set defined                        */
+int             isTranslateDef;        /* is a translation block defined                */
+int             isTranslateDiff;       /* is translate different from current taxaset?  */
+char            logFileName[100];      /* name of the log file                          */
+int             logToFile;             /* should screen output be logged to a file      */
+FILE            *logFileFp;            /* file pointer to log file                      */
+int             longIntegerSize;       /* size of an unsigned integer                   */
+char            manFileName[100];      /* name of the file for the command help info    */
+int             *matrix;               /* matrix containing original data               */
+int             matrixHasPoly;         /* flag for whether matrix has polymorphisms     */
+int             memAllocs[NUM_ALLOCS]; /* allocated memory flags                        */
+int             mode;                  /* mode of program (interactive/noninteractive)  */
+Calibration     *nodeCalibration;      /* holds information about node calibrations     */
+int             noWarn;                /* no warnings on overwriting files              */
+int             numChar;               /* number of characters in character matrix      */
+int             numCharSets;           /* number of character sets                      */
+int             numComments;           /* counts how deeply nested a comment is         */
+int             numDefinedConstraints; /* number of constraints defined                 */
+int             numDefinedPartitions;  /* number of partitions defined                  */
+int             numDefinedSpeciespartitions;  /* number of speciespartitions defined    */
+int             numNamedTaxa;          /* number of named taxa during parsing of cmd    */
+int             numOpenExeFiles;       /* number of execute files open                  */
+int             numSpecies;            /* number of species in current speciespartition */
+int             numTaxa;               /* number of taxa in character matrix            */
+int             numTaxaSets;           /* number of taxa sets                           */
+int             numTranslates;         /* number of taxa in active translate block      */
+int             outGroupNum;           /* number of outgroup taxon                      */
+ParmInfo        paramTable[NUMPARAMS]; /* information on parameters                     */
+char            **partitionNames;      /* hold names of partitions (first is "default") */
+int             **partitionId;         /* holds information about defined partitions    */
+int             partitionNum;          /* index of current partition                    */
+Plot            plotParams;            /* holds parameters for plot command             */
+int             precision;             /* precision of samples and summary stats        */
+int             quitOnError;           /* quit on error?                                */
+int             replaceLogFile;        /* should logfile be replace/appended to         */
+int             scientific;            /* use scientific format for samples ?           */
+char            spacer[10];            /* holds blanks for printing indentations        */
+NameSet         *speciesNameSets;      /* hold species name sets, one for each speciespartition     */
+int             **speciespartitionId;  /* holds info about defined speciespartitions    */
+char            **speciespartitionNames;    /* hold names of speciespartitions (first is "default") */
+int             speciespartitionNum;   /* index of current speciespartition             */
+Sump            sumpParams;            /* holds parameters for sump command             */
+Sumt            sumtParams;            /* holds parameters for sumt command             */
+Sumss           sumssParams;           /* holds parameters for sumss command            */
+TaxaInformation *taxaInfo;             /* holds critical information about taxa         */
+char            **taxaNames;           /* holds name of taxa                            */
+BitsLong        **taxaSet;             /* holds information about defined taxasets      */
+char            **taxaSetNames;        /* holds names of taxa sets                      */
+int             *tempActiveConstraints;/* temporarily holds active constraints size allcated        */
+enum ConstraintType  *definedConstraintsType;  /* Store type of constraint              */
+int             *tempSet;              /* temporarily holds defined set                 */
+int             *tempSetNeg;           /* holds bitset of negative set of taxa for partial constraint*/
+int             theAmbigChar;          /* int containing ambiguous character            */
+Calibration     *tipCalibration;       /* holds information about node calibrations     */
+char            **transFrom;           /* translation block information                 */
+char            **transTo;             /* translation block information                 */
+int             userBrlensDef;         /* are the branch lengths on user tree defined   */
+
+#if defined (BEAGLE_ENABLED)
+int             tryToUseBEAGLE;        /* try to use the BEAGLE library                 */
+int             beagleScalingScheme;   /* BEAGLE dynamic scaling                        */
+int             beagleScalingFrequency;/* BEAGLE dynamic scaling frequency              */
+long            beagleFlags;           /* BEAGLE required resource flags                */
+int             beagleResourceNumber;  /* BEAGLE resource number                        */
+int             *beagleResource;       /* BEAGLE resource choice list                   */
+int             beagleResourceCount;   /* BEAGLE resource choice list length            */
+int             beagleInstanceCount;   /* total number of BEAGLE instances              */
+#endif
+
+#if defined (THREADS_ENABLED)
+int             tryToUseThreads;       /* try to use pthreads with BEAGLE library       */
+#endif
+
+/* local (to this file) */
+char            *tokenP, token[CMD_STRING_LENGTH], *cmdStr=NULL;
+Calibration     defaultCalibration = {
+                    "Unconstrained",      /* name */
+                    unconstrained,        /* prior */
+                    { -1.0, -1.0, -1.0 }, /* priorParams */
+                    NULL,                 /* LnPriorProb */
+                    NULL,                 /* LnPriorRatio */
+                    -1.0,                 /* min */
+                    -1.0                  /* max */
+                };
+
+CmdType     commands[] =
+            {
+            /*  Information on commands initialization:
+             
+                    1 = Command number (cmdNumber)
+                    2 = Command name (string)
+                    3 = Special command (YES/NO) (specialCmd) 
+                    4 = Pointer to finishing function (fp)
+                    5 = Number of valid parameters (numParms)
+                    6 = List of valid parameters (parmList) 
+                    7 = Expecting (2^TokenType) (expect) (PARAMETER = 4; SEMICOLON = 32; ALPHA = 16384; 
+                        ALPHA | QUESTIONMARK | DASH | NUMBER | ASTERISK | EXCLAMATIONMARK | PERCENT | WEIRD | SEMICOLON = 11715360;
+                        ALPHA | QUESTIONMARK | DASH | NUMBER | ASTERISK | EXCLAMATIONMARK | PERCENT | WEIRD | VERTICALBAR | SEMICOLON | LEFTPAR | RIGHTPAR | LEFTCURL | RIGHTCURL = 649252640;
+                        PARAMETER | SEMICOLON = 36; NUMBER | ALPHA = 49152; ALPHA | SEMICOLON = 16416; EQUALSIGN = 8; NUMBER = 32768)
+                    8 = Description of the command (cmdDescription)
+                    9 = Where should the command be used (cmdUse) (IN_CMD = used from command line or mrbayes block; IN_FILE = used in data block or in tree block)
+                   10 = Should the command be shown when "help" is typed (hiding).
+             
+              #1                 #2   #3                 #4  #5                                                                                                #6        #7                                                            #8       #9   #10
+             -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
+            {  0,               "#",  NO,              NULL,  1,                                                                                              {0},        4,                                                           "", IN_FILE, HIDE },
+            {  1,           "About",  NO,           DoAbout,  0,                                                                                             {-1},       32,                                      "Describes the program",  IN_CMD, SHOW },
+            {  2, "Acknowledgments",  NO, DoAcknowledgments,  0,                                                                                             {-1},       32,                              "Shows program acknowledgments",  IN_CMD, SHOW },
+            {  3,           "Begin",  NO,              NULL,  6,                                                                              {1,2,3,201,226,227},        4,                         "Denotes beginning of block in file", IN_FILE, SHOW },
+            {  4,       "Calibrate",  NO,       DoCalibrate,  1,                                                                                            {119},        4,               "Assigns dates to terminals or interior nodes",  IN_CMD, SHOW },
+            {  5,         "Charset",  NO,         DoCharset,  1,                                                                                             {15},        4,                          "Assigns a group of sites to a set",  IN_CMD, SHOW },
+            {  6,        "Charstat",  NO,        DoCharStat,  0,                                                                                             {-1},       32,                                 "Shows status of characters",  IN_CMD, SHOW },
+            {  7,       "Citations",  NO,       DoCitations,  0,                                                                                             {-1},       32,                   "Citation of program, models, and methods",  IN_CMD, SHOW },
+            {  8,     "Comparetree",  NO,     DoCompareTree,  7,                                                                    {127,128,129,130,221,222,223},       36,                     "Compares the trees from two tree files",  IN_CMD, SHOW },
+            {  9,      "Constraint",  NO,      DoConstraint,  1,                                                                                             {66},        4,                      "Defines a constraint on tree topology",  IN_CMD, SHOW },
+            { 10,           "Ctype",  NO,           DoCtype,  1,                                                                                             {65},        4,                        "Assigns ordering for the characters",  IN_CMD, SHOW },
+            { 11,      "Databreaks", YES,          DoBreaks,  1,                                                                                             {93},    32768,           "Defines data breaks for autodiscrete gamma model",  IN_CMD, SHOW },
+            { 12,          "Delete", YES,          DoDelete,  1,                                                                                             {47},    49152,                             "Deletes taxa from the analysis",  IN_CMD, SHOW },
+            { 13,      "Dimensions",  NO,      DoDimensions,  2,                                                                                            {4,5},        4,                           "Defines size of character matrix", IN_FILE, SHOW },
+            { 14,      "Disclaimer",  NO,      DoDisclaimer,  0,                                                                                             {-1},       32,                               "Describes program disclaimer",  IN_CMD, SHOW },
+            { 15,             "End",  NO,        DoEndBlock,  0,                                                                                             {-1},       32,                             "Denotes end of a block in file", IN_FILE, SHOW },
+            { 16,        "Endblock",  NO,        DoEndBlock,  0,                                                                                             {-1},       32,                 "Alternative way of denoting end of a block", IN_FILE, SHOW },
+            { 17,         "Exclude", YES,         DoExclude,  1,                                                                                             {45},    49152,                           "Excludes sites from the analysis",  IN_CMD, SHOW },
+            { 18,         "Execute", YES,         DoExecute,  1,                                                                                             {12},    16384,                                            "Executes a file",  IN_CMD, SHOW },
+            { 19,          "Format",  NO,          DoFormat,  7,                                                                             {6,7,8,9,10,219,220},        4,                     "Defines character format in data block", IN_FILE, SHOW },
+            { 20,            "Help", YES,            DoHelp,  1,                                                                                             {50},    16416,                  "Provides detailed description of commands",  IN_CMD, SHOW },
+            { 21,         "Include", YES,         DoInclude,  1,                                                                                             {46},    49152,                                             "Includes sites",  IN_CMD, SHOW },
+            { 22,            "Link",  NO,            DoLink, 30,  {55,56,57,58,59,60,61,62,63,72,73,74,75,76,105,118,193,194,195,196,197,242,243,252,253,255,256,
+                                                                                                                                                     270,273,274},        4,               "Links parameters across character partitions",  IN_CMD, SHOW },
+            { 23,             "Log",  NO,             DoLog,  5,                                                                                 {85,86,87,88,89},        4,                               "Logs screen output to a file",  IN_CMD, SHOW },
+            { 24,            "Lset",  NO,            DoLset, 16,                                             {28,29,30,31,32,33,34,40,51,52,53,90,91,131,188,189},        4,                "Sets the parameters of the likelihood model",  IN_CMD, SHOW },
+            { 25,          "Manual",  NO,          DoManual,  1,                                                                                            {126},       36,                  "Prints a command reference to a text file",  IN_CMD, SHOW },
+            { 26,          "Matrix", YES,          DoMatrix,  1,                                                                                             {11},649252640,                 "Defines matrix of characters in data block", IN_FILE, SHOW },
+            { 27,            "Mcmc",  NO,            DoMcmc, 46,  {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
+                                                                                     153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215},       36,                   "Starts Markov chain Monte Carlo analysis",  IN_CMD, SHOW },
+            { 28,           "Mcmcp",  NO,           DoMcmcp, 46,  {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
+                                                                                     153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215},        4,     "Sets parameters of a chain (without starting analysis)",  IN_CMD, SHOW },
+            { 29,        "Outgroup", YES,        DoOutgroup,  1,                                                                                             {78},    49152,                                     "Changes outgroup taxon",  IN_CMD, SHOW },
+            { 30,           "Pairs", YES,           DoPairs,  1,                                                                                             {92},    32768,        "Defines nucleotide pairs (doublets) for stem models",  IN_CMD, SHOW },
+            { 31,       "Partition",  NO,       DoPartition,  1,                                                                                             {16},        4,                              "Assigns a character partition",  IN_CMD, SHOW },
+            { 32,            "Plot",  NO,            DoPlot,  6,                                                                        {106,107,108,109,224,225},       36,                        "Plots parameters from MCMC analysis",  IN_CMD, SHOW },
+            { 33,           "Prset",  NO,           DoPrset, 43,  {35,36,37,38,39,41,42,43,44,54,64,67,68,69,70,71,77,100,101,102,103,104,110,111,117,120,121,133,
+                                                                                                 168,172,173,174,183,184,185,218,241,246,247,251,254,269,271,272},        4,                         "Sets the priors for the parameters",  IN_CMD, SHOW },
+            { 34,         "Propset",  NO,         DoPropset,  1,                                                                                            {186},        4,          "Sets proposal probabilities and tuning parameters",  IN_CMD, SHOW },
+            { 35,            "Quit",  NO,            DoQuit,  0,                                                                                             {-1},       32,                                          "Quits the program",  IN_CMD, SHOW },
+            { 36,          "Report",  NO,          DoReport,  9,                                                            {122,123,124,125,134,135,136,192,217},        4,                 "Controls how model parameters are reported",  IN_CMD, SHOW },
+            { 37,         "Restore", YES,         DoRestore,  1,                                                                                             {48},    49152,                                              "Restores taxa",  IN_CMD, SHOW },
+            { 38,             "Set",  NO,             DoSet, 22,           {13,14,94,145,170,171,179,181,182,216,229,233,234,235,236,237,238,239,240,245,268,275},        4,      "Sets run conditions and defines active data partition",  IN_CMD, SHOW },
+            { 39,      "Showbeagle",  NO,      DoShowBeagle,  0,                                                                                             {-1},       32,                            "Show available BEAGLE resources",  IN_CMD, SHOW },
+            { 40,      "Showmatrix",  NO,      DoShowMatrix,  0,                                                                                             {-1},       32,                             "Shows current character matrix",  IN_CMD, SHOW },
+            { 41,   "Showmcmctrees",  NO,   DoShowMcmcTrees,  0,                                                                                             {-1},       32,                          "Shows trees used in mcmc analysis",  IN_CMD, SHOW },
+            { 42,       "Showmodel",  NO,       DoShowModel,  0,                                                                                             {-1},       32,                                       "Shows model settings",  IN_CMD, SHOW },
+            { 43,       "Showmoves",  NO,       DoShowMoves,  1,                                                                                            {180},       36,                              "Shows moves for current model",  IN_CMD, SHOW },
+            { 44,      "Showparams",  NO,      DoShowParams,  0,                                                                                             {-1},       32,                          "Shows parameters in current model",  IN_CMD, SHOW },
+            { 45,   "Showusertrees",  NO,   DoShowUserTrees,  0,                                                                                             {-1},       32,                                   "Shows user-defined trees",  IN_CMD, SHOW },
+            { 46,"Speciespartition",  NO,DoSpeciespartition,  1,                                                                                            {244},        4,                   "Defines a partition of tips into species",  IN_CMD, SHOW },
+            { 47,              "Ss",  NO,              DoSs, 50,  {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
+                                                                     153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215,248,249,250,257},       36,                             "Starts stepping-stone sampling",  IN_CMD, SHOW },
+            { 48,             "Ssp",  NO,             DoSsp, 50,  {17,18,19,20,21,22,23,24,25,26,27,84,98,112,113,114,115,116,132,142,143,144,148,149,150,151,152,
+                                                                     153,154,155,156,157,158,159,160,166,169,190,191,198,199,200,202,213,214,215,248,249,250,257},       36,"Sets parameters of stepping-stone analysis (without starting)",IN_CMD, SHOW },
+            { 49,       "Startvals",  NO,       DoStartvals,  1,                                                                                            {187},        4,                         "Sets starting values of parameters",  IN_CMD, SHOW },
+            { 50,            "Sump",  NO,            DoSump, 13,                                              {96,97,137,138,139,140,141,161,162,178,211,212,231},       36,                   "Summarizes parameters from MCMC analysis",  IN_CMD, SHOW },
+            { 51,           "Sumss",  NO,           DoSumSs, 10,                                                        {258,259,260,261,262,263,264,265,266,267},       36,         "Summarizes parameters from stepping-stone analysis",  IN_CMD, SHOW },
+            { 52,            "Sumt",  NO,            DoSumt, 21,                {80,81,82,95,146,147,163,164,165,167,175,177,204,205,206,207,208,209,210,230,232},       36,                        "Summarizes trees from MCMC analysis",  IN_CMD, SHOW },
+            { 53,        "Taxastat",  NO,        DoTaxaStat,  0,                                                                                             {-1},       32,                                       "Shows status of taxa",  IN_CMD, SHOW },
+            { 54,          "Taxset",  NO,         DoTaxaset,  1,                                                                                             {49},        4,                           "Assigns a group of taxa to a set",  IN_CMD, SHOW },
+            { 55,       "Taxlabels", YES,       DoTaxlabels,  1,                                                                                            {228},    49152,                                       "Defines taxon labels", IN_FILE, SHOW },
+            { 56,       "Translate", YES,       DoTranslate,  1,                                                                                             {83},    49152,                         "Defines alternative names for taxa", IN_FILE, SHOW },
+            { 57,            "Tree",  NO,            DoTree,  1,                                                                                             {79},        4,                                             "Defines a tree", IN_FILE, SHOW },
+            { 58,          "Unlink",  NO,          DoUnlink, 30,  {55,56,57,58,59,60,61,62,63,72,73,74,75,76,105,118,193,194,195,196,197,242,243,252,253,255,256,
+                                                                                                                                                     270,273,274},        4,             "Unlinks parameters across character partitions",  IN_CMD, SHOW },
+            { 59,        "Usertree", YES,        DoUserTree,  1,                                                                                            {203},        8,                                 "Defines a single user tree",  IN_CMD, HIDE },
+            { 60,         "Version",  NO,         DoVersion,  0,                                                                                             {-1},       32,                                      "Shows program version",  IN_CMD, SHOW },
+            { 61,      "Compareref",  NO,     DoCompRefTree,  7,                                                                    {127,128,129,130,221,222,223},       36,                     "Compares the tree to the reference trees",  IN_CMD, HIDE },
+            /* NOTE: If you add a command here, make certain to change NUMCOMMANDS (above, in this file) appropriately! */
+            { 999,             NULL,  NO,              NULL,  0,                                                                                             {-1},       32,                                                           "",  IN_CMD, HIDE }  
+            };
+int                 inDataBlock, inForeignBlock, isInterleaved, isFirstMatrixRead, isFirstInterleavedBlock, 
+                    taxonCount, fromI, toJ, everyK, foundDash, foundSlash, foundFirst, isMixed, whichPartition,
+                    isNegative, numDivisions, charOrdering, foundExp, foundColon, isFirstNode, nextAvailableNode,
+                    pairId, firstPair, inTaxaBlock, inCharactersBlock, foundEqual;
+char                gapId, missingId, matchId, tempSetName[100], **tempNames;
+CmdType             *commandPtr; /* Points to the commands array entry which corresponds to currently processed command */
+ParmInfoPtr         paramPtr;    /* Points to paramTable table array entry which corresponds to currently processed parameter of current command */
+TreeNode            *pPtr, *qPtr;
+
+enum ConstraintType     consrtainType; /* Used only in processing of constraine command to indicate what is the type of constrain */
+
+
+int AddToGivenSet (int i, int j, int k, int id, int *Set)
+{
+    int     m, n;
+    
+    if (id <= 0)
+        {
+        MrBayesPrint ("%s   The id for a temporary set should be greater than 0\n", spacer);
+        return (ERROR);
+        }
+    
+    if (i < 0 && j < 0)
+        return (ERROR);
+    else if (i < 0 && j >= 0)
+        return (ERROR);
+    else if (i >= 0 && j < 0)
+        {
+        if (k >= 0)
+            return (ERROR);
+        else
+            {
+            if (Set[i] != 0)
+                {
+                MrBayesPrint ("%s   Character %d defined more than once\n", spacer, i+1);
+                return (ERROR);
+                }
+            Set[i] = id;
+            }
+        }
+    else if (i >= 0 && j >= 0)
+        {
+        if (k < 0)
+            {
+            for (m=i; m<=j; m++)
+                {
+                if (Set[m] != 0)
+                    {
+                    MrBayesPrint ("%s   Character %d defined more than once\n", spacer, m+1);
+                    return (ERROR);
+                    }
+                Set[m] = id;
+                }
+            }
+        else
+            {
+            n = k;
+            for (m=i; m<=j; m++)    
+                {
+                if (n % k == 0)
+                    {
+                    if (Set[m] != 0)
+                        {
+                        MrBayesPrint ("%s   Character %d defined more than once\n", spacer, m+1);
+                        return (ERROR);
+                        }
+                    Set[m] = id;
+                    }
+                n++;
+                }
+            }
+        }
+
+    return (NO_ERROR);
+    
+}
+
+
+int AddToSet (int i, int j, int k, int id)
+{
+    return AddToGivenSet (i, j, k,id, tempSet);
+}
+
+
+/* AddNameSet: Push a name set onto the end of a list of name sets, with reallocation
+      of list to hold the extra element. The calling function needs to keep track of
+      the counter holding the length of the list. */
+int AddNameSet (NameSet **nameSetList, int numNameSets, char **nameSet, int numNames)
+{
+    int     i;
+
+    (*nameSetList) = (NameSet*) SafeRealloc ((void*)(*nameSetList), ((size_t)numNameSets+1)*sizeof(NameSet));
+
+    (*nameSetList)[numNameSets].names    = NULL;
+    (*nameSetList)[numNameSets].numNames = numNames;
+
+    for (i=0; i<numNames; i++)
+        AddString(&((*nameSetList)[numNameSets].names), i, nameSet[i]);
+    
+    return NO_ERROR;
+}
+
+
+/* AddString: Push a string onto the end of a list, with reallocation of list
+      to hold the extra element. The calling function needs to keep track of
+      the counter holding the length of the list. */
+int AddString (char ***list, int len, char *token)
+{
+    (*list) = (char **) SafeRealloc ((void *)(*list), ((size_t)len+1)*sizeof(char*));
+    if (!(*list))
+        return ERROR;
+
+    (*list)[len] = (char *) SafeCalloc ((strlen(token)+1), sizeof(char));
+    if (!(*list)[len])
+        return ERROR;
+
+    strcpy ((*list)[len], token);
+    
+    return NO_ERROR;
+}
+
+
+int AllocCharacters (void)
+{
+    int     i, tempSetSize;
+
+    if (memAllocs[ALLOC_MATRIX] == YES)
+        goto errorExit;
+    matrix = (int *) SafeMalloc((size_t)numTaxa * (size_t)numChar * sizeof(int));
+    if (!matrix)
+        {
+        MrBayesPrint ("%s   Problem allocating matrix (%d)\n", spacer, numTaxa * numChar * sizeof(int));
+        goto errorExit;
+        }
+    for (i=0; i<numTaxa * numChar; i++)
+        matrix[i] = 0;
+    memAllocs[ALLOC_MATRIX] = YES;
+
+    if (memAllocs[ALLOC_CHARINFO] == YES)
+        goto errorExit;
+    charInfo = (CharInformation *) SafeMalloc ((size_t)numChar * sizeof(CharInformation));
+    if (!charInfo)
+        {
+        MrBayesPrint ("%s   Problem allocating charInfo (%d)\n", spacer, numChar * sizeof(CharInformation));
+        goto errorExit;
+        }
+    for (i=0; i<numChar; i++)
+        {
+        charInfo[i].isExcluded = NO;
+        charInfo[i].numStates = 0;
+        charInfo[i].charType = 0;
+        charInfo[i].isMissAmbig = NO;
+        charInfo[i].ctype = UNORD;
+        charInfo[i].charId = 0;
+        charInfo[i].pairsId = 0;
+        charInfo[i].bigBreakAfter = NO;
+        }
+    memAllocs[ALLOC_CHARINFO] = YES;
+
+    if (memAllocs[ALLOC_CHARSETS] == YES)
+        goto errorExit;
+    charSetNames = NULL;
+    charSet = NULL;
+    numCharSets = 0;
+    memAllocs[ALLOC_CHARSETS] = YES;    /* safe to do free */
+
+    if (memAllocs[ALLOC_PARTITIONS] == YES)
+        goto errorExit;
+    partitionNames = NULL;
+    partitionId = (int**) SafeMalloc ((size_t)numChar * sizeof(int*));
+    for (i=0; i<numChar; i++)
+        partitionId[i] = (int *) SafeMalloc (sizeof(int));
+    numDefinedPartitions = 0;   /* number of defined partitions */
+    memAllocs[ALLOC_PARTITIONS] = YES;  /* safe to do free */
+
+    if (memAllocs[ALLOC_PARTITIONVARS] == YES)
+        goto errorExit;
+    numVars           = NULL;
+    tempLinkUnlinkVec = NULL;
+    activeParts       = NULL;
+    tempLinkUnlinkVec = NULL;
+    tempNum           = NULL;
+    linkTable[0]      = NULL;
+    tempLinkUnlink[0] = NULL;
+    for (i=0; i<NUM_LINKED; i++)
+        {
+        linkTable[i]      = NULL;
+        tempLinkUnlink[i] = NULL;
+        activeParams[i]   = NULL;
+        }
+    memAllocs[ALLOC_PARTITIONVARS] = YES;
+
+    if (memAllocs[ALLOC_TMPSET] == NO)
+        goto errorExit;
+    if (numChar > numTaxa)
+        tempSetSize = numChar;
+    else
+        tempSetSize = numTaxa;
+    tempSet = (int *) SafeRealloc ((void *)tempSet, (size_t)tempSetSize * sizeof(int));
+    tempSetNeg = (int *) SafeRealloc ((void *)tempSetNeg, (size_t)tempSetSize * sizeof(int));
+    if (!tempSet || !tempSetNeg)
+        {
+        MrBayesPrint ("%s   Problem reallocating tempSet (%d)\n", spacer, tempSetSize * sizeof(int));
+        goto errorExit;
+        }
+
+    MrBayesPrint ("%s   Allocated matrix\n", spacer);
+    return (NO_ERROR);
+
+    errorExit:
+        MrBayesPrint ("%s   Problem allocating matrix\n", spacer);
+        FreeMatrix();
+        return (ERROR);
+}
+
+
+int AllocMatrix (void)
+{
+    if (memAllocs[ALLOC_TAXA] == NO && AllocTaxa() == ERROR)
+        return ERROR;
+    else
+        return (AllocCharacters());
+}
+
+
+int AllocTaxa (void)
+{
+    int i;
+
+    if (defTaxa==NO)
+        {
+        MrBayesPrint ("%s   Number of taxa not defined\n", spacer);
+        return (ERROR);
+        }
+    if (numTaxa == 0)
+        {
+        MrBayesPrint ("%s   Number of taxa is 0\n", spacer);
+        return (ERROR);
+        }
+
+    /* allocate space for taxa */
+    if (memAllocs[ALLOC_TAXA] == YES)
+        goto errorExit;
+    taxaNames = NULL;   /* This variable is allocated in AddString */
+    taxaInfo = (TaxaInformation *) SafeMalloc ((size_t)numTaxa * sizeof(TaxaInformation));
+    if (!taxaInfo)
+        {
+        goto errorExit;
+        }
+    tipCalibration = (Calibration *) SafeMalloc ((size_t)numTaxa * sizeof(Calibration));
+    if (!tipCalibration)
+        {
+        free (taxaInfo);
+        taxaInfo = NULL;
+        goto errorExit;
+        }
+    for (i=0; i<numTaxa; i++)
+        {
+        taxaInfo[i].isDeleted = NO;
+        taxaInfo[i].charCount = 0;
+        }
+    memAllocs[ALLOC_TAXA] = YES;
+
+    /* taxa sets */
+    if (memAllocs[ALLOC_TAXASETS] == YES)
+        goto errorExit;
+    taxaSetNames = NULL;
+    taxaSet = NULL;
+    numTaxaSets = 0;
+    memAllocs[ALLOC_TAXASETS] = YES;    /* safe to free */
+
+    /* species partitions; allocate space and set default species partition */
+    if (memAllocs[ALLOC_SPECIESPARTITIONS] == YES)
+        goto errorExit;
+    speciespartitionNames = NULL;
+    speciesNameSets = NULL;
+    speciespartitionId = (int**) SafeMalloc ((size_t)numTaxa * sizeof(int*));
+    for (i=0; i<numTaxa; i++)
+        {
+        speciespartitionId[i] = (int *) SafeMalloc (sizeof(int));
+        speciespartitionId[i][0] = i + 1;   /* 1-based taxon index, do not ask me why */
+        }
+    numDefinedSpeciespartitions = 0;   /* number of defined species partitions */
+    memAllocs[ALLOC_SPECIESPARTITIONS] = YES;  /* safe to do free */
+
+    /* constraints */
+    if (memAllocs[ALLOC_CONSTRAINTS] == YES)
+        goto errorExit;
+    constraintNames = NULL;
+    definedConstraintsType = NULL; 
+    definedConstraint = NULL;
+    definedConstraintTwo = NULL;
+    definedConstraintPruned = NULL;
+    definedConstraintTwoPruned = NULL;   
+    numDefinedConstraints = 0;
+    tempActiveConstraints = NULL;
+    memAllocs[ALLOC_CONSTRAINTS] = YES;     /* safe to free */
+
+    /* translate table */
+    transFrom = NULL;
+    transTo = NULL;
+    numTranslates = 0;
+
+    /* tempSet */
+    if (memAllocs[ALLOC_TMPSET] == YES)
+        goto errorExit;
+    tempSet = (int *) SafeMalloc ((size_t)numTaxa * sizeof(int));
+    tempSetNeg = (int *) SafeMalloc ((size_t)numTaxa * sizeof(int));
+    if (!tempSet || !tempSetNeg)
+        goto errorExit;
+    memAllocs[ALLOC_TMPSET] = YES;
+
+    /* make sure previous user trees are freed */
+    if (numUserTrees > 0)
+        {
+        MrBayesPrint ("%s   Previous user trees not freed\n", spacer);
+        goto errorExit;
+        }
+
+    MrBayesPrint ("%s   Allocated taxon set\n", spacer);
+    return NO_ERROR;
+
+errorExit:
+    MrBayesPrint ("%s   Problem allocating taxon set\n", spacer);
+    FreeTaxa();
+    return ERROR;
+}
+
+
+char ChangeCase (char c)
+{
+    int     x;
+    
+    x = tolower(c);
+    return (x);
+}
+
+
+int CharacterCode (char ch, int *charCode, int chType)
+{
+    if (chType == DNA || chType == RNA)
+        {
+        if ((*charCode = NucID (ch)) == -1)
+            {
+            MrBayesPrint ("%s   Unrecognized DNA/RNA character '%c'\n", spacer, ch);
+            return (ERROR);
+            }
+        }
+    else if (chType == PROTEIN)
+        {
+        if ((*charCode = ProtID (ch)) == -1)
+            {
+            MrBayesPrint ("%s   Unrecognized Protein character '%c'\n", spacer, ch);
+            return (ERROR);
+            }
+        }
+    else if (chType == RESTRICTION)
+        {
+        if ((*charCode = MBResID (ch)) == -1)
+            {
+            MrBayesPrint ("%s   Unrecognized Restriction character '%c'\n", spacer, ch);
+            return (ERROR);
+            }
+        }
+    else if (chType == STANDARD)
+        {
+        if ((*charCode = StandID (ch)) == -1)
+            {
+            MrBayesPrint ("%s   Unrecognized Standard character '%c'\n", spacer, ch);
+            return (ERROR);
+            }
+        }
+    else if (chType == CONTINUOUS)
+        {
+        MrBayesPrint ("%s   CharacterCode function cannot check continuous characters\n", spacer);
+        }
+    else
+        {
+        MrBayesPrint ("%s   Unrecognized character type (%d)\n", spacer, chType);
+        return (ERROR);
+        }
+        
+    return (NO_ERROR);
+}
+
+
+int CharacterNumber (int charCode, int chType)
+{
+    int i, x = charCode;
+    
+    if (chType == CONTINUOUS)
+        return 0;
+
+    for (i=0; x!=0; i++)
+        x >>= 1;
+
+    return (i);
+}
+
+
+int CheckInitialPartitions (void)
+{
+    int     i;
+    
+    for (i=0; i<numChar; i++)
+        {
+        if (partitionId[i][0] <= 0 || partitionId[i][0] > numDivisions)
+            {
+            MrBayesPrint ("%s   The partition for site %d is incorrect\n", spacer, i+1); 
+            return (ERROR);
+            }
+        }
+        
+    return (NO_ERROR);
+}
+
+
+int CheckStringValidity (char *s)
+{
+    int         i, numUnknownChars, tempNumComments, tempInComment;
+    char        temp[100];
+
+    i = 0;
+    numUnknownChars = 0;
+    tempNumComments = numComments;
+    tempInComment = inComment;
+
+    while (s[i] != '\0')
+        {
+        if (tempInComment == NO)
+            {
+            if (!IsIn(s[i],"=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.;:,#()[]?-*/'\\'!%\"&~+^$@|{}`>< "))
+                {
+                if (IsWhite(s[i]) == 1 || IsWhite(s[i]) == 2)
+                    {
+                    
+                    }
+                else
+                    {
+                    if (commandPtr == NULL) 
+                        return (ERROR);
+                    MrBayesPrint ("%s   Unknown character \"%c\" (ASCII code %d)\n", spacer, s[i], s[i]);
+                    if (!strcmp(commandPtr->string,"Matrix"))
+                        {
+                        if (foundNewLine == NO)
+                            {
+                            MrBayesPrint ("%s   The error is in character %d for taxon %s\n", spacer, taxaInfo[taxonCount-1].charCount+i+1, "???"); /* bug? */
+                            }
+                        else
+                            {
+                            if (taxonCount == 0)
+                                MrBayesPrint ("%s   The error is in the first taxon name\n", spacer);
+                            else
+                                {
+                                strcpy(temp, taxaNames[taxonCount]);
+                                if (isInterleaved == NO)
+                                    MrBayesPrint ("%s   The error is in the name of the taxon following taxon %s\n", spacer, temp);
+                                else
+                                    {
+                                    MrBayesPrint ("%s   The error is in the name of the taxon following taxon %s\n", spacer, temp);
+                                    MrBayesPrint ("%s   in one of the interleaved data blocks\n", spacer);
+                                    }
+                                }
+                            }
+                        }
+                    else if (!strcmp(commandPtr->string,"Execute"))
+                        {
+                        MrBayesPrint ("%s   Assuming irrelevant characters at beginning of file; processing continues\n", spacer);
+                        return (NO_ERROR);
+                        }
+                    return (ERROR);
+                    }
+                }
+            if (s[i]=='[')
+                {
+                tempInComment = YES;
+                tempNumComments++;
+                }
+            }
+        else if (tempInComment == YES)
+            {
+            if (s[i]==']')
+                {
+                tempNumComments--;
+                if (tempNumComments == 0)
+                    tempInComment = NO;
+                }
+            }
+        i++;
+        }
+        
+    if (numUnknownChars > 0)
+        return (ERROR);
+    else
+        return (NO_ERROR);
+}
+
+
+/* CheckString: This function simply checks a vector of strings for a match against token.
+          Upon return, matchIndex contains the index of the matched string. An
+          ERROR is returned if there are no matches.  */
+int CheckString (char **list, int len, char *token, int *matchIndex)
+{
+    int         i;      
+        
+    *matchIndex = -1;
+    for (i=0; i<len; i++)
+        {
+        if (StrCmpCaseInsensitive(token,list[i]) == 0)
+            {
+            *matchIndex = i;
+            return (NO_ERROR);
+            }
+        }
+
+    return (ERROR); 
+}
+
+
+int Dex (TreeNode *p)
+{
+    return (p == NULL) ? -1 : p->index;
+}
+
+
+int DoAbout (void)
+{
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+    MrBayesPrint ("   About the program                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes is a program for the Bayesian estimation of phylogeny. Bayesian       \n");
+    MrBayesPrint ("   inference of phylogeny is based upon the posterior probability distribution   \n");
+    MrBayesPrint ("   of trees. Trees are labelled T1, T2, ..., Tn, where n is the number of        \n");
+    MrBayesPrint ("   possible trees. The posterior probability of the i-th tree is calculated      \n");
+    MrBayesPrint ("   using Bayes\'s formula as                                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Pr[Ti | X] = Pr[X | Ti] X Pr[Ti] / Pr[X]                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   where X is a character matrix. Here, \"Pr[Ti | X]\" is the posterior          \n");
+    MrBayesPrint ("   probability of the i-th tree, \"Pr[X | Ti]\" is the likelihood of the         \n");
+    MrBayesPrint ("   i-th tree, and \"Pr[Ti]\" is the prior probability of the i-th tree. The      \n");
+    MrBayesPrint ("   denominator of Bayes\'s formula (\"Pr[X]\") is a normalizing constant that    \n");
+    MrBayesPrint ("   involves a summation over all possible trees. The likelihood, as described    \n");
+    MrBayesPrint ("   above, cannot be calculated with knowledge of only the tree\'s topology. You  \n");
+    MrBayesPrint ("   also need to have information on the lenths of the branches and on the        \n");
+    MrBayesPrint ("   mechanism of character change. Hence, the likelihood (\"Pr[X | Ti]\")         \n");
+    MrBayesPrint ("   involves a multidimensional integral over all possible combinations of        \n");
+    MrBayesPrint ("   branch lengths and substitution model parameters.                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   In practice, it is impossible to calculate the posterior probability dist-    \n");
+    MrBayesPrint ("   ribution of trees analytically. Instead, the posterior probability            \n");
+    MrBayesPrint ("   of trees must be approximated. MrBayes uses a method called Markov chain      \n");
+    MrBayesPrint ("   Monte Carlo (MCMC) to approximate the posterior probability of trees.         \n");
+    MrBayesPrint ("   The object of MCMC is to construct a Markov chain that has as its state       \n");
+    MrBayesPrint ("   space the parameters of the phylogenetic model and a stationary distribution  \n");
+    MrBayesPrint ("   that is the posterior probability distribution of trees. MCMC takes valid,    \n");
+    MrBayesPrint ("   albeit dependent, samples from the posterior probability distribution of      \n");
+    MrBayesPrint ("   trees. The fraction of the time any tree appears in this sample is a          \n");
+    MrBayesPrint ("   valid approximation of the posterior probability of the tree. MrBayes keeps   \n");
+    MrBayesPrint ("   track of all the parameters of the phylogenetic model. The trees (with branch \n");
+    MrBayesPrint ("   lengths) that were sampled by the MCMC procedure are saved in one file        \n");
+    MrBayesPrint ("   (a file with a \".t\" extension) whereas the parameters of the model of       \n");
+    MrBayesPrint ("   character change are saved in another file (a file with a \".p\" ext-         \n");
+    MrBayesPrint ("   ension). You can summarize the results in the \".t\" and \".p\" files         \n");
+    MrBayesPrint ("   using the \"sumt\" and \"sump\" commands, respectively.                       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes was originally written by John Huelsenbeck in August of 2000 and was  \n");
+    MrBayesPrint ("   intended to be distributed to a small number of people. In March of 2001,     \n");
+    MrBayesPrint ("   Fredrik Ronquist started making contributions to the program. The contribu-   \n");
+    MrBayesPrint ("   tions were of such a significant nature that he was made a coauthor of the    \n");
+    MrBayesPrint ("   program. Version 3 of MrBayes was a fully joint effort, started in the summer \n");
+    MrBayesPrint ("   of 2002 when JPH visited Sweden on a grant from the Wenner-Gren Foundations.  \n");
+    MrBayesPrint ("   Several others have contributed to the MrBayes code since then, most notably  \n");
+    MrBayesPrint ("   Paul van der Mark and Maxim Teslenko, both postdocs/programmers in Fredrik's  \n");
+    MrBayesPrint ("   lab. A large number of users and students, too many to list here, have also   \n");
+    MrBayesPrint ("   contributed importantly to the project (type 'Acknowledgments' for a list of  \n");
+    MrBayesPrint ("   some of them).                                                                \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   Since 2003, MrBayes has been distributed from SourceForge. Bugs can be repor- \n");
+    MrBayesPrint ("   ted to the MrBayes site on SourceForge or by contacting Maxim Teslenko        \n");
+    MrBayesPrint ("   (maxim.teslenko@nrm.se) directly.                                             \n");
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+
+    return (NO_ERROR);
+}
+
+
+int DoAcknowledgments (void)
+{
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+    MrBayesPrint ("   Acknowledgments                                                               \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   JPH and FR would like to thank Gautam Altekar, Andrea Betancourt, Jon         \n");
+    MrBayesPrint ("   Bollback, Barry Hall, Jimmy McGuire, Rasmus Nielsen, David Swofford,          \n");
+    MrBayesPrint ("   Johan Nylander, Mikael Thollesson, and Derrick Zwickl for help during the     \n");
+    MrBayesPrint ("   initial development of this program. Gautam Altekar, especially, was instru-  \n");
+    MrBayesPrint ("   mental in getting the parallel version of the program working. Important bug- \n");
+    MrBayesPrint ("   fixes and additional functionality was contributed by Clemens Lakner, Sebas-  \n");
+    MrBayesPrint ("   tian Hoehna, Paul Lewis, Mark Holder, Julian Catchen and Bret Larget. Marc    \n");
+    MrBayesPrint ("   Suchard, Daniel Ayres and Aaron Darling got mrbayes working with beagle and   \n");
+    MrBayesPrint ("   contributed a lot of related functionality and bug fixes. Aaron Darling was   \n");
+    MrBayesPrint ("   instrumental in getting the Windows installer set up. Liu Liang and Dennis    \n");
+    MrBayesPrint ("   Pearl helped integrate MrBayes with BEST.                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   Bug fixes and user support was provided by Paul van der Mark (2005-2007) and  \n");
+    MrBayesPrint ("   from 2010 by Maxim Teslenko (maxim.teslenko@nrm.se).                          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   Our wives -- Edna Huelsenbeck and Eva Ronquist -- showed extraordinary        \n");
+    MrBayesPrint ("   patience with us while we spent many late nights programming.                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   JPH was supported by NSF grants DEB-007540 and MCB-0075404 and a Wenner-      \n");
+    MrBayesPrint ("   Gren scholarship while writing this program. FR was supported by grants       \n");
+    MrBayesPrint ("   from the Swedish Natural Science Research Council and the Swedish Research    \n");
+    MrBayesPrint ("   Council.                                                                      \n");
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+
+    return (NO_ERROR);
+}
+
+
+int DoBeginParm (char *parmName, char *tkn)
+{
+    if (expecting == Expecting(PARAMETER))
+        {
+        /* set Data (inDataBlock) *************************************************************/
+        if (!strcmp(parmName, "Data"))
+            {
+            if (FreeModel () == ERROR)
+                return (ERROR);
+            if (FreeMatrix () == ERROR)
+                return (ERROR);
+            MrBayesPrint ("   Reading data block\n");
+            inDataBlock = YES;
+            expecting = Expecting(SEMICOLON);
+            strcpy (spacer, "   ");
+            }
+        /* set Characters (inCharactersBlock) *************************************************************/
+        else if (!strcmp(parmName, "Characters"))
+            {
+            if (FreeModel () == ERROR)
+                return (ERROR);
+            if (FreeCharacters () == ERROR)
+                return (ERROR);
+            MrBayesPrint ("   Reading characters block\n");
+            inCharactersBlock = YES;
+            expecting = Expecting(SEMICOLON);
+            strcpy (spacer, "   ");
+            }
+        /* set Taxa (inTaxaBlock) *************************************************************/
+        else if (!strcmp(parmName, "Taxa"))
+            {
+            if (FreeModel () == ERROR)
+                return (ERROR);
+            if (FreeMatrix () == ERROR)
+                return (ERROR);
+            MrBayesPrint ("   Reading taxa block\n");
+            inTaxaBlock = YES;
+            expecting = Expecting(SEMICOLON);
+            strcpy (spacer, "   ");
+            }
+        /* set Mrbayes (inMrbayesBlock) *******************************************************/
+        else if (!strcmp(parmName, "Mrbayes"))
+            {
+            MrBayesPrint ("   Reading mrbayes block\n");
+            inMrbayesBlock = YES;
+            expecting = Expecting(SEMICOLON);
+            strcpy (spacer, "   ");
+            }
+        /* set Trees (inTreesBlock) *******************************************************/
+        else if (!strcmp(parmName, "Trees"))
+            {
+            MrBayesPrint ("   Reading trees block\n");
+            inTreesBlock = YES;
+            expecting = Expecting(SEMICOLON);
+            strcpy (spacer, "   ");
+            }
+        /* set Foreign (inForeignBlock) *******************************************************/
+        else
+            {
+            MrBayesPrint ("   Skipping \"%s\" block\n", tkn);
+            inForeignBlock = YES;
+            expecting = Expecting(SEMICOLON);
+            strcpy (spacer, "");
+            }
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoBreaks (void)
+{
+    int         i, numBreaks;
+    
+    numBreaks = 0;
+    for (i=0; i<numChar; i++)
+        {
+        if (charInfo[i].bigBreakAfter == YES)
+            {
+            numBreaks++;
+            }
+        }
+        
+    if (numBreaks > 0)
+        {
+        if (numBreaks == 1)
+            MrBayesPrint ("%s   One data break found after character ", spacer, numBreaks);
+        else
+            MrBayesPrint ("%s   %d data breaks found after characters: ", spacer, numBreaks);
+        for (i=0; i<numChar; i++)
+            {
+            if (charInfo[i].bigBreakAfter == YES)
+                {
+                MrBayesPrint ("%d ", i+1);
+                }
+            }
+        MrBayesPrint ("\n");
+
+        if (numBreaks == 1)
+            MrBayesPrint ("%s   Successfully defined one break in data\n", spacer);
+        else
+            MrBayesPrint ("%s   Successfully defined %d breaks in data\n", spacer, numBreaks);
+        }
+    else
+        {
+        MrBayesPrint ("%s   No breaks in data found\n", spacer);
+        }
+        
+    return (NO_ERROR);
+}
+
+
+int DoBreaksParm (char *parmName, char *tkn)
+{
+    int     i, tempInt;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can define breaks in the data\n", spacer);
+        return (ERROR);
+        }
+            
+    if (expecting == Expecting(NUMBER))
+        {
+        sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numChar)
+            {
+            MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+            for (i=0; i<numChar; i++)
+                charInfo[i].bigBreakAfter = NO;
+            return (ERROR);
+            }
+        if (tempInt == numChar)
+            {
+            MrBayesPrint ("%s   Character number %d is the last character. MrBayes will define the\n", spacer, tempInt);
+            MrBayesPrint ("%s   break, even though it doesn't make too much sense.\n", spacer);
+            }
+        tempInt--;
+                    
+        charInfo[tempInt].bigBreakAfter = YES;
+        
+        expecting  = (Expecting(NUMBER) | Expecting(SEMICOLON));
+        }
+    else
+        {
+        for (i=0; i<numChar; i++)
+            charInfo[i].bigBreakAfter = NO;
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoCalibrate (void)
+{
+    int         i;
+
+    /* show calibration times (for debugging) */
+#   if 0
+    MrBayesPrint ("Taxon ages\n");
+    for (i=0; i<numTaxa; i++)
+        MrBayesPrint ("%4d  --  %s\n", i+1, tipCalibration[i].name);
+    MrBayesPrint ("Constraint ages\n");
+    for (i=0; i<numDefinedConstraints; i++)
+        {
+        if (definedConstraintsType[i] != HARD)
+            continue;
+        MrBayesPrint ("%4d  --  %s\n", i+1, nodeCalibration[i].name);
+        }
+#   endif
+
+    /* Update model if calibrations enforced */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        if (!strcmp(modelParams[i].nodeAgePr,"Calibrated"))
+            {
+            if (SetUpAnalysis (&globalSeed) == ERROR)
+                return (ERROR);
+            break;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoCalibrateParm (char *parmName, char *tkn)
+{
+    static int              isTaxon, paramIndex;
+    static char             nodeName[100], calName[100];
+    static MrBFlt           priorParams[3];
+    static enum CALPRIOR    calPrior;
+    int                     howMany, index;
+    char                    s[20], tempStr[100];
+    MrBFlt                  tempD;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can calibrate nodes\n", spacer);
+        return (ERROR);
+        }
+        
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (strcmp(parmName, "Xxxxxxxxxx") != 0)
+            {
+            MrBayesPrint ("%s   Unexpected error - Wrong parmName in DoCalibrateParm\n", spacer);
+            return (ERROR);
+            }
+
+        /* find taxon with this name */
+        calibrationPtr = NULL;
+        howMany = 0;
+
+        /* first look in constraint names */
+        if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) != ERROR && definedConstraintsType[index] == HARD)
+            {
+            calibrationPtr = &nodeCalibration[index];
+            howMany++;
+            isTaxon = NO;
+            strcpy (nodeName, tkn);
+            }
+        
+        /* then look in terminal taxon names */
+        if (CheckString (taxaNames, numTaxa, tkn, &index) != ERROR)
+            {
+            calibrationPtr = &tipCalibration[index];
+            howMany++;
+            isTaxon = YES;
+            strcpy (nodeName, tkn);
+            }
+
+        /* return error if not found or ambiguous */
+        if (howMany == 0)
+            {
+            MrBayesPrint ("%s   No taxon or hard constraint named ""%s"" found. Note that only hard constraint can be calibrated.\n", spacer, tkn);
+            return (ERROR);
+            }
+        else if (howMany > 1)
+            {
+            MrBayesPrint ("%s   Both a taxon and a constraint named ""%s"" encountered -- please rename one\n", spacer, tkn);
+            return (ERROR);
+            }
+
+        /* get ready to find the equal sign */
+        expecting = Expecting(EQUALSIGN);
+        }
+
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        /* get ready to find the calibration prior */
+        expecting = Expecting(ALPHA);
+        }
+
+    else if (expecting == Expecting(ALPHA))
+        {
+        /* set the calibration prior type */
+        if (IsArgValid(tkn,tempStr) == NO_ERROR)
+            {
+            if (!strcmp (tempStr, "Unconstrained"))
+                calPrior = unconstrained;
+            else if (!strcmp (tempStr, "Fixed"))
+                calPrior = fixed;
+            else if (!strcmp (tempStr, "Uniform"))
+                calPrior = uniform;
+            else if (!strcmp (tempStr, "Offsetexponential"))
+                calPrior = offsetExponential;
+            else if (!strcmp (tempStr, "Truncatednormal"))
+                calPrior = truncatedNormal;
+            else if (!strcmp (tempStr, "Lognormal"))
+                calPrior = logNormal;
+            else if (!strcmp (tempStr, "Offsetlognormal"))
+                calPrior = offsetLogNormal;
+            else if (!strcmp (tempStr, "Gamma"))
+                calPrior = standardGamma;
+            else if (!strcmp (tempStr, "Offsetgamma"))
+                calPrior = offsetGamma;
+
+            if (calPrior == unconstrained)
+                {
+                /* reset the values of the calibration */
+                MrBayesPrint ("%s   Resetting previous calibration for ""%s""\n", spacer, nodeName);
+
+                calibrationPtr->prior           = defaultCalibration.prior;
+                calibrationPtr->priorParams[0]  = defaultCalibration.priorParams[0];
+                calibrationPtr->priorParams[1]  = defaultCalibration.priorParams[1];
+                calibrationPtr->priorParams[2]  = defaultCalibration.priorParams[2];
+                calibrationPtr->LnPriorProb     = defaultCalibration.LnPriorProb;
+                calibrationPtr->LnPriorRatio    = defaultCalibration.LnPriorRatio;
+                calibrationPtr->min             = defaultCalibration.min;
+                calibrationPtr->max             = defaultCalibration.max;
+                strcpy(calibrationPtr->name, defaultCalibration.name);
+            
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                strcpy (calName, tempStr);
+                paramIndex = 0;
+                priorParams[0] = priorParams[1] = priorParams[2] =  -1.0;
+                expecting = Expecting(LEFTPAR);
+                }
+            }
+        else
+            {
+            MrBayesPrint ("%s   Invalid calibration prior argument \n", spacer);
+            return (ERROR);
+            }
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        strcat (calName, "(");
+        expecting  = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        sscanf (tkn, "%lf", &tempD);
+        if (paramIndex == 0)
+            {
+            if (calPrior == logNormal)
+                {
+                if (tempD < 0.0)
+                    {
+                    MrBayesPrint ("%s   Mean age must be nonnegative\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the lognormal distribution used for dating are mean age\n", spacer);
+                    MrBayesPrint ("%s   and standard deviation, both specified on the linear scale, not as log values.\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == standardGamma)
+                {
+                if (tempD <= 0.0)
+                    {
+                    MrBayesPrint ("%s   Mean parameter must be positive\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the gamma distribution used for dating are mean age and\n", spacer);
+                    MrBayesPrint ("%s   standard deviation. In terms of the common shape (alpha) and rate (beta)\n", spacer);
+                    MrBayesPrint ("%s   parameterization, the expected mean is alpha/beta and the standard\n", spacer);
+                    MrBayesPrint ("%s   deviation is the square root of (alpha / beta^2).\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (tempD < 0.0)
+                {
+                if (calPrior == fixed)
+                    MrBayesPrint ("%s   Fixed age must be nonnegative\n", spacer);
+                else if (calPrior == uniform)
+                    {
+                    MrBayesPrint ("%s   Minimum age must be nonnegative\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the uniform are minimum age and maximum age.\n", spacer);
+                    }
+                else if (calPrior == truncatedNormal)
+                    {
+                    MrBayesPrint ("%s   Offset (minimum or truncation) age must be nonnegative.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the truncated normal distribution are offset (minimum\n", spacer);
+                    MrBayesPrint ("%s   or truncation) age, mean age and standard deviation.\n", spacer);
+                    }
+                else if (calPrior == offsetGamma)
+                    {
+                    MrBayesPrint ("%s   Offset age must be nonnegative\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset gamma distribution used for dating are offset age,\n", spacer);
+                    MrBayesPrint ("%s   mean age, and standard deviation. In terms of the common shape (alpha) and\n", spacer);
+                    MrBayesPrint ("%s   rate (beta) parameterization, the expected mean is alpha/beta and the standard\n", spacer);
+                    MrBayesPrint ("%s   deviation is the square root of (alpha / beta^2).\n", spacer);
+                    }
+                else if (calPrior == offsetExponential)
+                    {
+                    MrBayesPrint ("%s   Offset age must be nonnegative\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset exponential are offset age and mean age.\n", spacer);
+                    }
+                else if (calPrior == offsetLogNormal)
+                    {
+                    MrBayesPrint ("%s   Offset age must be nonnegative\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset lognormal distribution are offset age, mean age,\n", spacer);
+                    MrBayesPrint ("%s   and standard deviation. All values are specified on the linear scale, not\n", spacer);
+                    MrBayesPrint ("%s   as log values.\n", spacer);
+                    }
+                return (ERROR);
+                }
+            priorParams[0] = tempD;
+            if (calPrior == fixed)
+                expecting = Expecting(RIGHTPAR);
+            else
+                expecting = Expecting(COMMA);
+            }
+        else if (paramIndex == 1)
+            {
+            if (calPrior == uniform)
+                {
+                if (tempD <= priorParams[0])
+                    {
+                    MrBayesPrint ("%s   Maximum age of uniform distribution must be larger than minimum age\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == offsetExponential)
+                {
+                if (tempD <= priorParams[0])
+                    {
+                    MrBayesPrint ("%s   Mean age must be larger than offset age.\n", spacer);
+                    MrBayesPrint ("%s   MrBayes now uses offset and mean rather than offset and rate\n", spacer);
+                    MrBayesPrint ("%s   as the parameters for the offset exponential distribution.\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == truncatedNormal)
+                {
+                if (tempD <= priorParams[0])
+                    {
+                    MrBayesPrint ("%s   Mean age must be larger than offset (truncation) age.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the truncated normal distribution are offset (minimum\n", spacer);
+                    MrBayesPrint ("%s   or truncation) age, mean age and standard deviation\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == logNormal)
+                {
+                if (tempD <= 0.0)
+                    {
+                    MrBayesPrint ("%s   Standard deviation must be positive.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the lognormal distribution used for dating are mean age\n", spacer);
+                    MrBayesPrint ("%s   and standard deviation, both specified on the linear scale, not as log values.\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == offsetLogNormal)
+                {
+                if (tempD <= priorParams[0])
+                    {
+                    MrBayesPrint ("%s   Mean age must be larger than offset age.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset lognormal distribution are offset age, mean age,\n", spacer);
+                    MrBayesPrint ("%s   and standard deviation. All values are specified on the linear scale, not\n", spacer);
+                    MrBayesPrint ("%s   as log values.\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == standardGamma)
+                {
+                if (tempD <= 0.0)
+                    {
+                    MrBayesPrint ("%s   Standard deviation must be positive.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the gamma distribution used for dating are mean age and\n", spacer);
+                    MrBayesPrint ("%s   standard deviation. In terms of the common shape (alpha) and rate (beta)\n", spacer);
+                    MrBayesPrint ("%s   parameterization, the expected mean is alpha/beta and the standard\n", spacer);
+                    MrBayesPrint ("%s   deviation is the square root of (alpha / beta^2).\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == offsetGamma)
+                {
+                if (tempD <= 0.0)
+                    {
+                    MrBayesPrint ("%s   Mean age must be positive.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset gamma distribution used for dating are offset age,\n", spacer);
+                    MrBayesPrint ("%s   mean age, and standard deviation. In terms of the common shape (alpha) and\n", spacer);
+                    MrBayesPrint ("%s   rate (beta) parameterization, the expected mean is alpha/beta and the standard\n", spacer);
+                    MrBayesPrint ("%s   deviation is the square root of (alpha / beta^2).\n", spacer);
+                    return (ERROR);
+                    }
+                }
+
+            priorParams[1] = tempD;
+            if (calPrior == uniform || calPrior == standardGamma || calPrior == logNormal || calPrior == offsetExponential)
+                expecting = Expecting(RIGHTPAR);
+            else
+                expecting = Expecting(COMMA);
+            }
+        else /* if (paramIndex == 2) */
+            {
+            if (calPrior == offsetGamma)
+                {
+                if (tempD <= 0.0)
+                    {
+                    MrBayesPrint ("%s   Standard deviation must be positive.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset gamma distribution used for dating are offset age,\n", spacer);
+                    MrBayesPrint ("%s   mean age, and standard deviation. In terms of the common shape (alpha) and\n", spacer);
+                    MrBayesPrint ("%s   rate (beta) parameterization, the expected mean is alpha/beta and the standard\n", spacer);
+                    MrBayesPrint ("%s   deviation is the square root of (alpha / beta^2).\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (calPrior == offsetLogNormal)
+                {
+                if (tempD <= 0.0)
+                    {
+                    MrBayesPrint ("%s   Standard deviation must be positive.\n", spacer);
+                    MrBayesPrint ("%s   Parameters of the offset lognormal distribution are offset age, mean age,\n", spacer);
+                    MrBayesPrint ("%s   and standard deviation. All values are specified on the linear scale, not\n", spacer);
+                    MrBayesPrint ("%s   as log values.\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            priorParams[2] = tempD;
+            expecting = Expecting(RIGHTPAR);
+            }
+        sprintf (s, "%1.2lf", tempD);
+        strcat (calName, s);
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        strcat (calName, ",");
+        paramIndex++;
+        expecting  = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        strcat (calName, ")");
+        if (isTaxon == YES)
+            MrBayesPrint ("%s   Setting age of taxon '%s' to %s\n", spacer, nodeName, calName);
+        else
+            MrBayesPrint ("%s   Setting age of constraint node '%s' to %s\n", spacer, nodeName, calName);
+
+        /* set calibration based on collected values and settings */
+        strcpy(calibrationPtr->name, calName);
+        calibrationPtr->priorParams[0]  = priorParams[0];
+        calibrationPtr->priorParams[1]  = priorParams[1];
+        calibrationPtr->priorParams[2]  = priorParams[2];
+        calibrationPtr->prior           = calPrior;
+        if (calPrior == fixed)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbFix;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioFix;
+            calibrationPtr->min             = priorParams[0];
+            calibrationPtr->max             = priorParams[0];
+            }
+        else if (calPrior == uniform)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbUniform;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioUniform;
+            calibrationPtr->min             = priorParams[0];
+            calibrationPtr->max             = priorParams[1];
+            }
+        else if (calPrior == offsetExponential)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbOffsetExponential_Param_Offset_Mean;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioOffsetExponential_Param_Offset_Mean;
+            calibrationPtr->min             = priorParams[0];
+            calibrationPtr->max             = POS_INFINITY;
+            }
+        else if (calPrior == truncatedNormal)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbTruncatedNormal_Param_Trunc_Mean_Sd;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioTruncatedNormal_Param_Trunc_Mean_Sd;
+            calibrationPtr->min             = priorParams[0];
+            calibrationPtr->max             = POS_INFINITY;
+            }
+        else if (calPrior == logNormal)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbLognormal_Param_Mean_Sd;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioLognormal_Param_Mean_Sd;
+            calibrationPtr->min             = BRLENS_MIN;
+            calibrationPtr->max             = POS_INFINITY;
+            }
+        else if (calPrior == offsetLogNormal)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbOffsetLognormal_Param_Offset_Mean_Sd;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioOffsetLognormal_Param_Offset_Mean_Sd;
+            calibrationPtr->min             = BRLENS_MIN + priorParams[0];
+            calibrationPtr->max             = POS_INFINITY;
+            }
+        else if (calPrior == standardGamma)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbGamma_Param_Mean_Sd;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioGamma_Param_Mean_Sd;
+            calibrationPtr->min             = BRLENS_MIN;
+            calibrationPtr->max             = POS_INFINITY;
+            }
+        else if (calPrior == offsetGamma)
+            {
+            calibrationPtr->LnPriorProb     = &LnPriorProbOffsetGamma_Param_Offset_Mean_Sd;
+            calibrationPtr->LnPriorRatio    = &LnProbRatioOffsetGamma_Param_Offset_Mean_Sd;
+            calibrationPtr->min             = BRLENS_MIN + priorParams[0];
+            calibrationPtr->max             = POS_INFINITY;
+            }
+
+        /* get ready to find more calibrated nodes or taxa, if present */
+        expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoCharset (void)
+{
+    /* first add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* add name to charSetNames */
+    if (AddString (&charSetNames, numCharSets, tempSetName) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding charset %s to list\n", spacer, tempSetName);
+        return (ERROR);
+        }
+
+    /* store charset */
+    AddBitfield (&charSet, numCharSets, tempSet, numChar);
+
+    /* increment number of char sets */
+    numCharSets++;
+
+    return (NO_ERROR);
+}
+
+
+int DoCharsetParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt, allDigit;
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before charsets can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* check that the name of the charset is not a number */
+            allDigit = YES;
+            for (i=0; i<(int)strlen(tkn); i++)
+                {
+                if (tkn[i] == '0' || tkn[i] == '1' || tkn[i] == '2' || tkn[i] == '3' || tkn[i] == '4' || 
+                    tkn[i] == '5' || tkn[i] == '6' || tkn[i] == '7' || tkn[i] == '8' || tkn[i] == '9' || tkn[i] == '.')
+                    {}
+                else
+                    allDigit = NO;
+                }
+            if (allDigit == YES)
+                {
+                MrBayesPrint ("%s   Charset name may not be a number\n", spacer);
+                return (ERROR);
+                }
+            
+            /* check size of charset name */
+            if (strlen(tkn) > 99)
+                {
+                MrBayesPrint ("%s   Charset name is too long\n", spacer);
+                return (ERROR);
+                }
+                
+            /* check to see if the name has already been used as a charset */
+            if (numCharSets > 1)
+                {
+                if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
+                    {
+                    /* if the charset name has not been used, then we should have an ERROR returned */
+                    /* we _want_ to be here */
+
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Charset name has been used previously\n", spacer);
+                    return (ERROR);
+                    }
+                }
+                
+            /* add the name to the character set */
+            strcpy (tempSetName, tkn);
+            
+            /* clear tempSet */
+            for (i=0; i<numChar; i++)
+                tempSet[i] = 0;
+            
+            fromI = toJ = everyK = -1;
+            foundDash = foundSlash = NO;
+            MrBayesPrint ("%s   Defining charset called '%s'\n", spacer, tkn);
+            expecting = Expecting(EQUALSIGN);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        /* We are defining a character set in terms of another (called tkn, here). We should be able
+           to find tkn in the list of character set names. If we cannot, then we have a problem and
+           return an error. */
+        if (numCharSets < 1)
+            {
+            MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+            return (ERROR);
+            }
+        if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
+            {
+            MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+            return (ERROR);
+            }
+        /* add characters from charset "tkn" to new tempset */
+        for (i=0; i<numChar; i++)
+            {
+            if (IsBitSet(i,charSet[index]) == YES)
+                tempSet[i] = 1;
+            }       
+        fromI = toJ = everyK = -1;
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && tkn[0] == '.')
+            tempInt = numChar;
+        else
+            sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numChar)
+            {
+            MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+            return (ERROR);
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else if (foundSlash == YES)
+            {
+            tempInt++;
+            if (tempInt <= 1)
+                {
+                MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                return (ERROR);
+                }
+            if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                everyK = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                return (ERROR);
+                }
+            foundSlash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+                
+            }
+
+        
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(BACKSLASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoCharStat (void)
+{
+    int         i, j, numDivs;
+    char        tempName[100];
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        return (ERROR);
+        }
+            
+    if (numDefinedPartitions == 1)
+        MrBayesPrint ("%s   1 character partition defined:\n", spacer, numDefinedPartitions);
+    else
+        MrBayesPrint ("%s   %d character partitions defined:\n", spacer, numDefinedPartitions);
+    for (i=0; i<numDefinedPartitions; i++)
+        {
+        numDivs = GetNumPartDivisions (i);
+        if (numDivs == 1)
+            MrBayesPrint ("%s      Partition %d (\"%s\") does not divide the characters\n", spacer, i+1, partitionNames[i]);
+        else
+            MrBayesPrint ("%s      Partition %d (\"%s\") divides the characters into %d parts\n", spacer, i+1, partitionNames[i], numDivs);
+        }
+    MrBayesPrint ("%s      Current partition is \"%s\"\n", spacer, partitionNames[partitionNum]);
+    MrBayesPrint ("\n");
+
+    /* print out list of characters with information about each */
+    MrBayesPrint ("%s   Showing character status:\n\n", spacer);
+    MrBayesPrint ("%s                                                    Partition(s)\n", spacer);
+    MrBayesPrint ("%s      #      Type      In/Out    Ambiguity Order  ", spacer);
+    for (i=0; i<numDefinedPartitions; i++)
+        MrBayesPrint (" %2d", i+1);
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   -----------------------------------------------", spacer);
+    for (i=0; i<numDefinedPartitions; i++)
+        MrBayesPrint ("---");
+    MrBayesPrint ("\n");
+    for (i=0; i<numChar; i++)
+        {
+        MrBayesPrint ("%s   %4d -- ", spacer, i+1);
+                
+        if (charInfo[i].charType == DNA)
+            MrBayesPrint ("   DNA");
+        else if (charInfo[i].charType == RNA)
+            MrBayesPrint ("   RNA");
+        else if (charInfo[i].charType == PROTEIN)
+            MrBayesPrint ("  Prot");
+        else if (charInfo[i].charType == RESTRICTION)
+            MrBayesPrint ("  Rest");
+        else if (charInfo[i].charType == STANDARD)
+            MrBayesPrint (" Stand");
+        else if (charInfo[i].charType == CONTINUOUS)
+            MrBayesPrint ("  Cont");
+            
+        if (charInfo[i].charType == DNA)
+            MrBayesPrint ("   4");
+        else if (charInfo[i].charType == RNA)
+            MrBayesPrint ("   4");
+        else if (charInfo[i].charType == PROTEIN)
+            MrBayesPrint ("  20");
+        else if (charInfo[i].charType == RESTRICTION)
+            MrBayesPrint ("   2");
+        else if (charInfo[i].charType == STANDARD)
+            MrBayesPrint ("  %2d", charInfo[i].numStates);
+        else if (charInfo[i].charType == CONTINUOUS)
+            MrBayesPrint (" Inf");
+            
+        if (charInfo[i].isExcluded == NO)
+            MrBayesPrint ("  Included");
+        else
+            MrBayesPrint ("  Excluded");
+            
+        if (charInfo[i].isMissAmbig == YES)
+            MrBayesPrint ("  MissAmbig");
+        else
+            MrBayesPrint ("       None");
+            
+        if (charInfo[i].ctype == UNORD)
+            MrBayesPrint (" Unord");
+        else if (charInfo[i].ctype == ORD)
+            MrBayesPrint ("   Ord");
+        else if (charInfo[i].ctype == DOLLO)
+            MrBayesPrint (" Dollo");
+        else if (charInfo[i].ctype == IRREV)
+            MrBayesPrint (" Irrev");
+
+        MrBayesPrint ("  ");
+            
+        for (j=0; j<numDefinedPartitions; j++)
+            MrBayesPrint (" %2d", partitionId[i][j]);
+
+        /* MrBayesPrint ("%4d   ", charSet[i]);*/
+        
+        if (charInfo[i].pairsId > 0)
+            {
+            /* find paired character */
+            for (j=0; j<numChar; j++)
+                {
+                if (i != j && charInfo[j].pairsId == charInfo[i].pairsId)
+                    {
+                    MrBayesPrint (" (coupled with %d)", j+1);
+                    break;
+                    }
+                }
+            }
+                    
+        MrBayesPrint ("\n");
+        
+        if (charInfo[i].bigBreakAfter == YES)
+            {
+            MrBayesPrint ("%s   ", spacer);
+            MrBayesPrint ("     - - - - - - - - - - - - - - - - - - - -  \n");
+            }
+        
+        /* we may want to pause */
+        if (autoClose == NO)
+            {
+            if ((i+1) % 100 == 0)
+                {
+                MrBayesPrint ("%s   Hit return key to continue  ", spacer);
+                fflush (stdin);
+                if (fgets (tempName, 100, stdin) == NULL)
+                    {
+                    printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+                    }
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoCitations (void)
+{
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+    MrBayesPrint ("   Citations                                                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   If you publish results obtained using MrBayes you may want to cite the        \n");
+    MrBayesPrint ("   program using one of these papers:                                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Huelsenbeck, J. P. and F. Ronquist. 2001. MRBAYES: Bayesian                \n");
+    MrBayesPrint ("         inference of phylogeny. Bioinformatics 17:754-755.                      \n");
+    MrBayesPrint ("      Ronquist, F. and J. P. Huelsenbeck. 2003. MRBAYES 3: Bayesian phylogenetic \n");
+    MrBayesPrint ("         inference under mixed models. Bioinformatics 19:1572-1574.              \n");
+    MrBayesPrint ("      Ronquist, F. et al. 2012. MRBAYES 3.2: Efficient Bayesian phylogenetic     \n");
+    MrBayesPrint ("         inference and model selection across a large model space. Systematic    \n");
+    MrBayesPrint ("         Biology 61 (in press).                                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   If you use the parallel abilities of the program, you may also want to cite   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Altekar, G., S. Dwarkadas, J. P. Huelsenbeck, and F. Ronquist. 2004.       \n");
+    MrBayesPrint ("         Parallel Metropolis-coupled Markov chain Monte Carlo for Bayesian       \n");
+    MrBayesPrint ("         phylogenetic inference. Bioinformatics 20:407-415.                      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   If you use the BEAGLE library, the appropriate citation is                    \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Ayres, D. L., A. Darling, D. J. Zwickl, P. Beerli, M. T. Holder, P. O.     \n");
+    MrBayesPrint ("         J. P. Huelsenbeck, F. Ronquist, D. L. Swofford, M. P. Cummings, A.      \n");
+    MrBayesPrint ("         Rambaut, and M. A. Suchard. 2012. BEAGLE: an application programming    \n");
+    MrBayesPrint ("         interface for statistical phylogenetics. Syst. Biol. 61:170-173.        \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   You should also cite other papers for different ideas that are implemented    \n");
+    MrBayesPrint ("   in the program. For example, the program performs Bayesian inference of       \n");
+    MrBayesPrint ("   phylogeny, an idea that was first proposed in the following papers:           \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Larget, B., and D. Simon. 1999. Markov chain Monte Carlo                   \n");
+    MrBayesPrint ("         algorithms for the Bayesian analysis of phylogenetic trees.             \n");
+    MrBayesPrint ("         Mol. Biol. Evol. 16:750-759.                                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Li, S. 1996. Phylogenetic tree construction using Markov chain             \n");
+    MrBayesPrint ("         Monte carlo. Ph. D. dissertation, Ohio State University, Columbus.      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Mau, B. 1996. Bayesian phylogenetic inference via Markov chain             \n");
+    MrBayesPrint ("         Monte carlo methods. Ph. D. dissertation, University of                 \n");
+    MrBayesPrint ("         Wisconsin, Madison.                                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Mau, B., and M. Newton. 1997. Phylogenetic inference for binary            \n");
+    MrBayesPrint ("         data on dendrograms using Markov chain Monte Carlo. Journal of          \n");
+    MrBayesPrint ("         Computational and Graphical Statistics 6:122-131.                       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Mau, B., M. Newton, and B. Larget. 1999. Bayesian phylogenetic             \n");
+    MrBayesPrint ("         inference via Markov chain Monte carlo methods. Biometrics. 55:1-12.    \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Newton, M., B. Mau, and B. Larget. 1999. Markov chain Monte Carlo          \n");
+    MrBayesPrint ("         for the Bayesian analysis of evolutionary trees from aligned            \n");
+    MrBayesPrint ("         molecular sequences. In Statistics in molecular biology (F. Seillier-   \n");
+    MrBayesPrint ("         Moseiwitch, T. P. Speed, and M. Waterman, eds.). Monograph Series       \n");
+    MrBayesPrint ("         of the Institute of Mathematical Statistics.                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Rannala, B., and Z. Yang. 1996. Probability distribution of                \n");
+    MrBayesPrint ("         molecular evolutionary trees: a new method of phylogenetic              \n");
+    MrBayesPrint ("         inference. J. Mol. Evol. 43:304-311.                                    \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z., and B. Rannala. 1997. Bayesian phylogenetic inference            \n");
+    MrBayesPrint ("         using DNA sequences: a Markov chain Monte carlo method. Molecular       \n");
+    MrBayesPrint ("         Biology and Evolution. 14:717-724.                                      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes uses Markov chain Monte Carlo (MCMC) to approximate the posterior     \n");
+    MrBayesPrint ("   probability of trees. MCMC was developed in the following papers:             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Metropolis, N., A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller,          \n");
+    MrBayesPrint ("         and E. Teller. 1953. Equations of state calculations by fast            \n");
+    MrBayesPrint ("         computing machines. J. Chem. Phys. 21:1087-1091.                        \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Hastings, W. K. 1970. Monte Carlo sampling methods using Markov            \n");
+    MrBayesPrint ("         chains and their applications. Biometrika 57:97-109.                    \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   In particular, MrBayes implements a variant of MCMC that was described by     \n");
+    MrBayesPrint ("   Charles Geyer:                                                                \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Geyer, C. J. 1991. Markov chain Monte Carlo maximum likelihood.            \n");
+    MrBayesPrint ("         Pages 156-163 in Computing Science and Statistics: Proceed-             \n");
+    MrBayesPrint ("         ings of the 23rd Symposium on the Interface. (E. M. Keramidas,          \n");
+    MrBayesPrint ("         ed.). Fairfax Station: Interface Foundation.                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes implements a large number of DNA substitution models. These models    \n");
+    MrBayesPrint ("   are of three different structures. The \"4by4\" models are the usual          \n");
+    MrBayesPrint ("   flavor of phylogenetic models. The \"Doublet\" model was first proposed       \n");
+    MrBayesPrint ("   by                                                                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Schoniger, M., and A. von Haeseler. 1994. A stochastic model and the       \n");
+    MrBayesPrint ("         evolution of autocorrelated DNA sequences. Molecular Phylogenetics      \n");
+    MrBayesPrint ("         and Evolution 3:240-247.                                                \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The program also implements codon models. Two papers, published back-to-back  \n");
+    MrBayesPrint ("   were the first to implement a codon model of DNA substitution in which the    \n");
+    MrBayesPrint ("   substitution process is modelled on the codon, not on a site-by-site basis:   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Goldman, N., and Z. Yang. 1994. A codon-based model of nucleotide          \n");
+    MrBayesPrint ("         substitution for protein coding DNA sequences. Molecular Biology        \n");
+    MrBayesPrint ("         and Evolution. 11:725-736.                                              \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Muse, S., and B. Gaut. 1994. A likelihood approach for comparing           \n");
+    MrBayesPrint ("         synonymous and non-synonymous substitution rates, with application      \n");
+    MrBayesPrint ("         to the chloroplast genome. Molecular Biology and Evolution.             \n");
+    MrBayesPrint ("         11:715-724.                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The program can be used to detect positively slected amino-acid sites using   \n");
+    MrBayesPrint ("   a full hierarchical Bayes analysis. The method is based on the excellent paper\n");
+    MrBayesPrint ("   by Nielsen and Yang:                                                          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Nielsen, R., and Z. Yang. 1998. Likelihood models for detecting            \n");
+    MrBayesPrint ("         positively selected amino acid sites and applications to the HIV-1      \n");
+    MrBayesPrint ("         envelope gene. Genetics. 148:929-936.                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The previous four papers describe three different stuctures for the nuc-      \n");
+    MrBayesPrint ("   leotide models implemented in MrBayes--the four-by-four models, the           \n");
+    MrBayesPrint ("   16-by-16 (doublet) models and the 64-by-64 (codon) models. The program        \n");
+    MrBayesPrint ("   implements three different substitution models within each model structure.   \n");
+    MrBayesPrint ("   These include the nst=1 models:                                               \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Jukes, T., and C. Cantor. 1969. Evolution of protein molecules.            \n");
+    MrBayesPrint ("         Pages 21-132 in Mammalian Protein Metabolism. (H. Munro, ed.).          \n");
+    MrBayesPrint ("         Academic Press, New York.                                               \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Felsenstein, J. 1981. Evolutionary trees from DNA sequences: A             \n");
+    MrBayesPrint ("         maximum likelihood approach. Journal of Molecular Evolution             \n");
+    MrBayesPrint ("         17:368-376.                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   the nst=2 models:                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Kimura, M. 1980. A simple method for estimating evolutionary rates         \n");
+    MrBayesPrint ("         of base substitutions through comparative studies of nucleotide         \n");
+    MrBayesPrint ("         sequences. Journal of Molecular Evolution. 16:111-120.                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Hasegawa, M., T. Yano, and H. Kishino. 1984. A new molecular clock         \n");
+    MrBayesPrint ("         of mitochondrial DNA and the evolution of Hominoids. Proc.              \n");
+    MrBayesPrint ("         Japan Acad. Ser. B 60:95-98.                                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Hasegawa, M., H. Kishino, and T. Yano. 1985. Dating the human-ape          \n");
+    MrBayesPrint ("         split by a molecular clock of mitochondrial DNA. Journal of             \n");
+    MrBayesPrint ("         Molecular Evolution 22:160-174.                                         \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   and the the nst=6 models:                                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Tavare, S. 1986. Some probabilistic and statisical problems on the         \n");
+    MrBayesPrint ("         analysis of DNA sequences. Lect. Math. Life Sci. 17:57-86.              \n");
+    MrBayesPrint ("         17:368-376.                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes implements a large number of amino-acid models. These include:        \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Poisson --                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Bishop, M.J., and A.E. Friday. 1987. Tetropad relationships: the           \n");
+    MrBayesPrint ("         molecular evidence. Pp. 123-139 in Molecules and morphology in          \n");
+    MrBayesPrint ("         evolution: conflict or compromise? (C. Patterson, ed.). Cambridge       \n");
+    MrBayesPrint ("         University Press, Cambridge, England.                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Jones --                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Jones, D.T., W. R. Taylor, and J. M. Thornton. 1992. The rapid generation  \n");
+    MrBayesPrint ("         of mutation data matrices from protein sequences. Comput. Appl.         \n");
+    MrBayesPrint ("         Biosci. 8:275-282.                                                      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Dayhoff --                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Dayhoff, M.O., R.M. Schwartz, and B.C. Orcutt. 1978. A model of evol-      \n");
+    MrBayesPrint ("         utionary change in proteins. Pp. 345-352 in Atlas of protein sequence   \n");
+    MrBayesPrint ("         and structure. Vol. 5, Suppl. 3. National Biomedical Research           \n");
+    MrBayesPrint ("          Foundation, Washington, D.C.                                           \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Mtrev --                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Adachi, J. and M. Hasegawa. 1996. MOLPHY version 2.3: programs for         \n");
+    MrBayesPrint ("         molecular phylogenetics based on maximum likelihood.  Computer Science  \n");
+    MrBayesPrint ("         Monographs of Institute of Statistical Mathematics 28:1-150.            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Mtmam --                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Cao, Y., A. Janke, P.J. Waddell, M. Westerman, O. Takenaka, S. Murata,     \n");
+    MrBayesPrint ("         N. Okada, S. Paabo, and M. Hasegawa. 1998. Conflict amongst individual  \n");
+    MrBayesPrint ("         mitochondrial proteins in resolving the phylogeny of eutherian orders.  \n");
+    MrBayesPrint ("         Journal of Molecular Evolution                                          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z., R. Nielsen, and M. Hasegawa. 1998.  Models of amino acid         \n");
+    MrBayesPrint ("         substitution and applications to mitochondrial protein evolution        \n");
+    MrBayesPrint ("         Molecular Biology and Evolution 15:1600-1611.                           \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      WAG --                                                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Whelan, S. and Goldman, N. 2001. A general empirical model of protein      \n");
+    MrBayesPrint ("         evolution derived from multiple protein families using a maximum-       \n");
+    MrBayesPrint ("         likelihood approach. Molecular Biology and Evolution 18:691-699.        \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Rtrev --                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Dimmic M.W., J.S. Rest, D.P. Mindell, and D. Goldstein. 2002. RArtREV:     \n");
+    MrBayesPrint ("         An amino acid substitution matrix for inference of retrovirus and       \n");
+    MrBayesPrint ("         reverse transcriptase phylogeny. Journal of Molecular Evolution         \n");
+    MrBayesPrint ("         55: 65-73.                                                              \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Cprev --                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Adachi, J., P. Waddell, W. Martin, and M. Hasegawa. 2000. Plastid          \n");
+    MrBayesPrint ("         genome phylogeny and a model of amino acid substitution for proteins    \n");
+    MrBayesPrint ("         encoded by chloroplast DNA. Journal of Molecular Evolution              \n");
+    MrBayesPrint ("         50:348-358.                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Blosum --                                                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Henikoff, S., and J. G. Henikoff. 1992. Amino acid substitution            \n");
+    MrBayesPrint ("         matrices from protein blocks. Proc. Natl. Acad. Sci., U.S.A.            \n");
+    MrBayesPrint ("         89:10915-10919. The matrix implemented in MrBayes is Blosum62.          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Vt --                                                                      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Muller, T., and M. Vingron. 2000. Modeling amino acid replacement.         \n");
+    MrBayesPrint ("         Journal of Computational Biology 7:761-776.                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      LG --                                                                      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Le, Si Q. & Gascuel, O. 2008 An improved general amino- acid replacement   \n");
+    MrBayesPrint ("         matrix. Mol. Biol. Evol. 25, 1307-1320.                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes implements a simple Jukes-Cantor-like model for restriction sites     \n");
+    MrBayesPrint ("   and other binary data. A problem with some of these data is that there is a   \n");
+    MrBayesPrint ("   coding bias, such that certain characters are missing from any observable     \n");
+    MrBayesPrint ("   data matrix. It is impossible, for instance, to observe restriction sites that\n");
+    MrBayesPrint ("   are absent in all the studied taxa. However, MrBayes corrects for this coding \n");
+    MrBayesPrint ("   bias according to an idea described in                                        \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Felsenstein, J. 1992. Phylogenies from restriction sites: A maximum-       \n");
+    MrBayesPrint ("         likelihood approach. Evolution 46:159-173.                              \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The model used by MrBayes for 'standard' or morphological data is based on    \n");
+    MrBayesPrint ("   the ideas originally presented by                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Lewis, P. O. 2001. A likelihood approach to estimating phylogeny from      \n");
+    MrBayesPrint ("         discrete morphological character data. Systematic Biology 50:913-925.   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   For both DNA sequence and amino-acid data, the program allows rates to        \n");
+    MrBayesPrint ("   change under a covarion-like model, first described by Tuffley and Steel      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Tuffley, C., and M. Steel. 1998. Modeling the covarion hypothesis          \n");
+    MrBayesPrint ("         of nucleotide substitution. Mathematical Biosciences 147:63-91.         \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   and implemented by Huelsenbeck (2002)                                         \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Huelsenbeck, J. P. 2002. Testing a covariotide model of DNA sub-           \n");
+    MrBayesPrint ("         stitution. Molecular Biology and Evolution 19(5):698-707.               \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   Galtier (2001) implements a different variant of the covarion model in        \n");
+    MrBayesPrint ("   a paper that is worth reading:                                                \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Galtier, N. 2001. Maximum-likelihood phylogenetic analysis under a         \n");
+    MrBayesPrint ("         covarion-like model. Mol. Biol. Evol. 18:866-873.                       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   A number of models are available that allow rates to vary                     \n");
+    MrBayesPrint ("   across the characters. The program implements the proportion                  \n");
+    MrBayesPrint ("   of invariable sites model and two variants of gamma distributed               \n");
+    MrBayesPrint ("   rate variation. Yang\'s (1993) paper is a good one to cite for                \n");
+    MrBayesPrint ("   implementing a gamma-distributed rates model. In the 1994 paper he            \n");
+    MrBayesPrint ("   provides a way to approximate the continuous gamma distribution:              \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z. 1993. Maximum likelihood estimation of phylogeny from DNA         \n");
+    MrBayesPrint ("         sequences when substitution rates differ over sites. Molecular          \n");
+    MrBayesPrint ("         Biology and Evolution 10:1396-1401.                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z. 1994. Maximum likelihood phylogenetic estimation from DNA         \n");
+    MrBayesPrint ("         sequences with variable rates over sites: Approximate methods.          \n");
+    MrBayesPrint ("         Journal of Molecular Evolution 39:306-314.                              \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The program also implements Yang\'s autocorrelated gamma model. In            \n");
+    MrBayesPrint ("   this model, the rate at one site depends to some extent on the rate at        \n");
+    MrBayesPrint ("   an adjacent site. The appropriate citation for this model is:                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z. 1995. A space-time process model for the evolution of             \n");
+    MrBayesPrint ("         DNA sequences. Genetics 139:993-1005.                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The following two papers show how ancestral states on a tree can be recon-    \n");
+    MrBayesPrint ("   structed. The Yang et al. paper implements an empirical Bayes approach while  \n");
+    MrBayesPrint ("   Huelsenbeck and Bollback use a pure, hierarchical Bayes approach. The method  \n");
+    MrBayesPrint ("   used in MrBayes is the latter, since it integrates over uncertainty in model  \n");
+    MrBayesPrint ("   parameters.                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z., S. Kumar, and M. Nei. 1995. A new method of inference of         \n");
+    MrBayesPrint ("         ancestral nucleotide and amino acid sequences. Genetics 141:1641        \n");
+    MrBayesPrint ("         1650.                                                                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Huelsenbeck, J. P., and J. P. Bollback. 2001. Empirical and hier-          \n");
+    MrBayesPrint ("         archical Bayesian estimation of ancestral states. Systematic            \n");
+    MrBayesPrint ("         Biology 50:351-366.                                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   You may also want to consult a more recent review of Bayesian reconstruction  \n");
+    MrBayesPrint ("   of ancestral states and character evolution:                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Ronquist, F. 2004. Bayesian inference of character evolution. Trends in    \n");
+    MrBayesPrint ("         Ecology and Evolution 19: 475-481.                                      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes allows you to analyze gene tree - species tree problems using the     \n");
+    MrBayesPrint ("   multi-species coalescent approach originally proposed by Edwards et al:       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Edwards, S., L. Liu, and D. Pearl. 2007. High-resolution species trees     \n");
+    MrBayesPrint ("         without concatenation. Proc. Natl. Acad. Sci. USA 104: 5936-5941.       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The program implements an incredibly parameter rich model, first described    \n");
+    MrBayesPrint ("   by Tuffley and Steel (1997), that orders trees in the same way as the         \n");
+    MrBayesPrint ("   so-called parsimony method of phylogenetic inference. The appropriate         \n");
+    MrBayesPrint ("   citation is:                                                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Tuffley, C., and M. Steel. 1997. Links between maximum likelihood          \n");
+    MrBayesPrint ("         and maximum parsimony under a simple model of site substitution.        \n");
+    MrBayesPrint ("         Bull. Math. Bio. 59:581-607.                                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes implements three relaxed clock models: the Compound Poisson Process   \n");
+    MrBayesPrint ("   (CPP), the Thorne-Kishino 2002 (TK02), and the Independent Gamma Rates (IGR)  \n");
+    MrBayesPrint ("   models. The CPP model was first described by Huelsenbeck et al. (2000). It    \n");
+    MrBayesPrint ("   is an autocorrelated discrete model of rate variation over time. Instead of   \n");
+    MrBayesPrint ("   the modified gamma distribution originally proposed for the rate multipliers, \n");
+    MrBayesPrint ("   MrBayes uses a lognormal distribution. The extensions necessary to sample over\n");
+    MrBayesPrint ("   tree space under this model are original to MrBayes; the original paper only  \n");
+    MrBayesPrint ("   considered fixed trees.                                                       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The TK02 model was first described by Thorne and Kishino (2002), and is a     \n");
+    MrBayesPrint ("   variant of a model presented by them earlier (Thorne et al., 1998). It is an  \n");
+    MrBayesPrint ("   autocorrelated continuous model, in which rates vary according to a lognormal \n");
+    MrBayesPrint ("   distribution. Specifically, the rate of a descendant node is assumed to be    \n");
+    MrBayesPrint ("   drawn from a lognormal distribution with the mean being the rate of the an-   \n");
+    MrBayesPrint ("   cestral node, and the variance being proportional to the length of the branch \n");
+    MrBayesPrint ("   separating the nodes (measured in terms of expected substitutions per site at \n");
+    MrBayesPrint ("   the base rate of the clock).                                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The final relaxed clock model is the IGR model, in which branch rates are     \n");
+    MrBayesPrint ("   modeled as being drawn independently from gamma distributions. The model was  \n");
+    MrBayesPrint ("   originally described in the literature as the 'White Noise' model by Lepage   \n");
+    MrBayesPrint ("   et al. (2007), but the original MrBayes implementation predates that paper.   \n");
+    MrBayesPrint ("   The IGR model is closely related to the uncorrelated gamma model presented    \n");
+    MrBayesPrint ("   originally by Drummond et al. (2006), but it is more elegant in that it truly \n");
+    MrBayesPrint ("   lacks time structure. See Lepage et al. (2007) for details.                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Huelsenbeck, J. P., B. Larget, and D. Swofford. 2000. A compound Poisson   \n");
+    MrBayesPrint ("         process for relaxing the molecular clock. Genetics 154: 1879-1892.      \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Thorne, J. L., H. Kishino, and I. S. Painter. 1998. Estimating the rate    \n");
+    MrBayesPrint ("         of evolution of the rate of molecular evolution. Mol. Biol. Evol.       \n");
+    MrBayesPrint ("         15: 1647-1657.                                                          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Thorne, J. L., and H. Kishino. 2002. Divergence time and evolutionary      \n");
+    MrBayesPrint ("         rate estimation with multilocus data. Syst. Biol. 51: 689-702.          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Drummond, A. J., S. Y. W. Ho, M. J. Phillips, and A. Rambaut. 2006.        \n");
+    MrBayesPrint ("         Relaxed phylogenetics and dating with confidence. PLoS Biology          \n");
+    MrBayesPrint ("         4: 699-710.                                                             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Lepage, T., D. Bryant, H. Philippe, and N. Lartillot. 2007. A general      \n");
+    MrBayesPrint ("         comparison of relaxed molecular clock models. Mol. Biol. Evol.          \n");
+    MrBayesPrint ("         24: 2669-2680.                                                          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The standard tree proposals used by MrBayes are described by Lakner et al.    \n");
+    MrBayesPrint ("   (2008). The parsimony-biased tree proposals are still undescribed, although   \n");
+    MrBayesPrint ("   a rough outline of the idea is presented in the same paper.                   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Lakner, C., P. van der Mark, J. P. Huelsenbeck, B. Larget, and F. Ronquist.\n");
+    MrBayesPrint ("         2008. Efficiency of Markov chain Monte Carlo tree proposals in Bayesian \n");
+    MrBayesPrint ("         phylogenetics. Syst. Biol. 57: 86-103.                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The topology convergence diagnostic used by MrBayes, the average standard     \n");
+    MrBayesPrint ("   deviation of split frequencies, is described by Lakner et al. (2008). The     \n");
+    MrBayesPrint ("   potential scale reduction factor, the diagnostic used by MrBayes for contin-  \n");
+    MrBayesPrint ("   uous parameters, was first proposed by Gelman and Rubin (1992). The auto-     \n");
+    MrBayesPrint ("   tuning mechanism used in MrBayes is based on a paper by Roberts and Rosenthal \n");
+    MrBayesPrint ("   (2009).                                                                       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Gelman, A., and D. B. Rubin. 1992. Inference from iterative simulation     \n");
+    MrBayesPrint ("         using multiple sequences. Statistical Science 7: 457-472.               \n");
+    MrBayesPrint ("         Bull. Math. Bio. 59:581-607.                                            \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Lakner, C., P. van der Mark, J. P. Huelsenbeck, B. Larget, and F. Ronquist.\n");
+    MrBayesPrint ("         2008. Efficiency of Markov chain Monte Carlo tree proposals in Bayesian \n");
+    MrBayesPrint ("         phylogenetics. Syst. Biol. 57: 86-103.                                  \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Roberts, G. O., and J. S. Rosenthal. 2009. Examples of adaptive MCMC. Jour-\n");
+    MrBayesPrint ("         nal of Compuational and Graphical Statistics 18: 349-367.               \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   The harmonic mean estimator of model likelihoods, used for Bayes factor tes-  \n");
+    MrBayesPrint ("   ting, was discussed by Newton and Raftery (1996). The more accurate stepping- \n");
+    MrBayesPrint ("   stone algorithm was first proposed by Xie et al. (2011). The paper by         \n");
+    MrBayesPrint ("   Lartillot and Philippe (2006) presents an interesting discussion of the       \n");
+    MrBayesPrint ("   shortcomings of the harmonic mean estimator and describes thermodynamic       \n");
+    MrBayesPrint ("   integration, a technique that is similar to the stepping-stone algorithm.     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Newton, M. A., and A. E. Raftery. 1994. Approcimate Bayesian inference     \n");
+    MrBayesPrint ("         with the weighted likelihood bootstrap. J. R. Stat. Soc. B. 56. 3-48.   \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Lartillot, N., and H. Philippe. 2006. Computing Bayes factors using        \n");
+    MrBayesPrint ("         thermodynamic integration. Syst. Biol. 55: 195-207.                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving      \n");
+    MrBayesPrint ("         marginal likelihood estimation for Bayesian phylogenetic model          \n");
+    MrBayesPrint ("         selection. Syst. Biol. 60: 150-160.                                     \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   For unconstrained branch lengths, MrBayes implements the compound Dirichlet   \n");
+    MrBayesPrint ("   priors for branch lengths described by Rannala et al. (2012) and Zhang et al. \n");
+    MrBayesPrint ("   (2012). Compared with the i.i.d. exponential and uniform priors for branch    \n");
+    MrBayesPrint ("   lengthes in the previous versions of MrBayes, the Dirichlet priors appear more\n");
+    MrBayesPrint ("   reasonable and may avoid the problem of extremely long trees, as discussed by \n");
+    MrBayesPrint ("   Brown et al. (2010) and Marshall (2010). The two-exponential prior on internal\n");
+    MrBayesPrint ("   and external branch lengths described by Yang & Rannala (2005) and Yang (2007)\n");
+    MrBayesPrint ("   is also implemented in this version.                                          \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Brown, J. M., S. M. Hedtke, A. R. Lemmon, and E. M. Lemmon. 2010. When     \n");
+    MrBayesPrint ("         trees  grow too long: investigating the causes of highly inaccurate     \n");
+    MrBayesPrint ("         Bayesian branch-length estimates. Syst. Biol. 59:145-161.               \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Marshall, D. C. 2010. Cryptic failure of partitioned Bayesian phylogenetic \n");
+    MrBayesPrint ("         analyses: lost in the land of long trees. Syst. Biol. 59:108-117.       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Rannala, B., T. Zhu, and Z. Yang. 2012. Tail paradox, partial              \n");
+    MrBayesPrint ("         identifiability and influential priors in Bayesian branch length        \n");
+    MrBayesPrint ("         inference. Mol. Biol. Evol. 29:325-335.                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Zhang, C., B. Rannala, and Z. Yang. 2012. Robustness of compound Dirichlet \n");
+    MrBayesPrint ("         priors for Bayesian inference of branch lengths. Syst. Biol. 61:779-784.\n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z. 2007. Fair-balance paradox, star-tree paradox and Bayesian        \n");
+    MrBayesPrint ("         phylogenetics. Mol. Biol. Evol. 24:1639-1655.                           \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      Yang, Z., and B. Rannala. 2005. Branch-length prior influences Bayesian    \n");
+    MrBayesPrint ("         posterior probability of phylogeny. Syst. Biol. 54:455-470.             \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+
+    return (NO_ERROR);
+}
+
+
+int DoConstraint (void)
+{
+    int         i, howMany;
+    int         *tset;
+
+    if (consrtainType == PARTIAL)
+        tset=tempSetNeg;
+    else
+        tset=tempSet;
+
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToGivenSet (fromI, toJ, everyK, 1, tset) == ERROR)
+            return (ERROR);
+        }
+            
+    /* check that this is not a stupid constraint */
+    howMany = 0;
+    for (i=0; i<numTaxa; i++)
+        if (tempSet[i] != 0)
+            howMany++;
+
+    if (howMany == 0)
+        {
+        MrBayesPrint ("%s   This constraint does not include any taxa and will not be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (consrtainType == HARD)
+        {
+        if (howMany == numTaxa)
+            {
+            /* We allow this so we can report states from and calibrate root */
+            }
+        
+        } /*end consrtainType == HARD */
+    else if (consrtainType == PARTIAL)
+        {
+        if (howMany == 1)
+            {
+            MrBayesPrint ("%s   This partial constraint include only one taxa. It is alwayes satisfied and will not be defined.\n", spacer);
+            return (ERROR);
+            }
+
+        howMany = 0;
+        for (i=0; i<numTaxa; i++)
+            {
+            if (tempSetNeg[i] != 0)
+                {
+                howMany++;
+                if (tempSetNeg[i] == tempSet[i])
+                    {
+                    MrBayesPrint ("%s   Two sets of taxa in partial constraint are not allowed to intersect. Constraint will not be defined\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            }
+        if (howMany == 0)
+            {
+            MrBayesPrint ("%s   This partial constraint does not include any taxa in the second set and will not be defined\n", spacer);
+            return (ERROR);
+            }
+        }
+    else if (consrtainType == NEGATIVE)
+        {
+        if (howMany == 1)
+            {
+            MrBayesPrint ("%s   Negative constraint should include more than one taxa. Constraint will not be defined\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    /* add name to constraintNames */
+    if (AddString (&constraintNames, numDefinedConstraints, tempSetName) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding constraint %s to list\n", spacer, tempSetName);
+        return (ERROR);
+        }
+
+    /* store tempSet */
+    AddBitfield (&definedConstraint, numDefinedConstraints, tempSet, numTaxa);
+    if (consrtainType == PARTIAL)
+        {
+        AddBitfield (&definedConstraintTwo, numDefinedConstraints, tempSetNeg, numTaxa);
+        }
+    else
+        {
+        definedConstraintTwo = (BitsLong **) SafeRealloc ((void *)(definedConstraintTwo), ((size_t)numDefinedConstraints+1)*sizeof(BitsLong *));
+        if (definedConstraintTwo==NULL)
+            return ERROR;
+        definedConstraintTwo[numDefinedConstraints]=NULL;
+        }
+    
+    /* add a default node calibration */
+    nodeCalibration = (Calibration *) SafeRealloc ((void *)nodeCalibration, ((size_t)numDefinedConstraints+1)*sizeof(Calibration));
+    nodeCalibration[numDefinedConstraints].prior            = defaultCalibration.prior;
+    nodeCalibration[numDefinedConstraints].priorParams[0]   = defaultCalibration.priorParams[0];
+    nodeCalibration[numDefinedConstraints].priorParams[1]   = defaultCalibration.priorParams[1];
+    nodeCalibration[numDefinedConstraints].priorParams[2]   = defaultCalibration.priorParams[2];
+    nodeCalibration[numDefinedConstraints].min              = defaultCalibration.min;
+    nodeCalibration[numDefinedConstraints].max              = defaultCalibration.max;
+    nodeCalibration[numDefinedConstraints].LnPriorProb      = defaultCalibration.LnPriorProb;
+    nodeCalibration[numDefinedConstraints].LnPriorRatio     = defaultCalibration.LnPriorRatio;
+    strcpy(nodeCalibration[numDefinedConstraints].name, defaultCalibration.name);
+
+    /* increment number of defined constraints */
+    numDefinedConstraints++;
+
+    /* reallocate and initialize space for activeConstraints */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        modelParams[i].activeConstraints = (int *) SafeRealloc((void *)(modelParams[i].activeConstraints), (size_t)numDefinedConstraints*sizeof(int));
+        modelParams[i].activeConstraints[numDefinedConstraints-1] = NO;
+        }
+
+    /* reallocate and initialize space for tempActiveConstraints */
+    tempActiveConstraints = (int *) SafeRealloc((void *)(tempActiveConstraints), (size_t)numDefinedConstraints*sizeof(int));
+    tempActiveConstraints[numDefinedConstraints-1] = NO;
+
+    definedConstraintsType = (enum ConstraintType *) SafeRealloc((void *)(definedConstraintsType), (size_t)numDefinedConstraints*sizeof(enum ConstraintType));
+    if (definedConstraintsType==NULL)
+        return ERROR;
+    definedConstraintsType[numDefinedConstraints-1] = consrtainType;
+
+    definedConstraintPruned = (BitsLong **) SafeRealloc ((void *)(definedConstraintPruned), (size_t)numDefinedConstraints*sizeof(BitsLong *));
+    if (definedConstraintPruned==NULL)
+        return ERROR;
+    definedConstraintPruned[numDefinedConstraints-1]=NULL;
+
+    definedConstraintTwoPruned = (BitsLong **) SafeRealloc ((void *)(definedConstraintTwoPruned), (size_t)numDefinedConstraints*sizeof(BitsLong *));
+    if (definedConstraintTwoPruned==NULL)
+        return ERROR;
+    definedConstraintTwoPruned[numDefinedConstraints-1]=NULL;
+
+    /* show taxset (for debugging) */
+    // for (i=0; i<numTaxa; i++)
+    //     MrBayesPrint ("%4d  %4d\n", i+1, taxaInfo[i].constraints[numDefinedConstraints-1]);
+
+    return (NO_ERROR);
+}
+
+
+int DoConstraintParm (char *parmName, char *tkn)
+{
+    int         i, index, tempInt;
+    MrBFlt      tempD;
+    static int  *tempSetCurrent;
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before constraints can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* check size of constraint name */
+            if (strlen(tkn) > 99)
+                {
+                MrBayesPrint ("%s   Constraint name is too long\n", spacer);
+                return (ERROR);
+                }
+                
+            /* check to see if the name has already been used as a constraint */
+            if (numDefinedConstraints > 0)
+                {
+                if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) == ERROR)
+                    {
+                    /* an ERROR returned if the constraint name has not been used. we _want_ to be here */
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Constraint name '%s' has been used previously\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                }
+                
+            /* copy the name to the temporary constraint names string */
+            strcpy (tempSetName, tkn);
+            
+            /* clear tempSet */
+            for (i=0; i<numTaxa; i++)
+                tempSet[i] = 0;
+
+            consrtainType = HARD; /* set default constrain type */
+            tempSetCurrent=tempSet;
+            fromI = toJ = everyK = -1;
+            foundDash = foundSlash = NO;
+            MrBayesPrint ("%s   Defining constraint called '%s'\n", spacer, tkn);
+            foundExp = NO;
+            foundFirst = YES;
+            foundEqual = NO;
+            isNegative = NO;
+            foundColon = NO;
+            expecting = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(DASH);
+            expecting |= Expecting(EQUALSIGN);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        foundEqual = YES;
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        isNegative = NO;
+        expecting = Expecting(NUMBER);
+        expecting |= Expecting(DASH);
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        isNegative = NO;
+        foundExp = NO;
+        expecting = Expecting(EQUALSIGN);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        if (foundExp == YES)
+            isNegative = YES;
+        else
+            foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        if (foundFirst == YES && foundEqual == NO)
+            {
+            /* We are filling in the probability for the constraint. Specifically, we expect exp(number). */
+            if (IsSame ("Partial", tkn) == SAME)
+                {
+                for (i=0; i<numTaxa; i++)
+                    tempSetNeg[i] = 0;
+
+                consrtainType = PARTIAL;
+                expecting = Expecting(EQUALSIGN);
+                expecting |= Expecting(ALPHA);
+                }
+            else if (IsSame ("Hard", tkn) == SAME)
+                {
+                consrtainType = HARD;
+                expecting = Expecting(EQUALSIGN);
+                expecting |= Expecting(ALPHA);
+                }
+            else if (IsSame ("Negative", tkn) == SAME)
+                {
+                consrtainType = NEGATIVE;
+                expecting = Expecting(EQUALSIGN);
+                expecting |= Expecting(ALPHA);
+                }
+            else if (IsSame ("Exp", tkn) == SAME || IsSame ("Exp", tkn) == CONSISTENT_WITH)
+                {
+                foundExp = YES;
+                foundDash = NO;
+                isNegative = NO;
+                expecting  = Expecting(LEFTPAR);
+                }
+            else
+                {
+                MrBayesPrint ("%s   Do not understand %s\n", spacer, tkn);
+                return (ERROR);
+                }
+            }
+        else
+            {
+            /* We are defining a constraint in terms of a taxon set (called tkn, here) or we are referring to
+               the taxon name. We should be able to find tkn in the list of taxon set names or in the list
+               of taxon names. If we cannot, then we have a problem and return an error. */
+            if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                {
+                if (numTaxaSets < 1)
+                    {
+                    MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                /* add taxa from taxset tkn to new tempSet */
+                for (i=0; i<numTaxa; i++)
+                    {
+                    if (IsBitSet(i, taxaSet[index]) == YES)
+                        {
+                        tempSetCurrent[i] = 1;
+                        }
+                    }
+                }
+            else
+                {
+                tempSetCurrent[index] = 1;
+                }
+            fromI = toJ = everyK = -1;
+
+            expecting  = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            if (consrtainType != PARTIAL || foundColon == YES)
+                expecting |= Expecting(SEMICOLON);
+            else
+                expecting |= Expecting(COLON);
+            }
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (foundFirst == YES && foundEqual == NO)
+            {
+            /* We are filling in the probability for the constraint. Specifically, we expect number. */
+            sscanf (tkn, "%lf", &tempD);        
+            if (foundExp == NO && tempD < 0.0)
+                {
+                MrBayesPrint ("%s   The probability of a clade cannot be less than zero\n", spacer, tkn);
+                return (ERROR);
+                }
+            if (isNegative == YES || foundDash == YES)
+                tempD *= -1.0;
+            if (foundExp == YES)
+                {
+                expecting  = Expecting(RIGHTPAR);
+                }
+            else
+                {
+                expecting  = Expecting(EQUALSIGN);
+                }
+            foundFirst = NO;
+            foundDash = NO;
+            }
+        else
+            {       
+            if (strlen(tkn) == 1 && !strcmp(tkn, "."))
+                {
+                tempInt = numTaxa;
+                }
+            else
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt <= 0 || tempInt > numTaxa)
+                    {
+                    MrBayesPrint ("%s   Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
+                    return (ERROR);
+                    }
+                }
+            tempInt--;
+            if (foundDash == YES)
+                {
+                if (fromI >= 0)
+                    toJ = tempInt;
+                else
+                    {
+                    MrBayesPrint ("%s   Improperly formatted constraint\n", spacer);
+                    return (ERROR);
+                    }
+                foundDash = NO;
+                }
+            else if (foundSlash == YES)
+                {
+                tempInt++;
+                if (tempInt <= 1)
+                    {
+                    MrBayesPrint ("%s   Improperly formatted constraint\n", spacer);
+                    return (ERROR);
+                    }
+                if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                    everyK = tempInt;
+                else
+                    {
+                    MrBayesPrint ("%s   Improperly formatted constraint\n", spacer);
+                    return (ERROR);
+                    }
+                foundSlash = NO;
+                }
+            else
+                {
+                if (fromI >= 0 && toJ < 0)
+                    {
+                    if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR)
+                        return (ERROR);
+                    fromI = tempInt;
+                    }
+                else if (fromI < 0 && toJ < 0)
+                    {
+                    fromI = tempInt;
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                    {
+                    if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR)
+                        return (ERROR);
+                    fromI = tempInt;
+                    toJ = everyK = -1;
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                    {
+                    if (AddToGivenSet (fromI, toJ, everyK, 1, tempSetCurrent) == ERROR)
+                        return (ERROR);
+                    fromI = tempInt;
+                    toJ = everyK = -1;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Improperly formatted constraint\n", spacer);
+                        {
+                        return (ERROR);
+                        }
+                    }
+                }
+
+            expecting  = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(DASH);
+            expecting |= Expecting(BACKSLASH);
+            if (consrtainType != PARTIAL || foundColon == YES)
+                expecting |= Expecting(SEMICOLON);
+            else
+                expecting |= Expecting(COLON);
+            }
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        if (foundColon == YES)
+            {
+            MrBayesPrint ("%s   Improperly formatted constraint: two colon charactors in constraint command.\n", spacer);
+            return (ERROR);
+            }
+
+        /* add set to tempSet */
+        if (fromI >= 0 && toJ < 0)
+            {
+            if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                return (ERROR);
+            }
+        else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+            {
+            if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                return (ERROR);
+            }
+        else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+            {
+            if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                return (ERROR);
+            }
+        fromI = toJ = everyK = -1;
+        foundDash = foundSlash = NO;
+
+        foundColon = YES;
+        tempSetCurrent = tempSetNeg;
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoCtype (void)
+{
+    int         i, foundIllegal, marks[5], numAppliedTo;
+
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* merge tempSet with ctype */
+    numAppliedTo = 0;
+    for (i=0; i<5; i++)
+        marks[i] = NO;
+    for (i=0; i<numChar; i++)
+        {
+        if (tempSet[i] != 0)
+            {
+            foundIllegal = NO;
+            if (charOrdering != UNORD)
+                {
+                if (charInfo[i].charType == DNA)
+                    {
+                    foundIllegal = YES;
+                    if (marks[0] == NO)
+                        MrBayesPrint ("%s   Ctype not applied to DNA states which must be unordered\n", spacer);
+                    marks[0] = YES;
+                    }
+                else if (charInfo[i].charType == RNA)
+                    {
+                    foundIllegal = YES;
+                    if (marks[1] == NO)
+                        MrBayesPrint ("%s   Ctype not applied to RNA states which must be unordered\n", spacer);
+                    marks[1] = YES;
+                    }
+                else if (charInfo[i].charType == PROTEIN)
+                    {
+                    foundIllegal = YES;
+                    if (marks[2] == NO)
+                        MrBayesPrint ("%s   Ctype not applied to amino acid states which must be unordered\n", spacer);
+                    marks[2] = YES;
+                    }
+                else if (charInfo[i].charType == RESTRICTION)
+                    {
+                    foundIllegal = YES;
+                    if (marks[3] == NO)
+                        MrBayesPrint ("%s   Ctype not applied to restriction site states which must be unordered\n", spacer);
+                    marks[3] = YES;
+                    }
+                else if (charInfo[i].charType == CONTINUOUS)
+                    {
+                    foundIllegal = YES;
+                    if (marks[4] == NO)
+                        MrBayesPrint ("%s   Ctype not applied to continuous characters\n", spacer);
+                    marks[4] = YES;
+                    }
+                }
+            if (foundIllegal == NO)
+                {
+                charInfo[i].ctype = charOrdering;
+                numAppliedTo++;
+                }
+            }
+        }
+    if (numAppliedTo > 0)
+        {
+        MrBayesPrint ("%s   Ctype was applied to %d standard characters\n", spacer, numAppliedTo);
+        }
+    else
+        {
+        MrBayesPrint ("%s   No standard characters found to apply ctype to\n", spacer);
+        }
+    
+#   if 0
+    for (i=0; i<numChar; i++)
+        MrBayesPrint ("%4d -- %d\n", i, ctype[i]);
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int DoCtypeParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before typesets can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            if (IsSame ("Ordered", tkn) == SAME || IsSame ("Ordered", tkn) == CONSISTENT_WITH)
+                charOrdering = ORD;
+            else if (IsSame ("Unordered", tkn) == SAME || IsSame ("Unordered", tkn) == CONSISTENT_WITH)
+                charOrdering = UNORD;
+            else if (IsSame ("Dollo", tkn) == SAME || IsSame ("Dollo", tkn) == CONSISTENT_WITH)
+                charOrdering = DOLLO;
+            else if (IsSame ("Irreversible", tkn) == SAME || IsSame ("Irreversible", tkn) == CONSISTENT_WITH)
+                charOrdering = IRREV;
+            else
+                {
+                MrBayesPrint ("%s   Do not understand delimiter \"%s\"\n", spacer, tkn);
+                return (ERROR);
+                }
+            
+            /* clear tempSet */
+            for (i=0; i<numChar; i++)
+                tempSet[i] = 0;
+            
+            fromI = toJ = everyK = -1;
+            foundDash = foundSlash = NO;
+            MrBayesPrint ("%s   Setting characters to %s\n", spacer, tkn);
+            expecting = Expecting(COLON);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        expecting  = Expecting(ALPHA) | Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        /* first, check that we are not trying to put in another character ordering */
+        if (IsSame ("Ordered", tkn) == SAME || IsSame ("Ordered", tkn) == CONSISTENT_WITH)
+            {
+            MrBayesPrint ("%s   You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
+            return (ERROR);
+            }
+        else if (IsSame ("Unordered", tkn) == SAME || IsSame ("Unordered", tkn) == CONSISTENT_WITH)
+            {
+            MrBayesPrint ("%s   You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
+            return (ERROR);
+            }
+        else if (IsSame ("Dollo", tkn) == SAME || IsSame ("Dollo", tkn) == CONSISTENT_WITH)
+            {
+            MrBayesPrint ("%s   You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
+            return (ERROR);
+            }
+        else if (IsSame ("Irreversible", tkn) == SAME || IsSame ("Irreversible", tkn) == CONSISTENT_WITH)
+            {
+            MrBayesPrint ("%s   You cannot specify more than one ordering with a single use of ctype\n", spacer, tkn);
+            return (ERROR);
+            }
+        
+        /* We are defining a type set in terms of another (called tkn, here). We should be able
+           to find tkn in the list of character set names. If we cannot, then we have a problem and
+           return an error. */
+        if (IsSame ("All", tkn) == SAME)
+            {
+            for (i=0; i<numChar; i++)
+                tempSet[i] = 1;
+            fromI = toJ = everyK = -1;
+            expecting = Expecting(SEMICOLON);
+            }
+        else
+            {
+            if (numCharSets < 1)
+                {
+                MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
+                {
+                MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+                
+            /* add characters from charset tkn to new tempset */
+            for (i=0; i<numChar; i++)
+                {
+                if (IsBitSet(i, charSet[index]) == YES)
+                    tempSet[i] = 1;
+                }
+            fromI = toJ = everyK = -1;
+            expecting  = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(SEMICOLON);
+            }
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && tkn[0] == '.')
+            tempInt = numChar;
+        else
+            sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numChar)
+            {
+            MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+            return (ERROR);
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted ctype\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else if (foundSlash == YES)
+            {
+            tempInt++;
+            if (tempInt <= 1)
+                {
+                MrBayesPrint ("%s   Improperly formatted ctype\n", spacer);
+                return (ERROR);
+                }
+            if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                everyK = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted ctype\n", spacer);
+                return (ERROR);
+                }
+            foundSlash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted ctype\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+                
+            }
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(BACKSLASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoDelete (void)
+{
+    int         i, alreadyDone;
+
+    MrBayesPrint ("%s   Excluding taxa\n", spacer);
+
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* merge tempSet with taxaset */
+    alreadyDone = NO;
+    for (i=0; i<numTaxa; i++)
+        {
+        if (tempSet[i] == 1)
+            {
+            if (taxaInfo[i].isDeleted == YES && alreadyDone == NO)
+                {
+                MrBayesPrint ("%s   Some taxa already excluded\n", spacer);
+                alreadyDone = YES;
+                }
+            taxaInfo[i].isDeleted = YES;
+            }
+        }
+
+    SetLocalTaxa ();
+    if (SetUpAnalysis(&globalSeed) == ERROR)
+        return ERROR;
+
+    /* show tempSet (for debugging) */
+#   if 0
+    for (i=0; i<numTaxa; i++)
+        MrBayesPrint ("%4d  %4d\n", i+1, tempSet[i]);
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int DoDeleteParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can delete taxa\n", spacer);
+        return (ERROR);
+        }
+        
+    if (foundFirst == NO)
+        {
+        /* this is the first time in */
+        fromI = toJ = everyK = -1;
+        foundDash = NO;
+        for (i=0; i<numTaxa; i++) /* clear tempSet */
+            tempSet[i] = 0;
+        foundFirst = YES;
+        }
+
+    if (expecting == Expecting(ALPHA))
+        {
+        if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
+            {
+            for (i=0; i<numTaxa; i++)
+                tempSet[i] = 1;
+            }
+        else
+            {
+            if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                {
+                /* we are using a pre-defined taxa set */
+                if (numTaxaSets < 1)
+                    {
+                    MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                /* add taxa from taxset tkn to new tempSet */
+                for (i=0; i<numTaxa; i++)
+                    {
+                    if (IsBitSet (i, taxaSet[index]) == YES)
+                        tempSet[i] = 1;
+                    }
+                }
+            else
+                {
+                /* we found the taxon name */
+                if (fromI >= 0 && toJ < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                        return (ERROR);
+                    }
+                else if (fromI >= 0 && toJ >= 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                        return (ERROR);
+                    }
+                    
+                tempSet[index] = 1;
+                }
+            }
+        foundDash = NO;
+        fromI = toJ = everyK = -1;
+        
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && !strcmp(tkn, "."))
+            tempInt = numTaxa;
+        else
+            {
+            sscanf (tkn, "%d", &tempInt);
+            if (tempInt <= 0 || tempInt > numTaxa)
+                {
+                MrBayesPrint ("%s   Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
+                return (ERROR);
+                }
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted delete set\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted delete set\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoDimensions (void)
+{
+    if (inDataBlock == NO && inTaxaBlock == NO && inCharactersBlock == NO)
+        {
+        MrBayesPrint ("%s   Dimensions can only be defined in a data, characters or taxa block\n", spacer);
+        return (ERROR);
+        }
+
+    /* other problems are detected already when reading in DoDimensionsParm */
+    if (inDataBlock == YES && (defTaxa == NO || defChars == NO))
+        {
+        MrBayesPrint ("%s   Expecting both Ntax and Nchar to be defined in a data block\n", spacer);
+        return (ERROR);
+        }
+
+    /* allocate matrix */
+    if (inTaxaBlock == YES)
+        {
+        if (AllocTaxa () == ERROR)
+            return ERROR;
+        MrBayesPrint ("%s   Defining new set of %d taxa\n", spacer, numTaxa);
+        }
+
+    if (inCharactersBlock == YES)
+        {
+        if (AllocMatrix() == ERROR)
+            return (ERROR);
+        MrBayesPrint ("%s   Defining new character matrix with %d characters\n", spacer, numChar);
+        }
+
+    if (inDataBlock == YES)
+        {
+        if (AllocMatrix() == ERROR)
+            return (ERROR);
+        MrBayesPrint ("%s   Defining new matrix with %d taxa and %d characters\n", spacer, numTaxa, numChar);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoDimensionsParm (char *parmName, char *tkn)
+{
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Ntax (numTaxa) *****************************************************************/
+        if (!strcmp(parmName, "Ntax"))
+            {
+            if (inCharactersBlock == YES)
+                {
+                MrBayesPrint ("%s   You cannot define ntax in a characters block\n");
+                return (ERROR);
+                }
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &numTaxa);
+                defTaxa = YES;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Nchar (numChar) ****************************************************************/
+        else if (!strcmp(parmName, "Nchar"))
+            {
+            if (inTaxaBlock == YES)
+                {
+                MrBayesPrint ("%s   You cannot define nchar in a taxa block\n");
+                return (ERROR);
+                }
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &numChar);
+                defChars = YES;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoDisclaimer (void)
+{
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+    MrBayesPrint ("   Disclaimer                                                                    \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   Copyright 2003 by John P. Huelsenbeck and Fredrik Ronquist                    \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   This software package is provided \"as is\" and without a warranty of any     \n");
+    MrBayesPrint ("   kind. In no event shall the authors be held responsible for any damage        \n");
+    MrBayesPrint ("   resulting from the use of this software. The program--including source code,  \n");
+    MrBayesPrint ("   example data sets, and executables--is distributed free of charge for         \n");
+    MrBayesPrint ("   academic use only.                                                            \n");
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+
+    return (NO_ERROR);
+}
+
+
+int DoEndBlock (void)
+{
+    if (inMrbayesBlock == YES)
+        {
+        MrBayesPrint ("   Exiting mrbayes block\n");
+        inMrbayesBlock = NO;
+        }
+    else if (inDataBlock == YES)
+        {
+        MrBayesPrint ("   Exiting data block\n");
+        inDataBlock = NO;
+        }
+    else if (inCharactersBlock == YES)
+        {
+        MrBayesPrint ("   Exiting characters block\n");
+        inCharactersBlock = NO;
+        }
+    else if (inTaxaBlock == YES)
+        {
+        MrBayesPrint ("   Exiting taxa block\n");
+        if (numNamedTaxa < numTaxa)
+            {
+            MrBayesPrint ("%s   Leaving taxa block without taxon labels being defined\n", spacer);
+            FreeTaxa();
+            }
+        inTaxaBlock = NO;
+        }
+    else if (inTreesBlock == YES)
+        {
+        MrBayesPrint ("   Exiting trees block\n");
+        inTreesBlock = NO;
+        ResetTranslateTable();
+        }
+    else if (inForeignBlock == YES)
+        {
+        MrBayesPrint ("   Exiting foreign block\n");
+        inForeignBlock = NO;
+        }
+    else
+        {
+        MrBayesPrint ("   Unknown \"end\" statement\n");
+        return (ERROR);
+        }
+
+    strcpy(spacer,"");  /* reset indentation */
+    return (NO_ERROR);
+}
+
+
+int DoExecute (void)
+{
+    int         c, i, rc, cmdLine, lineTerm, longestLineLength, nErrors;
+    char        *s, exeFileName[100];
+    FILE        *fp;
+    CmdType     *oldCommandPtr;
+#   if defined (MPI_ENABLED)
+    int         sumErrors;
+#   endif
+        
+    nErrors = 0;
+    cmdLine = 0;
+    numOpenExeFiles++;
+    s = NULL;
+    strncpy (exeFileName, inputFileName, 98);
+    
+    if (numOpenExeFiles > 1)
+        MrBayesPrint ("\n%s   Executing file \"%s\"...\n\n", spacer, inputFileName);
+    else
+        MrBayesPrint ("%s   Executing file \"%s\"\n", spacer, inputFileName);
+
+    /* Save old command ptr */
+    oldCommandPtr = commandPtr;
+
+    /* open binary file */
+    if ((fp = OpenBinaryFileR(inputFileName)) == NULL)
+        nErrors++;
+
+    /* set indentation to 0 */
+    strcpy (spacer, "");
+    
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+        goto errorExit;
+        }
+#   else
+    if (nErrors > 0)
+        goto errorExit;
+#   endif
+
+    /* find out what type of line termination is used */
+    lineTerm = LineTermType (fp);
+    if (lineTerm == LINETERM_MAC)
+        MrBayesPrint ("%s   Macintosh line termination\n", spacer);
+    else if (lineTerm == LINETERM_DOS)
+        MrBayesPrint ("%s   DOS line termination\n", spacer);
+    else if (lineTerm == LINETERM_UNIX)
+        MrBayesPrint ("%s   UNIX line termination\n", spacer);
+    else
+        {
+        MrBayesPrint ("%s   Unknown line termination\n", spacer);
+        nErrors++;
+        }
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+        goto errorExit;
+        }
+#   else
+    if (nErrors > 0)
+        goto errorExit;
+#   endif
+            
+    /* find length of longest line */
+    longestLineLength = LongestLine (fp);
+    MrBayesPrint ("%s   Longest line length = %d\n", spacer, longestLineLength);
+    longestLineLength += 50;
+    
+    /* check that longest line is not longer than CMD_STRING_LENGTH */
+    if (longestLineLength >= CMD_STRING_LENGTH - 100)
+        {
+        /*MrBayesPrint ("%s   A maximum of %d characters is allowed on a single line\n", spacer, CMD_STRING_LENGTH - 100);*/
+        MrBayesPrint ("%s   The longest line of the file %s\n", spacer, inputFileName);
+        MrBayesPrint ("%s   contains at least one line with %d characters.\n", spacer, longestLineLength);
+        }
+    /*
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+        goto errorExit;
+        }
+#   else
+    if (nErrors > 0)
+        goto errorExit;
+#   endif
+    */
+
+    /* allocate a string long enough to hold a line */
+    s = (char *)SafeMalloc((size_t)longestLineLength * sizeof(char));
+    if (!s)
+        {
+        MrBayesPrint ("%s   Problem allocating string for reading file\n", spacer);
+        nErrors++;
+        }
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+        goto errorExit;
+        }
+#   else
+    if (nErrors > 0)
+        goto errorExit;
+#   endif
+
+    /* close binary file */
+    SafeFclose (&fp);
+    
+    /* open text file */
+    if ((fp = OpenTextFileR(inputFileName)) == NULL)
+        {
+        nErrors++;
+        }
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+        goto errorExit;
+        }
+#   else
+    if (nErrors > 0)
+        goto errorExit;
+#   endif
+    
+    /* parse file, reading each line in turn */
+    MrBayesPrint ("%s   Parsing file\n", spacer);
+
+    inMrbayesBlock = inDataBlock = inForeignBlock = inTreesBlock = NO;
+    foundNewLine = NO;
+    expecting = Expecting(COMMAND);
+    cmdLine = 0;
+
+    do {
+        /* read in a new line into s */
+        i = 0;
+        do {
+            c = fgetc(fp);
+            if (c == '\r' || c == '\n' || c == EOF)
+                s[i++] = '\n';
+            else
+                s[i++] = c;
+            } while (s[i-1] != '\n');
+        s[i] = '\0';
+        foundNewLine = YES;
+        cmdLine++;
+
+        /* process string if not empty */
+        if (strlen(s) > 1)
+            {
+            /* check that all characters in the string are valid */
+            if (CheckStringValidity (s) == ERROR)
+                {
+                nErrors++;
+                }
+#           if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+                goto errorExit;
+                }
+#           else
+            if (nErrors > 0)
+                goto errorExit;
+#           endif
+                
+            /* interpret commands on line */
+            rc = ParseCommand (s);
+            if (rc == ERROR)
+                nErrors++;
+#           if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+                goto errorExit;
+                }
+#           else
+            if (nErrors > 0)
+                goto errorExit;
+#           endif
+            if (rc == NO_ERROR_QUIT)
+                nErrors++;
+#           if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                goto quitExit;
+#           else
+            if (nErrors > 0)
+                goto quitExit;
+#           endif
+            }
+        } while (c != EOF); 
+    
+    MrBayesPrint ("%s   Reached end of file\n", spacer);
+
+    if (inComment == YES)
+        nErrors++;
+
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   There was an error on at least one processor\n", spacer);
+        goto errorExit;
+        }
+#   else
+    if (nErrors > 0)
+        goto errorExit;
+#   endif
+
+    if (s)
+        free (s);
+    SafeFclose (&fp);
+    numOpenExeFiles--;
+
+    if (numOpenExeFiles > 0)
+        {
+        inMrbayesBlock = YES;
+        MrBayesPrint ("\n   Returning execution to calling file ...\n\n");
+        strcpy (spacer, "   ");
+        }
+    else
+        strcpy (spacer, "");
+
+    commandPtr = oldCommandPtr;
+
+    return (NO_ERROR);
+    
+    quitExit:
+        if (s)
+            free (s);
+        SafeFclose (&fp);
+        numOpenExeFiles--;
+        if (numOpenExeFiles > 0)
+            {
+            inMrbayesBlock = YES;
+            strcpy (spacer, "   ");
+            }
+        else
+            strcpy (spacer, "");
+
+        commandPtr = oldCommandPtr;
+
+        return (NO_ERROR_QUIT);
+            
+    errorExit:
+        if (inComment == YES)
+            {
+            MrBayesPrint ("%s   ERROR: Reached end of file while in comment.\n", spacer);
+            inComment = NO;
+            numComments = 0;
+            }
+        if (fp)
+            {
+            MrBayesPrint ("%s   The error occurred when reading char. %d on line %d\n", spacer, tokenP-cmdStr-strlen(token)+1, cmdLine);
+            MrBayesPrint ("%s      in the file '%s'\n", spacer, exeFileName);
+            }
+        if (s)
+            free (s);
+        SafeFclose (&fp);
+        numOpenExeFiles--;  /* we increase the value above even if no file is successfully opened */
+
+        /* make sure we exit the block we were reading from correctly */
+        if (inMrbayesBlock == YES)
+            inMrbayesBlock = NO;
+        else if (inDataBlock == YES)
+            inDataBlock = NO;
+        else if (inTreesBlock == YES)
+            {
+            inTreesBlock = NO;
+            ResetTranslateTable();
+            }
+        else if (inForeignBlock == YES)
+            inForeignBlock = NO;
+
+        /* make sure correct return if we came from mrbayes block in another execute file */
+        if (numOpenExeFiles > 0)
+            {
+            inMrbayesBlock = YES;
+            MrBayesPrint ("\n   Returning execution to calling file ...\n\n");
+            strcpy (spacer, "   ");
+            commandPtr = oldCommandPtr;
+            return (ERROR);
+            }
+        else
+            strcpy (spacer, "");
+
+        commandPtr = oldCommandPtr;
+
+        return (ERROR);
+}
+
+
+int DoExecuteParm (char *parmName, char *tkn)
+{
+    if (strlen(tkn)>99)
+        {
+        MrBayesPrint ("%s   Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
+        MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+        MrBayesPrint ("%s   has %d characters.\n", spacer,strlen(tkn));
+        return (ERROR);
+        }
+    strcpy (inputFileName, tkn);
+    
+    expecting = Expecting (SEMICOLON);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoExclude (void)
+{
+    int         i, alreadyDone;
+
+    MrBayesPrint ("%s   Excluding character(s)\n", spacer);
+
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* merge tempSet with charset */
+    alreadyDone = NO;
+    for (i=0; i<numChar; i++)
+        {
+        if (tempSet[i] == 1)
+            {
+            if (charInfo[i].isExcluded == YES && alreadyDone == NO)
+                {
+                MrBayesPrint ("%s   Some characters already excluded\n", spacer);
+                alreadyDone = YES;
+                }
+            charInfo[i].isExcluded = YES;
+            }
+        }
+        
+    foundFirst = NO;
+
+    /* reset analysis to recompress data */
+    if (SetUpAnalysis(&globalSeed) == ERROR)
+        return ERROR;
+
+    return (NO_ERROR);
+}
+
+
+int DoExcludeParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can exclude characters\n", spacer);
+        return (ERROR);
+        }
+        
+    if (foundFirst == NO)
+        {
+        /* this is the first time in */
+        fromI = toJ = everyK = -1;
+        foundDash = foundSlash = NO;
+        for (i=0; i<numChar; i++) /* clear tempSet */
+            tempSet[i] = 0;
+        foundFirst = YES;
+        }
+
+    if (expecting == Expecting(ALPHA))
+        {
+        if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
+            {
+            for (i=0; i<numChar; i++)
+                tempSet[i] = 1;
+            }
+        else if (IsSame ("Missambig", tkn) == SAME || IsSame ("Missambig", tkn) == CONSISTENT_WITH)
+            {
+            for (i=0; i<numChar; i++)
+                {
+                if (charInfo[i].isMissAmbig == YES)
+                    tempSet[i] = 1;
+                }
+            }
+        else
+            {
+            /* we are using a pre-defined character set */
+            if (numCharSets < 1)
+                {
+                MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
+                {
+                MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            /* add characters from charset tkn to new tempSet */
+            for (i=0; i<numChar; i++)
+                {
+                if (IsBitSet(i, charSet[index]) == YES)
+                    tempSet[i] = 1;
+                }
+            fromI = toJ = everyK = -1;
+            }
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && tkn[0] == '.')
+            tempInt = numChar;
+        else
+            sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numChar)
+            {
+            MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+            return (ERROR);
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted exclude set\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else if (foundSlash == YES)
+            {
+            tempInt++;
+            if (tempInt <= 1)
+                {
+                MrBayesPrint ("%s   Improperly formatted exclude set\n", spacer);
+                return (ERROR);
+                }
+            if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                everyK = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted exclude set\n", spacer);
+                return (ERROR);
+                }
+            foundSlash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted exclude set\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(BACKSLASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoFormat (void)
+{
+    if (inDataBlock == NO && inCharactersBlock == NO)
+        {
+        MrBayesPrint ("%s   Formats can only be defined in a data or characters block\n", spacer);
+        return (ERROR);
+        }
+
+    return CheckInitialPartitions();
+}
+
+
+int DoFormatParm (char *parmName, char *tkn)
+{
+    int         i, tempInt;
+    char        tempStr[100];
+    
+    if (inDataBlock == NO && inCharactersBlock == NO)
+        {
+        MrBayesPrint ("%s   Formats can only be defined in a data or characters block\n", spacer);
+        return (ERROR);
+        }
+    if (defTaxa == NO || defChars == NO)
+        {
+        MrBayesPrint ("%s   The dimensions of the matrix must be defined before the format\n", spacer);
+        return (ERROR);
+        }
+    
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        if (!strcmp(parmName, "Interleave"))
+            {
+            expecting = Expecting(EQUALSIGN) | Expecting(PARAMETER) | Expecting(SEMICOLON);
+            isInterleaved = YES;
+            }
+        }
+    else
+        {
+        /* set Datatype (dataType) ************************************************************/
+        if (!strcmp(parmName, "Datatype"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (isMixed == NO)
+                        {
+                        if (!strcmp(tempStr, "Dna"))
+                            dataType = DNA;
+                        else if (!strcmp(tempStr, "Rna"))
+                            dataType = RNA;
+                        else if (!strcmp(tempStr, "Protein"))
+                            dataType = PROTEIN;
+                        else if (!strcmp(tempStr, "Restriction"))
+                            dataType = RESTRICTION;
+                        else if (!strcmp(tempStr, "Standard"))
+                            dataType = STANDARD;
+                        else if (!strcmp(tempStr, "Continuous"))
+                            dataType = CONTINUOUS;
+                        else if (!strcmp(tempStr, "Mixed"))
+                            {
+                            dataType = MIXED;
+                            isMixed = YES;
+                            for (i=0; i<numChar; i++)
+                                tempSet[i] = 0;
+                            fromI = toJ = everyK = -1;
+                            foundDash = foundSlash = NO;
+                            numDivisions = 0;
+                            MrBayesPrint ("%s   Data is Mixed\n", spacer);
+                            }
+                        if (dataType == MIXED)
+                            expecting = Expecting(LEFTPAR);
+                        else
+                            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                        }
+                    else
+                        {
+                        if (!strcmp(tempStr, "Dna"))
+                            dataType = DNA;
+                        else if (!strcmp(tempStr, "Rna"))
+                            dataType = RNA;
+                        else if (!strcmp(tempStr, "Protein"))
+                            dataType = PROTEIN;
+                        else if (!strcmp(tempStr, "Restriction"))
+                            dataType = RESTRICTION;
+                        else if (!strcmp(tempStr, "Standard"))
+                            dataType = STANDARD;
+                        else if (!strcmp(tempStr, "Continuous"))
+                            dataType = CONTINUOUS;
+                        else if (!strcmp(tempStr, "Mixed"))
+                            {
+                            MrBayesPrint ("%s   Cannot have mixed datatype within a mixed datatype\n", spacer);
+                            return (ERROR);
+                            }
+                        expecting = Expecting(COLON);
+                        for (i=0; i<numChar; i++)
+                            tempSet[i] = 0;
+                        fromI = toJ = everyK = -1;
+                        foundDash = foundSlash = NO;
+                        }
+                    if (isMixed == NO)
+                        {
+                        numDivisions = 1;
+                        for (i=0; i<numChar; i++)
+                            {
+                            charInfo[i].charType = dataType;
+                            partitionId[i][0] = numDivisions;
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid data type argument\n", spacer);
+                    return (ERROR);
+                    }
+                if (isMixed == NO)
+                    MrBayesPrint ("%s   Data is %s\n", spacer, tempStr);
+                else if (strcmp(tempStr, "Mixed"))
+                    MrBayesPrint ("%s      Data for partition %d is %s\n", spacer, numDivisions+1, tempStr);
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(COLON))
+                {
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                if (strlen(tkn) == 1 && tkn[0] == '.')
+                    tempInt = numChar;
+                else
+                    sscanf (tkn, "%d", &tempInt);
+                if (tempInt <= 0 || tempInt > numChar)
+                    {
+                    MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+                    return (ERROR);
+                    }
+                tempInt--;
+                if (foundDash == YES)
+                    {
+                    if (fromI >= 0)
+                        toJ = tempInt;
+                    else
+                        {
+                        MrBayesPrint ("%s   Improperly formatted partition\n", spacer);
+                        return (ERROR);
+                        }
+                    foundDash = NO;
+                    }
+                else if (foundSlash == YES)
+                    {
+                    tempInt++;
+                    if (tempInt <= 1)
+                        {
+                        MrBayesPrint ("%s   Improperly formatted partition\n", spacer);
+                        return (ERROR);
+                        }
+                    if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                        everyK = tempInt;
+                    else
+                        {
+                        MrBayesPrint ("%s   Improperly formatted partition\n", spacer);
+                        return (ERROR);
+                        }
+                    foundSlash = NO;
+                    }
+                else
+                    {
+                    if (fromI >= 0 && toJ < 0)
+                        {
+                        if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                            return (ERROR);
+                        fromI = tempInt;
+                        }
+                    else if (fromI < 0 && toJ < 0)
+                        {
+                        fromI = tempInt;
+                        }
+                    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                        {
+                        if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                            return (ERROR);
+                        fromI = tempInt;
+                        toJ = everyK = -1;
+                        }
+                    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                        {
+                        if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                            return (ERROR);
+                        fromI = tempInt;
+                        toJ = everyK = -1;
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Improperly formatted partition\n", spacer);
+                            {
+                            return (ERROR);
+                            }
+                        }
+                        
+                    }
+                expecting  = Expecting(NUMBER);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(BACKSLASH);
+                expecting |= Expecting(COMMA);
+                expecting |= Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(BACKSLASH))
+                {
+                foundSlash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                /* add set to tempSet */
+                if (fromI >= 0 && toJ < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                        return (ERROR);
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                        return (ERROR);
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                        return (ERROR);
+                    }
+                for (i=0; i<numChar; i++)
+                    {
+                    if (tempSet[i] == numDivisions)
+                        charInfo[i].charType = dataType;
+                    }
+
+                /* merge tempSet */
+                for (i=0; i<numChar; i++)
+                    {
+                    if (tempSet[i] != 0)
+                        {
+                        if (partitionId[i][0] == 0)
+                            {
+                            charInfo[i].charType = dataType;
+                            partitionId[i][0] = numDivisions + 1;
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Improperly formatted partition (same character found in multiple partitions)\n", spacer);
+                            return (ERROR);
+                            }
+                        }
+                    }
+                
+                /* increment number of partitions */
+                numDivisions++;             
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                /* add set to tempSet */
+                if (fromI >= 0 && toJ < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                        return (ERROR);
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                        return (ERROR);
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, numDivisions+1) == ERROR)
+                        return (ERROR);
+                    }
+                    
+                /* merge tempSet */
+                for (i=0; i<numChar; i++)
+                    {
+                    if (tempSet[i] != 0)
+                        {
+                        if (partitionId[i][0] == 0)
+                            {
+                            charInfo[i].charType = dataType;
+                            partitionId[i][0] = numDivisions + 1;
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Improperly formatted partition (same character found in multiple partitions)\n", spacer);
+                            return (ERROR);
+                            }
+                        }
+                    }
+                
+                /* increment number of partitions */
+                numDivisions++;             
+                if (isMixed == YES)
+                    dataType = MIXED;
+                    
+                if (numDivisions > 1)
+                    MrBayesPrint ("%s   There are a total of %d default data divisions\n", spacer, numDivisions);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Interleave (isInterleaved) *****************************************************/
+        else if (!strcmp(parmName, "Interleave"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        isInterleaved = YES;
+                    else
+                        isInterleaved = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for interleaved data\n", spacer);
+                    return (ERROR);
+                    }
+                if (isInterleaved == YES)
+                    MrBayesPrint ("%s   Data matrix is interleaved\n", spacer);
+                else
+                    MrBayesPrint ("%s   Data matrix is not interleaved\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Gap (gapId) ********************************************************************/
+        else if (!strcmp(parmName, "Gap"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting  = Expecting(ALPHA);
+                expecting |= Expecting(QUESTIONMARK);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(NUMBER);
+                expecting |= Expecting(ASTERISK);
+                expecting |= Expecting(EXCLAMATIONMARK);
+                expecting |= Expecting(PERCENT);
+                expecting |= Expecting(WEIRD);
+                expecting |= Expecting(VERTICALBAR);
+                }
+            else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) || 
+                     ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) || 
+                     ((expecting & Expecting(DASH)) == Expecting(DASH)) || 
+                     ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) || 
+                     ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) || 
+                     ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) || 
+                     ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) || 
+                     ((expecting & Expecting(WEIRD)) == Expecting(WEIRD)) ||
+                     ((expecting & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR)))
+                {
+                if (strlen(tkn) == 1)
+                    {
+                    if (tkn[0] == matchId || tkn[0] == missingId)
+                        {
+                        MrBayesPrint ("%s   Gap character matches matching or missing characters\n", spacer);
+                        return (ERROR);
+                        }
+                    gapId = tkn[0];
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid gap argument %s\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Gaps coded as %s\n", spacer, tkn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Missing (missingId) ************************************************************/
+        else if (!strcmp(parmName, "Missing"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting  = Expecting(ALPHA);
+                expecting |= Expecting(QUESTIONMARK);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(NUMBER);
+                expecting |= Expecting(ASTERISK);
+                expecting |= Expecting(EXCLAMATIONMARK);
+                expecting |= Expecting(PERCENT);
+                expecting |= Expecting(WEIRD);
+                expecting |= Expecting(VERTICALBAR);
+                }
+            else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) || 
+                     ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) || 
+                     ((expecting & Expecting(DASH)) == Expecting(DASH)) || 
+                     ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) || 
+                     ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) || 
+                     ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) || 
+                     ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) || 
+                     ((expecting & Expecting(WEIRD)) == Expecting(WEIRD)) ||
+                     ((expecting & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR)))
+                {
+                if (strlen(tkn) == 1)
+                    {
+                    if (tkn[0] == gapId || tkn[0] == matchId)
+                        {
+                        MrBayesPrint ("%s   Missing character matches matching or gap characters\n", spacer);
+                        return (ERROR);
+                        }
+                    missingId = tkn[0];
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid missing argument %s\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Missing data coded as %s\n", spacer, tkn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Matchchar (matchId) ************************************************************/
+        else if (!strcmp(parmName, "Matchchar"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting  = Expecting(ALPHA);
+                expecting |= Expecting(QUESTIONMARK);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(NUMBER);
+                expecting |= Expecting(ASTERISK);
+                expecting |= Expecting(EXCLAMATIONMARK);
+                expecting |= Expecting(PERCENT);
+                expecting |= Expecting(WEIRD);
+                expecting |= Expecting(VERTICALBAR);
+                }
+            else if (((expecting & Expecting(ALPHA)) == Expecting(ALPHA)) || 
+                     ((expecting & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK)) || 
+                     ((expecting & Expecting(DASH)) == Expecting(DASH)) || 
+                     ((expecting & Expecting(NUMBER)) == Expecting(NUMBER)) || 
+                     ((expecting & Expecting(ASTERISK)) == Expecting(ASTERISK)) || 
+                     ((expecting & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK)) || 
+                     ((expecting & Expecting(PERCENT)) == Expecting(PERCENT)) || 
+                     ((expecting & Expecting(WEIRD)) == Expecting(WEIRD)) ||
+                     ((expecting & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR)))
+                {
+                if (strlen(tkn) == 1)
+                    {
+                    if (tkn[0] == gapId || tkn[0] == missingId)
+                        {
+                        MrBayesPrint ("%s   Matching character matches gap or missing characters\n", spacer);
+                        return (ERROR);
+                        }
+                    matchId = tkn[0];
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid matchchar argument %s\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Matching characters coded as %s\n", spacer, tkn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* skip Symbols ***************************************************************/
+        else if (!strcmp(parmName, "Symbols"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                MrBayesPrint ("%s   WARNING: MrBayes does not support 'symbols' specification; default symbols assumed\n", spacer);
+                readWord=YES;
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* on Equate return ERROR ***************************************************************/
+        else if (!strcmp(parmName, "Equate"))
+            {
+            MrBayesPrint ("%s   ERROR: MrBayes does not support 'Equate' macros; please remove or comment out\n", spacer);
+            return (ERROR);
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoHelp (void)
+{
+    int         i, j, longestDescription;
+    CmdType     *p;
+
+    if (foundFirst == NO)
+        {
+        longestDescription = 0;
+        for (i=1; i<NUMCOMMANDS; i++)
+            {
+            p = commands + i;
+            if ((int)strlen(p->string) > longestDescription)
+                longestDescription = (int) strlen(p->string);
+            }
+        
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Commands that are available from the command                                  \n");
+        MrBayesPrint ("   line or from a MrBayes block include:                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        for (i=1; i<NUMCOMMANDS; i++)
+            {
+            p = commands + i;
+            if (p->cmdUse == IN_CMD && p->hiding == SHOW)
+                {
+                MrBayesPrint ("   %s", p->string);
+                for (j=0; j<longestDescription - (int) strlen(p->string); j++)
+                MrBayesPrint (" ");
+                MrBayesPrint (" -- %s\n", p->cmdDescription);
+                }
+            }
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Commands that should be in a NEXUS file (data                                 \n");
+        MrBayesPrint ("   block, trees block or taxa block) include:                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        for (i=1; i<NUMCOMMANDS; i++)
+            {
+            p = commands + i;
+            if (p->cmdUse == IN_FILE && p->hiding == SHOW)
+                {
+                MrBayesPrint ("   %s", p->string);
+                for (j=0; j<longestDescription - (int) strlen(p->string); j++)
+                MrBayesPrint (" ");
+                MrBayesPrint (" -- %s\n", p->cmdDescription);
+                }
+            }
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that this program supports the use of the shortest unambiguous           \n"); 
+        MrBayesPrint ("   spelling of the above commands (e.g., \"exe\" instead of \"execute\").        \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    foundFirst = NO;
+
+    return (NO_ERROR);
+}
+
+
+int DoHelpParm (char *parmName, char *tkn)
+{
+    int         i, j, tkLen, targetLen, numDiff, numMatches;
+    CmdType     *p, *q=NULL;
+
+    if (expecting == Expecting(ALPHA))
+        {
+        p = commands + 0;
+        tkLen = (int) strlen(tkn);
+        numMatches = 0;
+        for (i=0; i<NUMCOMMANDS; i++)
+            {
+            targetLen = (int) strlen(p->string);
+            if (tkLen <= targetLen)
+                {
+                for (j=0, numDiff=0; j<tkLen; j++)
+                    {
+                    if (ChangeCase(tkn[j]) != ChangeCase(p->string[j]))
+                        numDiff++;
+                    }
+                if (numDiff == 0)
+                    {
+                    numMatches++;
+                    q = p;
+                    if (tkLen == targetLen)
+                        break;
+                    }
+                }       
+            p++;
+            }
+        if (numMatches == 0)
+            {
+            MrBayesPrint ("%s   Could not find command \"%s\"\n", spacer, tkn);
+            return (ERROR);
+            }
+        else if (numMatches == 1)
+            {
+            if (GetUserHelp (q->string) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem getting help for command \"%s\"\n", spacer, q->string);
+                }
+            }
+        else 
+            {
+            MrBayesPrint ("%s   Ambiguous command \"%s\"\n", spacer, tkn);
+            return (ERROR);
+            }
+            
+        expecting = Expecting(SEMICOLON);
+        foundFirst = YES;
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoInclude (void)
+{
+    int         i, alreadyDone;
+
+    MrBayesPrint ("%s   Including character(s)\n", spacer);
+
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* merge tempSet with excludedChars */
+    alreadyDone = NO;
+    for (i=0; i<numChar; i++)
+        {
+        if (tempSet[i] == 1)
+            {
+            if (charInfo[i].isExcluded == NO && alreadyDone == NO)  
+                {
+                MrBayesPrint ("%s   Some characters already included\n", spacer);
+                alreadyDone = YES;
+                }
+            charInfo[i].isExcluded = NO;
+            }
+        }
+
+    /* reset analysis to recompress data */
+    if (SetUpAnalysis(&globalSeed) == ERROR)
+        return ERROR;
+
+    return (NO_ERROR);
+}
+
+
+int DoIncludeParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can include characters\n", spacer);
+        return (ERROR);
+        }
+        
+    if (foundFirst == NO)
+        {
+        /* this is the first time in */
+        fromI = toJ = everyK = -1;
+        foundDash = foundSlash = NO;
+        for (i=0; i<numChar; i++) /* clear tempSet */
+            tempSet[i] = 0;
+        foundFirst = YES;
+        }
+
+    if (expecting == Expecting(ALPHA))
+        {
+        if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
+            {
+            for (i=0; i<numChar; i++)
+                tempSet[i] = 1;
+            }
+        else if (IsSame ("Missambig", tkn) == SAME || IsSame ("Missambig", tkn) == CONSISTENT_WITH)
+            {
+            for (i=0; i<numChar; i++)
+                {
+                if (charInfo[i].isMissAmbig == YES)
+                    tempSet[i] = 1;
+                }
+            }
+        else
+            {
+            /* we are using a pre-defined character set */
+            if (numCharSets < 1)
+                {
+                MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
+                {
+                MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            /* add characters from charset tkn to new tempSet */
+            for (i=0; i<numChar; i++)
+                {
+                if (IsBitSet(i, charSet[index]) == YES)
+                    tempSet[i] = 1;
+                }
+            fromI = toJ = everyK = -1;
+            }
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && tkn[0] == '.')
+            tempInt = numChar;
+        else
+            sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numChar)
+            {
+            MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+            return (ERROR);
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted include set\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else if (foundSlash == YES)
+            {
+            tempInt++;
+            if (tempInt <= 1)
+                {
+                MrBayesPrint ("%s   Improperly formatted include set\n", spacer);
+                return (ERROR);
+                }
+            if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                everyK = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted include set\n", spacer);
+                return (ERROR);
+                }
+            foundSlash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted include set\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(BACKSLASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoLog (void)
+{
+    if (logToFile == YES)
+        {
+        SafeFclose (&logFileFp);
+        if (replaceLogFile == YES)
+            {
+            if ((logFileFp = OpenTextFileW (logFileName)) == NULL)  
+                {
+                logToFile = NO;
+                return (ERROR);
+                }
+            }
+        else
+            {
+            if ((logFileFp = OpenTextFileA (logFileName)) == NULL)  
+                {
+                logToFile = NO;
+                return (ERROR);
+                }
+            }
+        MrBayesPrint ("%s   Logging screen output to file \"%s\"\n", spacer, logFileName);
+        }
+    else
+        {
+        SafeFclose (&logFileFp);
+        MrBayesPrint ("%s   Terminating log output\n", spacer);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoLogParm (char *parmName, char *tkn)
+{
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Start"))
+            {
+            if (logToFile == YES)
+                MrBayesPrint ("%s   Logging to file is already on\n", spacer, logFileName);
+            else
+                logToFile = YES;
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            }
+        else if (!strcmp(parmName, "Stop"))
+            {
+            if (logToFile == NO)
+                MrBayesPrint ("%s   Logging to file is already off\n", spacer, logFileName);
+            else
+                logToFile = NO;
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            }
+        else if (!strcmp(parmName, "Replace"))
+            {
+            replaceLogFile = YES;
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            }
+        else if (!strcmp(parmName, "Append"))
+            {
+            replaceLogFile = NO;
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            }
+        else
+            expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (logFileName, tkn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            {
+            MrBayesPrint ("%s   Unknown parameter in Log\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoManual (void)
+{
+    int     i, j, logSetting;
+    char    title[100];
+    FILE    *fp, *logfp;
+    CmdType *p;
+    
+    /* try to open file, return error if present */
+    if ((fp = OpenTextFileRQuait(manFileName)) != NULL)
+        {
+        MrBayesPrint ("%s   File \"%s\" already exists \n", spacer, manFileName);
+        SafeFclose(&fp);
+        return (ERROR);
+        }
+
+    /* try to open file for writing, return error if not possible */
+    if ((fp = OpenTextFileW(manFileName)) == NULL)
+        return (ERROR);
+
+    /* print message */
+    MrBayesPrint ("%s   Producing command reference file \"%s\"\n", spacer, manFileName);
+
+    /* temporarily disable normal logging and switch echoing off */
+    logSetting = logToFile;
+    logfp = logFileFp;
+    echoMB = NO;
+    logToFile = YES;
+    logFileFp = fp;
+    
+    /* produce command reference file */
+    /* header */
+    strcpy (title, "Command Reference for MrBayes ver. ");
+    strcat (title, VERSION_NUMBER);
+
+    i = (70 - (int) strlen (title)) / 2;
+    j = 70 - i - (int) strlen(title);
+
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("      %*c%s%*c      \n", i, ' ', title, j, ' ');
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("                   (c) John P. Huelsenbeck, Fredrik Ronquist                     \n");
+    MrBayesPrint ("                               and Maxim Teslenko                                \n");
+    MrBayesPrint ("                                                                                 \n");
+
+    /* summary */
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   ***************************************************************************   \n");
+    MrBayesPrint ("   *                                                                         *   \n");
+    MrBayesPrint ("   *  1. Command summary                                                     *   \n");
+    MrBayesPrint ("   *                                                                         *   \n");
+    MrBayesPrint ("   ***************************************************************************   \n");
+    MrBayesPrint ("                                                                                 \n");
+    foundFirst = NO;
+    if (DoHelp() == ERROR)
+        {
+        MrBayesPrint ("%s   Could not produce command reference summary\n", spacer);
+        goto errorExit;
+        }
+    
+    /* list of MrBayes commands */
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   ***************************************************************************   \n");
+    MrBayesPrint ("   *                                                                         *   \n");
+    MrBayesPrint ("   *  2. MrBayes commands                                                    *   \n");
+    MrBayesPrint ("   *                                                                         *   \n");
+    MrBayesPrint ("   ***************************************************************************   \n");
+    MrBayesPrint ("                                                                                 \n");
+    for (i=1; i<NUMCOMMANDS; i++)
+        {
+        p = commands + i;
+        if (p->cmdUse == IN_CMD && p->hiding == SHOW)
+            {
+            if (GetUserHelp(p->string)==ERROR)
+                goto errorExit;
+            }
+        }
+
+    /* list of data or tree block commands */
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   ***************************************************************************   \n");
+    MrBayesPrint ("   *                                                                         *   \n");
+    MrBayesPrint ("   *  3. 'Data' or 'tree' block commands (in #NEXUS file)                    *   \n");
+    MrBayesPrint ("   *                                                                         *   \n");
+    MrBayesPrint ("   ***************************************************************************   \n");
+    MrBayesPrint ("                                                                                 \n");
+    for (i=1; i<NUMCOMMANDS; i++)
+        {
+        p = commands + i;
+        if (p->cmdUse == IN_FILE && p->hiding == SHOW)
+            {
+            if (GetUserHelp(p->string) == ERROR)
+                goto errorExit;
+            }
+        }
+
+    /* return logging to previous setings and switch echoing on */
+    SafeFclose (&fp);
+    logToFile = logSetting;
+    logFileFp = logfp;
+    echoMB = YES;
+
+    MrBayesPrint ("%s   Successfully produced command reference file \"%s\"\n", spacer, manFileName);
+
+    return (NO_ERROR);
+
+    errorExit:
+        SafeFclose (&fp);
+        logToFile = logSetting;
+        logFileFp = logfp;
+        echoMB = YES;
+
+        return (ERROR);
+}
+
+
+int DoManualParm (char *parmName, char *tkn)
+{
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (manFileName, tkn);
+                expecting = Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            {
+            MrBayesPrint ("%s   Unknown parameter in Manual\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoMatrix (void)
+{
+    int         i, j, hasMissingAmbig;
+    
+    if (taxonCount != numTaxa)
+        {
+        MrBayesPrint ("%s   Problem with number of taxa read in (%d taxa read in, while expecting %d)\n", spacer, taxonCount, numTaxa);
+        FreeMatrix();
+        return (ERROR);
+        }
+    for (i=0; i<numTaxa; i++)
+        {
+        if (taxaInfo[i].charCount != numChar)
+            {
+            MrBayesPrint ("%s   Problem with number of characters read in (%d expected for taxon %d, %d read in)\n", spacer, numChar, i, taxaInfo[i].charCount);
+            FreeMatrix();
+            return (ERROR);
+            }
+        }
+        
+    /* find out which characters have missing or ambiguous states (one time only, so no special function) */
+    for (i=0; i<numChar; i++)
+        {
+        hasMissingAmbig = NO;
+        for (j=0; j<numTaxa; j++)
+            {
+            if (IsMissing (matrix[pos(j,i,numChar)], charInfo[i].charType) == YES)
+                hasMissingAmbig = YES;
+            if (IsAmbig (matrix[pos(j,i,numChar)], charInfo[i].charType) == YES)
+                hasMissingAmbig = YES;
+            }
+        if (hasMissingAmbig == YES)
+            charInfo[i].isMissAmbig = YES;
+        }
+
+    MrBayesPrint ("%s   Successfully read matrix\n", spacer);
+    if (matrixHasPoly == YES)
+        MrBayesPrint ("%s   Matrix contains polymorphisms, interpreted as ambiguity\n", spacer);
+    defMatrix = YES;
+    isTaxsetDef = YES;
+
+    /* add name of default partition */
+    if (AddString (&partitionNames, 0, "Default") == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding Default name to partition list\n", spacer);
+        return (ERROR);
+        }
+    numDefinedPartitions = 1;
+
+    if (numDefinedSpeciespartitions == 0)   /* the default species partition could have been added already in DoTaxLabels */
+        {
+        /* add default speciespartition name to list of valid speciespartitions */
+        if (AddString (&speciespartitionNames, 0, "Default") == ERROR)
+            {
+            MrBayesPrint ("%s   Problem adding Default speciespartition to list\n", spacer);
+            return (ERROR);
+            }
+
+        /* add default species name set */
+        AddNameSet(&speciesNameSets, 0, taxaNames, numTaxa);
+
+        /* set number of defined speciespartitions to 1 */
+        numDefinedSpeciespartitions = 1;
+        }
+        
+    if (SetPartition (0) == ERROR)
+        return ERROR;
+
+    if (SetSpeciespartition (0) == ERROR)
+        return ERROR;
+
+    if (numCurrentDivisions == 1)
+        MrBayesPrint ("%s   Setting default partition (does not divide up characters)\n", spacer);
+    else
+        MrBayesPrint ("%s   Setting default partition, dividing characters into %d parts\n", spacer, numCurrentDivisions);
+    
+    if (SetModelDefaults () == ERROR)
+        return (ERROR);
+
+    if (SetUpAnalysis (&globalSeed) == ERROR)
+        return (ERROR);
+
+    /* set default names for some output file names based on processed file */
+    strcpy (sumtParams.sumtFileName, inputFileName);
+    strcpy (sumtParams.sumtOutfile, inputFileName);
+    strcpy (sumpParams.sumpFileName, inputFileName);
+    strcpy (sumpParams.sumpOutfile, inputFileName);
+    strcpy (comptreeParams.comptOutfile, inputFileName);
+
+    if (chainParams.numRuns == 1)
+        {
+        sprintf (comptreeParams.comptFileName1, "%s.t", inputFileName);
+        sprintf (comptreeParams.comptFileName2, "%s.t", inputFileName);
+        }
+    else /* if (chainParams.numRuns > 1) */
+        {
+        sprintf (comptreeParams.comptFileName1, "%s.run1.t", inputFileName);
+        sprintf (comptreeParams.comptFileName2, "%s.run2.t", inputFileName);
+        }
+
+    if (chainParams.numRuns == 1)
+        sprintf (plotParams.plotFileName, "%s.p", inputFileName);
+    else /* if (chainParams.numRuns > 1) */
+        sprintf (plotParams.plotFileName, "%s.run1.p", inputFileName);
+
+    strcpy (chainParams.chainFileName, inputFileName);
+
+    if (chainParams.numRuns > 1)
+        MrBayesPrint ("%s   Setting output file names to \"%s.run<i>.<p|t>\"\n", spacer, chainParams.chainFileName);
+    else
+        MrBayesPrint ("%s   Setting output file names to \"%s.<p|t>\"\n", spacer, chainParams.chainFileName);
+
+#   if 0
+    for (i=0; i<numChar; i++)
+        {
+        int     j;
+        MrBayesPrint ("%4d -- ", i+1);
+        for (j=0; j<numTaxa; j++)
+            MrBayesPrint ("%2d ", matrix[pos(j,i,numChar)]);
+        MrBayesPrint ("\n");
+        }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int DoMatrixParm (char *parmName, char *tkn)
+{
+    int             i, j, charCode=0, index;
+    MrBFlt          charValue;
+
+    expecting  = Expecting(ALPHA);
+    expecting |= Expecting(QUESTIONMARK);
+    expecting |= Expecting(DASH);
+    expecting |= Expecting(NUMBER);
+    expecting |= Expecting(ASTERISK);
+    expecting |= Expecting(EXCLAMATIONMARK);
+    expecting |= Expecting(PERCENT);
+    expecting |= Expecting(WEIRD);
+    expecting |= Expecting(VERTICALBAR);
+    expecting |= Expecting(SEMICOLON);
+    expecting |= Expecting(LEFTPAR);
+    expecting |= Expecting(RIGHTPAR);
+    expecting |= Expecting(LEFTCURL);
+    expecting |= Expecting(RIGHTCURL);
+
+    if (defTaxa == NO || defChars == NO)
+        {
+        MrBayesPrint ("%s   Number of taxa and characters needs to be defined before matrix is read\n", spacer);
+        goto errorExit;
+        }
+    if (inDataBlock == NO && inCharactersBlock == NO)
+        {
+        MrBayesPrint ("%s   Must be in data or characters block to read in character matrix\n", spacer);
+        goto errorExit;
+        }
+
+    if (isFirstMatrixRead == YES)
+        {
+        foundNewLine = YES;
+        isFirstInterleavedBlock = YES;
+        taxonCount = 0;
+        isNegative = NO;
+        }
+    isFirstMatrixRead = NO;
+    
+    /* allow line breaks in non-interleaved matrices */
+    if (isInterleaved == NO)
+        {
+        if (foundNewLine == YES && taxonCount > 0)
+            {
+            if (taxaInfo[taxonCount-1].charCount < numChar)
+                foundNewLine = NO;
+            }
+        }
+
+    if (taxonCount >= numTaxa && foundNewLine == YES)
+        {
+        if (isInterleaved == YES)
+            {
+            taxonCount = 0;
+            isFirstInterleavedBlock = NO;
+            }
+        else
+            {
+            MrBayesPrint ("%s   Too many taxa in matrix\n", spacer);
+            goto errorExit;
+            }
+        }
+    
+    if (taxaInfo[0].charCount > 4010)
+        i = 1;
+
+    if (foundNewLine == YES)
+        {
+        /* Should be a taxon. */
+        if (isFirstInterleavedBlock == YES)
+            {
+            /* If this is the first interleaved block, then we need to add the taxon
+               to the set of taxon names unless there is already a defined taxon set. */
+            if (strlen(tkn)>99)
+                {
+                MrBayesPrint ("%s   Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, tkn);
+                goto errorExit;
+                }
+            if (isTaxsetDef == NO && AddString (&taxaNames, taxonCount, tkn) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem adding taxon %s to taxon set\n", spacer, tkn);
+                goto errorExit;
+                }
+            if (numTaxa < 10)
+                MrBayesPrint ("%s   Taxon %d -> %s\n", spacer, taxonCount+1, tkn);
+            else if (numTaxa < 100 && numTaxa >= 10)
+                MrBayesPrint ("%s   Taxon %2d -> %s\n", spacer, taxonCount+1, tkn);
+            else if (numTaxa < 1000 && numTaxa >= 100)
+                MrBayesPrint ("%s   Taxon %3d -> %s\n", spacer, taxonCount+1, tkn);
+            else
+                MrBayesPrint ("%s   Taxon %4d -> %s\n", spacer, taxonCount+1, tkn);
+            }
+        else
+            {
+            /* If this is not the first interleaved block, then we need to
+               check to see if taxon name is present and in correct place. */
+            if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                {
+                MrBayesPrint ("%s   Could not find taxon %s in list of taxa\n", spacer, tkn);
+                goto errorExit;
+                }
+            if (index != taxonCount)
+                {
+                MrBayesPrint ("%s   Could not find taxon %s in correct position in list of taxa\n", spacer, tkn);
+                goto errorExit;
+                }
+            }
+        foundNewLine = NO;
+        isNegative = NO;
+        taxonCount++;
+        }
+    else
+        {
+        /* Should be a character (either continuous or otherwise). */
+        if (charInfo[taxaInfo[taxonCount-1].charCount].charType == CONTINUOUS)
+            {
+            /* If we have a CONTINUOUS character, then the entire token should either be
+               a number or a dash (for a negative sign). */
+            if (!strcmp(tkn, "-"))
+                {
+                /* Dealing with a negative number. We will multiply the next tkn, which
+                   had better be a number, by -1. */
+                isNegative = YES;
+                }
+            else
+                {
+                /* We have a number, we hope. */
+                if (tkn[0] == matchId)
+                    {
+                    /* If the token is a matchchar, then things are simple. */
+                    if (taxonCount == 1)
+                        {
+                        MrBayesPrint ("%s   Matching characters cannot be in first taxon\n", spacer);
+                        goto errorExit;
+                        }
+                    charCode = matrix[pos(0,taxaInfo[taxonCount-1].charCount,numChar)];
+                    matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount,numChar)] = charCode;
+                    }
+                else
+                    {
+                    /* Otherwise, we have a number. Check that it is a valid number first... */
+                    if (!IsIn(tkn[0],"0123456789."))
+                        {
+                        MrBayesPrint ("%s   Expecting a number for the continuous character\n", spacer);
+                        goto errorExit;
+                        }
+                    /* ... and then put the character into the matrix. Note that matrix
+                       is defined as an integer, but we may have floating precision continuous
+                       characters. To get around this, we multiply the value of the character
+                       by 1000 before putting it into matrix. We will divide by 1000 later on
+                       when/if we use the characters. */
+                    sscanf (tkn, "%lf", &charValue);
+                    charValue *= 1000.0;
+                    if (isNegative == YES)
+                        {
+                        charValue *= -1.0;
+                        isNegative = NO;
+                        }
+                    /*MrBayesPrint ("%d \n", (int)charValue);*/
+                    matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = (int)charValue;
+                    }
+                }
+            }
+        else
+            {
+            /* Otherwise, we are dealing with a run-of-the-mill character, and we
+               cannot expect the entire token to contain only a single character. We
+               must, therefore, go through the token character-by-character. */
+            i = 0;
+            while (tkn[i] != '\0')
+                {
+                /*MrBayesPrint ("%c", tkn[i]);*/
+                if (tkn[i] == matchId)
+                    {
+                    if (taxonCount == 1)
+                        {
+                        MrBayesPrint ("%s   Matching characters cannot be in first taxon\n", spacer);
+                        goto errorExit;
+                        }
+                    charCode = matrix[pos(0,taxaInfo[taxonCount-1].charCount,numChar)];
+                    matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode;
+                    }
+                else
+                    {
+                    if ((tkn[i] == ')' && isInAmbig == YES) || (tkn[i] == '}' && isInPoly == YES))
+                        {
+                        isInAmbig = isInPoly = NO;
+                        charCode = theAmbigChar;
+                        j = CharacterNumber (charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType);
+                        if (j > charInfo[taxaInfo[taxonCount-1].charCount].numStates)
+                            charInfo[taxaInfo[taxonCount-1].charCount].numStates = j;
+                        matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode;
+                        theAmbigChar = 0;
+                        }
+                    else if ((tkn[i] == '(' && isInAmbig == YES) || (tkn[i] == '{' && isInPoly == YES))
+                        {
+                        if (isInAmbig == YES)
+                            MrBayesPrint ("%s   Found an inappropriate \"(\"\n", spacer);
+                        else
+                            MrBayesPrint ("%s   Found an inappropriate \"{\"\n", spacer);
+                        goto errorExit;
+                        }
+                    else if (isInAmbig == YES || isInPoly == YES)
+                        {
+                        if (tkn[i] == ',')
+                            expecting |= Expecting (COMMA);
+                        else 
+                            {
+                            if (CharacterCode(tkn[i], &charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType) == ERROR)
+                                goto errorExit;
+                            if (charCode == MISSING || charCode == GAP)
+                                goto errorExit;
+                            theAmbigChar |= charCode;
+                            expecting ^= Expecting (COMMA);
+                            }
+                        }
+                    else if (tkn[i] == '{' && isInPoly == NO && isInAmbig == NO)
+                        {
+                        isInPoly = YES;
+                        matrixHasPoly = YES;
+                        theAmbigChar = 0;
+                        }   
+                    else if (tkn[i] == '(' && isInPoly == NO && isInAmbig == NO)
+                        {
+                        isInAmbig = YES;
+                        theAmbigChar = 0;
+                        }
+                    else if (tkn[i] == '(' && isInPoly == NO && isInAmbig == NO)
+                        {
+                        isInAmbig = YES;
+                        theAmbigChar = 0;
+                        }
+                    else
+                        {
+                        if (CharacterCode(tkn[i], &charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Error while reading character position %d (charCode %d)\n", spacer, taxaInfo[taxonCount-1].charCount+1, charCode);
+                            goto errorExit;
+                            }
+                        if (charCode != MISSING && charCode != GAP)
+                            {
+                            j = CharacterNumber (charCode, charInfo[taxaInfo[taxonCount-1].charCount].charType);
+                            if (j > charInfo[taxaInfo[taxonCount-1].charCount].numStates)
+                                charInfo[taxaInfo[taxonCount-1].charCount].numStates = j;
+                            }
+                        matrix[pos(taxonCount-1,taxaInfo[taxonCount-1].charCount++,numChar)] = charCode;
+                        }
+                    }
+                i++; 
+                }
+            }
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+    errorExit:
+        numTaxa=taxonCount;
+        FreeMatrix();
+        return (ERROR);
+}
+
+
+int DoNexusParm (char *parmName, char *tkn)
+{
+    if (!strcmp(parmName, "NEXUS"))
+        {
+        MrBayesPrint ("%s   Expecting NEXUS formatted file\n", spacer);
+        expecting = Expecting(COMMAND);
+        }
+    else
+        {
+        MrBayesPrint ("%s   Found %s\n", spacer, tkn);
+        return (ERROR);
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int DoOutgroup (void)
+{
+    MrBayesPrint ("%s   Setting outgroup to taxon \"%s\"\n", spacer, taxaNames[outGroupNum]);
+    return (NO_ERROR);
+}
+
+
+int DoOutgroupParm (char *parmName, char *tkn)
+{
+    int     index, tempInt;
+
+    if (expecting == Expecting(ALPHA))
+        {
+        if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+            {
+            MrBayesPrint ("%s   Could not find taxon %s in list of taxa\n", spacer, tkn);
+            return (ERROR);
+            }
+        outGroupNum = index;
+        
+        expecting = Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+            {
+            /* OK, as we expect, the taxon is not a digit. So, now we assume that
+               the user is assigning the outgroup by its number */
+            sscanf (tkn, "%d", &tempInt);
+            if (tempInt < 1 || tempInt > numTaxa)
+                {
+                MrBayesPrint ("%s   Taxon number %d is out of range\n", spacer, tempInt);
+                return (ERROR);
+                }
+            outGroupNum = tempInt - 1;
+            }
+        else
+            {
+            outGroupNum = index;
+            }
+        
+        expecting = Expecting(SEMICOLON);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoPairs (void)
+{
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   Successfully defined character pairings\n", spacer);
+
+    defPairs = YES;
+    foundFirst = NO;
+    
+    return (NO_ERROR);
+}
+
+
+int DoPairsParm (char *parmName, char *tkn)
+{
+    int     i, tempInt;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can define pairs of characters\n", spacer);
+        return (ERROR);
+        }
+    
+    if (defPairs == YES)
+        {
+        MrBayesPrint ("%s   Character pairs have been previously defined \n", spacer);
+        MrBayesPrint ("%s   Now overwriting old pairings\n", spacer);
+        for (i=0; i<numChar; i++)
+            charInfo[i].pairsId = 0;
+        defPairs = NO;
+        }
+        
+    if (foundFirst == NO)
+        {
+        /* this is the first time in */
+        pairId = 1;
+        firstPair = YES;
+        foundFirst = YES;
+        MrBayesPrint ("%s   Defining character pairings:\n\n", spacer);
+        MrBayesPrint ("%s      Pair --  First Second \n", spacer);
+        }
+
+    if (expecting == Expecting(NUMBER))
+        {
+        sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numChar)
+            {
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+            for (i=0; i<numChar; i++)
+                charInfo[i].pairsId = 0;
+            return (ERROR);
+            }
+        tempInt--;
+        
+        if (charInfo[tempInt].pairsId != 0)
+            {
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   Character number %d has already been included in a pairing\n", spacer, tempInt+1);
+            for (i=0; i<numChar; i++)
+                charInfo[i].pairsId = 0;
+            return (ERROR);
+            }
+        if (charInfo[tempInt].charType != DNA && charInfo[tempInt].charType != RNA)
+            {
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s  Pairings may only include nucleotide data\n", spacer);
+            if (charInfo[tempInt].charType == PROTEIN)
+                MrBayesPrint ("%s  Character %d is an amino acid character\n", spacer, tempInt+1);
+            else if (charInfo[tempInt].charType == RESTRICTION)
+                MrBayesPrint ("%s  Character %d is a restriction site character\n", spacer, tempInt+1);
+            else if (charInfo[tempInt].charType == STANDARD)
+                MrBayesPrint ("%s  Character %d is a \"standard\" character\n", spacer, tempInt+1);
+            else if (charInfo[tempInt].charType == CONTINUOUS)
+                MrBayesPrint ("%s  Character %d is a continuously varying character\n", spacer, tempInt+1);
+            for (i=0; i<numChar; i++)
+                charInfo[i].pairsId = 0;
+            return (ERROR);
+            }
+            
+        charInfo[tempInt].pairsId = pairId;
+        
+        if (firstPair == YES)
+            {
+            MrBayesPrint ("%s      %4d --  %5d  ", spacer, pairId, tempInt+1);
+            expecting  = Expecting(COLON);
+            firstPair = NO;
+            }
+        else
+            {
+            MrBayesPrint ("%5d\n", tempInt+1);
+            expecting  = (Expecting(COMMA) | Expecting(SEMICOLON));
+            firstPair = YES;
+            }
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        pairId++;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        expecting = Expecting(NUMBER);
+        }
+    else
+        {
+        for (i=0; i<numChar; i++)
+            charInfo[i].pairsId = 0;
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoPartition (void)
+{
+    int     i, *partTypes;
+        
+    /* add set to tempSet */
+    if (fromI >= 0)
+        if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+            return (ERROR);
+
+    /* check that all characters are included */
+    for (i=0; i<numChar; i++)
+        {
+        /* MrBayesPrint ("%4d %4d \n", i, tempSet[i]); */
+        if (tempSet[i] == 0)
+            {
+            MrBayesPrint ("%s   Character %d not included in partition\n", spacer, i+1);
+            return (ERROR);
+            }
+        }
+
+            
+    /* check how many partitions were found against how many were expected */
+    if (whichPartition != numDivisions - 1)
+        {
+        MrBayesPrint ("%s   Did not find correct number of partitions (expecting %d, found %d)\n", spacer, numDivisions, whichPartition + 1);
+        return (ERROR);
+        }
+
+    partTypes = (int *) SafeCalloc (numDivisions, sizeof(int));
+    if (!partTypes)
+        return ERROR;
+    
+    /* make certain that the partition labels go from 1 - numDivisions, inclusive */
+    for (i=0; i<numChar; i++)
+        partTypes[tempSet[i] - 1] = -1; //partTypes is temporary used here not as an indicator of partition type 
+    for (i=0; i<numDivisions; i++)
+        {
+        if (partTypes[i] == 0)
+            {
+            MrBayesPrint ("%s   Could not find a single character for division %d\n", spacer, i+1);
+            return (ERROR);
+            }
+        }
+
+    /* check if partition overruns data types */
+    for (i=0; i<numChar; i++)
+        {
+        if (partTypes[ tempSet[i]-1 ] == -1)
+            partTypes[ tempSet[i]-1 ] = charInfo[i].charType;
+        else
+            {
+            if (partTypes[ tempSet[i]-1 ] != charInfo[i].charType)
+                {
+                MrBayesPrint ("%s   There are two different data types for partition division %d\n", spacer, tempSet[i]);
+                free (partTypes);
+                return (ERROR);
+                }
+            }
+        }
+    free (partTypes);
+
+    /* add name to list of valid partitions */
+    if (AddString (&partitionNames, numDefinedPartitions, tempSetName) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding partition %s to list\n", spacer, tempSetName);
+        return (ERROR);
+        }
+        
+    /* add new partition */
+    for (i=0; i<numChar; i++) {
+        partitionId[i] = (int *) SafeRealloc ((void *)(partitionId[i]), ((size_t)numDefinedPartitions + 1) * sizeof(int));
+        if (!partitionId[i])
+            return ERROR;
+    }
+
+    /* set new partition */
+    for (i=0; i<numChar; i++)
+        partitionId[i][numDefinedPartitions] = tempSet[i];
+
+    /* increment number of defined partitions */
+    numDefinedPartitions++;
+    
+    return (NO_ERROR);
+}
+
+
+int DoPartitionParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before partitions can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        /* set Partition () ******************************************************************/
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* check size of partition name */
+            if (strlen(tkn) > 99)
+                {
+                MrBayesPrint ("%s   Partition name is too long. Max 100 characters\n", spacer);
+                return (ERROR);
+                }
+                
+            /* check to see if the name has already been used as a partition */
+            if (numDefinedPartitions > 1)
+                {
+                if (CheckString (partitionNames, numDefinedPartitions, tkn, &index) == ERROR)
+                    {
+                    /* if the partition name has not been used, then we should have an ERROR returned */
+                    /* we _want_ to be here */
+
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Partition name '%s' has been used previously\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                }
+                
+            /* add the name temporarily to tempSetName */
+            strcpy (tempSetName, tkn);
+            
+            /* clear tempSet */
+            for (i=0; i<numChar; i++)
+                tempSet[i] = 0;
+            
+            fromI = toJ = everyK = -1;
+            foundDash = foundSlash = NO;
+            whichPartition = 0;
+            foundFirst = NO;
+            numDivisions = 0;
+            MrBayesPrint ("%s   Defining partition called '%s'\n", spacer, tkn);
+            expecting = Expecting(EQUALSIGN);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        /* We are defining a partition in terms of a character set (called tkn, here). We should be able
+           to find tkn in the list of character set names. If we cannot, then we have a problem and
+           return an error. */
+        if (numCharSets < 1)
+            {
+            MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+            return (ERROR);
+            }
+        if (CheckString (charSetNames, numCharSets, tkn, &index) == ERROR)
+            {
+            MrBayesPrint ("%s   Could not find a character set called '%s'\n", spacer, tkn);
+            return (ERROR);
+            }
+        /* add characters from charset tkn to new tempSet */
+        for (i=0; i<numChar; i++)
+            {
+            if (IsBitSet (i, charSet[index]) == YES)
+                tempSet[i] = whichPartition + 1;
+            }
+        fromI = toJ = everyK = -1;
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(COMMA);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (foundFirst == NO)
+            {
+            sscanf (tkn, "%d", &tempInt);
+            numDivisions = tempInt;
+            expecting  = Expecting(COLON);
+            foundFirst = YES;
+            }
+        else
+            {
+            if (strlen(tkn) == 1 && tkn[0] == '.')
+                tempInt = numChar;
+            else
+                sscanf (tkn, "%d", &tempInt);
+            if (tempInt <= 0 || tempInt > numChar)
+                {
+                MrBayesPrint ("%s   Character number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numChar);
+                return (ERROR);
+                }
+            tempInt--;
+            if (foundDash == YES)
+                {
+                if (fromI >= 0)
+                    toJ = tempInt;
+                else
+                    {
+                    MrBayesPrint ("%s   Improperly formatted partition\n", spacer);
+                    return (ERROR);
+                    }
+                foundDash = NO;
+                }
+            else if (foundSlash == YES)
+                {
+                tempInt++;
+                if (tempInt <= 1)
+                    {
+                    MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                    return (ERROR);
+                    }
+                if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                    everyK = tempInt;
+                else
+                    {
+                    MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                    return (ERROR);
+                    }
+                foundSlash = NO;
+                }
+            else
+                {
+                if (fromI >= 0 && toJ < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                        return (ERROR);
+                    fromI = tempInt;
+                    }
+                else if (fromI < 0 && toJ < 0)
+                    {
+                    fromI = tempInt;
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                        return (ERROR);
+                    fromI = tempInt;
+                    toJ = everyK = -1;
+                    }
+                else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                        return (ERROR);
+                    fromI = tempInt;
+                    toJ = everyK = -1;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Improperly formatted charset\n", spacer);
+                        {
+                        return (ERROR);
+                        }
+                    }
+                }
+            
+            expecting  = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(SEMICOLON);
+            expecting |= Expecting(DASH);
+            expecting |= Expecting(BACKSLASH);
+            expecting |= Expecting(COMMA);
+            }
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        /* add set to tempSet */
+        if (fromI >= 0)
+            if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                return (ERROR);
+
+        fromI = toJ = everyK = -1;
+        foundDash = foundSlash = NO;
+        whichPartition++;
+        if (whichPartition > numDivisions)
+            {
+            MrBayesPrint ("%s   Too many partitions of the data (expecting %d)\n", spacer, numDivisions);
+            return (ERROR);
+            }
+        expecting  = Expecting(NUMBER);
+        expecting |= Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        expecting  = Expecting(NUMBER);
+        expecting |= Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoRestore (void)
+{
+    int         i, alreadyDone;
+
+    MrBayesPrint ("%s   Restore taxa\n", spacer);
+
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* merge tempSet with excludedTaxa */
+    alreadyDone = NO;
+    for (i=0; i<numTaxa; i++)
+        {
+        if (tempSet[i] == 1)
+            {
+            if (taxaInfo[i].isDeleted == NO && alreadyDone == NO)
+                {
+                MrBayesPrint ("%s   Some taxa already included\n", spacer);
+                alreadyDone = YES;
+                }
+            taxaInfo[i].isDeleted = NO;
+            }
+        }
+
+    SetLocalTaxa();
+    if (SetUpAnalysis(&globalSeed) == ERROR)
+        return ERROR;
+
+    /* show tempSet (for debugging) */
+#   if 0
+    for (i=0; i<numTaxa; i++)
+        MrBayesPrint ("%4d  %4d\n", i+1, tempSet[i]);
+#   endif
+        
+    return (NO_ERROR);
+}
+
+
+int DoRestoreParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+        
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before you can restore taxa\n", spacer);
+        return (ERROR);
+        }
+        
+    if (foundFirst == NO)
+        {
+        /* this is the first time in */
+        fromI = toJ = everyK = -1;
+        foundDash = NO;
+        for (i=0; i<numTaxa; i++) /* clear tempSet */
+            tempSet[i] = 0;
+        foundFirst = YES;
+        }
+
+    if (expecting == Expecting(ALPHA))
+        {
+        if (IsSame ("All", tkn) == SAME || IsSame ("All", tkn) == CONSISTENT_WITH)
+            {
+            for (i=0; i<numTaxa; i++)
+                tempSet[i] = 1;
+            }
+        else
+            {
+            if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                {
+                /* we are using a pre-defined taxa set */
+                if (numTaxaSets < 1)
+                    {
+                    MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                /* add taxa from taxset tkn to new tempSet */
+                for (i=0; i<numTaxa; i++)
+                    {
+                    if (IsBitSet (i, taxaSet[index]) == YES)
+                        tempSet[i] = 1;
+                    }
+                }
+            else
+                {
+                /* we found the taxon name */
+                if (fromI >= 0 && toJ < 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                        return (ERROR);
+                    }
+                else if (fromI >= 0 && toJ >= 0)
+                    {
+                    if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                        return (ERROR);
+                    }
+                tempSet[index] = 1;
+                }
+            fromI = toJ = everyK = -1;
+            }
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && !strcmp(tkn, "."))
+            {
+            tempInt = numTaxa;
+            }
+        else
+            {
+            sscanf (tkn, "%d", &tempInt);
+            if (tempInt <= 0 || tempInt > numTaxa)
+                {
+                MrBayesPrint ("%s   Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
+                return (ERROR);
+                }
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted restore set\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted restore set\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoSet (void)
+{
+    return (NO_ERROR);
+}
+
+
+int DoSetParm (char *parmName, char *tkn)
+{
+    int         index;
+    char        tempStr[100];
+    int         tempI;
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Autoclose (autoClose) **********************************************************/
+        if (!strcmp(parmName, "Autoclose"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        autoClose = YES;
+                    else
+                        autoClose = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for autoclose\n", spacer);
+                    return (ERROR);
+                    }
+                if (autoClose == YES)
+                    MrBayesPrint ("%s   Setting autoclose to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting autoclose to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Nowarnings (noWarn) **********************************************************/
+        else if (!strcmp(parmName, "Nowarnings"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        noWarn = YES;
+                    else
+                        noWarn = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for nowarnings\n", spacer);
+                    return (ERROR);
+                    }
+                if (noWarn == YES)
+                    MrBayesPrint ("%s   Setting nowarnings to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting nowarnings to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Quitonerror (quitOnError) **************************************************/
+        else if (!strcmp(parmName, "Quitonerror"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        quitOnError = YES;
+                    else
+                        quitOnError = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for quitonerror\n", spacer);
+                    return (ERROR);
+                    }
+                if (quitOnError == YES)
+                    MrBayesPrint ("%s   Setting quitonerror to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting quitonerror to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Autoreplace (autoOverwrite) **************************************************/
+        else if (!strcmp(parmName, "Autoreplace"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        {
+                        autoOverwrite = YES;
+                        MrBayesPrint ("%s   Setting autoreplace to yes\n", spacer);
+                        }
+                    else
+                        {
+                        autoOverwrite = NO;
+                        MrBayesPrint ("%s   Setting autoreplace to no\n", spacer);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for autoreplace\n", spacer);
+                    return (ERROR);
+                    }                   
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }           
+        /* set Scientific (scientific) *********************************************/
+        else if (!strcmp(parmName, "Scientific"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        scientific = YES;
+                    else
+                        scientific = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Scientific\n", spacer);
+                    return (ERROR);
+                    }
+                if (scientific == YES)
+                    MrBayesPrint ("%s   Setting Scientific to Yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting Scientific to No\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Userlevel (userLevel) **********************************************************/
+        else if (!strcmp(parmName, "Userlevel"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Standard"))
+                        userLevel = STANDARD_USER;
+                    else if (!strcmp (tempStr,"Developer"))
+                        userLevel = DEVELOPER;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for userlevel\n", spacer);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Setting userlevel to %s\n", spacer, tempStr);
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Npthreads (number of pthreads) ****************************************************/
+        else if (!strcmp(parmName, "Npthreads"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                nPThreads = tempI;
+                MrBayesPrint ("%s   Setting Npthreads to %d\n", spacer, nPThreads);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                return (ERROR);
+            }
+        /* set Precision (number of decimals) ****************************************************/
+        else if (!strcmp(parmName, "Precision"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 3 || tempI > 15)
+                    {
+                    MrBayesPrint ("%s   Precision must be in the range 3 to 15\n", spacer);
+                    return ERROR;
+                    }
+                precision = tempI;
+                MrBayesPrint ("%s   Setting Precision to %d\n", spacer, precision);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                return (ERROR);
+            }
+        /* set Partition (partitionNum) *******************************************************/
+        else if (!strcmp(parmName, "Partition"))
+            {
+            if (defMatrix == NO)
+                {
+                MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+                return (ERROR);
+                }
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA) | Expecting(NUMBER);
+            else if (expecting == Expecting(ALPHA))
+                {
+                /* first check to see if name is there */
+                if (CheckString (partitionNames, numDefinedPartitions, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find \"%s\" as a defined partition\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                if (SetPartition (index) == ERROR)
+                    return ERROR;
+                if (numCurrentDivisions == 1)
+                    MrBayesPrint ("%s   Setting %s as the partition (does not divide up characters).\n", spacer, tkn); 
+                else
+                    MrBayesPrint ("%s   Setting %s as the partition, dividing characters into %d parts.\n", spacer, tkn, numCurrentDivisions); 
+                if (SetModelDefaults () == ERROR)
+                    return (ERROR);
+                if (SetUpAnalysis (&globalSeed) == ERROR)
+                    return (ERROR);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &index);
+                if (index > numDefinedPartitions) 
+                    {
+                    MrBayesPrint ("%s   Partition number %d is not a valid partition. Only %d partitions\n", spacer, index, numDefinedPartitions);
+                    MrBayesPrint ("%s   have been defined.\n", spacer);
+                    return (ERROR);
+                    }
+                if (index < 1)
+                    {
+                    MrBayesPrint ("%s   Partition number %d is not a valid partition. Must be between 1 and %d.\n", spacer, index+1, numDefinedPartitions);
+                    return (ERROR);
+                    }
+                if (SetPartition (index) == ERROR)
+                    return ERROR;
+                if (numCurrentDivisions == 1)
+                    MrBayesPrint ("%s   Setting %s as the partition (does not divide up characters).\n", spacer, partitionNames[index]);
+                else
+                    MrBayesPrint ("%s   Setting %s as the partition, dividing characters into %d parts.\n", spacer, partitionNames[index], numCurrentDivisions);
+                if (SetModelDefaults () == ERROR)
+                    return (ERROR);
+                if (SetUpAnalysis (&globalSeed) == ERROR)
+                    return (ERROR);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Speciespartition (speciespartitionNum) *******************************************************/
+        else if (!strcmp(parmName, "Speciespartition"))
+            {
+            if (defTaxa == NO)
+                {
+                MrBayesPrint ("%s   A taxaset must be defined first\n", spacer);
+                return (ERROR);
+                }
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA) | Expecting(NUMBER);
+            else if (expecting == Expecting(ALPHA))
+                {
+                /* first check to see if name is there */
+                if (CheckString (speciespartitionNames, numDefinedSpeciespartitions, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find \"%s\" as a defined speciespartition\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                if (SetSpeciespartition (index) == ERROR)
+                    return ERROR;
+                MrBayesPrint ("%s   Setting %s as the speciespartition, dividing taxa into %d species.\n", spacer, tkn, numSpecies);
+                if (SetModelDefaults () == ERROR)
+                    return (ERROR);
+                if (SetUpAnalysis (&globalSeed) == ERROR)
+                    return (ERROR);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &index);
+                if (index > numDefinedSpeciespartitions) 
+                    {
+                    MrBayesPrint ("%s   Speciespartition number %d is not valid. Only %d speciespartitions\n", spacer, index, numDefinedSpeciespartitions);
+                    MrBayesPrint ("%s   have been defined.\n", spacer);
+                    return (ERROR);
+                    }
+                if (index < 1)
+                    {
+                    MrBayesPrint ("%s   Speciespartition number %d is not valid. Must be between 1 and %d.\n", spacer, index, numDefinedSpeciespartitions);
+                    return (ERROR);
+                    }
+                if (SetSpeciespartition (index-1) == ERROR)
+                    return ERROR;
+                MrBayesPrint ("%s   Setting %s as the speciespartition, dividing taxa into %d species.\n", spacer, speciespartitionNames[index-1], numSpecies);
+                if (SetModelDefaults () == ERROR)
+                    return (ERROR);
+                if (SetUpAnalysis (&globalSeed) == ERROR)
+                    return (ERROR);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Seed (global variable globalSeed) ****************************************************/
+        else if (!strcmp(parmName, "Seed"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI == 0 || tempI == 2147483647)
+                    {
+                    MrBayesPrint ("%s   Error: Seed can be any natural number except 0 and 2147483647\n", spacer);
+                    return (ERROR);
+                    }
+                globalSeed = tempI;
+                MrBayesPrint ("%s   Setting seed to %ld\n", spacer, globalSeed);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                return (ERROR);
+            }
+        /* set Swapseed (global variable swapSeed) ***************************************************************/
+        else if (!strcmp(parmName, "Swapseed"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI == 0 || tempI == 2147483647)
+                    {
+                    MrBayesPrint ("%s   Error: Swapseed can be any natural number except 0 and 2147483647\n", spacer);
+                    return (ERROR);
+                    }
+                swapSeed = tempI;
+                MrBayesPrint ("%s   Setting swapseed to %ld\n", spacer, swapSeed);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Dir (global variable workingDir) ***************************************************************/
+        else if (!strcmp(parmName, "Dir"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (strlen(tkn)>99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of working directory name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+                    MrBayesPrint ("%s   has %d characters.\n", spacer,strlen(tkn));
+                    return (ERROR);
+                    }
+                strcpy (workingDir, tkn);
+#   if defined (WIN_VERSION)
+                /* Reformat to Windows with trailing '\' */
+                for (index=0; index<(int)strlen(workingDir); index++)
+                    {
+                    if (workingDir[index] == '/')
+                        workingDir[index] = '\\';
+                    }
+                if (strlen(workingDir) > 0 && workingDir[strlen(workingDir)-1] != '\\')
+                    strcat(workingDir,"\\");
+#   else
+                /* Reformat to Unix with trailing '/' */
+                for (index=0; index<(int)strlen(workingDir); index++)
+                    {
+                    if (workingDir[index] == '\\')
+                        workingDir[index] = '/';
+                    }
+                if (strlen(workingDir) > 0 && workingDir[strlen(workingDir)-1] != '/')
+                    strcat(workingDir,"/");
+#   endif
+                MrBayesPrint ("%s   Setting working directory to \"%s\"\n", spacer, workingDir);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Usebeagle (global variable BEAGLE usage) ***************************************************************/    
+        else if (!strcmp(parmName, "Usebeagle"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        tryToUseBEAGLE = YES;
+                    else
+                        tryToUseBEAGLE = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for usebeagle\n", spacer);
+                    return (ERROR);
+                    }
+                if (tryToUseBEAGLE == YES)
+                    MrBayesPrint ("%s   Setting usebeagle to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting usebeagle to no\n", spacer);
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Beagle resource number (global variable BEAGLE flag) ****************************************/
+        else if (!strcmp(parmName, "Beagleresource"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting =  Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+#   if defined (BEAGLE_ENABLED)
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 0)
+                    {
+                    MrBayesPrint ("%s   Beagleresource must be a valid resource number or 99 to disable resource selection\n", spacer);
+                    return ERROR;
+                    }
+                beagleResourceNumber = tempI;
+                if (beagleResourceNumber == 99)
+                    MrBayesPrint ("%s   Setting Beagleresource to %d (auto)\n", spacer, beagleResourceNumber);
+                else
+                    MrBayesPrint ("%s   Setting Beagleresource to %d\n", spacer, beagleResourceNumber);
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Beagle resources requirements (global variable BEAGLE flag) ****************************************/
+        else if (!strcmp(parmName, "Beagledevice"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    long oldFlags = beagleFlags;
+                    if (!strcmp(tempStr, "Gpu"))
+                        {
+                        beagleFlags &= ~BEAGLE_FLAG_PROCESSOR_CPU;
+                        beagleFlags |= BEAGLE_FLAG_PROCESSOR_GPU;
+                        BeagleAddGPUDevicesToList(&beagleResource, &beagleResourceCount);                       
+                        }
+                    else
+                        {  
+                        beagleFlags &= ~BEAGLE_FLAG_PROCESSOR_GPU;
+                        beagleFlags |= BEAGLE_FLAG_PROCESSOR_CPU;
+                        BeagleRemoveGPUDevicesFromList(&beagleResource, &beagleResourceCount);
+                        }
+                    if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
+                        beagleFlags = oldFlags;
+                        }
+                    else {
+                        if (beagleFlags & BEAGLE_FLAG_PROCESSOR_GPU)
+                            MrBayesPrint ("%s   Setting beagledevice to GPU\n", spacer);
+                        else
+                            MrBayesPrint ("%s   Setting beagledevice to CPU\n", spacer);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beagledevice\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else if (!strcmp(parmName, "Beagleprecision"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    long oldFlags = beagleFlags;
+                    if (!strcmp(tempStr, "Single"))
+                        {
+                        beagleFlags &= ~BEAGLE_FLAG_PRECISION_DOUBLE;
+                        beagleFlags |= BEAGLE_FLAG_PRECISION_SINGLE;                       
+                        }
+                    else
+                        {
+                        beagleFlags &= ~BEAGLE_FLAG_PRECISION_SINGLE;
+                        beagleFlags |= BEAGLE_FLAG_PRECISION_DOUBLE;
+                        }
+                    if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
+                        beagleFlags = oldFlags;
+                        }
+                    else {
+                        if (beagleFlags & BEAGLE_FLAG_PRECISION_DOUBLE)
+                            MrBayesPrint ("%s   Setting beagleprecision to double\n", spacer);
+                        else
+                            MrBayesPrint ("%s   Setting beagleprecision to single\n", spacer);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beagleprecision\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else if (!strcmp(parmName, "Beagleopenmp"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    long oldFlags = beagleFlags;
+                    if (!strcmp(tempStr, "Yes"))
+                        {
+                        beagleFlags |= BEAGLE_FLAG_THREADING_OPENMP;
+                        }
+                    else
+                        {
+                        beagleFlags &= ~BEAGLE_FLAG_THREADING_OPENMP;                       
+                        }
+                    if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
+                        beagleFlags = oldFlags;
+                        }
+                    else {
+                        if (beagleFlags & BEAGLE_FLAG_THREADING_OPENMP)
+                            MrBayesPrint ("%s   Setting beagleopenmp to Yes\n", spacer);
+                        else
+                            MrBayesPrint ("%s   Setting beagleopenmp to No\n", spacer);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beagleopenmp\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else if (!strcmp(parmName, "Beaglefreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+#   if defined (BEAGLE_ENABLED)
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 0)
+                    {
+                    MrBayesPrint ("%s   Beaglefreq must be greater than 0\n", spacer);
+                    return ERROR;
+                    }
+                beagleScalingFrequency= tempI;
+                MrBayesPrint ("%s   Setting Beaglefreq to %d\n", spacer, beagleScalingFrequency);
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                return (ERROR);
+            }        
+        else if (!strcmp(parmName, "Beaglesse"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    long oldFlags = beagleFlags;
+                    if (!strcmp(tempStr, "Yes"))
+                        {
+                        beagleFlags |= BEAGLE_FLAG_VECTOR_SSE;
+                        }
+                    else
+                        {
+                        beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE;                     
+                        }
+                    if (BeagleCheckFlagCompatability(beagleFlags) == NO) {
+                        beagleFlags = oldFlags;
+                        }
+                    else {
+                        if (beagleFlags & BEAGLE_FLAG_VECTOR_SSE)
+                            MrBayesPrint ("%s   Setting beaglesse to Yes\n", spacer);
+                        else
+                            MrBayesPrint ("%s   Setting beaglesse to No\n", spacer);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beagleopenmp\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+#if 0
+        else if (!strcmp(parmName, "Beaglevec"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {                    
+                    long oldFlags = beagleFlags;
+                    if (!strcmp(tempStr, "Sse"))
+                        {                      
+                        beagleFlags |= BEAGLE_FLAG_VECTOR_SSE;
+                        beagleFlags &= ~BEAGLE_FLAG_VECTOR_AVX;
+                        }
+                    else if (!strcmp(tempStr, "Avx"))
+                        {  
+                        beagleFlags |= ~BEAGLE_FLAG_VECTOR_AVX;
+                        beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE;
+                        }
+                    else if (!strcmp(tempStr, "None"))
+                        {
+                        beagleFlags &= ~BEAGLE_FLAG_VECTOR_SSE;
+                        beagleFlags &= ~BEAGLE_FLAG_VECTOR_AVX;
+                        }
+                    else
+                        {
+                        MrBayesPrint("%s   Unrecognized argument for beaglevec\n", spacer);
+                        }
+                    MrBayesPrint ("%s   Setting beaglevec to %s\n", spacer, tempStr);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beagleopenmp\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+#endif
+        else if (!strcmp(parmName, "Beaglethreads"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED) && defined (THREADS_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        {
+                        tryToUseThreads = YES;
+                        }
+                    else
+                        {
+                        tryToUseThreads = NO;                       
+                        }
+                    
+                    if (tryToUseThreads == YES)
+                        MrBayesPrint ("%s   Setting beaglethreads to Yes\n", spacer);
+                    else
+                        MrBayesPrint ("%s   Setting beaglethreads to No\n", spacer);                    
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beaglethreads\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleThreadsNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            }
+        else if (!strcmp(parmName, "Beaglescaling"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+#   if defined (BEAGLE_ENABLED)
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Always"))
+                        {
+                        beagleScalingScheme = MB_BEAGLE_SCALE_ALWAYS;
+                        }
+                    else
+                        {
+                        beagleScalingScheme = MB_BEAGLE_SCALE_DYNAMIC;                      
+                        }
+                    
+                    if (beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS)
+                        MrBayesPrint ("%s   Setting beaglescaling to Always\n", spacer);
+                    else
+                        MrBayesPrint ("%s   Setting beaglescaling to Dynamic\n", spacer);                    
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for beaglescaling\n", spacer);
+                    return (ERROR);
+                    }
+#   else
+                BeagleThreadsNotLinked();
+#   endif
+                if (defMatrix == YES && SetUpAnalysis(&globalSeed) == ERROR)
+                    return ERROR;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoShowMatrix (void)
+{
+    int         i, j, nameLen, start, finish, ct, longestName;
+    char        tempStr[100], stride;
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        return (ERROR);
+        }
+            
+    longestName = 0;
+    for (i=0; i<numTaxa; i++)
+        {
+        nameLen = (int) strlen(taxaNames[i]);
+        if (nameLen > longestName)
+            longestName = nameLen;
+        }
+            
+    stride = 50;
+    start = finish = 0;
+    do
+        {
+        finish += stride;
+        if (finish > numChar)
+            finish = numChar;
+
+        MrBayesPrint ("%s   ", spacer);
+        for (j=0; j<longestName; j++)
+            MrBayesPrint (" ");
+        MrBayesPrint ("  ");
+        MrBayesPrint ("%d\n", start+1);
+
+        for (i=0; i<numTaxa; i++)
+            {
+            strcpy (tempStr, taxaNames[i]);
+            nameLen = (int) strlen(tempStr);
+            
+            MrBayesPrint ("%s   ", spacer);
+            if (nameLen >= longestName)
+                {
+                for (j=0; j<longestName; j++)
+                    MrBayesPrint ("%c", tempStr[j]);
+                }
+            else
+                {
+                MrBayesPrint ("%s", tempStr);
+                for (j=0; j<longestName-nameLen; j++)
+                    MrBayesPrint (" ");
+                }
+            MrBayesPrint ("  ");
+
+            for (j=start; j<finish; j++)
+                {
+                ct = charInfo[j].charType;
+                if (ct == DNA || ct == RNA)
+                    MrBayesPrint ("%c", WhichNuc(matrix[pos(i,j,numChar)]));
+                else if (ct == PROTEIN)
+                    MrBayesPrint ("%c", WhichAA(matrix[pos(i,j,numChar)]));
+                else if (ct == STANDARD)
+                    MrBayesPrint ("%c", WhichStand(matrix[pos(i,j,numChar)]));
+                else if (ct == RESTRICTION)
+                    MrBayesPrint ("%c", WhichRes(matrix[pos(i,j,numChar)]));
+                else if (ct == CONTINUOUS)
+                    {
+                    if (WhichCont(matrix[pos(i,j,numChar)]) < 0.0)
+                        MrBayesPrint (" %2.2lf", WhichCont(matrix[pos(i,j,numChar)]));
+                    else
+                        MrBayesPrint ("  %2.2lf", WhichCont(matrix[pos(i,j,numChar)]));
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Unknown data type\n", spacer);
+                    return (ERROR);
+                    }
+                
+                }
+            MrBayesPrint ("\n");
+            }
+        MrBayesPrint ("\n");
+        start = finish;
+        } while (finish != numChar);
+
+    return (NO_ERROR);
+}
+
+
+int DoShowUserTrees (void)
+{
+    int         i;
+
+    if (numUserTrees == 0)
+        {
+        MrBayesPrint ("%s   No user trees have been defined\n", spacer);
+        }
+    else
+        {
+        for (i=0; i<numUserTrees; i++)
+            {
+            MrBayesPrint ("\n   Tree #%d -- '%s':\n\n", i+1, userTree[i]->name);
+            ShowConTree (stdout, userTree[i], 70, NO);
+            MrBayesPrint ("\n");
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoShowBeagle (void)
+{
+#   if defined (BEAGLE_ENABLED)
+    BeaglePrintResources();
+#   else
+    BeagleNotLinked();
+#   endif
+    return (NO_ERROR);
+}
+
+
+int DoTaxlabels (void)
+{
+    isTaxsetDef = YES;
+
+    /* add default speciespartition name to list of valid speciespartitions */
+    if (AddString (&speciespartitionNames, 0, "Default") == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding Default speciespartition to list\n", spacer);
+        return (ERROR);
+        }
+
+    /* add default species name set */
+    AddNameSet(&speciesNameSets, 0, taxaNames, numTaxa);
+
+    /* set number of defined speciespartitions to 1 */
+    numDefinedSpeciespartitions = 1;
+        
+    return (NO_ERROR);
+}
+
+
+int DoTaxlabelsParm (char *parmName, char *tkn)
+{
+    int         index;
+
+    if (inTaxaBlock == NO)
+        {
+        MrBayesPrint ("%s   You must be in a taxa block to read a taxlabels command\n", spacer);
+        return (ERROR);
+        }
+
+    if (defTaxa == NO)
+        {
+        MrBayesPrint ("%s   The number of taxa must be given before a set of taxon labels can be read\n", spacer);
+        return ERROR;
+        }
+
+    if (isTaxsetDef == YES)
+        {
+        MrBayesPrint ("%s   A set of taxon labels has already been defined\n", spacer);
+        if (defMatrix == NO)
+            if (WantTo ("Do you want to delete the current set of taxon labels") == NO)
+                return (SKIP_COMMAND);
+            else
+                FreeTaxa();
+        else
+            if (WantTo ("Do you want to delete the current character matrix") == NO)
+                return (SKIP_COMMAND);
+            else
+                FreeMatrix();
+        }
+
+    if (expecting == Expecting(ALPHA) ||
+        expecting == Expecting(NUMBER))
+        {
+        if (CheckString (taxaNames, numNamedTaxa, tkn, &index) == ERROR)
+            {
+            if (strlen(tkn)>99)
+                {
+                MrBayesPrint ("%s   Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, tkn);
+                return (ERROR);
+                }
+            if (AddString (&taxaNames, numNamedTaxa, tkn) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem adding label %s to list of taxon labels\n", spacer, tkn);
+                return (ERROR);
+                }
+            numNamedTaxa++;
+            }
+        else
+            {
+            MrBayesPrint ("%s   Taxon label '%s' is included twice in list of taxon labels\n", spacer, tkn);
+            return (ERROR);
+            }
+        if (numNamedTaxa < numTaxa)
+            {
+            expecting = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            }
+        else
+            expecting |= Expecting(SEMICOLON);
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+    MrBayesPrint ("%s", tkn);
+}
+
+
+int DoSpeciespartition (void)
+{
+    int     i, *partCount;
+        
+    /* add set to tempSet */
+    if (fromI >= 0)
+        if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+            {
+            for (i=0; i<numDivisions; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return (ERROR);
+            }
+
+    /* set numDivisions; not set while reading the speciespartition */
+    numDivisions = whichPartition + 1;
+    
+    /* check that all species are included */
+    for (i=0; i<numTaxa; i++)
+        {
+        if (tempSet[i] == 0)
+            {
+            MrBayesPrint ("%s   Tip %d not included in speciespartition\n", spacer, i+1);
+            for (i=0; i<numDivisions; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return (ERROR);
+            }
+        /*MrBayesPrint ("%4d %4d \n", i, tempSet[i]);*/
+        }
+
+    partCount = (int *) SafeCalloc (numDivisions, sizeof(int));
+    if (!partCount)
+        {
+        for (i=0; i<numDivisions; i++)
+            free(tempNames[i]);
+        free (tempNames);
+        tempNames = NULL;
+        return ERROR;
+        }
+
+    /* make certain that the partition labels go from 1 - numTaxa, inclusive */
+    for (i=0; i<numTaxa; i++)
+        {
+        if (tempSet[i] < 1 || tempSet[i] > numTaxa)
+            {
+            MrBayesPrint ("%s   Speciespartition index for tip %d out of bound (%d)\n", spacer, i+1, tempSet[i]);
+            free (partCount);
+            for (i=0; i<numDivisions; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return (ERROR);
+            }
+        partCount[tempSet[i] - 1]++;
+        }
+    for (i=0; i<numDivisions; i++)
+        {
+        if (partCount[i] == 0)
+            {
+            MrBayesPrint ("%s   Could not find a single tip for species %d\n", spacer, i+1);
+            free (partCount);
+            for (i=0; i<numDivisions; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return (ERROR);
+            }
+        }
+    free (partCount);
+
+    /* add name to list of valid partitions */
+    if (AddString (&speciespartitionNames, numDefinedSpeciespartitions, tempSetName) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding speciespartition %s to list\n", spacer, tempSetName);
+        for (i=0; i<numDivisions; i++)
+            free(tempNames[i]);
+        free (tempNames);
+        tempNames = NULL;
+        return (ERROR);
+        }
+
+    /* add new partition */
+    for (i=0; i<numTaxa; i++)
+        {
+        speciespartitionId[i] = (int *) SafeRealloc ((void *)(speciespartitionId[i]), ((size_t)numDefinedSpeciespartitions + 1) * sizeof(int));
+        if (!speciespartitionId[i])
+            {
+            for (i=0; i<numDivisions; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return ERROR;
+            }
+        }
+
+    /* set new partition */
+    for (i=0; i<numTaxa; i++)
+        speciespartitionId[i][numDefinedSpeciespartitions] = tempSet[i];
+
+    /* add new set of species names */
+    AddNameSet(&speciesNameSets, numDefinedSpeciespartitions, tempNames, numDivisions);
+
+    /* free species names */
+    for (i=0; i<numDivisions; i++)
+        free(tempNames[i]);
+    free (tempNames);
+    tempNames = NULL;
+
+    /* increment number of defined partitions */
+    numDefinedSpeciespartitions++;
+    
+    return (NO_ERROR);
+}
+
+
+int DoSpeciespartitionParm (char *parmName, char *tkn)
+{
+    int             i, index, tempInt;
+    
+    if (defTaxa == NO || numTaxa == 0)
+        {
+        MrBayesPrint ("%s   A matrix or taxaset must be specified before partitions can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        /* set Speciespartition name ******************************************************************/
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* check size of partition name */
+            if (strlen(tkn) > 99)
+                {
+                MrBayesPrint ("%s   Partition name is too long. Max 100 characters\n", spacer);
+                return (ERROR);
+                }
+                
+            /* check to see if the name has already been used as a partition */
+            if (numDefinedSpeciespartitions > 0)
+                {
+                if (CheckString (speciespartitionNames, numDefinedSpeciespartitions, tkn, &index) == ERROR)
+                    {
+                    /* if the partition name has not been used, then we should have an ERROR returned */
+                    /* we _want_ to be here */
+
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Speciespartition name '%s' has been used previously\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                }
+                
+            /* add the name temporarily to tempSetName */
+            strcpy (tempSetName, tkn);
+            
+            /* clear tempSet */
+            for (i=0; i<numTaxa; i++)
+                tempSet[i] = 0;
+    
+            /* make sure tempNames is NULL */
+            assert (tempNames == NULL);
+
+            fromI = toJ = everyK = -1;
+            foundDash = foundSlash = NO;
+            whichPartition = 0;
+            foundFirst = NO;
+            numDivisions = 0;
+            MrBayesPrint ("%s   Defining speciespartition called '%s'\n", spacer, tkn);
+            expecting = Expecting(EQUALSIGN);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        expecting = Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        if (foundFirst == NO)
+            {
+            AddString(&tempNames, whichPartition, tkn);
+            foundFirst = YES;
+            expecting = Expecting(COLON);
+            }
+        else
+            {
+            /* We are defining a species partition in terms of a tip name (called tkn, here). We should be able
+               to find tkn in the list of tip names. If we cannot, then we have a problem and
+               return an error. */
+            if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                {
+                MrBayesPrint ("%s   Could not find a tip called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            /* add index of the tip named tkn to new tempSet */
+            tempSet[index] = whichPartition + 1;
+            fromI = toJ = everyK = -1;
+
+            expecting  = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(SEMICOLON);
+            expecting |= Expecting(COMMA);
+            }
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && tkn[0] == '.')
+            tempInt = numTaxa;
+        else
+            sscanf (tkn, "%d", &tempInt);
+        if (tempInt <= 0 || tempInt > numTaxa)
+            {
+            MrBayesPrint ("%s   Tip number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
+            for (i=0; i<whichPartition; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return (ERROR);
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted speciespartition\n", spacer);
+                for (i=0; i<whichPartition; i++)
+                    free(tempNames[i]);
+                free (tempNames);
+                tempNames = NULL;
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else if (foundSlash == YES)
+            {
+            tempInt++;
+            if (tempInt <= 1)
+                {
+                MrBayesPrint ("%s   Improperly formatted speciespartition\n", spacer);
+                for (i=0; i<whichPartition; i++)
+                    free(tempNames[i]);
+                free (tempNames);
+                tempNames = NULL;
+                return (ERROR);
+                }
+            if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                everyK = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted speciespartition\n", spacer);
+                for (i=0; i<whichPartition; i++)
+                    free(tempNames[i]);
+                free (tempNames);
+                tempNames = NULL;
+                return (ERROR);
+                }
+            foundSlash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                    {
+                    for (i=0; i<whichPartition; i++)
+                        free(tempNames[i]);
+                    free (tempNames);
+                    tempNames = NULL;
+                    return (ERROR);
+                    }
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted speciespartition\n", spacer);
+                    {
+                    for (i=0; i<whichPartition; i++)
+                        free(tempNames[i]);
+                    free (tempNames);
+                    tempNames = NULL;
+                    return (ERROR);
+                    }
+                }
+            }
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(BACKSLASH);
+        expecting |= Expecting(COMMA);
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        /* add set to tempSet */
+        if (fromI >= 0)
+            if (AddToSet (fromI, toJ, everyK, whichPartition+1) == ERROR)
+                {
+                for (i=0; i<whichPartition; i++)
+                    free(tempNames[i]);
+                free (tempNames);
+                tempNames = NULL;
+                return (ERROR);
+                }
+
+        fromI = toJ = everyK = -1;
+        foundDash = foundSlash = foundFirst = NO;
+        whichPartition++;
+        if (whichPartition > numTaxa)
+            {
+            MrBayesPrint ("%s   Too many speciespartitions (expecting maximum %d speciespartitions)\n", spacer, numTaxa);
+            for (i=0; i<whichPartition; i++)
+                free(tempNames[i]);
+            free (tempNames);
+            tempNames = NULL;
+            return (ERROR);
+            }
+        expecting  = Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        expecting  = Expecting(NUMBER);
+        expecting |= Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        {
+        for (i=0; i<whichPartition; i++)
+            free(tempNames[i]);
+        free (tempNames);
+        tempNames = NULL;
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoTaxaset (void)
+{
+    /* add set to tempSet */
+    if (fromI >= 0 && toJ < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+    else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+        {
+        if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+            return (ERROR);
+        }
+        
+    /* add name to taxaSetNames */
+    if (AddString (&taxaSetNames, numTaxaSets, tempSetName) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem adding taxset %s to list\n", spacer, tempSetName);
+        return (ERROR);
+        }
+
+    /* merge tempSet with taxaSet */
+    AddBitfield (&taxaSet, numTaxaSets, tempSet, numTaxa);
+    
+    /* increment number of char sets */
+    numTaxaSets++;
+    
+    /* show taxset (for debugging) */
+#   if 0
+    for (i=0; i<numTaxa; i++)
+        MrBayesPrint ("%4d  %4d\n", i+1, tempSet[i]);
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int DoTaxasetParm (char *parmName, char *tkn)
+{
+    int     i, index, tempInt;
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before taxsets can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* check size of taxset name */
+            if (strlen(tkn) > 99)
+                {
+                MrBayesPrint ("%s   Taxset name is too long\n", spacer);
+                return (ERROR);
+                }
+                
+            /* check to see if the name has already been used as a taxset */
+            if (numTaxaSets > 0)
+                {
+                if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
+                    {
+                    /* if the taxset name has not been used, then we should have an ERROR returned */
+                    /* we _want_ to be here */
+
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Taxset name has been used previously\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (numTaxaSets > 30)
+                {
+                MrBayesPrint ("%s   You cannot define more than 30 taxsets\n", spacer);
+                return (ERROR);
+                }
+                
+            /* add the name to the taxa set */
+            strcpy (tempSetName, tkn);
+            
+            /* clear tempSet */
+            for (i=0; i<numTaxa; i++)
+                tempSet[i] = 0;
+            
+            fromI = toJ = everyK = -1;
+            foundDash = foundSlash = NO;
+            MrBayesPrint ("%s   Defining taxset called '%s'\n", spacer, tkn);
+            expecting = Expecting(EQUALSIGN);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        /* We are defining a taxon set in terms of another (called tkn, here) or we are referring to
+           the taxon name. We should be able to find tkn in the list of character set names or in the list
+           of taxon names. If we cannot, then we have a problem and return an error. */
+        if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+            {
+            if (numTaxaSets < 1)
+                {
+                MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            if (CheckString (taxaSetNames, numTaxaSets, tkn, &index) == ERROR)
+                {
+                MrBayesPrint ("%s   Could not find a taxset called '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            /* add taxa from taxset tkn to new tempSet */
+            for (i=0; i<numTaxa; i++)
+                {
+                if (IsBitSet (i, taxaSet[index]) == YES)
+                    tempSet[i] = 1;
+                }
+            }
+        else
+            {
+            tempSet[index] = 1;
+            }
+        fromI = toJ = everyK = -1;
+
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (strlen(tkn) == 1 && !strcmp(tkn, "."))
+            {
+            tempInt = numTaxa;
+            }
+        else
+            {
+            sscanf (tkn, "%d", &tempInt);
+            if (tempInt <= 0 || tempInt > numTaxa)
+                {
+                MrBayesPrint ("%s   Taxon number %d is out of range (should be between %d and %d)\n", spacer, tempInt, 1, numTaxa);
+                return (ERROR);
+                }
+            }
+        tempInt--;
+        if (foundDash == YES)
+            {
+            if (fromI >= 0)
+                toJ = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted taxset\n", spacer);
+                return (ERROR);
+                }
+            foundDash = NO;
+            }
+        else if (foundSlash == YES)
+            {
+            tempInt++;
+            if (tempInt <= 1)
+                {
+                MrBayesPrint ("%s   Improperly formatted taxset\n", spacer);
+                return (ERROR);
+                }
+            if (fromI >= 0 && toJ >= 0 && fromI < toJ)
+                everyK = tempInt;
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted taxset\n", spacer);
+                return (ERROR);
+                }
+            foundSlash = NO;
+            }
+        else
+            {
+            if (fromI >= 0 && toJ < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                }
+            else if (fromI < 0 && toJ < 0)
+                {
+                fromI = tempInt;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK < 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else if (fromI >= 0 && toJ >= 0 && everyK >= 0)
+                {
+                if (AddToSet (fromI, toJ, everyK, 1) == ERROR)
+                    return (ERROR);
+                fromI = tempInt;
+                toJ = everyK = -1;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Improperly formatted taxset\n", spacer);
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        
+        expecting  = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(SEMICOLON);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(BACKSLASH);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(BACKSLASH))
+        {
+        foundSlash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoTaxaStat (void)
+{
+    int         i, j, maxLen, nameLen, nIncludedTaxa;
+    char        tempName[100];
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        return (ERROR);
+        }
+        
+    /* find maximum length of taxon name */
+    maxLen = nIncludedTaxa = 0;
+    for (i=0; i<numTaxa; i++)
+        {
+        strcpy (tempName, taxaNames[i]);
+        if ((int)strlen(tempName) > maxLen)
+            maxLen = (int) strlen(tempName);
+        if (taxaInfo[i].isDeleted == NO)
+            nIncludedTaxa++;
+        }
+            
+    MrBayesPrint ("%s   Showing taxon status:\n\n", spacer);
+    if (nIncludedTaxa == numTaxa)
+        MrBayesPrint ("%s     Number of taxa        = %d (all of which are included)\n", spacer, numTaxa);
+    else
+        MrBayesPrint ("%s     Number of taxa        = %d (of which %d are included)\n", spacer, numTaxa, nIncludedTaxa);
+    MrBayesPrint ("%s     Number of constraints = %d\n\n", spacer, numDefinedConstraints);
+    
+    if (numDefinedConstraints > 0)
+        {
+        for (j=0; j<numDefinedConstraints; j++)
+            {
+            strcpy (tempName, constraintNames[j]);
+
+            /* for now, ignore the probability */
+            if (definedConstraintsType[j] == HARD)
+                MrBayesPrint ("%s     %2d -- Trees with 'hard' constraint \"%s\" are infinitely\n", spacer, j+1, tempName);
+            else if (definedConstraintsType[j] == PARTIAL)
+                MrBayesPrint ("%s     %2d -- Trees with 'partial' constraint \"%s\" are infinitely\n", spacer, j+1, tempName);
+            else
+                MrBayesPrint ("%s     %2d -- Trees with 'negative' constraint \"%s\" are infinitely\n", spacer, j+1, tempName);
+            MrBayesPrint ("%s           more probable than those without \n", spacer);
+            }
+        MrBayesPrint ("\n");
+        for (j=0; j<maxLen; j++)
+            MrBayesPrint (" ");
+        MrBayesPrint ("                             Constraints\n");
+        }
+    MrBayesPrint ("%s     Taxon  ", spacer);
+    for (j=0; j<maxLen; j++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("   Inclusion");
+    MrBayesPrint ("   ");
+    for (j=0; j<numDefinedConstraints; j++)
+        MrBayesPrint (" %2d", j+1);
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   -------", spacer);
+    for (j=0; j<maxLen; j++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("--------------");
+    
+    if (numDefinedConstraints > 0)
+        {
+        MrBayesPrint ("----");
+        for (j=0; j<numDefinedConstraints; j++)
+            MrBayesPrint ("---");
+        }
+    MrBayesPrint ("\n");
+    for (i=0; i<numTaxa; i++)
+        {
+        strcpy (tempName, taxaNames[i]);
+        nameLen = (int) strlen(tempName);
+        
+        if (i == outGroupNum)
+            MrBayesPrint ("%s ->%4d (%s) ", spacer, i+1, tempName);
+        else
+            MrBayesPrint ("%s   %4d (%s) ", spacer, i+1, tempName);
+        for (j=0; j<(maxLen-nameLen); j++)
+            MrBayesPrint (" ");
+        MrBayesPrint (" -- ");
+        
+        if (taxaInfo[i].isDeleted == YES)
+            MrBayesPrint ("Deleted ");
+        else
+            MrBayesPrint ("Included");
+            
+        MrBayesPrint ("    ");
+            
+        for (j=0; j<numDefinedConstraints; j++)
+            {
+            if (definedConstraintsType[j] == HARD)
+                {
+                if (IsBitSet(i, definedConstraint[j]) == NO)
+                    MrBayesPrint ("  .");
+                else
+                    MrBayesPrint ("  *");
+                }
+            else if (definedConstraintsType[j] == PARTIAL)
+                {
+                if (IsBitSet(i, definedConstraint[j]) == YES)
+                    MrBayesPrint ("  +");
+                else if (IsBitSet(i, definedConstraintTwo[j]) == YES)
+                    MrBayesPrint ("  -");
+                else
+                    MrBayesPrint ("  .");
+                }
+            else if (definedConstraintsType[j] == NEGATIVE)
+                {
+                if (IsBitSet(i, definedConstraint[j]) == NO)
+                    MrBayesPrint ("  .");
+                else
+                    MrBayesPrint ("  #");
+                }
+            }
+        MrBayesPrint ("\n");
+        }
+        
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   '.' indicate that the taxon is not present in the constraint. \n", spacer);
+    MrBayesPrint ("%s   '*' indicate that the taxon is present in the 'hard' constraint. \n", spacer);
+    MrBayesPrint ("%s   '+' indicate that the taxon is present in the first groupe of 'partial' constraint. \n", spacer);
+    MrBayesPrint ("%s   '-' indicate that the taxon is present in the second groupe of 'partial' constraint. \n", spacer);
+    MrBayesPrint ("%s   '#' indicate that the taxon is present in the 'negative' constraint. \n", spacer);
+    MrBayesPrint ("%s   Arrow indicates current outgroup. \n", spacer);
+
+    return (NO_ERROR);
+}
+
+
+int DoTranslate (void)
+{
+    int     i, j;
+
+    if (inTreesBlock == NO)
+        {
+        MrBayesPrint ("%s   You must be in a trees block to read a translate command\n", spacer);
+        return (ERROR);
+        }
+    numTranslates++;    /* number of taxa in translate table */
+    isTranslateDef = YES;
+
+    isTranslateDiff = NO;
+    if (isTaxsetDef == NO)
+        SetTaxaFromTranslateTable();
+    else
+        {
+        for (i=0; i<numTranslates; i++)
+            {
+            strcpy (token, transFrom[i]);
+            if (CheckString (taxaNames, numTaxa, token, &j) == ERROR)
+                {
+                isTranslateDiff = YES;
+                }
+            }
+        if (numTranslates != numTaxa)
+            isTranslateDiff = YES;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoTranslateParm (char *parmName, char *tkn)
+{
+    int         index;
+    static int  whichTranslate;
+
+    if (inTreesBlock == NO)
+        {
+        MrBayesPrint ("%s   You must be in a trees block to read a translate command\n", spacer);
+        return (ERROR);
+        }
+
+    if (isTranslateDef == YES)
+        {
+        MrBayesPrint ("%s   A translation has already been defined for this tree block\n", spacer);
+        return (ERROR);
+        }
+        
+    if (expecting == Expecting(ALPHA) ||
+        expecting == Expecting(NUMBER))
+        {
+        if (numTaxa == 0)
+            {
+            MrBayesPrint ("%s   Data matrix should be defined before translation table could be set.\n", spacer);
+            return (ERROR);
+            }
+        if (numTranslates == numTaxa)
+            {
+            MrBayesPrint ("%s   Too many entries in translation table. Maximum number of taxon names to translate is %d\n", spacer,numTaxa);
+            return (ERROR);
+            }
+        if (whichTranslate == 0)
+            {
+            if (CheckString (transTo, numTranslates, tkn, &index) == ERROR)
+                {
+                if (AddString (&transTo, numTranslates, tkn) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Problem adding taxon %s to list\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                }
+            else
+                {
+                MrBayesPrint ("%s   Already found name (%s) in list\n", spacer, tkn);
+                return (ERROR);
+                }           
+            whichTranslate++;
+            expecting = Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            }
+        else 
+            {
+            if (CheckString (transFrom, numTranslates, tkn, &index) == ERROR)
+                {
+                if (AddString (&transFrom, numTranslates, tkn) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Problem adding taxon %s to list\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                }
+            else
+                {
+                MrBayesPrint ("%s   Already found name (%s) in list\n", spacer, tkn);
+                return (ERROR);
+                }           
+            whichTranslate = 0;
+            expecting = Expecting(COMMA);
+            expecting |= Expecting(SEMICOLON);
+            }
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        numTranslates++;
+        expecting = Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+    MrBayesPrint ("%s", tkn);
+}
+
+
+int DoTree (void)
+{
+    readComment = NO;
+
+    if (inSumtCommand == YES || inComparetreeCommand == YES)
+        return (DoSumtTree ());
+
+    return (NO_ERROR);
+}
+
+
+int DoTreeParm (char *parmName, char *tkn)
+{
+    int                 i, tempInt, index;
+    MrBFlt              tempD;
+    char                tempName[100];
+    static BitsLong     lastExpecting; /* keep track of what we expected before a comment, in case we want to skip a comment */
+    static char         *tempNameString=NULL; /* Contains multiple tokens which form name string of param set*/
+    static int          foundAmpersand, foundColon, foundComment, foundE, foundB, foundN, foundFirst,
+                        foundCurly, /* is set to YES when we are between two curly bracets ONLY while processing CppEvent name */
+                        foundClockrate, 
+                        foundName, /*is set to YES when param set name token is found and set to NO once full param set name is processed*/
+                        eSetIndex, /* is set in the begining of reading CppEvent for a node/branch to the index of currently processed CppEvent set */
+                        bSetIndex, eventIndex, treeIndex, nextIntNodeIndex;
+    static PolyNode     *pp, *qq;
+    static PolyTree     *t;
+    
+    /* This function will read in components of a tree description. We expect one of the following formats:
+    
+          tree <name> = [&R] <newick-description>;
+          tree <name> = [&U] <newick-description>;
+          tree <name> [&E CppEvents]  = [&R] [&clockrate = 1.23] ((1:0.021[&E CppEvents 2: (0.10 1.11,0.83 3.17)],...
+          tree <name> [&B TK02Brlens] = [&R] [&clockrate = 1.23] ((1:0.021[&B TK02Brlens 0.019],...
+          tree <name> [&B IgrBrlens]  = [&R] [&clockrate = 1.23] ((1:0.021[&B IgrBrlens 0.019],...
+     
+       Values will be stored in event sets that go with the tree and that are used to initialize the relaxed clock
+       parameters before a run is started. Note that several sets of events can be stored with each tree.
+    */
+
+    if (isTaxsetDef == NO)
+        {
+        MrBayesPrint ("%s   Taxon labels must be specified before a tree could be red in\n", spacer);
+        return (ERROR);
+        }
+    if (inTreesBlock == NO)
+        {
+        MrBayesPrint ("%s   You must be in a trees block to read a tree\n", spacer);
+        return (ERROR);
+        }
+    
+    if (expecting == Expecting(PARAMETER))
+        {
+        /* this is the name of the tree */
+        if (inSumtCommand==YES || inComparetreeCommand == YES)
+            {
+            /* we are reading in a tree to sumt or comparetree counters */
+            t = sumtParams.tree;
+            ResetPolyTree (t);
+            }
+        else
+            {
+            /* we are reading in a user tree */
+            /* check if the tree exists */
+            treeIndex = 0;
+            for (i=0; i<numUserTrees; i++)
+                if (strcmp(tkn,userTree[i]->name) == 0)
+                    break;
+            treeIndex = i;
+            if (treeIndex < numUserTrees)
+                {
+                MrBayesPrint ("%s   Overwriting tree '%s'.\n", spacer, userTree[treeIndex]);
+                FreePolyTree (userTree[treeIndex]);
+                }
+            if ((userTree[treeIndex] = AllocatePolyTree (numTaxa)) == NULL)
+                return (ERROR);
+            t = userTree[treeIndex];
+            }
+        strncpy (t->name, tkn, 99);
+        foundColon = foundAmpersand = foundEqual = foundComment = NO;
+        foundE = foundB = foundN = foundFirst = foundClockrate = foundName = NO;
+        eSetIndex = bSetIndex = eventIndex = 0;
+        nextAvailableNode = 0;
+        if (isTranslateDef == YES && isTranslateDiff == YES)
+            nextIntNodeIndex = numTranslates;
+        else
+            nextIntNodeIndex = numTaxa;
+        pp = &t->nodes[nextAvailableNode++];
+        t->root = pp;
+        t->isRooted = NO;  /* expect unrooted tree */
+        t->isClock = NO;   /* expect nonclock tree */
+        t->isCalibrated = NO;  /* expect uncalibrated tree */
+        t->isRelaxed = NO;    /* expect strict clock if clock tree */
+        t->clockRate = 0.0;     /* expect no clock rate */
+        t->popSizeSet = NO;     
+        readComment = YES;
+        expecting = Expecting(EQUALSIGN) | Expecting(LEFTCOMMENT);
+        lastExpecting = expecting;
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        if (foundClockrate == YES)
+            expecting = Expecting(NUMBER);
+        else
+            {
+            for (i=0; i<numTaxa; i++)
+                tempSet[i] = NO;
+            foundEqual = YES;
+            expecting = Expecting(LEFTPAR) | Expecting(LEFTCOMMENT);
+            lastExpecting = expecting;
+            }
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        if (foundE == YES)
+            {
+            expecting = Expecting(NUMBER);
+            }
+        else
+            {
+            if (nextAvailableNode >= 2*numTaxa)
+                {
+                MrBayesPrint ("%s   Too many nodes on tree '%s'\n", spacer, t->name);
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    FreePolyTree (userTree[treeIndex]);
+                return (ERROR);
+                }
+            qq = &t->nodes[nextAvailableNode++];
+            qq->anc = pp;
+            pp->left = qq;
+            pp->index = nextIntNodeIndex++;
+            pp = qq;
+            expecting = Expecting(LEFTPAR);
+            expecting |= Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(LEFTCOMMENT);
+            lastExpecting = expecting;
+            }
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        if (foundAmpersand == YES)
+            {
+            if (strcmp(tkn,"E") == 0)
+                {
+                foundE = YES;
+                expecting = Expecting(ALPHA);
+                }
+            else if (strcmp(tkn,"B") == 0)
+                {
+                foundB = YES;
+                expecting = Expecting(ALPHA);
+                }
+            else if (strcmp(tkn,"N") == 0)
+                {
+                foundN = YES;
+                expecting = Expecting(ALPHA);
+                }
+            else if (strcmp(tkn, "R") == 0)
+                {
+                t->isRooted = YES;
+                t->isClock = YES;   /* assume clock if rooted */
+                expecting = Expecting(RIGHTCOMMENT);
+                }
+            else if (strcmp(tkn, "U") == 0)
+                {
+                t->isRooted = NO;
+                expecting = Expecting(RIGHTCOMMENT);
+                }
+            else if (strcmp(tkn, "clockrate") == 0)
+                {
+                t->isCalibrated = YES;
+                foundClockrate = YES;
+                expecting = Expecting(EQUALSIGN);
+                }
+            else
+                {
+                inComment = YES;
+                numComments++;
+                expecting = lastExpecting;
+                }
+            foundAmpersand = NO;
+            }
+        else if (foundName == YES && foundCurly == YES)
+            {
+            if (strcmp("all",tkn) == 0)
+                {
+                SafeStrcat (&tempNameString,tkn);
+                expecting = Expecting(RIGHTCURL);
+                }
+            else
+                {
+                MrBayesPrint ("%s   Urecognized argument '%s'\n", spacer, tkn);
+                return (ERROR);
+                }
+            }
+        else if (foundE == YES) /* We have seen &E */
+            {
+            if (foundEqual == NO) /* We have not seen name before and we are in header */
+                {
+                t->nESets++;
+                t->isRelaxed = YES;
+                t->nEvents  = (int **) SafeRealloc ((void *)t->nEvents, t->nESets*sizeof(int *));
+                t->position = (MrBFlt ***) SafeRealloc ((void *)t->position, t->nESets*sizeof(MrBFlt **));
+                t->rateMult = (MrBFlt ***) SafeRealloc ((void *)t->rateMult, t->nESets*sizeof(MrBFlt **));
+                t->nEvents[t->nESets-1]  = (int *) SafeCalloc (2*(size_t)numTaxa, sizeof(int));
+                t->position[t->nESets-1] = (MrBFlt **) SafeCalloc (2*(size_t)numTaxa, sizeof(MrBFlt *));
+                t->rateMult[t->nESets-1] = (MrBFlt **) SafeCalloc (2*(size_t)numTaxa, sizeof(MrBFlt *));
+                t->eSetName = (char **) SafeRealloc ((void *)t->eSetName, t->nESets*sizeof(char **));
+                }
+            SafeStrcpy (&tempNameString,tkn);
+            foundName = YES;
+            expecting = Expecting(LEFTCURL);
+            if (foundEqual == YES)
+                expecting |= Expecting(NUMBER);
+            else
+                expecting |= Expecting(RIGHTCOMMENT);
+            }
+        else if (foundB == YES)
+            {
+            if (foundEqual == NO)
+                {
+                t->nBSets++;
+                t->isRelaxed = YES;
+                t->effectiveBrLen = (MrBFlt **) SafeRealloc ((void *)t->effectiveBrLen, (size_t)(t->nBSets)*sizeof(MrBFlt *));
+                t->effectiveBrLen[t->nBSets-1] = (MrBFlt *) SafeCalloc (2*(size_t)numTaxa, sizeof(MrBFlt));
+                for (i=0; i<2*numTaxa; i++)
+                    t->effectiveBrLen[t->nBSets-1][i] = 1.0;
+                t->bSetName = (char **) SafeRealloc ((void *)t->bSetName, (size_t)(t->nBSets)*sizeof(char *));
+                t->bSetName[t->nBSets-1] = (char *) SafeCalloc (strlen(tkn)+1, sizeof(char));
+                }
+            SafeStrcpy (&tempNameString,tkn);
+            foundName = YES;
+            expecting = Expecting(LEFTCURL);
+            if (foundEqual == YES)
+                expecting |= Expecting(NUMBER);
+            else
+                expecting |= Expecting(RIGHTCOMMENT);
+            }
+        else if (foundN == YES)
+            {
+            if (foundEqual == NO)
+                {
+                if (t->popSizeSet == YES)
+                    {
+                    MrBayesPrint ("%s   Cannot hold more than one population size set\n", spacer);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                t->popSizeSet = YES;
+                if (isTranslateDef == YES && isTranslateDiff == YES)
+                    t->popSize = (MrBFlt *) SafeCalloc (2*numTranslates, sizeof(MrBFlt));
+                else
+                    t->popSize = (MrBFlt *) SafeCalloc (2*numLocalTaxa, sizeof(MrBFlt));
+                }
+            SafeStrcpy (&tempNameString,tkn);
+            foundName = YES;
+            expecting = Expecting(LEFTCURL);
+            if (foundEqual == YES)
+                expecting |= Expecting(NUMBER);
+            else
+                expecting |= Expecting(RIGHTCOMMENT);
+            }
+        else   /* taxon name */
+            {
+            if (isTranslateDef == YES)
+                {
+                /* we are using the translation table */
+                if (CheckString (transTo, numTranslates, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find token '%s' in taxon translation table\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                strcpy (tempName, transFrom[index]);
+                if (isTranslateDiff == NO && CheckString (taxaNames, numTaxa, tempName, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find taxon '%s' in list of taxa\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                if (tempSet[index] == YES)
+                    {
+                    MrBayesPrint ("%s   Taxon name '%s' already used in tree\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                tempSet[index] = YES;
+                strcpy (pp->label, tempName);
+                pp->index = index;
+                }
+            else
+                {
+                /* Check to see if the name is in the list of taxon names. */
+                if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find taxon '%s' in list of taxa\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                if (tempSet[index] == YES)
+                    {
+                    MrBayesPrint ("%s   Taxon name '%s' already used in tree\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                tempSet[index] = YES;
+                strcpy (pp->label, tkn);
+                pp->index = index;
+                }
+            expecting  = Expecting(COMMA);
+            expecting |= Expecting(COLON);
+            expecting |= Expecting(RIGHTPAR);
+            }
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        if (foundE == YES)
+            expecting = Expecting(RIGHTCOMMENT);
+        else
+            {
+            if (pp->anc == NULL)
+                {
+                MrBayesPrint ("%s   Incorrect tree format: cannot go down\n", spacer);//, tkn
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    FreePolyTree (userTree[treeIndex]);
+                return (ERROR);
+                }
+            if (pp->anc->left == pp)
+                {
+                MrBayesPrint ("%s   Incorrect tree format: all nodes except tips should have more then one child. Either a single\n", spacer);
+                MrBayesPrint ("%s   taxon is surrounded with brackets or there is a clade surrounded by double brackets.\n", spacer);
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    FreePolyTree (userTree[treeIndex]);
+                return (ERROR);
+                }
+            pp = pp->anc;
+            if (pp->anc == NULL)
+                {
+                /* finish up tree */
+                t->nNodes = nextAvailableNode;
+                t->nIntNodes = t->nNodes;
+                for (i=0; i<t->nNodes; i++)
+                    {
+                    if (t->nodes[i].left == NULL)
+                        t->nIntNodes--;
+                    }
+                GetPolyDownPass(t);
+                
+                /* check that number of taxa is correct */
+                if (t->isRooted == NO && t->nNodes-t->nIntNodes == t->nIntNodes + 1)
+                    t->isRooted = YES;
+                if ((t->isRooted == YES && t->nNodes-t->nIntNodes != t->nIntNodes + 1) ||
+                    (t->isRooted == NO  && t->nNodes-t->nIntNodes != t->nIntNodes + 2))
+                    {
+                    /* we are protected from adding too many taxa by taxon-matching code above */
+                    if (t->isRooted == YES && t->nNodes-t->nIntNodes == t->nIntNodes + 2)
+                        {
+                        MrBayesPrint ("%s   The tree is declared as rooted (by comment [&R]) but\n", spacer);
+                        MrBayesPrint ("%s   the given tree has unrooted structure.\n", spacer);
+                        }
+                    else
+                        MrBayesPrint ("%s   Taxa missing in tree, or NOT a binary tree\n", spacer);
+
+                    return (ERROR);
+                    }
+
+                /* check other properties */
+                if (t->isClock == YES && t->isRooted == NO)
+                    {
+                    MrBayesPrint ("%s   Tree has clock rate but is not rooted\n", spacer);
+                    return (ERROR);
+                    /* Note: any deviation from an ultrametric tree must be assumed to be due to dated
+                       tips at this point */
+                    }
+                if (t->isRelaxed == YES && t->isClock == NO)
+                    {
+                    MrBayesPrint ("%s   Tree has relaxed clock rates but is not a clock tree\n", spacer);
+                    return (ERROR);
+                    }
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    {
+                    if (treeIndex == numUserTrees)
+                        numUserTrees++;
+                    MrBayesPrint ("%s   Successfully read tree '%s'\n", spacer, userTree[treeIndex]->name);
+                    }
+                if (t->popSize == NULL)
+                    {
+                    readComment = NO;
+                    expecting = Expecting(SEMICOLON);
+                    }
+                else
+                    {
+                    readComment = YES;
+                    expecting = Expecting(LEFTCOMMENT);
+                    lastExpecting = expecting;
+                    }
+                }
+            else
+                {
+                expecting = Expecting(COMMA);
+                expecting |= Expecting(COLON);
+                expecting |= Expecting(RIGHTPAR);
+                }
+            }
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        foundColon = YES;
+        if (foundE == YES)
+            expecting = Expecting(LEFTPAR);
+        else
+            expecting  = Expecting(NUMBER);
+        expecting |= Expecting(LEFTCOMMENT);
+        lastExpecting = expecting;
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        if (foundName == YES)
+            {
+            SafeStrcat (&tempNameString,",");
+            expecting = Expecting(NUMBER);
+            }
+        else if (foundE == YES)
+            {
+            expecting = Expecting(NUMBER);
+            }
+        else
+            {
+            if (nextAvailableNode >= 2*numTaxa)
+                {
+                MrBayesPrint ("%s   Too many nodes on tree '%s'\n", spacer, t->name);
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    FreePolyTree (userTree[treeIndex]);
+                return (ERROR);
+                }
+            qq = &t->nodes[nextAvailableNode++];
+            pp->sib = qq;
+            qq->anc = pp->anc;
+            pp = qq;
+            expecting = Expecting(LEFTPAR);
+            expecting |= Expecting(ALPHA);
+            expecting |= Expecting(NUMBER);
+            expecting |= Expecting(LEFTCOMMENT);
+            lastExpecting = expecting;
+            }
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (foundClockrate == YES)
+            {
+            sscanf (tkn, "%lf", &tempD);
+            t->clockRate = tempD;
+            foundClockrate = NO;
+            expecting = Expecting(RIGHTCOMMENT);
+            }
+        else if (foundName == YES && foundCurly == YES)
+            {
+            /* still assembling name of a param set */
+            SafeStrcat (&tempNameString,tkn);       
+            expecting = Expecting(RIGHTCURL) | Expecting(COMMA);
+            }
+        else if (foundN == YES)
+            {
+            /* we only know now that name is complete if it does not have curlies in it */
+            foundName = NO;
+
+            if (strcmp(tempNameString,t->popSizeSetName) != 0)
+                {
+                MrBayesPrint ("%s   Could not find population size set '%s'\n", spacer, tempNameString);
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    FreePolyTree (userTree[treeIndex]);
+                return (ERROR);
+                }
+
+            sscanf (tkn, "%lf", &tempD);
+            t->popSize[pp->index] = tempD;
+            foundN = NO;
+            expecting = Expecting(RIGHTCOMMENT);
+            }
+        else if (foundB == YES)
+            {
+            /* we only know now that name is complete if it does not have curlies in it */
+            foundName = NO;
+
+            /* find the right effective branch length set */
+            for (i=0; i<t->nBSets; i++)
+                if (strcmp(t->bSetName[i],tempNameString) == 0)
+                    break;
+            if (i == t->nBSets)
+                {
+                MrBayesPrint ("%s   Could not find effective branch length set '%s'\n", spacer, tempNameString);
+                if (inSumtCommand == NO && inComparetreeCommand == NO)
+                    FreePolyTree (userTree[treeIndex]);
+                return (ERROR);
+                }
+            bSetIndex = i;
+
+            sscanf (tkn, "%lf", &tempD);
+            t->effectiveBrLen[bSetIndex][pp->index] = tempD;
+            foundB = NO;
+            expecting = Expecting(RIGHTCOMMENT);
+            }
+        else if (foundE == YES)
+            {
+            if (foundColon == NO)
+                {
+                /* we only know now that name is complete if it does not have curlies in it */
+                foundName = NO;
+
+                /* find the right event set */
+                for (i=0; i<t->nESets; i++)
+                    if (strcmp(t->eSetName[i],tempNameString) == 0)
+                        break;
+                if (i == t->nESets)
+                    {
+                    MrBayesPrint ("%s   Could not find event set '%s'\n", spacer, tempNameString);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                eSetIndex = i;
+
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt < 0)
+                    {
+                    MrBayesPrint ("%s   Wrong number of events (%d) for event set '%s'\n", spacer, tempInt, t->eSetName[eSetIndex]);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                t->nEvents[eSetIndex][pp->index]  = tempInt;
+                if (tempInt > 0)
+                    {
+                    t->position[eSetIndex][pp->index] = (MrBFlt *) SafeCalloc (tempInt, sizeof(MrBFlt));
+                    t->rateMult[eSetIndex][pp->index] = (MrBFlt *) SafeCalloc (tempInt, sizeof(MrBFlt));
+                    expecting = Expecting (COLON);
+                    if (inSumtCommand == YES || inComparetreeCommand == YES)
+                        expecting |= Expecting (RIGHTCOMMENT);  /* we allow empty event specifications in sumt and comparetree */
+                    }
+                else
+                    expecting = Expecting (RIGHTCOMMENT);
+                eventIndex = 0;
+                }
+            else if (foundFirst == NO)
+                {
+                /* processing the first number in the cpp event pair <position rate> */
+                sscanf (tkn, "%lf", &tempD);
+                t->position[eSetIndex][pp->index][eventIndex] = tempD;
+                expecting = Expecting(NUMBER);
+                foundFirst = YES;
+                }
+            else
+                {
+                /* processing the second number in the cpp event pair <position rate> */
+                foundFirst = NO;
+                sscanf (tkn, "%lf", &tempD);
+                t->rateMult[eSetIndex][pp->index][eventIndex] = tempD;
+                eventIndex++;
+                if (eventIndex == t->nEvents[eSetIndex][pp->index])
+                    {
+                    expecting = Expecting(RIGHTPAR);
+                    foundColon = NO;
+                    }
+                else
+                    expecting = Expecting(COMMA);
+                }
+            }
+        else if (foundColon == YES)
+            {
+            /* branch length */
+            sscanf (tkn, "%lf", &tempD);
+            pp->length = tempD;
+            foundColon = NO;
+            t->brlensDef = YES;
+            expecting  = Expecting(COMMA);
+            expecting |= Expecting(RIGHTPAR);
+            expecting |= Expecting(LEFTCOMMENT);
+            lastExpecting = expecting;
+            }
+        else    /* taxon identifier */
+            {
+            if (isTranslateDef == YES)
+                {
+                /* we are using the translation table */
+                if (CheckString (transTo, numTranslates, tkn, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find token '%s' in taxon translation table\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                strcpy (tempName, transFrom[index]);
+                if (isTranslateDiff == NO && CheckString (taxaNames, numTaxa, tempName, &index) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Could not find taxon '%s' in list of taxa\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                if (tempSet[index] == YES)
+                    {
+                    MrBayesPrint ("%s   Taxon name '%s' already used in tree\n", spacer, tkn);
+                    if (inSumtCommand == NO && inComparetreeCommand == NO)
+                        FreePolyTree (userTree[treeIndex]);
+                    return (ERROR);
+                    }
+                tempSet[index] = YES;
+                strcpy (pp->label, tempName);
+                pp->index = index;
+                }
+            else
+                {
+                /* Simply use taxon number; first check to see if the name is in the list of taxon names. */
+                if (CheckString (taxaNames, numTaxa, tkn, &index) == ERROR)
+                    {
+                    /* The number could not be found as a taxon name in the list of taxon names. We will
+                        assume that the user has then input taxa as numbers and not the names. */
+                    sscanf (tkn, "%d", &index);
+                    if (index < 1 || index > numTaxa)
+                        {
+                        MrBayesPrint ("%s   Taxon number %d is out of range\n", spacer, index);
+                        if (inSumtCommand == NO && inComparetreeCommand == NO)
+                            FreePolyTree (userTree[treeIndex]);
+                        return (ERROR);
+                        }
+                    index--;
+                    if (tempSet[index] == YES)
+                        {
+                        MrBayesPrint ("%s   Taxon name %d has already been used in tree '%s'\n", spacer, index+1, t->name);
+                        if (inSumtCommand == NO && inComparetreeCommand == NO)
+                            FreePolyTree (userTree[treeIndex]);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    /* The number is in the list of taxon names */
+                    if (index < 0 || index >= numTaxa)
+                        {
+                        MrBayesPrint ("%s   Taxon name %s could not be found\n", spacer, tkn);
+                        if (inSumtCommand == NO && inComparetreeCommand == NO)
+                            FreePolyTree (userTree[treeIndex]);
+                        return (ERROR);
+                        }
+                    if (tempSet[index] == YES)
+                        {
+                        MrBayesPrint ("%s   Taxon %d has already been used in tree '%s'\n", spacer, index+1, t->name);
+                        if (inSumtCommand == NO && inComparetreeCommand == NO)
+                            FreePolyTree (userTree[treeIndex]);
+                        return (ERROR);
+                        }
+                    }
+                tempSet[index] = YES;
+                strcpy (pp->label, taxaNames[index]);
+                pp->index = index;
+                }
+            expecting  = Expecting(COMMA);
+            expecting |= Expecting(COLON);
+            expecting |= Expecting(RIGHTPAR);
+            expecting |= Expecting(LEFTCOMMENT);
+            lastExpecting = expecting;
+            }
+        }
+    else if (expecting == Expecting(LEFTCOMMENT))
+        {
+        expecting = Expecting(AMPERSAND);
+        foundComment = YES;
+        }
+    else if (expecting == Expecting(RIGHTCOMMENT))
+        {
+        if (foundEqual == NO)
+            {
+            /* We may have a complete name of a set of branch parameters, which needs to be recorded */
+            if (foundName == YES)
+                {
+                if (foundE == YES)
+                    {
+                    t->eSetName[t->nESets-1] = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char));
+                    strcat(t->eSetName[t->nESets-1],tempNameString);
+                    }
+                else if (foundB == YES)
+                    {
+                    t->bSetName[t->nBSets-1] = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char));
+                    strcat(t->bSetName[t->nBSets-1],tempNameString);
+                    }
+                else if (foundN == YES)
+                    {
+                    t->popSizeSetName = (char *) SafeCalloc (strlen(tempNameString)+1,sizeof(char));
+                    strcpy(t->popSizeSetName,tempNameString);
+                    }
+                foundName = NO;
+                }
+            expecting = Expecting(EQUALSIGN);
+            }
+        else
+            {
+            if (pp->anc == NULL)
+                {
+                if (pp->left == NULL)
+                    expecting = Expecting(LEFTPAR);
+                else
+                    expecting = Expecting(SEMICOLON);
+                }
+            else if (pp == pp->anc->left)
+                expecting = Expecting(COMMA);
+            else
+                expecting = Expecting(RIGHTPAR);
+            }
+        foundE = foundB = foundN = NO;
+        expecting |= Expecting(LEFTCOMMENT);
+        }
+    else if (expecting == Expecting(AMPERSAND))
+        {
+        foundAmpersand = YES;
+        foundComment = NO;
+        expecting = Expecting (ALPHA);
+        }
+    else if (foundComment == YES)
+        {
+        numComments++;
+        foundComment = NO;
+        }
+    else if (expecting == Expecting(LEFTCURL))
+        {
+        if (foundName == YES)
+            {
+            foundCurly=YES;
+            SafeStrcat (&tempNameString,"{");               
+            expecting = Expecting(NUMBER) | Expecting(ALPHA);
+            }
+        else
+            return(ERROR);
+        }
+    else if (expecting == Expecting(RIGHTCURL))
+        {
+        if (foundName == YES)
+            {
+            SafeStrcat (&tempNameString,"}");
+            foundCurly=NO;
+            if (foundEqual == NO)
+                {
+                /* We are processing a name of a set of branch params in the header of a tree.  */
+                expecting = Expecting(RIGHTCOMMENT);
+                }
+            else
+                {
+                /* We are processing a param value of a branch param set  */
+                expecting = Expecting(NUMBER);
+                }
+            }
+        else
+            return(ERROR);
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int DoUserTree (void)
+{
+    MrBayesPrint ("%s   Usertree command deprecated. Define the tree in a treeblock and use 'Startvals' instead.\n", spacer);
+    return (ERROR);
+}
+
+
+int DoUserTreeParm (char *parmName, char *tkn)
+{
+    if (expecting == Expecting(EQUALSIGN))
+        {
+        expecting = Expecting(LEFTPAR);
+        expecting |= Expecting(RIGHTPAR);
+        expecting |= Expecting(COLON);
+        expecting |= Expecting(NUMBER);
+        expecting |= Expecting(ALPHA);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        expecting = Expecting(LEFTPAR);
+        expecting |= Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        expecting = Expecting(COLON);
+        expecting |= Expecting(COMMA);
+        expecting |= Expecting(RIGHTPAR);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        expecting = Expecting(COLON);
+        expecting |= Expecting(COMMA);
+        expecting |= Expecting(RIGHTPAR);
+        }
+    else if (expecting == Expecting(COLON))
+        {
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        expecting = Expecting(LEFTPAR);
+        expecting |= Expecting(ALPHA);
+        expecting |= Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        expecting = Expecting(RIGHTPAR);
+        expecting |= Expecting(COMMA);
+        expecting |= Expecting(COLON);
+        expecting |= Expecting(SEMICOLON);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%s", parmName); /* just because I am tired of seeing the unused parameter error msg */
+    MrBayesPrint ("%s", tkn);
+}
+
+
+int DoVersion (void)
+{
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+    MrBayesPrint ("   Version                                                                       \n");
+    MrBayesPrint ("                                                                                 \n");
+    MrBayesPrint ("   MrBayes v%s                                                                   \n", VERSION_NUMBER);
+    MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+
+    return (NO_ERROR);
+}
+
+
+BitsLong Expecting (int y)
+{
+    BitsLong x;
+    
+    x = (BitsLong) pow (2.0, (MrBFlt)y);
+    
+    return (x);
+}
+
+
+#ifdef HAVE_LIBREADLINE
+/* This function is for commandline substitution: first word is always a command */
+char *command_generator(const char *text, int state)
+{
+    static int list_index, len;
+    char *command;
+
+    if (state==0) 
+        {
+        list_index=0;
+        len= (int) strlen(text);
+        }
+    while ((command=commands[list_index].string)!=NULL) 
+        {
+        list_index++;
+        if (strncasecmp(command,text,len)==0) 
+            /* memory is freed by the readline library so we need a strdup here */ 
+            return strdup(command);
+        }
+    return (char *)NULL;
+}
+#endif
+
+
+int FindValidCommand (char *tk, int *numMatches)
+{
+    int             i, j, tkLen, targetLen, numDiff;
+    CmdType         *p;
+
+    p = commands + 0;
+    tkLen = (int) strlen(tk);
+
+    (*numMatches) = 0;
+    for (i=0; i<NUMCOMMANDS; i++)
+        {
+        targetLen = (int) strlen(p->string);
+        if (tkLen <= targetLen)
+            {
+            for (j=0, numDiff=0; j<tkLen; j++)
+                {
+                if (ChangeCase(tk[j]) != ChangeCase(p->string[j]))
+                    numDiff++;
+                }
+            if (numDiff == 0)
+                {
+                (*numMatches)++;
+                commandPtr = p;
+                if (tkLen == targetLen)
+                    break;
+                }
+            }
+        p++;
+        }
+
+    inValidCommand = NO;
+    if (*numMatches == 1)
+        {
+        inValidCommand = YES;
+        return (NO_ERROR);
+        }
+    else
+        return (ERROR);
+}
+
+
+int FindValidParam (char *tk, int *numMatches)
+{
+    int         i, j, tkLen, targetLen, numDiff;
+    CmdType     *p;
+    ParmInfoPtr q;
+
+    if (commandPtr)
+        p = commandPtr;
+    else
+        {
+        MrBayesPrint ("%s   Command pointer is NULL\n", spacer);
+        return (ERROR);
+        }
+    tkLen = (int) strlen(tk);
+
+    *numMatches = 0;
+    for (i=0; i<p->numParms; i++)
+        {
+        q = paramTable + (p->parmList[i]);
+        targetLen = (int) strlen(q->string);
+        /* printf ("%s %d (%s %d)\n", q->string, targetLen, tk, p->numParms); */
+        if (!strcmp(q->string, "Xxxxxxxxxx"))
+            {
+            (*numMatches)++;
+            paramPtr = q;
+            }
+        else if (tkLen <= targetLen)
+            {
+            for (j=0, numDiff=0; j<tkLen; j++)
+                {
+                if (ChangeCase(tk[j]) != ChangeCase(q->string[j]))
+                    numDiff++;
+                }
+            if (numDiff == 0)
+                {
+                (*numMatches)++;
+                paramPtr = q;
+                if (tkLen == targetLen)
+                    break;
+                }
+            }   
+        }
+    
+    if (*numMatches == 1)
+        return (NO_ERROR);
+    else
+        return (ERROR);
+}
+
+
+int FreeCharacters (void)
+{
+    int     i, memoryLetFree;
+    
+    memoryLetFree = NO;
+
+    if (memAllocs[ALLOC_TMPSET] == YES)
+        {
+        if (numChar > numTaxa)
+            tempSet = (int *) SafeRealloc ((void *)tempSet, (size_t)numTaxa*sizeof(int));
+            tempSetNeg = (int *) SafeRealloc ((void *)tempSetNeg, (size_t)numTaxa*sizeof(int));
+        }
+    if (memAllocs[ALLOC_MATRIX] == YES)
+        {
+        free (matrix);
+        matrix = NULL;
+        defMatrix = NO;
+        memAllocs[ALLOC_MATRIX] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_CHARINFO] == YES)
+        {
+        free (charInfo);
+        charInfo = NULL;
+        memAllocs[ALLOC_CHARINFO] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_CHARSETS] == YES)
+        {
+        for (i=0; i<numCharSets; i++)
+            {
+            free (charSetNames[i]);
+            free (charSet[i]);
+            }
+        free (charSetNames);
+        free (charSet);
+        charSetNames = NULL;
+        charSet = NULL;
+        numCharSets = 0;
+        memAllocs[ALLOC_CHARSETS] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_PARTITIONS] == YES)
+        {
+        for (i=0; i<numDefinedPartitions; i++)
+            free (partitionNames[i]);
+        free (partitionNames);
+        partitionNames = NULL;
+        for (i=0; i<numChar; i++)
+            free (partitionId[i]);
+        free (partitionId);
+        numDefinedPartitions = 0;
+        memAllocs[ALLOC_PARTITIONS] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_PARTITIONVARS] == YES)
+        {
+        free (numVars);
+        numVars = NULL;
+        free (tempNum);
+        tempNum = NULL;
+        free (activeParams[0]);
+        activeParams[0] = NULL;
+        free (linkTable[0]);
+        linkTable[0] = NULL;
+        tempLinkUnlinkVec = NULL;
+        activeParts = NULL;
+        tempLinkUnlinkVec = NULL;
+        for (i=0; i<NUM_LINKED; i++)
+            {
+            linkTable[i] = NULL;
+            activeParams[i] = NULL;
+            }
+        memAllocs[ALLOC_PARTITIONVARS] = NO;
+        memoryLetFree = YES;
+        }
+
+    ResetCharacterFlags();
+
+    if (memoryLetFree == YES)
+        MrBayesPrint ("%s   Deleting previously defined characters\n", spacer);
+
+    return (NO_ERROR);
+}
+
+
+int FreeMatrix (void)
+{
+    if (FreeCharacters() == ERROR)
+        return ERROR;
+
+    return (FreeTaxa());
+}
+
+
+int FreeTaxa (void)
+{
+    int i, memoryLetFree;
+
+    memoryLetFree = NO;
+    if (memAllocs[ALLOC_TAXA] == YES)
+        {
+        if (taxaNames)
+            {
+            for (i=0; i<taxonCount; i++)
+                free (taxaNames[i]);
+            }
+        free (taxaNames);
+        taxaNames = NULL;
+        free (taxaInfo);
+        taxaInfo = NULL;
+        free (tipCalibration);
+        tipCalibration = NULL;
+        numTaxa = 0;
+        memAllocs[ALLOC_TAXA] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_TMPSET] == YES)
+        {
+        free (tempSet);
+        tempSet = NULL;
+        free (tempSetNeg);
+        tempSetNeg = NULL;
+        memAllocs[ALLOC_TMPSET] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_TAXASETS] == YES)
+        {
+        for (i=0; i<numTaxaSets; i++)
+            {
+            free (taxaSetNames[i]);
+            free (taxaSet[i]);
+            }
+        free (taxaSetNames);
+        taxaSetNames = NULL;
+        free (taxaSet);
+        taxaSet = NULL;
+        numTaxaSets = 0;
+        memAllocs[ALLOC_TAXASETS] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_SPECIESPARTITIONS] == YES)
+        {
+        for (i=0; i<numDefinedSpeciespartitions; i++)
+            free (speciespartitionNames[i]);
+        free (speciespartitionNames);
+        speciespartitionNames = NULL;
+        for (i=0; i<numTaxa; i++)
+            free (speciespartitionId[i]);
+        free (speciespartitionId);
+        speciespartitionId = NULL;
+        numDefinedSpeciespartitions = 0;
+        memAllocs[ALLOC_SPECIESPARTITIONS] = NO;
+        memoryLetFree = YES;
+        }
+    if (memAllocs[ALLOC_CONSTRAINTS] == YES)
+        {
+        for (i=0; i<numDefinedConstraints; i++)
+            {
+            free(definedConstraint[i]);
+            free(definedConstraintTwo[i]);
+            free(definedConstraintPruned[i]);
+            free(definedConstraintTwoPruned[i]);
+            free (constraintNames[i]);
+            }
+        free (definedConstraint);
+        definedConstraint = NULL;
+        free (definedConstraintTwo);
+        definedConstraintTwo = NULL;
+        free (definedConstraintsType);
+        definedConstraintsType = NULL;
+        free (constraintNames);
+        constraintNames = NULL;
+        free (nodeCalibration);
+        nodeCalibration = NULL;
+        numDefinedConstraints = 0;
+        free (tempActiveConstraints);
+        tempActiveConstraints = NULL;
+        memAllocs[ALLOC_CONSTRAINTS] = NO;
+        memoryLetFree = YES;
+        }
+    if (numUserTrees > 0)
+        {
+        MrBayesPrint ("%s   Deleting user trees\n", spacer);
+        for (i=0; i<numUserTrees; i++)
+            {
+            FreePolyTree(userTree[i]);
+            userTree[i] = NULL;
+            }
+        numUserTrees = 0;
+        }
+
+    FreeCharacters();
+
+    if (memoryLetFree == YES)
+        MrBayesPrint ("%s   Deleting previously defined taxa\n", spacer);
+
+    /* reinitialize taxa variables */
+    ResetTaxaFlags();
+
+    return NO_ERROR;
+}
+
+
+int GetNumPartDivisions (int n)
+{
+    int         i, maxDiv, numDivs, *divFound;
+    
+    maxDiv = 0;
+    for (i=0; i<numChar; i++)
+        if (partitionId[i][n] > maxDiv)
+            maxDiv = partitionId[i][n];
+
+    divFound = (int *) SafeCalloc (maxDiv, sizeof(int));
+    
+    for (i=0; i<maxDiv; i++)
+        divFound[i] = NO;
+    
+    for (i=0; i<numChar; i++)
+        divFound[partitionId[i][n]] = YES;
+        
+    numDivs = 0;
+    for (i=0; i<maxDiv; i++)
+        if (divFound[i] == YES)
+            numDivs++;
+    
+    free (divFound);
+
+    return (numDivs + 1);
+}
+
+
+int GetToken (char *token, int *tokenType, char **sourceH)
+{
+    int             allNumbers, foundExp, foundExpSign;
+    register char   *temp;
+    char            *tempMax;
+    
+    (*tokenType) = 0;
+    temp = token;
+    tempMax = temp + CMD_STRING_LENGTH - 10;
+    
+    while (IsWhite(**sourceH) == 1 || IsWhite(**sourceH) == 2)
+        {
+        if (IsWhite(**sourceH) == 2)
+            {
+            *tokenType = RETURNSYMBOL;
+            /* foundNewLine = YES;  Why is this commented out?? */
+            /* MrBayesPrint ("RETURN\n"); */
+            }
+        ++(*sourceH);
+        }
+    
+    if (readWord == YES && **sourceH != '"')
+        {
+        if (**sourceH==';')
+            {
+            *temp++ = ';';
+            *tokenType = SEMICOLON;
+            }
+        else
+            {
+            while (isgraph(**sourceH) && **sourceH!=';')
+                {
+                if (temp > tempMax)
+                    {
+                    *tokenType = NOTHING;
+                    token[20]='\0';
+                    MrBayesPrint ("%s   Error while parsing a string. Token \"%s...[followed by at least %d  more charectors]\" is too long.\n", spacer,token,tempMax-token-20);
+                    MrBayesPrint ("%s   Maximum allowed lenght of a token is %d\n", spacer,tempMax-token);
+                    return (ERROR);
+                    }
+                *temp++ = *(*sourceH)++;
+                }
+            *tokenType = ALPHA;
+            }
+        *temp = '\0';
+        readWord = NO;
+        return (NO_ERROR);;
+        }
+
+    *tokenType = UNKNOWN_TOKEN_TYPE;
+    if (IsIn(**sourceH,"="))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = EQUALSIGN;
+        }
+    else if (IsIn(**sourceH,";"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = SEMICOLON;
+        }
+    else if (IsIn(**sourceH,":"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = COLON;
+        }
+    else if (IsIn(**sourceH,","))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = COMMA;
+        }
+    else if (IsIn(**sourceH,"#"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = POUNDSIGN;
+        }
+    else if (IsIn(**sourceH,"("))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = LEFTPAR;
+        }
+    else if (IsIn(**sourceH,")"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = RIGHTPAR;
+        }
+    else if (IsIn(**sourceH,"{"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = LEFTCURL;
+        }
+    else if (IsIn(**sourceH,"}"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = RIGHTCURL;
+        }
+    else if (IsIn(**sourceH,"["))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = LEFTCOMMENT;
+        }
+    else if (IsIn(**sourceH,"]"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = RIGHTCOMMENT;
+        }
+    else if (IsIn(**sourceH,"?"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = QUESTIONMARK;
+        }
+    else if (IsIn(**sourceH,"-"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = DASH;
+        }
+    else if (IsIn(**sourceH,"$"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = DOLLAR;
+        }
+    else if (IsIn(**sourceH,"\"") && readWord == YES)
+        {
+        (*sourceH)++;
+        while (**sourceH != '"' && **sourceH != '\0')
+            {
+            if (temp > tempMax)
+                {
+                *tokenType = NOTHING;
+                token[20]='\0';
+                MrBayesPrint ("%s   Error while parsing a string. Token \"%s...[followed by at least %d  more charectors]\" is too long.\n", spacer,token,tempMax-token-20);
+                MrBayesPrint ("%s   Maximum allowed lenght of a token is %d\n", spacer,tempMax-token);
+                return (ERROR);
+                }
+            *temp++ = *((*sourceH)++);
+            }
+        *temp='\0';
+        *tokenType = ALPHA;
+        (*sourceH)++;
+        readWord = NO;
+        }
+    else if (IsIn(**sourceH,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789."))
+        {
+        if (IsIn(**sourceH,"0123456789."))
+            allNumbers = TRUE;
+        else
+            allNumbers = FALSE;
+        foundExp = foundExpSign = FALSE;
+        *temp++ = *(*sourceH)++;
+        while (IsIn(**sourceH,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789.-+"))
+            {
+            if (temp > tempMax)
+                {
+                *tokenType = NOTHING;
+                token[20]='\0';
+                MrBayesPrint ("%s   Error while parsing a string. Token \"%s...[followed by at least %d  more charectors]\" is too long.\n", spacer,token,tempMax-token-20);
+                MrBayesPrint ("%s   Maximum allowed lenght of a token is %d\n", spacer,tempMax-token);
+                return (ERROR);
+                }
+            if (allNumbers == TRUE && !IsIn((*sourceH)[-1],"Ee") && **sourceH=='-')
+                break;
+            else if (allNumbers == TRUE && IsIn(**sourceH,"Ee") && foundExp == NO)
+                foundExp = TRUE;
+            else if (allNumbers == TRUE && IsIn(**sourceH,"+-") && IsIn((*sourceH)[-1],"Ee"))
+                foundExpSign = TRUE;
+            else if (!IsIn(**sourceH,"0123456789."))
+                allNumbers = FALSE;
+            *temp++ = *(*sourceH)++;
+            }
+        if (allNumbers == TRUE)
+            *tokenType = NUMBER;
+        else
+            *tokenType = ALPHA;
+        }
+    else if (IsIn(**sourceH,"*"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = ASTERISK;
+        }
+    else if (IsIn(**sourceH,"/"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = FORWARDSLASH;
+        }
+    else if (IsIn(**sourceH,"'\\'"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = BACKSLASH;
+        }
+    else if (IsIn(**sourceH,"!"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = EXCLAMATIONMARK;
+        }
+    else if (IsIn(**sourceH,"%"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = PERCENT;
+        }
+    else if (IsIn(**sourceH,"\""))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = QUOTATIONMARK;
+        }
+    else if (IsIn(**sourceH,"&"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = AMPERSAND;
+        }
+    else if (IsIn(**sourceH,"~+^@{}`><"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = WEIRD;
+        }
+    else if (IsIn(**sourceH,"|"))
+        {
+        *temp++ = *(*sourceH)++;
+        *tokenType = VERTICALBAR;
+        }
+
+    *temp = '\0';
+    return (NO_ERROR);
+}
+
+
+int GetUserHelp (char *helpTkn)
+{
+    int         i, j, k, tempInt;
+    char        tempString[100];
+    Model       *mp;
+    
+    if (!strcmp(helpTkn, "Begin"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Begin                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to format data or commands in the program. The correct   \n");
+        MrBayesPrint ("   usage is                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin <data or mrbayes>;                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The two valid uses of the \"begin\" command, then, are                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("      begin mrbayes;                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The \"data\" specifier is used to specify the beginning of a data block; your \n");
+        MrBayesPrint ("   character data should follow. For example, the following is an example of     \n");
+        MrBayesPrint ("   a data block for four taxa and ten DNA sites:                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("         dimensions ntax=4 nchar=10;                                             \n");
+        MrBayesPrint ("         format datatype=dna;                                                    \n");
+        MrBayesPrint ("         matrix                                                                  \n");
+        MrBayesPrint ("         taxon_1  AACGATTCGT                                                     \n");
+        MrBayesPrint ("         taxon_2  AAGGATTCCA                                                     \n");
+        MrBayesPrint ("         taxon_3  AACGACTCCT                                                     \n");
+        MrBayesPrint ("         taxon_4  AAGGATTCCT                                                     \n");
+        MrBayesPrint ("         ;                                                                       \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The other commands -- dimensions, format, and matrix -- are discussed         \n");
+        MrBayesPrint ("   in the appropriate help menu. The only thing to note here is that the         \n");
+        MrBayesPrint ("   block begins with a \"begin data\" command. The \"mrbayes\" command is        \n");
+        MrBayesPrint ("   used to enter commands specific to the MrBayes program into the file.         \n");
+        MrBayesPrint ("   This allows you to automatically process commands on execution of the         \n");
+        MrBayesPrint ("   program. The following is a simple mrbayes block:                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin mrbayes;                                                             \n");
+        MrBayesPrint ("         charset first  = 1-10\\3;                                               \n");
+        MrBayesPrint ("         charset second = 2-10\\3;                                               \n");
+        MrBayesPrint ("         charset third  = 3-10\\3;                                               \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This mrbayes block sets off the three \"charset\" commands, used to           \n");
+        MrBayesPrint ("   predefine some blocks of characters. The mrbayes block can be very useful.    \n");
+        MrBayesPrint ("   For example, in this case, it would save you the time of typing the char-     \n");
+        MrBayesPrint ("   acter sets each time you executed the file. Also, note that every             \n");
+        MrBayesPrint ("   \"begin <data or mrbayes>\" command ends with an \"end\". Finally, you can    \n");
+        MrBayesPrint ("   have so-called foreign blocks in the file. An example of a foreign block      \n");
+        MrBayesPrint ("   would be \"begin paup\". The program will simply skip this block. This is     \n");
+        MrBayesPrint ("   useful because it means that you can use the same file for MrBayes, PAUP*     \n");
+        MrBayesPrint ("   or MacClade (although it isn't clear why you would want to use those other    \n");
+        MrBayesPrint ("   programs).                                                                    \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "End"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   End                                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to terminate a data or mrbayes block. The correct        \n");
+        MrBayesPrint ("   usage is                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For more information on this, check the help for the \"begin\" command.       \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Endblock"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Endblock                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This is an older, deprecated version of \"End\", see that command.            \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Plot"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Plot                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command plots specified parameters in the .p file or one of the .p files \n");
+        MrBayesPrint ("   created during an MCMC analysis. An x-y graph of the parameter over the course\n");
+        MrBayesPrint ("   of the chain is created. The command can be useful for visually diagnosing    \n");
+        MrBayesPrint ("   convergence for many of the parameters of the phylogenetic model. The para-   \n");
+        MrBayesPrint ("   meter to be plotted is specified by the \"parameter\" option. Several para-   \n");
+        MrBayesPrint ("   meters can be plotted at once by using the \"match\" option, which has a      \n");
+        MrBayesPrint ("   default value of \"perfect\". For example, if you were to set \"parameter = pi\"\n");
+        MrBayesPrint ("   and \"match = consistentwith\", then all of the state frequency parameters    \n");
+        MrBayesPrint ("   would be plotted. You can also set \"match=all\", in which case all of the    \n");
+        MrBayesPrint ("   parameters are plotted.                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that the \"Sump\" command provides a different set of convergence diag-  \n");
+        MrBayesPrint ("   nostics tools that you may also want to explore. Unlike \"Plot\", \"Sump\" can\n");
+        MrBayesPrint ("   compare two or more parameter samples and will calculate convergence diagnos- \n");
+        MrBayesPrint ("   tics as wel as parameter summaries for the pooled sample.                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Relburnin     -- If this option is set to 'Yes', then a proportion of the     \n");
+        MrBayesPrint ("                    samples will be discarded as burnin when creating the plot.  \n");
+        MrBayesPrint ("                    The proportion to be discarded is set with Burninfrac (see   \n");
+        MrBayesPrint ("                    Burninfrac below). When the Relburnin option is set to 'No', \n");
+        MrBayesPrint ("                    then a specific number of samples is discarded instead. This \n");
+        MrBayesPrint ("                    number is set by Burnin (see below). Note that the burnin    \n");
+        MrBayesPrint ("                    setting is shared across the 'comparetree', 'sump' and 'sumt'\n");
+        MrBayesPrint ("                    commands.                                                    \n");
+        MrBayesPrint ("   Burnin        -- Determines the number of samples (not generations) that will \n");
+        MrBayesPrint ("                    be discarded when summary statistics are calculated. The     \n");
+        MrBayesPrint ("                    value of this option is only relevant when Relburnin is set  \n");
+        MrBayesPrint ("                    to 'No'.                                                     \n");
+        MrBayesPrint ("   Burninfrac    -- Determines the fraction of samples that will be discarded    \n");
+        MrBayesPrint ("                    when creating a plot. The value of this parameter is only    \n");
+        MrBayesPrint ("                    relevant when Relburnin is set to 'Yes'. Example: A value of \n");
+        MrBayesPrint ("                    this option of 0.25 means that 25%% of the samples will be   \n");
+        MrBayesPrint ("                    discarded.                                                   \n");
+        MrBayesPrint ("   Filename      -- The name of the file to plot.                                \n");
+        MrBayesPrint ("   Parameter     -- Specification of parameters to be plotted. See above for     \n");
+        MrBayesPrint ("                    details.                                                     \n");
+        MrBayesPrint ("   Match         -- Specifies how to match parameter names to the Parameter      \n");
+        MrBayesPrint ("                    specification. See above for details.                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter       Options                      Current Setting                  \n");
+        MrBayesPrint ("   ------------------------------------------------------------                  \n");
+        MrBayesPrint ("   Relburnin       Yes/No                       %s                               \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
+        MrBayesPrint ("   Burnin          <number>                     %d                               \n", chainParams.chainBurnIn);
+        MrBayesPrint ("   Burninfrac      <number>                     %1.2lf                           \n", chainParams.burninFraction);
+        MrBayesPrint ("   Filename        <name>                       %s                               \n", plotParams.plotFileName);
+        MrBayesPrint ("   Parameter       <name>                       %s                               \n", plotParams.parameter);
+        MrBayesPrint ("   Match           Perfect/Consistentwith/All   %s                               \n", plotParams.match);
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Dimensions"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Dimensions                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used in a data block to define the number of taxa and         \n");
+        MrBayesPrint ("   characters. The correct usage is                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      dimensions ntax=<number> nchar=<number>                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The dimensions must be the first command in a data block. The following       \n");
+        MrBayesPrint ("   provides an example of the proper use of this command:                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("         dimensions ntax=4 nchar=10;                                             \n");
+        MrBayesPrint ("         format datatype=dna;                                                    \n");
+        MrBayesPrint ("         matrix                                                                  \n");
+        MrBayesPrint ("         taxon_1  AACGATTCGT                                                     \n");
+        MrBayesPrint ("         taxon_2  AAGGATTCCA                                                     \n");
+        MrBayesPrint ("         taxon_3  AACGACTCCT                                                     \n");
+        MrBayesPrint ("         taxon_4  AAGGATTCCT                                                     \n");
+        MrBayesPrint ("         ;                                                                       \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Here, the dimensions command tells MrBayes to expect a matrix with four       \n");
+        MrBayesPrint ("   taxa and 10 characters.                                                       \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Format"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Format                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used in a data block to define the format of the char-        \n");
+        MrBayesPrint ("   acter matrix. The correct usage is                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      format datatype=<name> ... <parameter>=<option>                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The format command must be the second command in a data block. The following  \n");
+        MrBayesPrint ("   provides an example of the proper use of this command:                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("         dimensions ntax=4 nchar=10;                                             \n");
+        MrBayesPrint ("         format datatype=dna gap=-;                                              \n");
+        MrBayesPrint ("         matrix                                                                  \n");
+        MrBayesPrint ("         taxon_1  AACGATTCGT                                                     \n");
+        MrBayesPrint ("         taxon_2  AAGGAT--CA                                                     \n");
+        MrBayesPrint ("         taxon_3  AACGACTCCT                                                     \n");
+        MrBayesPrint ("         taxon_4  AAGGATTCCT                                                     \n");
+        MrBayesPrint ("         ;                                                                       \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Here, the format command tells MrBayes to expect a matrix with DNA char-      \n");
+        MrBayesPrint ("   acters and with gaps coded as \"-\".                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The following are valid options for format:                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Datatype   -- This parameter MUST BE INCLUDED in the format command. More-    \n");
+        MrBayesPrint ("                 over, it must be the first parameter in the line. The           \n");
+        MrBayesPrint ("                 datatype command specifies what type of characters are          \n");
+        MrBayesPrint ("                 in the matrix. The following are valid options:                 \n");
+        MrBayesPrint ("                    Datatype = Dna: DNA states (A,C,G,T,R,Y,M,K,S,W,H,B,         \n");
+        MrBayesPrint ("                               V,D,N)                                            \n");
+        MrBayesPrint ("                    Datatype = Rna: DNA states (A,C,G,U,R,Y,M,K,S,W,H,B,         \n");
+        MrBayesPrint ("                               V,D,N)                                            \n");
+        MrBayesPrint ("                    Datatype = Protein: Amino acid states (A,R,N,D,C,Q,E,        \n");
+        MrBayesPrint ("                               G,H,I,L,K,M,F,P,S,T,W,Y,V)                        \n");
+        MrBayesPrint ("                    Datatype = Restriction: Restriction site (0,1) states        \n");
+        MrBayesPrint ("                    Datatype = Standard: Morphological (0,1) states              \n");
+        MrBayesPrint ("                    Datatype = Continuous: Real number valued states             \n");
+        MrBayesPrint ("                    Datatype = Mixed(<type>:<range>,...,<type>:<range>): A       \n");
+        MrBayesPrint ("                               mixture of the above datatypes. For example,      \n");
+        MrBayesPrint ("                               \"datatype=mixed(dna:1-100,protein:101-200)\"     \n");
+        MrBayesPrint ("                               would specify a mixture of DNA and amino acid     \n");
+        MrBayesPrint ("                               characters with the DNA characters occupying      \n");
+        MrBayesPrint ("                               the first 100 sites and the amino acid char-      \n");
+        MrBayesPrint ("                               acters occupying the last 100 sites.              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Interleave -- This parameter specifies whether the data matrix is in          \n");
+        MrBayesPrint ("                 interleave format. The valid options are \"Yes\" or \"No\",     \n");
+        MrBayesPrint ("                 with \"No\" as the default. An interleaved matrix looks like    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    format datatype=dna gap=- interleave=yes;                    \n");
+        MrBayesPrint ("                    matrix                                                       \n");
+        MrBayesPrint ("                    taxon_1  AACGATTCGT                                          \n");
+        MrBayesPrint ("                    taxon_2  AAGGAT--CA                                          \n");
+        MrBayesPrint ("                    taxon_3  AACGACTCCT                                          \n");
+        MrBayesPrint ("                    taxon_4  AAGGATTCCT                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    taxon_1  CCTGGTAC                                            \n");
+        MrBayesPrint ("                    taxon_2  CCTGGTAC                                            \n");
+        MrBayesPrint ("                    taxon_3  ---GGTAG                                            \n");
+        MrBayesPrint ("                    taxon_4  ---GGTAG                                            \n");
+        MrBayesPrint ("                    ;                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Gap        -- This parameter specifies the format for gaps. Note that         \n");
+        MrBayesPrint ("                 gap character can only be a single character and that it        \n");
+        MrBayesPrint ("                 cannot correspond to a standard state (e.g., A,C,G,T,R,Y,       \n");
+        MrBayesPrint ("                 M,K,S,W,H,B,V,D,N for nucleotide data).                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Missing    -- This parameter specifies the format for missing data. Note      \n");
+        MrBayesPrint ("                 that the missing character can only be a single character and   \n");
+        MrBayesPrint ("                 cannot correspond to a standard state (e.g., A,C,G,T,R,Y,       \n");
+        MrBayesPrint ("                 M,K,S,W,H,B,V,D,N for nucleotide data). This is often an        \n");
+        MrBayesPrint ("                 unnecessary parameter to set because many data types, such      \n");
+        MrBayesPrint ("                 as nucleotide or amino acid, already have a missing char-       \n");
+        MrBayesPrint ("                 acter specified. However, for morphological or restriction      \n");
+        MrBayesPrint ("                 site data, \"missing=?\" is often used to specify ambiguity     \n");
+        MrBayesPrint ("                 or unobserved data.                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Matchchar  -- This parameter specifies the matching character for the         \n");
+        MrBayesPrint ("                 matrix. For example,                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    format datatype=dna gap=- matchchar=.;                       \n");
+        MrBayesPrint ("                    matrix                                                       \n");
+        MrBayesPrint ("                    taxon_1  AACGATTCGT                                          \n");
+        MrBayesPrint ("                    taxon_2  ..G...--CA                                          \n");
+        MrBayesPrint ("                    taxon_3  .....C..C.                                          \n");
+        MrBayesPrint ("                    taxon_4  ..G.....C.                                          \n");
+        MrBayesPrint ("                    ;                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                 is equivalent to                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    format datatype=dna gap=-;                                   \n");
+        MrBayesPrint ("                    matrix                                                       \n");
+        MrBayesPrint ("                    taxon_1  AACGATTCGT                                          \n");
+        MrBayesPrint ("                    taxon_2  AAGGAT--CA                                          \n");
+        MrBayesPrint ("                    taxon_3  AACGACTCCT                                          \n");
+        MrBayesPrint ("                    taxon_4  AAGGATTCCT                                          \n");
+        MrBayesPrint ("                    ;                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The only non-standard NEXUS format option is the use of the \"mixed\",        \n");
+        MrBayesPrint ("   \"restriction\", \"standard\" and \"continuous\" datatypes. Hence, if         \n");
+        MrBayesPrint ("   you use any of these datatype specifiers, a program like PAUP* or             \n");
+        MrBayesPrint ("   MacClade will report an error (as they should because MrBayes is not          \n");
+        MrBayesPrint ("   strictly NEXUS compliant).                                                    \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Matrix"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Matrix                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command specifies the actual data for the phylogenetic analysis.         \n");
+        MrBayesPrint ("   The character matrix should follow the dimensions and format commands         \n");
+        MrBayesPrint ("   in a data block. The matrix can have all of the characters for a taxon        \n");
+        MrBayesPrint ("   on a single line:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("         dimensions ntax=4 nchar=10;                                             \n");
+        MrBayesPrint ("         format datatype=dna gap=-;                                              \n");
+        MrBayesPrint ("         matrix                                                                  \n");
+        MrBayesPrint ("         taxon_1  AACGATTCGT                                                     \n");
+        MrBayesPrint ("         taxon_2  AAGGAT--CA                                                     \n");
+        MrBayesPrint ("         taxon_3  AACGACTCCT                                                     \n");
+        MrBayesPrint ("         taxon_4  AAGGATTCCT                                                     \n");
+        MrBayesPrint ("         ;                                                                       \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or be in \"interleaved\" format:                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("         dimensions ntax=4 nchar=20;                                             \n");
+        MrBayesPrint ("         format datatype=dna gap=- interleave=yes;                               \n");
+        MrBayesPrint ("         matrix                                                                  \n");
+        MrBayesPrint ("         taxon_1  AACGATTCGT                                                     \n");
+        MrBayesPrint ("         taxon_2  AAGGAT--CA                                                     \n");
+        MrBayesPrint ("         taxon_3  AACGACTCCT                                                     \n");
+        MrBayesPrint ("         taxon_4  AAGGATTCCT                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("         taxon_1  TTTTCGAAGC                                                     \n");
+        MrBayesPrint ("         taxon_2  TTTTCGGAGC                                                     \n");
+        MrBayesPrint ("         taxon_3  TTTTTGATGC                                                     \n");
+        MrBayesPrint ("         taxon_4  TTTTCGGAGC                                                     \n");
+        MrBayesPrint ("         ;                                                                       \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that the taxon names must not have spaces. If you really want to         \n");
+        MrBayesPrint ("   indicate a space in a taxon name (perhaps between a genus and species         \n");
+        MrBayesPrint ("   name), then you might use an underline (\"_\"). There should be at            \n");
+        MrBayesPrint ("   least a single space after the taxon name, separating the name from           \n");
+        MrBayesPrint ("   the actual data on that line. There can be spaces between the char-           \n");
+        MrBayesPrint ("   acters.                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   If you have mixed data, then you specify all of the data in the same          \n");
+        MrBayesPrint ("   matrix. Here is an example that includes two different data types:            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      begin data;                                                                \n");
+        MrBayesPrint ("         dimensions ntax=4 nchar=20;                                             \n");
+        MrBayesPrint ("         format datatype=mixed(dna:1-10,standard:21-30) interleave=yes;          \n");
+        MrBayesPrint ("         matrix                                                                  \n");
+        MrBayesPrint ("         taxon_1  AACGATTCGT                                                     \n");
+        MrBayesPrint ("         taxon_2  AAGGAT--CA                                                     \n");
+        MrBayesPrint ("         taxon_3  AACGACTCCT                                                     \n");
+        MrBayesPrint ("         taxon_4  AAGGATTCCT                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("         taxon_1  0001111111                                                     \n");
+        MrBayesPrint ("         taxon_2  0111110000                                                     \n");
+        MrBayesPrint ("         taxon_3  1110000000                                                     \n");
+        MrBayesPrint ("         taxon_4  1000001111                                                     \n");
+        MrBayesPrint ("         ;                                                                       \n");
+        MrBayesPrint ("      end;                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The matrix command is terminated by a semicolon.                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Finally, just a note on data presentation. It is much easier for others       \n");
+        MrBayesPrint ("   to (1) understand your data and (2) repeat your analyses if you make          \n");
+        MrBayesPrint ("   your data clean, comment it liberally (using the square brackets), and        \n");
+        MrBayesPrint ("   embed the commands you used in a publication in the mrbayes block.            \n");
+        MrBayesPrint ("   Remember that the data took a long time for you to collect. You might         \n");
+        MrBayesPrint ("   as well spend a little time making the data file look nice and clear to       \n");
+        MrBayesPrint ("   any that may later request the data for further analysis.                     \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Pairs"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Pairs                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to specify pairs of nucleotides. For example, your       \n");
+        MrBayesPrint ("   data may be RNA sequences with a known secondary structure of stems and       \n");
+        MrBayesPrint ("   loops. Substitutions in nucleotides involved in a Watson-Crick pairing        \n");
+        MrBayesPrint ("   in stems are not strictly independent; a change in one changes the prob-      \n");
+        MrBayesPrint ("   ability of a change in the partner. A solution to this problem is to          \n");
+        MrBayesPrint ("   expand the model around the pair of nucleotides in the stem. This             \n");
+        MrBayesPrint ("   command allows you to do this. The correct usage is:                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      pairs <NUC1>:<NUC2>, <NUC1>:<NUC2>,..., <NUC1>:<NUC2>;                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example,                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      pairs 30:56, 31:55, 32:54, 33:53, 34:52, 35:51, 36:50;                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   specifies pairings between nucleotides 30 and 56, 31 and 55, etc. Only        \n");
+        MrBayesPrint ("   nucleotide data (DNA or RNA) may be paired using this command. Note that      \n");
+        MrBayesPrint ("   in order for the program to actually implement a \"doublet\" model            \n");
+        MrBayesPrint ("   involving a 16 X 16 rate matrix, you must specify that the structure of       \n");
+        MrBayesPrint ("   the model is 16 X 16 using \"lset nucmodel=doublet\".                         \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Databreaks"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Databreaks                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to specify breaks in your input data matrix. Your        \n");
+        MrBayesPrint ("   data may be a mixture of genes or a mixture of different types of data.       \n");
+        MrBayesPrint ("   Some of the models implemented by MrBayes account for nonindependence at      \n");
+        MrBayesPrint ("   adjacent characters. The autocorrelated gamma model, for example, allows      \n");
+        MrBayesPrint ("   rates at adjacent sites to be correlated. However, there is no way for        \n");
+        MrBayesPrint ("   such a model to tell whether two sites, adjacent in the matrix, are           \n");
+        MrBayesPrint ("   actually separated by many kilobases or megabases in the genome. The          \n");
+        MrBayesPrint ("   databreaks command allows you to specify such breaks. The correct             \n");
+        MrBayesPrint ("   usage is:                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      databreaks <break 1> <break 2> <break 3> ...                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example, say you have a data matrix of 3204 characters that include       \n");
+        MrBayesPrint ("   nucleotide data from three genes. The first gene covers characters 1 to       \n");
+        MrBayesPrint ("   970, the second gene covers characters 971 to 2567, and the third gene        \n");
+        MrBayesPrint ("   covers characters 2568 to 3204. Also, let's assume that the genes are         \n");
+        MrBayesPrint ("   not directly adjacent to one another in the genome, as might be likely        \n");
+        MrBayesPrint ("   if you have mitochondrial sequences. In this case, you can specify            \n");
+        MrBayesPrint ("   breaks between the genes using:                                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      databreaks 970 2567;                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The first break, between genes one and two, is after character 970 and        \n");
+        MrBayesPrint ("   the second break, between genes two and three, is after character 2567.       \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Acknowledgments"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Acknowledgments                                                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the authors' acknowledgments.                              \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "About"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   About                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command provides some general information about the program.             \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Version"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Version                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the release version of the program.                        \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Citations"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Citations                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows a thorough list of citations you may consider using        \n");
+        MrBayesPrint ("   when publishing the results of a MrBayes analysis.                            \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showmatrix"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showmatrix                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the character matrix currently in memory.                  \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showbeagle"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showbeagle                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows available BEAGLE resources.                                \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Speciespartition"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Speciespartition                                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Defines a partition of tips into species. The format for the speciespartition \n");
+        MrBayesPrint ("   command is                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      Speciespartition <name> = <species name>:<taxon list> ,...,<sp nm>:<tx lst>\n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The command enumerates comma separated list of pairs consisting of 'species   \n");
+        MrBayesPrint ("   name' and 'taxon list'. The 'taxon list' is a standard taxon list, as used by \n");
+        MrBayesPrint ("   the 'Taxset' command. This means that you can use either the index or the name\n");
+        MrBayesPrint ("   of a sequence ('taxon'). Ranges are specified using a dash, and a period can  \n");
+        MrBayesPrint ("   be used as a synonym of the last sequence in the matrix.                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For exammple: speciespartition species = SpeciesA: 1, SpeciesB: 2-.           \n");
+        MrBayesPrint ("   Here, we name two species. SpeciesA is represented by a single sequence while \n");
+        MrBayesPrint ("   SpeciesB is represented by all remaining sequences in the matrix.             \n");
+        MrBayesPrint ("   Each sequence is specified by its row index in the data matrix.               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   As with ordinary partitioning you may define multiple species partitioning    \n");
+        MrBayesPrint ("   scheme. You have to use command 'set speciespartition' to enable use of one of\n");
+        MrBayesPrint ("   them.                                                                         \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Currently defined Speciespartitions:                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Number  Speciespartition name        Number of species                        \n");
+        MrBayesPrint ("   --------------------------------------------------------------------------    \n");
+        for (i=0; i<numDefinedSpeciespartitions; i++)
+            {
+            tempInt=0;
+            for (j=0; j<numTaxa; j++)
+                {
+                if (tempInt < speciespartitionId[j][i])
+                    tempInt = speciespartitionId[j][i];
+                }
+            MrBayesPrint ("   %4d    %-24.24s   %4d",i+1, speciespartitionNames[i], tempInt);
+            MrBayesPrint ("\n");
+            }
+        MrBayesPrint ("                                                                                \n");
+        MrBayesPrint ("   --------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Constraint"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Constraint                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command defines a tree constraint. The format for the constraint         \n");
+        MrBayesPrint ("   command is                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      constraint <name> [hard|negative|partial] = <taxon list> [:<taxon list>]   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   There are three types of constraint implemented in MrBayes. The type of the   \n");
+        MrBayesPrint ("   constraint is specified by using one of the three keywords 'hard', 'negative',\n");
+        MrBayesPrint ("   or 'partial' right after the name of the constraint. If no type is specified, \n");
+        MrBayesPrint ("   then the constraint is assumed to be 'hard'.                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   In a rooted tree, a 'hard' constraint forces the taxa in the list to form a   \n");
+        MrBayesPrint ("   monophyletic group. In an unrooted tree, the taxon split that separates the   \n");
+        MrBayesPrint ("   taxa in the list from other taxa is forced to be present. The interpretation  \n");
+        MrBayesPrint ("   of this depends on whether the tree is rooted on a taxon outside the list or  \n");
+        MrBayesPrint ("   a taxon in the list. If the outgroup is excluded , the taxa in the list are   \n");
+        MrBayesPrint ("   assumed to form a monophyletic group, but if the outgroup is included, the    \n");
+        MrBayesPrint ("   taxa that are not in the list are forced together.                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A 'negative' constraint bans all the trees that have the listed taxa in the   \n");
+        MrBayesPrint ("   same subtree. In other words, it is the opposite of a hard constraint.        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A 'partial' or backbone constraint is defined in terms of two sets of taxa    \n");
+        MrBayesPrint ("   separated by a colon character. The constraint forces all taxa in the first   \n");
+        MrBayesPrint ("   list to form a monophyletic group that does not include any taxon in the      \n");
+        MrBayesPrint ("   second list. Taxa that are not included in either list can be placed in any   \n");
+        MrBayesPrint ("   position on the tree, either inside or outside the constrained group. In an   \n");
+        MrBayesPrint ("   unrooted tree, the two taxon lists can be switched with each other with no    \n");
+        MrBayesPrint ("   effect. For a rooted tree, it is the taxa in the first list that have to be   \n");
+        MrBayesPrint ("   monophyletic, that is, these taxa must share a common ancestor not shared with\n");
+        MrBayesPrint ("   any taxon in the second list. The taxa in the second list may or may not fall \n");
+        MrBayesPrint ("   in a monophyletic group depending on the rooting of the tree.                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A list of taxa can be specified using a taxset, taxon names, taxon numbers, or\n");
+        MrBayesPrint ("   any combination of the above, sepatated by spaces. The constraint is treated  \n");
+        MrBayesPrint ("   as an absolute requirement of trees, that is, trees that are not compatible   \n");
+        MrBayesPrint ("   with the constraint have zero prior (and hence zero posterior) probabilty.    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   If you are interested in inferring ancestral states for a particular node,    \n");
+        MrBayesPrint ("   you need to 'hard' constrain that node first using the 'constraint' command.  \n");
+        MrBayesPrint ("   The same applies if you wish to calibrate an interior node in a dated         \n");
+        MrBayesPrint ("   analysis. For more information on how to infer ancestral states, see the help \n");
+        MrBayesPrint ("   for the 'report' command. For more on dating, see the 'calibrate' command.    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   It is important to note that simply defining a constraint using this          \n");
+        MrBayesPrint ("   command is not sufficient for the program to actually implement the           \n");
+        MrBayesPrint ("   constraint in an analysis. You must also enforce the constraints using        \n");
+        MrBayesPrint ("   'prset topologypr = constraints (<list of constraints>)'. For more infor-     \n");
+        MrBayesPrint ("   mation on this, see the help on the 'prset' command.                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Examples:                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      constraint myclade = Homo Pan Gorilla                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Defines a hard constraint forcing Homo, Pan, and Gorilla to form a mono-      \n");
+        MrBayesPrint ("   phyletic group or a split that does not include any other taxa.               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      constraint forbiddenclade negative = Homo Pan Gorilla                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Defines a negative constraint that associates all trees where Homon, Pan, and \n");
+        MrBayesPrint ("   Gorilla form a monophyletic group with zero posterior probability. In other   \n");
+        MrBayesPrint ("   words, such trees will not be sampled during MCMC.                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      constraint backbone partial = Homo Gorilla : Mus                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Defines a partial constraint that keeps Mus outside of the clade defined by   \n");
+        MrBayesPrint ("   the most recent common ancestor of Homo and Gorilla. Other taxa are allowed to\n");
+        MrBayesPrint ("   sit anywhere in the tree. Note that this particular constraint is meaningless \n");
+        MrBayesPrint ("   in unrooted trees. MrBayes does not assume anything about the position of the \n");
+        MrBayesPrint ("   outgroup unless it is explicitly included in the partial constraint. Therefore\n");
+        MrBayesPrint ("   a partial constraint must have at least two taxa on each side of the ':' to be\n");
+        MrBayesPrint ("   useful in analyses of unrooted trees. The case is different for rooted trees, \n");
+        MrBayesPrint ("   where it is sufficient for a partial constraint to have more than one taxon   \n");
+        MrBayesPrint ("   before the ':', as in the example given above, to constrain tree space.       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   To define a more complex constraint tree, simply combine constraints into a   \n");
+        MrBayesPrint ("   list when issuing the 'prset topologypr' command.                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        if (numDefinedConstraints > 0)
+            {
+            MrBayesPrint ("   Currently defined constraints:                                                \n");
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   Number  Constraint name          type      Number of taxa in[:out]            \n");
+            MrBayesPrint ("   --------------------------------------------------------------------------    \n");       
+            }
+        for (i=0; i<numDefinedConstraints; i++)
+            {
+            strncpy (tempString, constraintNames[i], 22);
+            MrBayesPrint ("   %4d    %-22.22s   ",i+1, tempString);
+            if (definedConstraintsType[i] == HARD)
+                MrBayesPrint ("hard      ");
+            else if (definedConstraintsType[i] == PARTIAL)
+                MrBayesPrint ("partial   ");
+            else
+                {
+                assert (definedConstraintsType[i] == NEGATIVE);
+                MrBayesPrint ("negative  ");
+                }
+            k = NumBits (definedConstraint[i], numTaxa/nBitsInALong + 1);
+            MrBayesPrint ("%d", k);
+            if (definedConstraintsType[i] == PARTIAL)
+                {
+                k = NumBits (definedConstraintTwo[i], numTaxa/nBitsInALong + 1);
+                MrBayesPrint (":%d", k);
+                }
+        MrBayesPrint ("\n");
+            }
+        MrBayesPrint ("                                                                                \n");
+        MrBayesPrint ("   --------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Calibrate"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Calibrate                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command dates a terminal or interior node in the tree. The format is     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      calibrate <node_name> = <age_prior>                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   where <node_name> is the name of a defined interior constraint node or the    \n");
+        MrBayesPrint ("   name of a terminal node (tip) and <age_prior> is a prior probability distribu-\n");
+        MrBayesPrint ("   tion on the age of the node. The latter can either be a fixed date or a date  \n");
+        MrBayesPrint ("   drawn from one of the available prior probability distributions. In general,  \n");
+        MrBayesPrint ("   the available prior probability distributions are parameterized in terms of   \n");
+        MrBayesPrint ("   the expected mean age of the distribution to facilitate for users. Some dis-  \n");
+        MrBayesPrint ("   tributions put a positive probability on all ages above 0.0, while others in- \n");
+        MrBayesPrint ("   clude a minimum-age constraint and sometimes a maximum-age constraint. The    \n");
+        MrBayesPrint ("   available distributions and their parameters are:                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      calibrate <node_name> = fixed(<age>)                                       \n");
+        MrBayesPrint ("      calibrate <node_name> = uniform(<min_age>,<max_age>)                       \n");
+        MrBayesPrint ("      calibrate <node_name> = offsetexponential(<min_age>,<mean_age>)            \n");
+        MrBayesPrint ("      calibrate <node_name> = truncatednormal(<min_age>,<mean_age>,<stdev>)      \n");
+        MrBayesPrint ("      calibrate <node_name> = lognormal(<mean_age>,<stdev>)                      \n");
+        MrBayesPrint ("      calibrate <node_name> = offsetlognormal(<min_age>,<mean_age>,<stdev>)      \n");
+        MrBayesPrint ("      calibrate <node_name> = gamma(<mean_age>,<stdev>)                          \n");
+        MrBayesPrint ("      calibrate <node_name> = offsetgamma(<min_age>,<mean_age>,<stdev>)          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that mean_age is always the mean age and stdev the standard deviation of \n");
+        MrBayesPrint ("   the distribution measured in user-defined time units. This way of specifying  \n");
+        MrBayesPrint ("   the distribution parameters is often different from the parameterization used \n");
+        MrBayesPrint ("   elsewhere in the program. For instance, the standard parameters of the gamma  \n");
+        MrBayesPrint ("   distribution used by MrBayes are shape (alpha) and rate (beta). If you want   \n");
+        MrBayesPrint ("   to use the standard parameterization, the conversions are as follows:         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exponential distributon: mean    = 1 / rate                                \n");
+        MrBayesPrint ("      gamma distributon:       mean    = alpha / beta                            \n");
+        MrBayesPrint ("                               st.dev. = square_root (alpha / beta^2)            \n");
+        MrBayesPrint ("      lognormal distributon:   mean    = exp (mean_log + st.dev._log^2/2)        \n");
+        MrBayesPrint ("                               st.dev. = square_root ((exp (st.dev._log^2) - 1)  \n");
+        MrBayesPrint ("                                         * (exp (2*mean_log + st.dev._log^2))    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The truncated normal distribution is an exception in that the mean_age and    \n");
+        MrBayesPrint ("   stdev parameters are the mean and standard deviation of the underlying non-   \n");
+        MrBayesPrint ("   truncated normal distribution. The truncation will cause the modified distri- \n");
+        MrBayesPrint ("   bution to have a higher mean and lower standard deviation. The magnitude of   \n");
+        MrBayesPrint ("   that effect depends on how much of the tail of the distribution is removed.   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that previous to version 3.2.2, MrBayes used the standard rate parameter-\n");
+        MrBayesPrint ("   ization of the offset exponential. This should not cause a problem in most    \n");
+        MrBayesPrint ("   cases because the old parameterization will result in an error in more recent \n");
+        MrBayesPrint ("   versions of MrBayes, and the likely source of the error is given in the error \n");
+        MrBayesPrint ("   message.                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For a practical example, assume that we had three fossil terminals named      \n");
+        MrBayesPrint ("   'FossilA', 'FossilB', and 'FossilC'. Assume further that we want to fix the   \n");
+        MrBayesPrint ("   age of FossilA to 100.0 million years, we think that FossilB is somewhere     \n");
+        MrBayesPrint ("   between 100.0 and 200.0 million years old, and that FossilC is at least 300.0 \n");
+        MrBayesPrint ("   million years old, possibly older but relatively unlikely to be more than     \n");
+        MrBayesPrint ("   400.0 million years old. Then we might use the commands:                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      calibrate FossilA = fixed(100) FossilB = uniform(100,200)                  \n");
+        MrBayesPrint ("      calibrate FossilC = offsetexponential(300,400)                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that it is possible to give more than one calibration for each           \n");
+        MrBayesPrint ("   'calibrate' statement. Thus, 'calibrate FossilA=<setting> FossilB=<setting>'  \n");
+        MrBayesPrint ("   would be a valid statement.                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   To actually use the calibrations to obtain dated trees, you also need to set  \n");
+        MrBayesPrint ("   a clock model using relevant 'brlenspr' and 'nodeagepr' options of the 'prset'\n");
+        MrBayesPrint ("   command. You may also want to examine the 'clockvarpr' and 'clockratepr' op-  \n");
+        MrBayesPrint ("   tions. Furthermore, you need to activate the relevant constraint(s) using     \n");
+        MrBayesPrint ("   'topologypr', if you use any dated interior nodes in the tree.                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   You may wish to remove a calibration from an interior or terminal node, which \n");
+        MrBayesPrint ("   has previously been calibrated. You can do that using                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      calibrate <node_name> = unconstrained                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        j = 0;
+        for (i=0; i<numTaxa; i++)
+            if (tipCalibration[i].prior != unconstrained)
+                j++;
+        for (i=0; i<numDefinedConstraints; i++)
+            if (nodeCalibration[i].prior != unconstrained)
+                j++;
+        if (j > 0)
+            {
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   Currently defined calibrations:                                               \n");
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   Node name                Type       Calibration                               \n");
+            MrBayesPrint ("   ------------------------------------------------------------------            \n");       
+            for (i=0; i<numTaxa+numDefinedConstraints; i++)
+                {
+                if (i<numTaxa)
+                    calibrationPtr = &tipCalibration[i];
+                else
+                    calibrationPtr = &nodeCalibration[i-numTaxa];
+                if (calibrationPtr != NULL && calibrationPtr->prior != unconstrained)
+                    {
+                    if (i<numTaxa)
+                        strncpy (tempString, taxaNames[i], 22);
+                    else
+                        strncpy (tempString, constraintNames[i-numTaxa], 22);
+                    if (i<numTaxa)
+                        MrBayesPrint ("   %-22.22s   Terminal   %s\n", tempString, calibrationPtr->name);
+                    else
+                        MrBayesPrint ("   %-22.22s   Interior   %s\n", tempString, calibrationPtr->name);
+                    }
+                }
+            }
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showmodel"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showmodel                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the current model settings. The correct usage is           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      showmodel                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   After typing \"showmodel\", the modelling assumptions are shown on a          \n");
+        MrBayesPrint ("   partition-by-partition basis.                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Execute"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Execute                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command executes a file called <file name>. The correct usage is:        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      execute <file name>                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example,                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      execute replicase.nex                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   would execute the file named \"replicase.nex\". This file must be in the      \n");
+        MrBayesPrint ("   same directory as the executable.                                             \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Lset"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Lset                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command sets the parameters of the likelihood model. The likelihood      \n");
+        MrBayesPrint ("   function is the probability of observing the data conditional on the phylo-   \n");
+        MrBayesPrint ("   genetic model. In order to calculate the likelihood, you must assume a        \n");
+        MrBayesPrint ("   model of character change. This command lets you tailor the biological        \n");
+        MrBayesPrint ("   assumptions made in the phylogenetic model. The correct usage is              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      lset <parameter>=<option> ... <parameter>=<option>                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example, \"lset nst=6 rates=gamma\" would set the model to a general      \n");
+        MrBayesPrint ("   model of DNA substition (the GTR) with gamma-distributed rate variation       \n");
+        MrBayesPrint ("   across sites.                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Applyto   -- This option allows you to apply the lset commands to specific    \n");
+        MrBayesPrint ("                partitions. This command should be the first in the list of      \n");
+        MrBayesPrint ("                commands specified in lset. Moreover, it only makes sense to     \n");
+        MrBayesPrint ("                be using this command if the data have been partitioned. A       \n");
+        MrBayesPrint ("                default partition is set on execution of a matrix. If the data   \n");
+        MrBayesPrint ("                are homogeneous (i.e., all of the same data type), then this     \n");
+        MrBayesPrint ("                partition will not subdivide the characters. Up to 30 other      \n");
+        MrBayesPrint ("                partitions can be defined, and you can switch among them using   \n");
+        MrBayesPrint ("                \"set partition=<partition name>\". Now, you may want to         \n");
+        MrBayesPrint ("                specify different models to different partitions of the data.    \n");
+        MrBayesPrint ("                Applyto allows you to do this. For example, say you have         \n");
+        MrBayesPrint ("                partitioned the data by codon position, and you want to apply    \n");
+        MrBayesPrint ("                a nst=2 model to the first two partitions and nst=6 to the       \n");
+        MrBayesPrint ("                last. This could be implemented in two uses of lset:             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                   lset applyto=(1,2) nst=2                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                   lset applyto=(3) nst=6                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                The first applies the parameters after \"applyto\" to the        \n");
+        MrBayesPrint ("                first and second partitions. The second lset applies nst=6       \n");
+        MrBayesPrint ("                to the third partition. You can also use applyto=(all), which    \n");
+        MrBayesPrint ("                attempts to apply the parameter settings to all of the data      \n");
+        MrBayesPrint ("                partitions. Importantly, if the option is not consistent with    \n");
+        MrBayesPrint ("                the data in the partition, the program will not apply the        \n");
+        MrBayesPrint ("                lset option to that partition.                                   \n");
+        MrBayesPrint ("   Nucmodel  -- This specifies the general form of the nucleotide substitution   \n");
+        MrBayesPrint ("                model. The options are \"4by4\" [the standard model of DNA       \n");
+        MrBayesPrint ("                substitution in which there are only four states (A,C,G,T/U)],   \n");
+        MrBayesPrint ("                \"doublet\" (a model appropriate for modelling the stem regions  \n");
+        MrBayesPrint ("                of ribosomal genes where the state space is the 16 doublets of   \n");
+        MrBayesPrint ("                nucleotides), \"codon\" (the substitution model is expanded      \n");
+        MrBayesPrint ("                around triplets of nucleotides--a codon), and \"Protein\"        \n");
+        MrBayesPrint ("                (triplets of nucleotides are translated to amino acids, which    \n");
+        MrBayesPrint ("                form the basis of the substitution model).                       \n");
+        MrBayesPrint ("   Nst       -- Sets the number of substitution types: \"1\" constrains all of   \n");
+        MrBayesPrint ("                the rates to be the same (e.g., a JC69 or F81 model); \"2\" all- \n");
+        MrBayesPrint ("                ows transitions and transversions to have potentially different  \n");
+        MrBayesPrint ("                rates (e.g., a K80 or HKY85 model); \"6\" allows all rates to    \n");
+        MrBayesPrint ("                be different, subject to the constraint of time-reversibility    \n");
+        MrBayesPrint ("                (e.g., a GTR model). Finally, 'nst' can be set to 'mixed', which \n");
+        MrBayesPrint ("                results in the Markov chain sampling over the space of all poss- \n");
+        MrBayesPrint ("                ible reversible substitution models, including the GTR model and \n");
+        MrBayesPrint ("                all models that can be derived from it model by grouping the six \n");
+        MrBayesPrint ("                rates in various combinations. This includes all the named models\n");
+        MrBayesPrint ("                above and a large number of others, with or without name.        \n");
+        MrBayesPrint ("   Code      -- Enforces the use of a particular genetic code. The default       \n");
+        MrBayesPrint ("                is the universal code. Other options include \"vertmt\" for      \n");
+        MrBayesPrint ("                vertebrate mitocondrial, \"invermt\", \"mycoplasma\", \"yeast\", \n");
+        MrBayesPrint ("                \"ciliate\", \"echinoderm\", \"euplotid\", and \"metmt\" (for    \n");
+        MrBayesPrint ("                metazoan mitochondrial except vertebrates).                      \n");
+        MrBayesPrint ("   Ploidy    -- Specifies the ploidy of the organism. Options are \"Haploid\",   \n");
+        MrBayesPrint ("                \"Diploid\" or \"Zlinked\". This option is used when a coalescent\n");
+        MrBayesPrint ("                prior is used on trees.                                          \n");
+        MrBayesPrint ("   Rates     -- Sets the model for among-site rate variation. In general, the    \n");
+        MrBayesPrint ("                rate at a site is considered to be an unknown random variable.   \n");
+        MrBayesPrint ("                The valid options are:                                           \n");
+        MrBayesPrint ("                * equal    -- No rate variation across sites.                    \n");
+        MrBayesPrint ("                * gamma    -- Gamma-distributed rates across sites. The rate     \n");
+        MrBayesPrint ("                              at a site is drawn from a gamma distribution.      \n");
+        MrBayesPrint ("                              The gamma distribution has a single parameter      \n");
+        MrBayesPrint ("                              that describes how much rates vary.                \n");
+        MrBayesPrint ("                * lnorm    -- Log Normal-distributed rates across sites. The     \n");
+        MrBayesPrint ("                              rate at a site is drawn from a lognormal           \n");
+        MrBayesPrint ("                              distribution. the lognormal distribiton has a      \n");
+        MrBayesPrint ("                              single parameter, sigma (SD) that describes how    \n");
+        MrBayesPrint ("                              much rates vary (mean fixed to log(1.0) == 0.0.    \n");
+        MrBayesPrint ("                * adgamma  -- Autocorrelated rates across sites. The marg-       \n");
+        MrBayesPrint ("                              inal rate distribution is gamma, but adjacent      \n");
+        MrBayesPrint ("                              sites have correlated rates.                       \n");
+        MrBayesPrint ("                * propinv  -- A proportion of the sites are invariable.          \n");
+        MrBayesPrint ("                * invgamma -- A proportion of the sites are invariable while     \n");
+        MrBayesPrint ("                              the rate for the remaining sites are drawn from    \n");
+        MrBayesPrint ("                              a gamma distribution.                              \n");
+        MrBayesPrint ("                Note that MrBayes versions 2.0 and earlier supported options     \n");
+        MrBayesPrint ("                that allowed site specific rates (e.g., ssgamma). In versions    \n");
+        MrBayesPrint ("                3.0 and later, site specific rates are allowed, but set using    \n");
+        MrBayesPrint ("                the 'prset ratepr' command for each partition.                   \n");
+        MrBayesPrint ("   Ngammacat -- Sets the number of rate categories for the gamma distribution.   \n");
+        MrBayesPrint ("                The gamma distribution is continuous. However, it is virtually   \n");
+        MrBayesPrint ("                impossible to calculate likelihoods under the continuous gamma   \n");
+        MrBayesPrint ("                distribution. Hence, an approximation to the continuous gamma    \n");
+        MrBayesPrint ("                is used; the gamma distribution is broken into ncat categories   \n");
+        MrBayesPrint ("                of equal weight (1/ncat). The mean rate for each category rep-   \n");
+        MrBayesPrint ("                resents the rate for the entire cateogry. This option allows     \n");
+        MrBayesPrint ("                you to specify how many rate categories to use when approx-      \n");
+        MrBayesPrint ("                imating the gamma. The approximation is better as ncat is inc-   \n");
+        MrBayesPrint ("                reased. In practice, \"ncat=4\" does a reasonable job of         \n");
+        MrBayesPrint ("                approximating the continuous gamma.                              \n");
+        MrBayesPrint ("                It is also used to set the number of rate categories for the     \n");
+        MrBayesPrint ("                lognormal distribution to avoid changing too much of the code,   \n");
+        MrBayesPrint ("                although the name is bad (should add Nlnormcat in future).       \n");
+#if 0
+        /* Temporarily disable this because of conflict with likelihood calculators. It should be renamed to samplerates when reintroduced. */
+        MrBayesPrint ("   Usegibbs  -- Specifies whether site probabilities under the discrete gamma    \n");
+        MrBayesPrint ("                model of rate variation across sites will be summed across rate  \n");
+        MrBayesPrint ("                categories ('Usegibbs=No') or sampled using a Gibbs sampler      \n");
+        MrBayesPrint ("                ('Usegibbs=Yes'). The Gibbs sampling approach is much faster and \n");
+        MrBayesPrint ("                requires less memory but the likelihood of the sampled points    \n");
+        MrBayesPrint ("                will be considerably higher than with the standard approach of   \n");
+        MrBayesPrint ("                summing probabilities, so you need to be aware of this when com- \n");
+        MrBayesPrint ("                paring your results with those you obtain with other programs.   \n");
+        MrBayesPrint ("                Assume that you are using n rate categories in your discrete     \n");
+        MrBayesPrint ("                gamma distribution. Then the Gibbs approach is up to n times     \n");
+        MrBayesPrint ("                faster and requires 1/n as much memory as the standard method.   \n");
+        MrBayesPrint ("                Unfortunately, the state space also becomes larger so the chain  \n");
+        MrBayesPrint ("                may need more time to converge. The approach should work best    \n");
+        MrBayesPrint ("                for large trees, where the uncertainty concerning the best rate  \n");
+        MrBayesPrint ("                category for each site is negligible. Gibbs sampling cannot be   \n");
+        MrBayesPrint ("                used for the autocorrelated discrete gamma model, for standard   \n");
+        MrBayesPrint ("                data, or for restriction data. Also, MrBayes will not use Gibbs  \n");
+        MrBayesPrint ("                sampling when you want to infer site rates.                      \n");
+        MrBayesPrint ("   Gibbsfreq -- Sets the frequency with which the rate categories of the discrete\n");
+        MrBayesPrint ("                gamma will be Gibbs sampled. In practice, we have found that a   \n");
+        MrBayesPrint ("                resampling frequency of every 100 MCMC generations works well for\n");
+        MrBayesPrint ("                reasonably long runs. The more frequent the Gibbs sampling, the  \n");
+        MrBayesPrint ("                slower the Gibbs sampling approach will be. If you have k rate   \n");
+        MrBayesPrint ("                categories and Gibbs sample them every n generations, then the   \n");
+        MrBayesPrint ("                time it takes to complete n generations will roughly be propor-  \n");
+        MrBayesPrint ("                tional to n+k. Compare this with the traditional approach of     \n");
+        MrBayesPrint ("                summing across the n rate categories in every generation, which  \n");
+        MrBayesPrint ("                requires time proportional to n*k. In practice, however, the     \n");
+        MrBayesPrint ("                speed difference is not quite as large as this.                  \n");
+#endif
+        MrBayesPrint ("   Nbetacat  -- Sets the number of rate categories for the beta distribution.    \n");
+        MrBayesPrint ("                A symmetric beta distribution is used to model the stationary    \n");
+        MrBayesPrint ("                frequencies when morphological data are used. This option        \n");
+        MrBayesPrint ("                specifies how well the beta distribution will be approximated.   \n");
+        MrBayesPrint ("   Omegavar  -- Allows the nonsynonymous/synonymous rate ratio (omega) to vary   \n");
+        MrBayesPrint ("                across codons. Ny98 assumes that there are three classes, with   \n");
+        MrBayesPrint ("                potentially different omega values (omega1, omega2, omega3):     \n");
+        MrBayesPrint ("                omega2 = 1; 0 < omega1 < 1; and omega3 > 1. Like the Ny98 model, \n");
+        MrBayesPrint ("                the M3 model has three omega classes. However, their values are  \n");
+        MrBayesPrint ("                less constrained, with omega1 < omega2 < omega3. The default     \n");
+        MrBayesPrint ("                (omegavar = equal) has no variation on omega across sites.       \n");
+        MrBayesPrint ("   Covarion  -- This forces the use of a covarion-like model of substitution     \n");
+        MrBayesPrint ("                for nucleotide or amino acid data. The valid options are \"yes\" \n");
+        MrBayesPrint ("                and \"no\". The covarion model allows the rate at a site to      \n");
+        MrBayesPrint ("                change over its evolutionary history. Specifically, the site     \n");
+        MrBayesPrint ("                is either on or off. When it is off, no substitutions are poss-  \n");
+        MrBayesPrint ("                ible. When the process is on, substitutions occur according to   \n");
+        MrBayesPrint ("                a specified substitution model (specified using the other        \n");
+        MrBayesPrint ("                lset options).                                                   \n");
+        MrBayesPrint ("   Coding    -- This specifies how characters were sampled. If all site patterns \n");
+        MrBayesPrint ("                had the possibility of being sampled, then \"All\" should be     \n");
+        MrBayesPrint ("                specified (the default). Otherwise \"Variable\" (only variable   \n");
+        MrBayesPrint ("                characters had the possibility of being sampled), \"Informative\"\n");
+        MrBayesPrint ("                (only parsimony informative characters has the possibility of    \n");
+        MrBayesPrint ("                being sampled), \"Nosingletons\" (characters which are constant  \n");
+        MrBayesPrint ("                in all but one taxon were not sampled), \"Noabsencesites\" (char-\n");
+        MrBayesPrint ("                acters for which all taxa were coded as absent were not sampled),\n");
+        MrBayesPrint ("                \"Nopresencesites\" (characters for which all taxa were coded as \n");
+        MrBayesPrint ("                present were not sampled). \"All\" works for all data types.     \n");
+        MrBayesPrint ("                However, the others only work for morphological (All/Variable/   \n");
+        MrBayesPrint ("                Informative/Nosingletons) or restriction site (All/Variable/     \n");
+        MrBayesPrint ("                Informative/Nosingletons/Noabsencesites/Nopresencesites/         \n");
+        MrBayesPrint ("                Nosingletonpresence/Nosingletonabsence) data.                    \n");
+        MrBayesPrint ("   Parsmodel -- This forces calculation under the so-called parsimony model      \n");
+        MrBayesPrint ("                described by Tuffley and Steel (1998). The options are \"yes\"   \n");
+        MrBayesPrint ("                or \"no\". Note that the biological assumptions of this model    \n");
+        MrBayesPrint ("                are anything but parsimonious. In fact, this model assumes many  \n");
+        MrBayesPrint ("                more parameters than the next most complicated model implemented \n");
+        MrBayesPrint ("                in this program. If you really believe that the parsimony model  \n");
+        MrBayesPrint ("                makes the biological assumptions described by Tuffley and Steel, \n");
+        MrBayesPrint ("                then the parsimony method is miss-named.                         \n");
+    /*  MrBayesPrint ("   Augment   -- This allows the chain to consider the missing entries of         \n");
+        MrBayesPrint ("                the data matrix as random variables. A Gibbs sampler is          \n");
+        MrBayesPrint ("                used to sample states.                                           \n"); */
+        MrBayesPrint ("                                                                                 \n");
+        if (numCurrentDivisions == 0)
+            tempInt = 1;
+        else
+            tempInt = numCurrentDivisions;
+        for (i=0; i<tempInt; i++)
+            {
+            if (numCurrentDivisions == 0)
+                {
+                MrBayesPrint ("   Default model settings:                                                       \n");
+                mp = &defaultModel;
+                }
+            else
+                {
+                MrBayesPrint ("   Model settings for partition %d:                                              \n", i+1);
+                mp = &modelParams[i];
+                }
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   Parameter    Options                               Current Setting            \n");
+            MrBayesPrint ("   ------------------------------------------------------------------            \n");       
+            MrBayesPrint ("   Nucmodel     4by4/Doublet/Codon/Protein              %s                       \n", mp->nucModel);
+            MrBayesPrint ("   Nst          1/2/6/Mixed                             %s                       \n", mp->nst);
+            MrBayesPrint ("   Code         Universal/Vertmt/Invermt/Yeast/Mycoplasma/                       \n");
+            MrBayesPrint ("                Ciliate/Echinoderm/Euplotid/Metmt       %s                       \n", mp->geneticCode);
+            MrBayesPrint ("   Ploidy       Haploid/Diploid/Zlinked                 %s                       \n", mp->ploidy);
+            MrBayesPrint ("   Rates        Equal/Gamma/LNorm/Propinv/                                       \n");
+            MrBayesPrint ("                Invgamma/Adgamma                        %s                       \n", mp->ratesModel);
+            MrBayesPrint ("   Ngammacat    <number>                                %d                       \n", mp->numGammaCats);
+#if 0
+/* Temporarily disable this because of conflict with likelihood calculators. It should be renamed to samplerates when reintroduced. */
+            MrBayesPrint ("   Usegibbs     Yes/No                                  %s                       \n", mp->useGibbs);
+            MrBayesPrint ("   Gibbsfreq    <number>                                %d                       \n", mp->gibbsFreq);
+#endif
+            MrBayesPrint ("   Nbetacat     <number>                                %d                       \n", mp->numBetaCats);
+            MrBayesPrint ("   Omegavar     Equal/Ny98/M3                           %s                       \n", mp->omegaVar);
+            MrBayesPrint ("   Covarion     No/Yes                                  %s                       \n", mp->covarionModel);
+            MrBayesPrint ("   Coding       All/Variable/Informative/Nosingletons                            \n");
+            MrBayesPrint ("                Noabsencesites/Nopresencesites/                                  \n");
+            MrBayesPrint ("                Nosingletonabsence/Nosingletonpresence  %s                       \n", mp->codingString);
+            MrBayesPrint ("   Parsmodel    No/Yes                                  %s                       \n", mp->parsModel);
+        /*  MrBayesPrint ("   Augment      No/Yes                                  %s                       \n", mp->augmentData); */
+            MrBayesPrint ("   ------------------------------------------------------------------            \n");       
+            MrBayesPrint ("                                                                                 \n");
+            }
+        }
+    else if (!strcmp(helpTkn, "Prset"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Prset                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command sets the priors for the phylogenetic model. Remember that        \n");
+        MrBayesPrint ("   in a Bayesian analysis, you must specify a prior probability distribution     \n");
+        MrBayesPrint ("   for the parameters of the likelihood model. The prior distribution rep-       \n");
+        MrBayesPrint ("   resents your prior beliefs about the parameter before observation of the      \n");
+        MrBayesPrint ("   data. This command allows you to tailor your prior assumptions to a large     \n");
+        MrBayesPrint ("   extent.                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Applyto       -- This option allows you to apply the prset commands to        \n");
+        MrBayesPrint ("                    specific partitions. This command should be the first        \n");
+        MrBayesPrint ("                    in the list of commands specified in prset. Moreover, it     \n");
+        MrBayesPrint ("                    only makes sense to be using this command if the data        \n");
+        MrBayesPrint ("                    have been partitioned. A default partition is set on         \n");
+        MrBayesPrint ("                    execution of a matrix. If the data are homogeneous           \n");
+        MrBayesPrint ("                    (i.e., all of the same data type), then this partition       \n");
+        MrBayesPrint ("                    will not subdivide the characters. Up to 30 other part-      \n");
+        MrBayesPrint ("                    itions can be defined, and you can switch among them using   \n");
+        MrBayesPrint ("                    \"set partition=<partition name>\". Now, you may want to     \n");
+        MrBayesPrint ("                    specify different priors to different partitions of the      \n");
+        MrBayesPrint ("                    data. Applyto allows you to do this. For example, say        \n");
+        MrBayesPrint ("                    you have partitioned the data by codon position, and         \n");
+        MrBayesPrint ("                    you want to fix the statefreqs to equal for the first two    \n");
+        MrBayesPrint ("                    partitions but apply a flat Dirichlet prior to the state-    \n");
+        MrBayesPrint ("                    freqs of the last. This could be implemented in two uses of  \n");
+        MrBayesPrint ("                    prset:                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset applyto=(1,2) statefreqs=fixed(equal)               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset applyto=(3) statefreqs=dirichlet(1,1,1,1)           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The first applies the parameters after \"applyto\"           \n");
+        MrBayesPrint ("                    to the first and second partitions. The second prset         \n");
+        MrBayesPrint ("                    applies a flat Dirichlet to the third partition. You can     \n");
+        MrBayesPrint ("                    also use applyto=(all), which attempts to apply the para-    \n");
+        MrBayesPrint ("                    meter settings to all of the data partitions. Importantly,   \n");
+        MrBayesPrint ("                    if the option is not consistent with the data in the part-   \n");
+        MrBayesPrint ("                    ition, the program will not apply the prset option to        \n");
+        MrBayesPrint ("                    that partition.                                              \n");
+        MrBayesPrint ("   Tratiopr      -- This parameter sets the prior for the transition/trans-      \n");
+        MrBayesPrint ("                    version rate ratio (tratio). The options are:                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset tratiopr = beta(<number>, <number>)                 \n");
+        MrBayesPrint ("                       prset tratiopr = fixed(<number>)                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The program assumes that the transition and transversion     \n");
+        MrBayesPrint ("                    rates are independent gamma-distributed random variables     \n");
+        MrBayesPrint ("                    with the same scale parameter when beta is selected. If you  \n");
+        MrBayesPrint ("                    want a diffuse prior that puts equal emphasis on transition/ \n");
+        MrBayesPrint ("                    transversion rate ratios above 1.0 and below 1.0, then use a \n");
+        MrBayesPrint ("                    flat Beta, beta(1,1), which is the default. If you wish to   \n");
+        MrBayesPrint ("                    concentrate this distribution more in the equal-rates region,\n");
+        MrBayesPrint ("                    then use a prior of the type beta(x,x), where the magnitude  \n");
+        MrBayesPrint ("                    of x determines how much the prior is concentrated in the    \n");
+        MrBayesPrint ("                    equal rates region. For instance, a beta(20,20) puts more    \n");
+        MrBayesPrint ("                    probability on rate ratios close to 1.0 than a beta(1,1). If \n");
+        MrBayesPrint ("                    you think it is likely that the transition/transversion rate \n");
+        MrBayesPrint ("                    ratio is 2.0, you can use a prior of the type beta(2x,x),    \n");
+        MrBayesPrint ("                    where x determines how strongly the prior is concentrated on \n");
+        MrBayesPrint ("                    tratio values near 2.0. For instance, a beta(2,1) is much    \n");
+        MrBayesPrint ("                    more diffuse than a beta(80,40) but both have the expected   \n");
+        MrBayesPrint ("                    tratio 2.0 in the absence of data. The parameters of the     \n");
+        MrBayesPrint ("                    Beta can be interpreted as counts: if you have observed x    \n");
+        MrBayesPrint ("                    transitions and y transversions, then a beta(x+1,y+1) is a   \n");
+        MrBayesPrint ("                    good representation of this information. The fixed option    \n");
+        MrBayesPrint ("                    allows you to fix the tratio to a particular value.          \n");
+        MrBayesPrint ("   Revmatpr      -- This parameter sets the prior for the substitution rates     \n");
+        MrBayesPrint ("                    of the GTR model for nucleotide data. The options are:       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset revmatpr = dirichlet(<number>,<number>,...,<number>)\n");
+        MrBayesPrint ("                       prset revmatpr = fixed(<number>,<number>,...,<number>)    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The program assumes that the six substitution rates          \n");
+        MrBayesPrint ("                    are independent gamma-distributed random variables with the  \n");
+        MrBayesPrint ("                    same scale parameter when dirichlet is selected. The six     \n");
+        MrBayesPrint ("                    numbers in brackets each corresponds to a particular substi- \n");
+        MrBayesPrint ("                    tution type. Together, they determine the shape of the prior.\n");
+        MrBayesPrint ("                    The six rates are in the order A<->C, A<->G, A<->T, C<->G,   \n");
+        MrBayesPrint ("                    C<->T, and G<->T. If you want an uninformative prior you can \n");
+        MrBayesPrint ("                    use dirichlet(1,1,1,1,1,1), also referred to as a 'flat'     \n");
+        MrBayesPrint ("                    Dirichlet. This is the default setting. If you wish a prior  \n");
+        MrBayesPrint ("                    where the C<->T rate is 5 times and the A<->G rate 2 times   \n");
+        MrBayesPrint ("                    higher, on average, than the transversion rates, which are   \n");
+        MrBayesPrint ("                    all the same, then you should use a prior of the form        \n");
+        MrBayesPrint ("                    dirichlet(x,2x,x,x,5x,x), where x determines how much the    \n");
+        MrBayesPrint ("                    prior is focused on these particular rates. For more info,   \n");
+        MrBayesPrint ("                    see tratiopr. The fixed option allows you to fix the substi- \n");
+        MrBayesPrint ("                    tution rates to particular values.                           \n");
+        MrBayesPrint ("   Revratepr     -- This parameter sets the prior for each substitution rate of  \n");
+        MrBayesPrint ("                    the GTR model subspace when 'nst' is set to 'mixed' (see the \n");
+        MrBayesPrint ("                    'lset' command). The only option is                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset revratepr = symdir(<number>)                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    which will associate each independent rate in the rate matrix\n");
+        MrBayesPrint ("                    with a modified symmetric Dirichlet prior, where a singleton \n");
+        MrBayesPrint ("                    rate has the specified alpha parameter, while a rate that    \n");
+        MrBayesPrint ("                    applies to n pairwise substitution types has an alpha that is\n");
+        MrBayesPrint ("                    n times the specified number. The higher the specified num-  \n");
+        MrBayesPrint ("                    ber, the more focused the prior will be on equal rates. The  \n");
+        MrBayesPrint ("                    default value is 1, which gives an effect similar to a flat  \n");
+        MrBayesPrint ("                    Dirichlet.                                                   \n");
+        MrBayesPrint ("   Aamodelpr     -- This parameter sets the rate matrix for amino acid data.     \n");
+        MrBayesPrint ("                    You can either fix the model by specifying aamodelpr=fixed   \n");
+        MrBayesPrint ("                    (<model name>), where <model name> is 'poisson' (a glorified \n");
+        MrBayesPrint ("                    Jukes-Cantor model), 'jones', 'dayhoff', 'mtrev', 'mtmam',   \n");
+        MrBayesPrint ("                    'wag', 'rtrev', 'cprev', 'vt', 'blosum', 'lg', 'equalin'     \n");
+        MrBayesPrint ("                    (a glorified Felsenstein 1981 model), or 'gtr'. You can also \n");
+        MrBayesPrint ("                    average over the first ten models by specifying aamodelpr=   \n");
+        MrBayesPrint ("                    mixed. If you do so, the Markov chain will sample each model \n");
+        MrBayesPrint ("                    according to its probability. The sampled model is reported  \n");
+        MrBayesPrint ("                    as an index: poisson(0), jones(1), dayhoff(2), mtrev(3),     \n");
+        MrBayesPrint ("                    mtmam(4), wag(5), rtrev(6), cprev(7), vt(8), or blosum(9).   \n");
+        MrBayesPrint ("                    The 'Sump' command summarizes the MCMC samples and calculates\n");
+        MrBayesPrint ("                    the posterior probability estimate for each of these models. \n");
+        MrBayesPrint ("   Aarevmatpr    -- This parameter sets the prior for the substitution rates     \n");
+        MrBayesPrint ("                    of the GTR model for amino acid data. The options are:       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset aarevmatpr = dirichlet(<number>,<number>,...,<number>)\n");
+        MrBayesPrint ("                       prset aarevmatpr = fixed(<number>,<number>,...,<number>)  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The options are the same as those for 'Revmatpr' except that \n");
+        MrBayesPrint ("                    they are defined over the 190 rates of the time-reversible   \n");
+        MrBayesPrint ("                    GTR model for amino acids instead of over the 6 rates of the \n");
+        MrBayesPrint ("                    GTR model for nucleotides. The rates are in the order A<->R, \n");
+        MrBayesPrint ("                    A<->N, etc to Y<->V. In other words, amino acids are listed  \n");
+        MrBayesPrint ("                    in alphabetic order based on their full name. The first amino\n");
+        MrBayesPrint ("                    acid (Alanine) is then combined in turn with all amino acids \n");
+        MrBayesPrint ("                    following it in the list, starting with amino acid 2 (Argi-  \n");
+        MrBayesPrint ("                    nine) and finishing with amino acid 20 (Valine). The second  \n");
+        MrBayesPrint ("                    amino acid (Arginine) is then combined in turn with all amino\n");
+        MrBayesPrint ("                    acids following it, starting with amino acid 3 (Asparagine)  \n");
+        MrBayesPrint ("                    and finishing with amino acid 20 (Valine), and so on.        \n");
+        MrBayesPrint ("   Omegapr       -- This parameter specifies the prior on the nonsynonymous/     \n");
+        MrBayesPrint ("                    synonymous rate ratio. The options are:                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset omegapr = dirichlet(<number>,<number>)              \n");
+        MrBayesPrint ("                       prset omegapr = fixed(<number>)                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only in effect if the nucleotide sub-      \n");
+        MrBayesPrint ("                    stitution model is set to codon using the lset command       \n");
+        MrBayesPrint ("                    (lset nucmodel=codon). Moreover, it only applies to the      \n");
+        MrBayesPrint ("                    case when there is no variation in omega across sites (i.e., \n");
+        MrBayesPrint ("                    \"lset omegavar=equal\").                                    \n");
+        MrBayesPrint ("   Ny98omega1pr  -- This parameter specifies the prior on the nonsynonymous/     \n");
+        MrBayesPrint ("                    synonymous rate ratio for sites under purifying selection.   \n");
+        MrBayesPrint ("                    The options are:                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset Ny98omega1pr = beta(<number>,<number>)              \n");
+        MrBayesPrint ("                       prset Ny98omega1pr = fixed(<number>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only in effect if the nucleotide sub-      \n");
+        MrBayesPrint ("                    stitution model is set to codon using the lset command       \n");
+        MrBayesPrint ("                    (lset nucmodel=codon). Moreover, it only applies to the      \n");
+        MrBayesPrint ("                    case where omega varies across sites using the model of      \n");
+        MrBayesPrint ("                    Nielsen and Yang (1998) (i.e., \"lset omegavar=ny98\"). If   \n");
+        MrBayesPrint ("                    fixing the parameter, you must specify a number between      \n");
+        MrBayesPrint ("                    0 and 1.                                                     \n");
+        MrBayesPrint ("   Ny98omega3pr  -- This parameter specifies the prior on the nonsynonymous/     \n");
+        MrBayesPrint ("                    synonymous rate ratio for positively selected sites. The     \n");
+        MrBayesPrint ("                    options are:                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset Ny98omega3pr = uniform(<number>,<number>)           \n");
+        MrBayesPrint ("                       prset Ny98omega3pr = exponential(<number>)                \n");
+        MrBayesPrint ("                       prset Ny98omega3pr = fixed(<number>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only in effect if the nucleotide sub-      \n");
+        MrBayesPrint ("                    stitution model is set to codon using the lset command       \n");
+        MrBayesPrint ("                    (lset nucmodel=codon). Moreover, it only applies to the      \n");
+        MrBayesPrint ("                    case where omega varies across sites according to the        \n");
+        MrBayesPrint ("                    NY98 model. Note that if the NY98 model is specified         \n");
+        MrBayesPrint ("                    that this parameter must be greater than 1, so you should    \n");
+        MrBayesPrint ("                    not specify a uniform(0,10) prior, for example.              \n");
+        MrBayesPrint ("   M3omegapr     -- This parameter specifies the prior on the nonsynonymous/     \n");
+        MrBayesPrint ("                    synonymous rate ratios for all three classes of sites for    \n");
+        MrBayesPrint ("                    the M3 model. The options are:                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset M3omegapr = exponential                             \n");
+        MrBayesPrint ("                       prset M3omegapr = fixed(<number>,<number>,<number>)       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only in effect if the nucleotide sub-      \n");
+        MrBayesPrint ("                    stitution model is set to codon using the lset command       \n");
+        MrBayesPrint ("                    (lset nucmodel=codon). Moreover, it only applies to the      \n");
+        MrBayesPrint ("                    case where omega varies across sites using the M3 model of   \n");
+        MrBayesPrint ("                    Yang et al. (2000) (i.e., \"lset omegavar=M3\"). Under the   \n");
+        MrBayesPrint ("                    exponential prior, the four rates (dN1, dN2, dN3, and dS)    \n");
+        MrBayesPrint ("                    are all considered to be independent draws from the same     \n");
+        MrBayesPrint ("                    exponential distribution (the parameter of the exponential   \n");
+        MrBayesPrint ("                    does not matter, and so you don't need to specify it). The   \n");
+        MrBayesPrint ("                    rates dN1, dN2, and dN3 are taken to be the order statistics \n");
+        MrBayesPrint ("                    with dN1 < dN2 < dN3. These three rates are all scaled to    \n");
+        MrBayesPrint ("                    the same synonymous rate, dS. The other option is to simply  \n");
+        MrBayesPrint ("                    fix the three rate ratios to some values.                    \n");
+        MrBayesPrint ("   Codoncatfreqs -- This parameter specifies the prior on frequencies of sites   \n");
+        MrBayesPrint ("                    under purifying, neutral, and positive selection. The        \n");
+        MrBayesPrint ("                    options are:                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset codoncatfreqs = dirichlet(<num>,<num>,<num>)        \n");
+        MrBayesPrint ("                       prset codoncatfreqs = fixed(<number>,<number>,<number>)   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only in effect if the nucleotide sub-      \n");
+        MrBayesPrint ("                    stitution model is set to codon using the lset command       \n");
+        MrBayesPrint ("                    (lset nucmodel=codon). Moreover, it only applies to the      \n");
+        MrBayesPrint ("                    case where omega varies across sites using the models of     \n");
+        MrBayesPrint ("                    Nielsen and Yang (1998) (i.e., \"lset omegavar=ny98\")       \n");
+        MrBayesPrint ("                    or Yang et al. (2000) (i.e., \"lset omegavar=M3\")           \n");
+        MrBayesPrint ("                    Note that the sum of the three frequencies must be 1.        \n");
+        MrBayesPrint ("   Statefreqpr   -- This parameter specifies the prior on the state freq-        \n");
+        MrBayesPrint ("                    uencies. The options are:                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset statefreqpr = dirichlet(<number>)                   \n");
+        MrBayesPrint ("                       prset statefreqpr = dirichlet(<number>,...,<number>)      \n");
+        MrBayesPrint ("                       prset statefreqpr = fixed(equal)                          \n");
+        MrBayesPrint ("                       prset statefreqpr = fixed(empirical)                      \n");
+        MrBayesPrint ("                       prset statefreqpr = fixed(<number>,...,<number>)          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For the dirichlet, you can specify either a single number    \n");
+        MrBayesPrint ("                    or as many numbers as there are states. If you specify a     \n");
+        MrBayesPrint ("                    single number, then the prior has all states equally         \n");
+        MrBayesPrint ("                    probable with a variance related to the single parameter     \n");
+        MrBayesPrint ("                    passed in.                                                   \n");
+        MrBayesPrint ("   Shapepr       -- This parameter specifies the prior for the gamma/lnorm shape \n");
+        MrBayesPrint ("                    parameter for among-site rate variation. The options are:    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset shapepr = uniform(<number>,<number>)                \n");
+        MrBayesPrint ("                       prset shapepr = exponential(<number>)                     \n");
+        MrBayesPrint ("                       prset shapepr = fixed(<number>)                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Pinvarpr      -- This parameter specifies the prior for the proportion of     \n");
+        MrBayesPrint ("                    invariable sites. The options are:                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset pinvarpr = uniform(<number>,<number>)               \n");
+        MrBayesPrint ("                       prset pinvarpr = fixed(<number>)                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    Note that the valid range for the parameter is between 0     \n");
+        MrBayesPrint ("                    and 1. Hence, \"prset pinvarpr=uniform(0,0.8)\" is valid     \n");
+        MrBayesPrint ("                    while \"prset pinvarpr=uniform(0,10)\" is not. The def-      \n");
+        MrBayesPrint ("                    ault setting is \"prset pinvarpr=uniform(0,1)\".             \n");
+        MrBayesPrint ("   Ratecorrpr    -- This parameter specifies the prior for the autocorrelation   \n");
+        MrBayesPrint ("                    parameter of the autocorrelated gamma distribution for       \n");
+        MrBayesPrint ("                    among-site rate variation. The options are:                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset ratecorrpr = uniform(<number>,<number>)             \n");
+        MrBayesPrint ("                       prset ratecorrpr = fixed(<number>)                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    Note that the valid range for the parameter is between -1    \n");
+        MrBayesPrint ("                    and 1. Hence, \"prset ratecorrpr=uniform(-1,1)\" is valid    \n");
+        MrBayesPrint ("                    while \"prset ratecorrpr=uniform(-11,10)\" is not. The       \n");
+        MrBayesPrint ("                    default setting is \"prset ratecorrpr=uniform(-1,1)\".       \n");
+        MrBayesPrint ("   Covswitchpr   -- This option sets the prior for the covarion switching        \n");
+        MrBayesPrint ("                    rates. The options are:                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset covswitchpr = uniform(<number>,<number>)            \n");
+        MrBayesPrint ("                       prset covswitchpr = exponential(<number>)                 \n");
+        MrBayesPrint ("                       prset covswitchpr = fixed(<number>,<number>)              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The covarion model has two rates: a rate from on to off      \n");
+        MrBayesPrint ("                    and a rate from off to on. The rates are assumed to have     \n");
+        MrBayesPrint ("                    independent priors that individually are either uniformly    \n");
+        MrBayesPrint ("                    or exponentially distributed. The other option is to         \n");
+        MrBayesPrint ("                    fix the switching rates, in which case you must specify      \n");
+        MrBayesPrint ("                    both rates. (The first number is off->on and the second      \n");
+        MrBayesPrint ("                    is on->off).                                                 \n");
+        MrBayesPrint ("   Symdirihyperpr - This option sets the prior for the stationary frequencies    \n");
+        MrBayesPrint ("                    of the states for morphological (standard) data. There can   \n");
+        MrBayesPrint ("                    be as many as 10 states for standard data. However, the      \n");
+        MrBayesPrint ("                    labelling of the states is somewhat arbitrary. For example,  \n");
+        MrBayesPrint ("                    the state \"1\" for different characters does not have the   \n");
+        MrBayesPrint ("                    same meaning. This is not true for DNA characters, for ex-   \n");
+        MrBayesPrint ("                    ample, where a \"G\" has the same meaning across characters. \n");
+        MrBayesPrint ("                    The fact that the labelling of morphological characters is   \n");
+        MrBayesPrint ("                    arbitrary makes it difficult to allow unequal character-     \n");
+        MrBayesPrint ("                    state frequencies. MrBayes gets around this problem by       \n");
+        MrBayesPrint ("                    assuming that the states have a symmetric Dirichlet prior    \n");
+        MrBayesPrint ("                    (i.e. all Dirichlet parameters are equal). The variation in  \n");
+        MrBayesPrint ("                    the Dirichlet can be controlled by this parameter.           \n");
+        MrBayesPrint ("                    Symdirihyperpr specifies the distribution on the parameter   \n");
+        MrBayesPrint ("                    of the symmetric Dirichlet. The valid options are:           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset Symdirihyperpr = uniform(<number>,<number>)         \n");
+        MrBayesPrint ("                       prset Symdirihyperpr = exponential(<number>)              \n");
+        MrBayesPrint ("                       prset Symdirihyperpr = fixed(<number>)                    \n");
+        MrBayesPrint ("                       prset Symdirihyperpr = fixed(infinity)                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    If \"fixed(infinity)\" is chosen, the Dirichlet prior is     \n");
+        MrBayesPrint ("                    fixed such that all character states have equal frequency.   \n");
+        MrBayesPrint ("   Topologypr    -- This parameter specifies the prior probabilities of          \n");
+        MrBayesPrint ("                    phylogenies. The options are:                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset topologypr = uniform                                \n");
+        MrBayesPrint ("                       prset topologypr = speciestree                            \n");
+        MrBayesPrint ("                       prset topologypr = constraints(<list>)                    \n");
+        MrBayesPrint ("                       prset topologypr = fixed(<treename>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    If the prior is selected to be \"uniform\", the default,     \n");
+        MrBayesPrint ("                    then all possible trees are considered a priori equally      \n");
+        MrBayesPrint ("                    probable. The 'speciestree' option is used when the topology \n");
+        MrBayesPrint ("                    is constrained to fold inside a species tree together with   \n");
+        MrBayesPrint ("                    other (gene) trees. The constraints option allows you to     \n");
+        MrBayesPrint ("                    specify complicated prior probabilities on trees (constraints\n");
+        MrBayesPrint ("                    are discussed more fully in \"help constraint\"). Note that  \n");
+        MrBayesPrint ("                    you must specify a list of constraints that you wish to be   \n");
+        MrBayesPrint ("                    obeyed. The list can be either the constraints' name or      \n");
+        MrBayesPrint ("                    number. Finally, you can fix the topology to that of a user  \n");
+        MrBayesPrint ("                    tree defined in a trees block. Branch lengths will still be  \n");
+        MrBayesPrint ("                    sampled as usual on the fixed topology.                      \n");
+        MrBayesPrint ("   Brlenspr      -- This parameter specifies the prior probability dist-         \n");
+        MrBayesPrint ("                    ribution on branch lengths. The options are specified using: \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset brlenspr = <setting>                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    where <setting> is one of                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       unconstrained:uniform(<num>,<num>)                        \n");
+        MrBayesPrint ("                       unconstrained:exponential(<number>)                       \n");
+        MrBayesPrint ("                       unconstrained:twoexp(<num>,<num>)                         \n");
+        MrBayesPrint ("                       unconstrained:gammadir(<num>,<num>,<num>,<num>)           \n");
+        MrBayesPrint ("                       unconstrained:invgamdir(<num>,<num>,<num>,<num>)          \n");
+        MrBayesPrint ("                       clock:uniform                                             \n");
+        MrBayesPrint ("                       clock:birthdeath                                          \n");
+        MrBayesPrint ("                       clock:coalescence                                         \n");
+        MrBayesPrint ("                       clock:fossilization                                       \n");
+        MrBayesPrint ("                       clock:speciestree                                         \n");
+        MrBayesPrint ("                       fixed(<treename>)                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    Trees with unconstrained branch lengths are unrooted         \n");
+        MrBayesPrint ("                    whereas clock-constrained trees are rooted. The option       \n");
+        MrBayesPrint ("                    after the colon specifies the details of the probability     \n");
+        MrBayesPrint ("                    density of branch lengths. If you choose a birth-death       \n");
+        MrBayesPrint ("                    or coalescence prior, you may want to modify the details     \n");
+        MrBayesPrint ("                    of the parameters of those processes (speciation rate,       \n");
+        MrBayesPrint ("                    extinction rate and sample probability for the birth-death   \n");
+        MrBayesPrint ("                    prior; population size and clock rate parameter for the      \n");
+        MrBayesPrint ("                    coalescence prior). When gene trees are constrained to fold  \n");
+        MrBayesPrint ("                    inside species trees, the appropriate branch length prior is \n");
+        MrBayesPrint ("                    'clock:speciestree'. Under this model, it is possible to     \n");
+        MrBayesPrint ("                    control whether the population size is constant or variable  \n");
+        MrBayesPrint ("                    across the species tree using the 'popvarpr' setting.        \n");
+        MrBayesPrint ("                    Branch lengths can also be fixed but only if the topology is \n");
+        MrBayesPrint ("                    fixed.                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For unconstrained branch lengths, MrBayes offers five alter- \n");
+        MrBayesPrint ("                    native prior distributions. The first two are the simple     \n");
+        MrBayesPrint ("                    'uniform' and 'exponential' priors. The 'uniform' prior takes\n");
+        MrBayesPrint ("                    two parameters, the lower and upper bound of the uniform dis-\n");
+        MrBayesPrint ("                    tribution, respectively. The 'exponential' prior takes a sin-\n");
+        MrBayesPrint ("                    gle parameter, the rate of the exponential distribution. The \n");
+        MrBayesPrint ("                    mean of the exponential distribution is the inverse of the   \n");
+        MrBayesPrint ("                    rate. For instance, an 'exp(10)' distribution has an expected\n");
+        MrBayesPrint ("                    mean of 0.1.                                                 \n");
+        MrBayesPrint ("                    MrBayes also offers three more complex prior distributions   \n");
+        MrBayesPrint ("                    on unconstrained branch lengths. The two-exponential prior   \n");
+        MrBayesPrint ("                    (Yang and Rannala 2005; Yang 2007) uses two different expo-  \n"); 
+        MrBayesPrint ("                    nential distributions, one for internal and one for external \n");
+        MrBayesPrint ("                    branch lengths. The two-exponential prior is invoked using   \n");
+        MrBayesPrint ("                    'twoexp(<r_I>,<r_E>)', where '<r_I>' is a number specifying  \n");
+        MrBayesPrint ("                    the rate of the exponential distribution on internal branch  \n");
+        MrBayesPrint ("                    lengths, while '<r_E>' is the rate for external branch       \n");
+        MrBayesPrint ("                    lengths. The prior mean for internal branch lengths is then  \n");
+        MrBayesPrint ("                    1/r_I, and for external ones is 1/r_E. For instance, to set  \n");
+        MrBayesPrint ("                    prior mean of internal branch lengths to 0.01, and external  \n");
+        MrBayesPrint ("                    ones to 0.1, use 'twoexp(100,10)'.                           \n");
+        MrBayesPrint ("                    The setting 'twoexp(10,10)' is equivalent to 'exp(10)'.      \n");
+        MrBayesPrint ("                    The compound Dirichlet priors 'gammadir(<a_T>,<b_T>,<a>,<c>)'\n");
+        MrBayesPrint ("                    and 'invgamdir(<a_T>,<b_T>,<a>,<c>)' specify a fairly diffuse\n");
+        MrBayesPrint ("                    prior on tree length 'T', and then partition the tree length \n");
+        MrBayesPrint ("                    into branch lengths according to a Dirichlet distribution    \n");
+        MrBayesPrint ("                    (Rannala et al. 2012). If 'T' is considered drawn from a     \n");
+        MrBayesPrint ("                    gamma distribution with parameters a_T and b_T, and with mean\n");
+        MrBayesPrint ("                    a_T/b_T, we recommend setting a_T = 1; if it is instead con- \n");
+        MrBayesPrint ("                    sidered drawn from an inverse gamma (invgamma) distribution  \n");
+        MrBayesPrint ("                    with parameters a_T and b_T, and with mean b_T/(a_T -1), then\n");
+        MrBayesPrint ("                    we reccommend setting a_T = 3. In the latter case, b_T should\n");
+        MrBayesPrint ("                    be chosen so that the prior mean of T is reasonable for the  \n");
+        MrBayesPrint ("                    data. In the former case, setting b_T = 0.1 (corresponding to\n");
+        MrBayesPrint ("                    a mean tree length of 10) should be appropriate for a wide   \n");
+        MrBayesPrint ("                    range of tree lengths (at least in the interval 1 to 100).   \n");
+        MrBayesPrint ("                    The concentration parameter a of the Dirichlet distribution  \n");
+        MrBayesPrint ("                    is inversely related to the variance of the branch lengths,  \n");
+        MrBayesPrint ("                    while c is the ratio of the prior means for the internal and \n");
+        MrBayesPrint ("                    external branch lengths. The default setting, a = c = 1,     \n");
+        MrBayesPrint ("                    specifies a uniform Dirichlet distribution of branch lengths \n");
+        MrBayesPrint ("                    given the tree length. For instance, 'gammadir(1,0.1,1,1)'   \n");
+        MrBayesPrint ("                    specifies a compound Dirichlet prior on branch lengths, where\n");
+        MrBayesPrint ("                    tree length is associated with a gamma distribution with mean\n");
+        MrBayesPrint ("                    10, and branch length proportions are associated with a uni- \n");
+        MrBayesPrint ("                    form Dirichlet distribution (default).                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For clock trees with calibrated external nodes (fossils),    \n");
+        MrBayesPrint ("                    MrBayes also offers the fossilized birth-death prior:        \n");
+        MrBayesPrint ("                    'clock:fossilization'.                                       \n");
+        MrBayesPrint ("                    If 'SampleStrat' is set to 'fossiltip', it assumes that upon \n");
+        MrBayesPrint ("                    sampling the lineage is dead and won't produce descendants,  \n");
+        MrBayesPrint ("                    meaning each fossil sample is a tip. If 'SampleStrat' is set \n");
+        MrBayesPrint ("                    to 'random' (default), fossils are sampled serially along the\n");
+        MrBayesPrint ("                    birth-death tree (Stadler 2010), so they can be tips or an-  \n");
+        MrBayesPrint ("                    cestors. See 'Speciationpr', 'Extinctionpr', 'SampleStrat',  \n");
+        MrBayesPrint ("                    'Fossilizationpr' for more information.                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Treeagepr     -- This parameter specifies the prior probability distribution  \n");
+        MrBayesPrint ("                    on the tree age when a uniform or fossilization prior is used\n");
+        MrBayesPrint ("                    on the branch lengths of a clock tree.                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The options are:                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset treeagepr = <setting>                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    where <setting> is one of                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       fixed(<age>)                                              \n");
+        MrBayesPrint ("                       uniform(<min_age>,<max_age>)                              \n");
+        MrBayesPrint ("                       offsetexponential(<min_age>,<mean_age>)                   \n");
+        MrBayesPrint ("                       truncatednormal(<min_age>,<mean_age>,<st.dev.>)           \n");
+        MrBayesPrint ("                       lognormal(<mean_age>,<st.dev.>)                           \n");
+        MrBayesPrint ("                       offsetlognormal(<min_age>,<mean_age>,<st.dev.>)           \n");
+        MrBayesPrint ("                       gamma(<mean_age>,<st.dev.>)                               \n");
+        MrBayesPrint ("                       offsetgamma(<min_age>,<mean_age>,<st.dev.>)               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    These are the same options used for the 'Calibrate' command. \n");
+        MrBayesPrint ("                    Note that, unlike elsewhere in MrMayes, we always use the    \n");
+        MrBayesPrint ("                    mean and standard deviation of the resulting age distribution\n");
+        MrBayesPrint ("                    rather than the standard parameterization, if different. This\n");
+        MrBayesPrint ("                    is to facilitate for the users who want to focus on the in-  \n");
+        MrBayesPrint ("                    formation conveyed about the age. For those who wish to use  \n");
+        MrBayesPrint ("                    the standard parameterization, there are simple conversions  \n");
+        MrBayesPrint ("                    between the two. See the 'Calibrate' command for more infor- \n");
+        MrBayesPrint ("                    mation.                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The tree age is simply the age of the most recent common     \n");
+        MrBayesPrint ("                    ancestor of the tree. If the clock rate is fixed to 1.0,     \n");
+        MrBayesPrint ("                    which is the default, the tree age is equivalent to the      \n");
+        MrBayesPrint ("                    expected number of substitutions from the root to the tip of \n");
+        MrBayesPrint ("                    the tree, that is, tree height. The tree age prior ensures   \n");
+        MrBayesPrint ("                    that the joint probability for the uniform prior (or fossil- \n");
+        MrBayesPrint ("                    ization prior) model of branch lengths on a clock tree is    \n");
+        MrBayesPrint ("                    proper. The default setting is 'gamma(1,1)'. If the root node\n");
+        MrBayesPrint ("                    in the tree is calibrated, the root calibration replaces the \n");
+        MrBayesPrint ("                    tree age prior.                                              \n");
+        MrBayesPrint ("   Speciationpr  -- This parameter sets the prior on the net speciation rate (net\n");
+        MrBayesPrint ("                    diversification), that is, (lambda - mu) in the birth-death  \n");
+        MrBayesPrint ("                    model and the general case of fossilized birth-death model.  \n");
+        MrBayesPrint ("                    Or, (lambda - mu - psi) in the special case of f-b-d model   \n");
+        MrBayesPrint ("                    (fossiltip). Values of this parameter are > 0. Prior options:\n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset speciationpr = uniform(<number>,<number>)           \n");
+        MrBayesPrint ("                       prset speciationpr = exponential(<number>)                \n");
+        MrBayesPrint ("                       prset speciationpr = fixed(<number>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only relevant if the (fossil) birth-death  \n");
+        MrBayesPrint ("                    process is selected as the prior on branch lengths.          \n");
+        MrBayesPrint ("   Extinctionpr  -- This parameter sets the prior on the relative extinction rate\n");
+        MrBayesPrint ("                    (turnover), that is, (mu / lambda) in the birth-death model  \n");
+        MrBayesPrint ("                    and the general case of fossilized birth-death model.        \n");
+        MrBayesPrint ("                    Or, (mu + psi) / lambda in the special case of f-b-d model   \n");
+        MrBayesPrint ("                    (fossiltip). Values of this parameter are in range (0,1).    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset extinctionpr = beta(<number>,<number>)              \n");
+        MrBayesPrint ("                       prset extinctionpr = fixed(<number>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only relevant if the (fossil) birth-death  \n");
+        MrBayesPrint ("                    process is selected as the prior on branch lengths.          \n");
+        MrBayesPrint (" Fossilizationpr -- This parameter sets the prior on the relative fossilization  \n");
+        MrBayesPrint ("                    rate (sampling proportion), psi/(mu+psi), in the fossilized  \n");
+        MrBayesPrint ("                    b-d model. Values of this parameter are in range (0,1).      \n");
+        MrBayesPrint ("                    If SampleStrat is used to divide up time intervals, it sets  \n");
+        MrBayesPrint ("                    the prior for the fossilization parameter in each interval.  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset fossilizationpr = beta(<number>,<number>)           \n");
+        MrBayesPrint ("                       prset fossilizationpr = fixed(<number>)                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only relevant if the fossilized birth-death\n");
+        MrBayesPrint ("                    process is selected as the prior on branch lengths.          \n");
+        MrBayesPrint ("   SampleStrat   -- This parameter sets the strategy under which species were    \n");
+        MrBayesPrint ("                    sampled in the analysis. For the birth-death prior, 'birth-  \n");
+        MrBayesPrint ("                    death' (Hohna et al. 2011), three strategies: 'random',      \n");
+        MrBayesPrint ("                    'diversity' and 'cluster' sampling can be used for extant    \n");
+        MrBayesPrint ("                    taxa. No extinct sample (fossil) is allowed in this prior.   \n");
+        MrBayesPrint ("                    For data with extant and extinct samples, use 'prset brlenspr\n");
+        MrBayesPrint ("                    =clock:fossilization'. (Stadler 2010; Zhang et al. 2015)     \n");
+        MrBayesPrint ("                    For the fossilized birth-death prior, 'fossiltip' assumes    \n");
+        MrBayesPrint ("                    extant taxa are sampled randomly, and extinct taxa (fossils) \n");
+        MrBayesPrint ("                    are sampled with constant rate and upon sampling the lineage \n");
+        MrBayesPrint ("                    is dead and won't produce any descendant. So fossils are all \n");
+        MrBayesPrint ("                    at tips. Except 'fossiltip', the following strategies allow  \n");
+        MrBayesPrint ("                    fossils also being ancestors of other samples.               \n");
+        MrBayesPrint ("                    'random' (default) assumes extant taxa are sampled randomly  \n");
+        MrBayesPrint ("                    with prob rho, while fossils are sampled on the birth-death  \n");
+        MrBayesPrint ("                    tree with piecewise constant rates, psi_i (i = 1,...,s+1).   \n");
+        MrBayesPrint ("                    'diversity' assumes extant taxa are sampled to maximize      \n");
+        MrBayesPrint ("                    diversity, while fossils are sampled randomly.               \n");
+        MrBayesPrint ("                    Time is divided by <s> slice samping events in the past, each\n");
+        MrBayesPrint ("                    at time <t_i> with probability <rho_i> (s >= 0). If rho_i = 0\n");
+        MrBayesPrint ("                    the slice is only used to divide up time intervals not for   \n");
+        MrBayesPrint ("                    sampling of fossils.  Extant taxa are sampled with prob.     \n");
+        MrBayesPrint ("                    (proportion) rho (set in sampleprob).                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset samplestrat = random                                \n");
+        MrBayesPrint ("                       prset samplestrat = diversity                             \n");
+        MrBayesPrint ("                       prset samplestrat = cluster                               \n");
+        MrBayesPrint ("                       prset samplestrat = fossiltip                             \n");
+        MrBayesPrint ("                       prset samplestrat = random    <s>:...,<t_i> <rho_i>,...   \n");
+        MrBayesPrint ("                       prset samplestrat = diversity <s>:...,<t_i> <rho_i>,...   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Sampleprob    -- This parameter sets the fraction of extant species that are  \n");
+        MrBayesPrint ("                    sampled in the analysis. This is used with the birth-death   \n");
+        MrBayesPrint ("                    prior on trees (Yang and Rannala 1997; Stadler 2009; Hohna   \n");
+        MrBayesPrint ("                    et al. 2011), and the fossilized birth-death prior (Stadler  \n");
+        MrBayesPrint ("                    2010, Zhang et al. 2015).                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset sampleprob = <number>                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Popsizepr     -- This parameter sets the prior on the population size compo-  \n");
+        MrBayesPrint ("                    nent of the coalescent parameter. The options are:           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset popsizepr = uniform(<number>,<number>)              \n");
+        MrBayesPrint ("                       prset popsizepr = lognormal(<number>,<number>)            \n");
+        MrBayesPrint ("                       prset popsizepr = normal(<number>,<number>)               \n");
+        MrBayesPrint ("                       prset popsizepr = gamma(<number>,<number>)                \n");
+        MrBayesPrint ("                       prset popsizepr = fixed(<number>)                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only relevant if the coalescence process is\n");
+        MrBayesPrint ("                    selected as the prior on branch lengths. Note that the set-  \n");
+        MrBayesPrint ("                    ting of 'ploidy' in 'lset' is important for how this para-   \n");
+        MrBayesPrint ("                    meter is interpreted.                                        \n");
+        MrBayesPrint ("   Popvarpr      -- In a gene tree - species tree model, this parameter deter-   \n");
+        MrBayesPrint ("                    mines whether the population size is the same for the entire \n");
+        MrBayesPrint ("                    species tree ('popvarpr = equal', the default), or varies    \n");
+        MrBayesPrint ("                    across branches of the species tree ('popvarpr=variable').   \n");
+/*      MrBayesPrint ("   Growthpr      -- This parameter sets the prior on the exponential growth      \n");
+        MrBayesPrint ("                    parameter of the coalescence process. The options are:       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset growthpr = uniform(<number>,<number>)               \n");
+        MrBayesPrint ("                       prset growthpr = exponential(<number>)                    \n");
+        MrBayesPrint ("                       prset growthpr = fixed(<number>)                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    This parameter is only relevant if the coalescence           \n");
+        MrBayesPrint ("                    process is selected as the prior on branch lengths.          \n"); */
+        MrBayesPrint ("   Nodeagepr     -- This parameter specifies the assumptions concerning the age  \n");
+        MrBayesPrint ("                    of the terminal and interior nodes in the tree. The default  \n");
+        MrBayesPrint ("                    model ('nodeagepr = unconstrained') assumes that all terminal\n");
+        MrBayesPrint ("                    nodes are of the same age while the age of interior nodes is \n");
+        MrBayesPrint ("                    unconstrained. The alternative ('nodeagepr = calibrated')    \n");
+        MrBayesPrint ("                    option derives a prior probability distribution on terminal  \n");
+        MrBayesPrint ("                    and interior node ages from the calibration settings (see    \n");
+        MrBayesPrint ("                    the 'calibrate' command). The 'nodeagepr' parameter is only  \n");
+        MrBayesPrint ("                    relevant for clock trees.                                    \n");
+        MrBayesPrint ("   Clockratepr   -- This parameter specifies the prior assumptions concerning the\n");
+        MrBayesPrint ("                    base substitution rate of the tree, measured in expected num-\n");
+        MrBayesPrint ("                    ber of substitutions per site per time unit. The default set-\n");
+        MrBayesPrint ("                    ting is 'Fixed(1.0)', which effectively means that the time  \n");
+        MrBayesPrint ("                    unit is the number of expected substitutions per site.       \n");
+/*      MrBayesPrint ("                    If you apply age constraints to the tree, the default setting\n");
+        MrBayesPrint ("                    changes automatically to 'Exponential(<x>)', where '<x>' (the\n");
+        MrBayesPrint ("                    rate of exponential) is ten times the age of the maximum age \n");
+        MrBayesPrint ("                    constraint. This will give you a very vague prior, which may \n");
+        MrBayesPrint ("                    or may not be adequate for your particular problem.          \n"); */
+        MrBayesPrint ("                    If you do not have any age calibrations in the tree, you can \n");
+        MrBayesPrint ("                    still calibrate the tree using 'Clockratepr'. For instance,  \n");
+        MrBayesPrint ("                    if you know that your sequence data evolve at a rate of 0.20 \n");
+        MrBayesPrint ("                    substitutions per million years, you might calibrate the tree\n");
+        MrBayesPrint ("                    by fixing the substitution rate to 0.20 using                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset clockratepr = fixed(0.20)                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    after which the tree will be calibrated using millions of    \n");
+        MrBayesPrint ("                    years as the unit.                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    You can also assign a prior probability distribution to the  \n");
+        MrBayesPrint ("                    substitution rate, accommodating the uncertainty of it.      \n");
+        MrBayesPrint ("                    When you calibrate the nodes, you should properly set this   \n");
+        MrBayesPrint ("                    prior to match the time unit of the calibrations.            \n");
+        MrBayesPrint ("                    You can choose among normal, lognormal, exponential and gamma\n");
+        MrBayesPrint ("                    distributions for this purpose. For instance, to assign a    \n");
+        MrBayesPrint ("                    normal distribution truncated at 0, so that only positive    \n");
+        MrBayesPrint ("                    values are allowed, and with mean 0.20 and standard deviation\n");
+        MrBayesPrint ("                    of 0.02, you would use                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset clockratepr = normal(0.20,0.02)                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    The lognormal distribution is parameterized in terms of the  \n");
+        MrBayesPrint ("                    mean and standard deviation on the log scale (natural logs). \n");
+        MrBayesPrint ("                    For instance,                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset clockratepr = lognormal(-1.61,0.10)                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    specifies a lognormal distribution with a mean of log values \n");
+        MrBayesPrint ("                    of -1.61 and a standard deviation of log values of 0.10. In  \n");
+        MrBayesPrint ("                    such a case, the mean value of the lognormal distribution is \n");
+        MrBayesPrint ("                    equal to e^(-1.61 + 0.10^2/2) = 0.20.                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    Note that the 'Clockratepr' parameter has no effect on non-  \n");
+        MrBayesPrint ("                    clock trees.                                                 \n");
+        MrBayesPrint ("   Clockvarpr    -- This parameter allows you to specify the type of clock you   \n");
+        MrBayesPrint ("                    are assuming. The default is 'strict', which corresponds to  \n");
+        MrBayesPrint ("                    the standard clock model where the evolutionary rate is      \n");
+        MrBayesPrint ("                    constant throughout the tree. For relaxed clock models, you  \n");
+        MrBayesPrint ("                    can use 'cpp', 'tk02', 'igr'. ('mixed' is not working)       \n");
+        MrBayesPrint ("                    'cpp' invokes a relaxed clock model where the rate evolves   \n");
+        MrBayesPrint ("                    according to a Compound Poisson Process (CPP) (Huelsenbeck   \n");
+        MrBayesPrint ("                    et al., 2000).                                               \n");
+        MrBayesPrint ("                    'tk02' invokes the Brownian Motion model described by Thorne \n");
+        MrBayesPrint ("                    and Kishino (2002). [autocorrelated lognormal distributions] \n");
+        MrBayesPrint ("                    'igr' invokes the Independent Gamma Rate (IGR) model where   \n");
+        MrBayesPrint ("                    each branch has an independent rate drawn from a gamma       \n");
+        MrBayesPrint ("                    distribution (LePage et al., 2007).                          \n");
+        MrBayesPrint ("                    Each of the relaxed clock models has additional parameters   \n");
+        MrBayesPrint ("                    with priors. For the CPP model, it is 'cppratepr' and        \n");
+        MrBayesPrint ("                    'cppmultdevpr'; for the TK02 model, it is 'tk02varpr'; for   \n");
+        MrBayesPrint ("                    the IGR  model, it is 'igrvarpr'.                            \n");
+        MrBayesPrint ("                    The 'clockvarpr' parameter is only relevant for clock trees. \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For backward compatibility, 'bm' is allowed as a synonym of  \n");
+        MrBayesPrint ("                    'tk02', and 'ibr' as a synonym of 'igr'.                     \n");
+        MrBayesPrint ("   Cppratepr     -- This parameter allows you to specify a prior probability     \n");
+        MrBayesPrint ("                    distribution on the rate of the Poisson process generating   \n");
+        MrBayesPrint ("                    changes in the evolutionary rate in the CPP relaxed clock    \n");
+        MrBayesPrint ("                    model. You can either fix the rate or associate it with an   \n");
+        MrBayesPrint ("                    exponential prior using                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset cppratepr = fixed(<number>)                         \n");
+        MrBayesPrint ("                       prset cppratepr = exponential(<number>)                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For instance, if you fix the rate to 2, then on a branch     \n");
+        MrBayesPrint ("                    with the length equual to one expresed in terms of average   \n");
+        MrBayesPrint ("                    expected number of substitution per site, you expect to see, \n"); 
+        MrBayesPrint ("                    on average, two rate-modifying events.                       \n");
+        MrBayesPrint ("                    If you put an exponential(0.1) on the rate, you will be      \n");
+        MrBayesPrint ("                    estimating the rate against a prior probability distribution \n");
+        MrBayesPrint ("                    where the expected rate is 10 (= 1/0.1).                     \n");
+        MrBayesPrint ("   Cppmultdevpr  -- This parameter allows you to specify the standard deviation  \n");
+        MrBayesPrint ("                    of the log-normal distribution from which the rate multi-    \n");
+        MrBayesPrint ("                    pliers of the CPP relaxed clock model are drawn. The standard\n");
+        MrBayesPrint ("                    deviation is given on the log scale. The default value of 1.0\n");
+        MrBayesPrint ("                    thus corresponds to rate multipliers varying from 0.37 (1/e) \n");
+        MrBayesPrint ("                    to 2.7 (e) when they are +/- one standard deviation from the \n");
+        MrBayesPrint ("                    expected mean. The expected mean of the logarithm of the mul-\n");
+        MrBayesPrint ("                    pliers is fixed to 0, ensuring that the expected mean rate is\n");
+        MrBayesPrint ("                    1.0. You can change the default value by using               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset cppmultdevpr = fixed(<number>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    where <number> is the standard deviation on the log scale.   \n");
+        MrBayesPrint ("   TK02varpr     -- This parameter allows you to specify the prior probability   \n");
+        MrBayesPrint ("                    distribution for the variance of the rate multiplier in the  \n");
+        MrBayesPrint ("                    Thorne-Kishino ('Brownian motion') relaxed clock model.      \n");
+        MrBayesPrint ("                    Specifically, the parameter specifies the rate at which the  \n");
+        MrBayesPrint ("                    variance increases with respect to the base rate of the      \n");
+        MrBayesPrint ("                    clock. If you have a branch of a length corresponding to 0.4 \n");
+        MrBayesPrint ("                    expected changes per site according to the base rate of the  \n");
+        MrBayesPrint ("                    clock, and the tk02var parameter has a value of 2.0, then the\n");
+        MrBayesPrint ("                    rate multiplier at the end of the branch will be drawn from a\n");
+        MrBayesPrint ("                    lognormal distribution with a variance of 0.4*2.0 (on the    \n");
+        MrBayesPrint ("                    linear, not the logarithm scale). The mean is the same as the\n");
+        MrBayesPrint ("                    rate multiplier at the start of the branch (again on the     \n");
+        MrBayesPrint ("                    linear scale).                                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    You can set the parameter to a fixed value, or specify that  \n");
+        MrBayesPrint ("                    it is drawn from an exponential or uniform distribution:     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset tk02varpr = fixed(<number>)                         \n");
+        MrBayesPrint ("                       prset tk02varpr = exponential(<number>)                   \n");
+        MrBayesPrint ("                       prset tk02varpr = uniform(<number>,<number>)              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For backward compatibility, 'bmvarpr' is allowed as a synonym\n");
+        MrBayesPrint ("                    of 'tko2varpr'.                                              \n");
+        MrBayesPrint ("   Igrvarpr      -- This parameter allows you to specify a prior on the variance \n");
+        MrBayesPrint ("                    of the gamma distribution from which the branch lengths are  \n");
+        MrBayesPrint ("                    drawn in the independent branch rate (IGR) relaxed clock     \n");
+        MrBayesPrint ("                    model. Specifically, the parameter specifies the rate at     \n");
+        MrBayesPrint ("                    which the variance increases with respect to the base rate of\n");
+        MrBayesPrint ("                    the clock. If you have a branch of a length corresponding to \n");
+        MrBayesPrint ("                    0.4 expected changes per site according to the base rate of  \n");
+        MrBayesPrint ("                    the clock, and the igrvar parameter has a value of 2.0, then \n");
+        MrBayesPrint ("                    the effective branch length will be drawn from a distribution\n");
+        MrBayesPrint ("                    with a variance of 0.4*2.0.                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    You can set the parameter to a fixed value, or specify that  \n");
+        MrBayesPrint ("                    it is drawn from an exponential or uniform distribution:     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset igrvarpr = fixed(<number>)                          \n");
+        MrBayesPrint ("                       prset igrvarpr = exponential(<number>)                    \n");
+        MrBayesPrint ("                       prset igrvarpr = uniform(<number>,<number>)               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    For backward compatibility, 'ibrvarpr' is allowed as a syn-  \n");
+        MrBayesPrint ("                    onym of 'igrvarpr'.                                          \n");
+        MrBayesPrint ("   Ratepr        -- This parameter allows you to specify the site specific rates \n");
+        MrBayesPrint ("                    model or any other model that allows different partitions to \n");
+        MrBayesPrint ("                    evolve at different rates. First, you must have defined a    \n");
+        MrBayesPrint ("                    partition of the characters. For example, you may define a   \n");
+        MrBayesPrint ("                    partition that divides the characters by codon position, if  \n");
+        MrBayesPrint ("                    you have DNA data. You can also divide your data using a     \n");
+        MrBayesPrint ("                    partition that separates different genes from each other.    \n");
+        MrBayesPrint ("                    The next step is to make the desired partition the active one\n");
+        MrBayesPrint ("                    using the set command. For example, if your partition is     \n");
+        MrBayesPrint ("                    called \"by_codon\", then you make that the active partition \n");
+        MrBayesPrint ("                    using \"set partition=by_codon\". Now that you have defined  \n");
+        MrBayesPrint ("                    and activated a partition, you can specify the rate multi-   \n");
+        MrBayesPrint ("                    pliers for the various partitions. The options are:          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                       prset ratepr = fixed                                      \n");
+        MrBayesPrint ("                       prset ratepr = variable                                   \n");
+        MrBayesPrint ("                       prset ratepr = dirichlet(<number>,<number>,...,<number>)  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                    If you specify \"fixed\", then the rate multiplier for       \n");
+        MrBayesPrint ("                    that partition is set to 1 (i.e., the rate is fixed to       \n");
+        MrBayesPrint ("                    the average rate across partitions). On the other hand,      \n");
+        MrBayesPrint ("                    if you specify \"variable\", then the rate is allowed to     \n");
+        MrBayesPrint ("                    vary across partitions subject to the constraint that the    \n");
+        MrBayesPrint ("                    average rate of substitution across the partitions is 1.     \n");
+        MrBayesPrint ("                    You must specify a variable rate prior for at least two      \n");
+        MrBayesPrint ("                    partitions, otherwise the option is not activated when       \n");
+        MrBayesPrint ("                    calculating likelihoods. The variable option automatically   \n");
+        MrBayesPrint ("                    associates the partition rates with a dirichlet(1,...,1)     \n");
+        MrBayesPrint ("                    prior. The dirichlet option is an alternative way of setting \n");
+        MrBayesPrint ("                    a partition rate to be variable, and also gives accurate     \n");
+        MrBayesPrint ("                    control of the shape of the prior. The parameters of the     \n");
+        MrBayesPrint ("                    Dirichlet are listed in the order of the partitions that the \n");
+        MrBayesPrint ("                    ratepr is applied to. For instance, \"prset applyto=(1,3,4)  \n");
+        MrBayesPrint ("                    ratepr = dirichlet(10,40,15)\" would set the Dirichlet para- \n");
+        MrBayesPrint ("                    meter 10 to partition 1, 40 to partition 3, and 15 to parti- \n");
+        MrBayesPrint ("                    tion 4. The Dirichlet distribution is applied to the weighted\n");
+        MrBayesPrint ("                    rates; that is, it weights the partition rates according to  \n");
+        MrBayesPrint ("                    the number of included characters in each partition.         \n");
+        MrBayesPrint ("   Generatepr    -- This parameter is similar to 'Ratepr' but applies to gene    \n");
+        MrBayesPrint ("                    trees in the multispecies coalescent, whereas 'Ratepr' app-  \n");
+        MrBayesPrint ("                    lies to partitions within genes.                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        if (numCurrentDivisions == 0)
+            tempInt = 1;
+        else
+            tempInt = numCurrentDivisions;
+        for (i=0; i<tempInt; i++)
+            {
+            if (numCurrentDivisions == 0)
+                {
+                MrBayesPrint ("   Default model settings:                                                       \n");
+                mp = &defaultModel;
+                }
+            else
+                {
+                MrBayesPrint ("   Model settings for partition %d:                                              \n", i+1);
+                mp = &modelParams[i];
+                }
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   Parameter        Options                      Current Setting                 \n");
+            MrBayesPrint ("   ------------------------------------------------------------------            \n");
+
+            MrBayesPrint ("   Tratiopr         Beta/Fixed                   %s", mp->tRatioPr);
+            if (!strcmp(mp->tRatioPr, "Beta"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->tRatioDir[0], mp->tRatioDir[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->tRatioFix);
+
+            MrBayesPrint ("   Revmatpr         Dirichlet/Fixed              %s", mp->revMatPr);
+            if (!strcmp(mp->revMatPr, "Dirichlet"))
+                MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->revMatDir[0],
+                mp->revMatDir[1], mp->revMatDir[2], mp->revMatDir[3],
+                mp->revMatDir[4], mp->revMatDir[5]);
+            else
+                MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->revMatFix[0],
+                mp->revMatFix[1], mp->revMatFix[2], mp->revMatFix[3],
+                mp->revMatFix[4], mp->revMatFix[5]);
+
+            MrBayesPrint ("   Aamodelpr        Fixed/Mixed                  %s", mp->aaModelPr);
+            if (!strcmp(mp->aaModelPr, "Fixed"))
+                MrBayesPrint ("(%s)\n", mp->aaModel);
+            else
+                MrBayesPrint ("\n");
+
+            MrBayesPrint ("   Aarevmatpr       Dirichlet/Fixed              %s", mp->aaRevMatPr);
+            if (!strcmp(mp->aaRevMatPr, "Dirichlet"))
+                {
+                for (j=1; j<190; j++)
+                    if (AreDoublesEqual (mp->aaRevMatDir[0], mp->aaRevMatDir[j], 0.00001) == NO)
+                        break;
+                if (j==190)
+                    MrBayesPrint ("(%1.1lf,%1.1lf,...)\n", mp->aaRevMatDir[0], mp->aaRevMatDir[0]);
+                else
+                    MrBayesPrint (" (use 'Showmodel' to see values set by user)\n");
+                }
+            else
+                {
+                for (j=1; j<190; j++)
+                    if (AreDoublesEqual (mp->aaRevMatFix[0], mp->aaRevMatFix[j], 0.00001) == NO)
+                        break;
+                if (j==190)
+                    MrBayesPrint ("(%1.1lf,%1.1lf,...)\n", mp->aaRevMatFix[0], mp->aaRevMatFix[0]);
+                else
+                    MrBayesPrint (" (use 'Showmodel' to see values set by user)\n");
+                }
+
+            MrBayesPrint ("   Omegapr          Dirichlet/Fixed              %s", mp->omegaPr);
+            if (!strcmp(mp->omegaPr, "Dirichlet"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->omegaDir[0], mp->omegaDir[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->omegaFix);
+
+            MrBayesPrint ("   Ny98omega1pr     Beta/Fixed                   %s", mp->ny98omega1pr);
+            if (!strcmp(mp->ny98omega1pr, "Beta"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->ny98omega1Beta[0], mp->ny98omega1Beta[1]);
+            else if (!strcmp(mp->ny98omega1pr, "Fixed"))
+                MrBayesPrint ("(%1.1lf)\n", mp->ny98omega1Fixed);
+                
+            MrBayesPrint ("   Ny98omega3pr     Uniform/Exponential/Fixed    %s", mp->ny98omega3pr);
+            if (!strcmp(mp->ny98omega3pr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->ny98omega3Uni[0], mp->ny98omega3Uni[1]);
+            else if (!strcmp(mp->ny98omega3pr, "Exponential"))
+                MrBayesPrint ("(%1.1lf)\n", mp->ny98omega3Exp);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->ny98omega3Fixed);
+
+            MrBayesPrint ("   M3omegapr        Exponential/Fixed            %s", mp->m3omegapr);
+            if (!strcmp(mp->m3omegapr, "Exponential"))
+                MrBayesPrint ("\n");
+            else if (!strcmp(mp->m3omegapr, "Fixed"))
+                MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->m3omegaFixed[0], mp->m3omegaFixed[1], mp->m3omegaFixed[2]);
+                
+            MrBayesPrint ("   Codoncatfreqs    Dirichlet/Fixed              %s", mp->codonCatFreqPr);
+            if (!strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->codonCatDir[0], mp->codonCatDir[1], mp->codonCatDir[2]);
+            else
+                MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf)\n", mp->codonCatFreqFix[0], mp->codonCatFreqFix[1], mp->codonCatFreqFix[2]);
+
+            MrBayesPrint ("   Statefreqpr      Dirichlet/Fixed              %s", mp->stateFreqPr);
+            if (!strcmp(mp->stateFreqPr, "Dirichlet"))
+                {
+                if (mp->dataType == DNA || mp->dataType == RNA)
+                    {
+                    if (!strcmp(mp->nucModel, "4by4"))
+                        MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->stateFreqsDir[0], mp->stateFreqsDir[1],
+                            mp->stateFreqsDir[2], mp->stateFreqsDir[3]);
+                    else
+                        MrBayesPrint ("\n");
+                    }
+                else if (mp->dataType == RESTRICTION)
+                    {
+                    MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->stateFreqsDir[0], mp->stateFreqsDir[1]);
+                    }
+                else
+                    MrBayesPrint ("\n");
+                }
+            else if (!strcmp(mp->stateFreqPr, "Fixed"))
+                {
+                if (mp->dataType == DNA || mp->dataType == RNA)
+                    {
+                    if (!strcmp(mp->nucModel, "4by4"))
+                        MrBayesPrint ("(%1.1lf,%1.1lf,%1.1lf,%1.1lf)\n", mp->stateFreqsFix[0], mp->stateFreqsFix[1],
+                            mp->stateFreqsFix[2], mp->stateFreqsFix[3]);
+                    else
+                        MrBayesPrint ("\n");
+                    }
+                else if (mp->dataType == RESTRICTION)
+                    {
+                    MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->stateFreqsFix[0], mp->stateFreqsFix[1]);
+                    }
+                else
+                    MrBayesPrint ("\n");
+                }
+
+            MrBayesPrint ("   Shapepr          Uniform/Exponential/Fixed    %s", mp->shapePr);
+            if (!strcmp(mp->shapePr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->shapeUni[0], mp->shapeUni[1]);
+            else if (!strcmp(mp->shapePr, "Exponential"))
+                MrBayesPrint ("(%1.1lf)\n", mp->shapeExp);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->shapeFix);
+
+            MrBayesPrint ("   Ratecorrpr       Uniform/Fixed                %s", mp->adGammaCorPr);
+            if (!strcmp(mp->adGammaCorPr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->corrUni[0], mp->corrUni[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->corrFix);
+
+            MrBayesPrint ("   Pinvarpr         Uniform/Fixed                %s", mp->pInvarPr);
+            if (!strcmp(mp->pInvarPr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->pInvarUni[0], mp->pInvarUni[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->pInvarFix);
+
+            MrBayesPrint ("   Covswitchpr      Uniform/Exponential/Fixed    %s", mp->covSwitchPr);
+            if (!strcmp(mp->covSwitchPr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->covswitchUni[0], mp->covswitchUni[1]);
+            else if (!strcmp(mp->covSwitchPr, "Exponential"))
+                MrBayesPrint ("(%1.1lf)\n", mp->covswitchExp);
+            else
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->covswitchFix[0], mp->covswitchFix[1]);
+
+            MrBayesPrint ("   Symdirihyperpr   Uniform/Exponential/Fixed    %s", mp->symPiPr);
+            if (!strcmp(mp->symPiPr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->symBetaUni[0], mp->symBetaUni[1]);
+            else if (!strcmp(mp->covSwitchPr, "Exponential"))
+                MrBayesPrint ("(%1.1lf)\n", mp->symBetaExp);
+            else
+                {
+                if (mp->symBetaFix < 0)
+                    MrBayesPrint ("(Infinity)\n");
+                else
+                    MrBayesPrint ("(%1.1lf)\n", mp->symBetaFix);
+                }
+            
+            MrBayesPrint ("   Topologypr       Uniform/Constraints/Fixed/   %s", mp->topologyPr);
+            if (!strcmp(mp->topologyPr, "Constraints"))
+                {
+                MrBayesPrint ("(");
+                for (j=0; j<numDefinedConstraints; j++)
+                    {
+                    if (mp->activeConstraints[j] == YES)
+                        {
+                        MrBayesPrint ("%d", j+1);
+                        break;
+                        }
+                    }
+               for (j++; j<numDefinedConstraints; j++)
+                    {
+                    if (mp->activeConstraints[j] == YES)
+                        {
+                        MrBayesPrint (",%d", j+1);
+                        }
+                    }
+                MrBayesPrint (")\n");
+                }
+            else if (!strcmp(mp->topologyPr, "Fixed"))
+                MrBayesPrint("(%s)\n", userTree[mp->topologyFix]->name);
+            else
+                MrBayesPrint ("\n");
+            MrBayesPrint ("                    Speciestree                  \n");
+            
+            MrBayesPrint ("   Brlenspr         Unconstrained/Clock/Fixed    %s", mp->brlensPr);
+            if (!strcmp(mp->brlensPr, "Unconstrained"))
+                {
+                if (!strcmp(mp->unconstrainedPr, "Uniform"))
+                    MrBayesPrint (":Uni(%1.1lf,%1.1lf)\n", mp->brlensUni[0], mp->brlensUni[1]);
+                else if (!strcmp(mp->unconstrainedPr, "GammaDir"))
+                    MrBayesPrint (":GammaDir(%1.1lf,%1.3lf,%1.1lf,%1.1lf)\n",
+                                mp->brlensDir[0], mp->brlensDir[1], mp->brlensDir[2], mp->brlensDir[3]);
+                else if (!strcmp(mp->unconstrainedPr, "invGamDir"))
+                    MrBayesPrint (":invGamDir(%1.1lf,%1.3lf,%1.1lf,%1.1lf)\n",
+                                mp->brlensDir[0], mp->brlensDir[1], mp->brlensDir[2], mp->brlensDir[3]);
+                else if (!strcmp(mp->unconstrainedPr, "twoExp"))
+                    MrBayesPrint (":twoExp(%1.1lf,%1.1lf)\n", mp->brlens2Exp[0], mp->brlens2Exp[1]);
+                else
+                    MrBayesPrint (":Exp(%1.1lf)\n", mp->brlensExp);
+                }
+            else if (!strcmp(mp->brlensPr, "Clock"))
+                {
+                if (!strcmp(mp->clockPr,"Fixed"))
+                    MrBayesPrint (":%s(%s)\n", mp->clockPr, userTree[mp->brlensFix]->name);
+                else
+                    MrBayesPrint (":%s\n", mp->clockPr);
+                }
+            else if (!strcmp(mp->brlensPr, "Fixed"))
+                MrBayesPrint("(%s)\n", userTree[mp->brlensFix]->name);
+            
+            MrBayesPrint ("   Treeagepr        Gamma/Uniform/Fixed/         %s\n", mp->treeAgePr.name);
+            MrBayesPrint ("                    Truncatednormal/Lognormal/   \n");
+            MrBayesPrint ("                    Offsetlognormal/Offsetgamma/ \n");
+            MrBayesPrint ("                    Offsetexponential            \n");
+            
+            MrBayesPrint ("   Speciationpr     Uniform/Exponential/Fixed    %s", mp->speciationPr);
+            if (!strcmp(mp->speciationPr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->speciationUni[0], mp->speciationUni[1]);
+            else if (!strcmp(mp->speciationPr, "Exponential"))
+                MrBayesPrint ("(%1.1lf)\n", mp->speciationExp);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->speciationFix);
+            
+            MrBayesPrint ("   Extinctionpr     Beta/Fixed                   %s", mp->extinctionPr);
+            if (!strcmp(mp->extinctionPr, "Beta"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->extinctionBeta[0], mp->extinctionBeta[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->extinctionFix);
+            
+            MrBayesPrint ("   Fossilizationpr  Beta/Fixed                   %s", mp->fossilizationPr);
+            if (!strcmp(mp->fossilizationPr, "Beta"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->fossilizationBeta[0], mp->fossilizationBeta[1]);
+            else
+                MrBayesPrint ("(%1.2lf)\n", mp->fossilizationFix);
+            
+            MrBayesPrint ("   SampleStrat      Random/Diversity/Cluster/    %s\n", mp->sampleStrat);
+            MrBayesPrint ("                    FossilTip                    \n");
+            // if (!strcmp(mp->sampleStrat, "Random") || !strcmp(mp->sampleStrat, "Diversity"))
+            
+            MrBayesPrint ("   Sampleprob       <number>                     %1.8lf\n", mp->sampleProb);
+            
+            MrBayesPrint ("   Popsizepr        Lognormal/Gamma/Uniform/     %s", mp->popSizePr);
+            if (!strcmp(mp->popSizePr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeUni[0], mp->popSizeUni[1]);
+            else if (!strcmp(mp->popSizePr, "Lognormal"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeLognormal[0], mp->popSizeLognormal[1]);
+            else if (!strcmp(mp->popSizePr, "Normal"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeNormal[0], mp->popSizeNormal[1]);
+            else if (!strcmp(mp->popSizePr, "Gamma"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->popSizeGamma[0], mp->popSizeGamma[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->popSizeFix);
+            MrBayesPrint ("                    Normal/Fixed                 \n");
+
+            MrBayesPrint ("   Popvarpr         Equal/Variable               %s\n", mp->popVarPr);
+
+            /*
+            MrBayesPrint ("   Growthpr         Uniform/Exponential/         \n");
+            MrBayesPrint ("                    Fixed/Normal                 %s", mp->growthPr);
+            if (!strcmp(mp->growthPr, "Uniform"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->growthUni[0], mp->growthUni[1]);
+            else if (!strcmp(mp->growthPr, "Exponential"))
+                MrBayesPrint ("(%1.1lf)\n", mp->growthExp);
+            else if (!strcmp(mp->growthPr, "Normal"))
+                MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->growthNorm[0], mp->growthNorm[1]);
+            else
+                MrBayesPrint ("(%1.1lf)\n", mp->growthFix); 
+            */
+
+            MrBayesPrint ("   Nodeagepr        Unconstrained/Calibrated     %s\n", mp->nodeAgePr);
+
+            MrBayesPrint ("   Clockratepr      Fixed/Normal/Lognormal/      %s", mp->clockRatePr);
+            if (!strcmp(mp->clockRatePr, "Fixed"))
+                MrBayesPrint ("(%1.2lf)\n", mp->clockRateFix);
+            else if (!strcmp(mp->clockRatePr,"Exponential"))
+                MrBayesPrint ("(%1.2lf)\n", mp->clockRateExp);
+            else if (!strcmp(mp->clockRatePr,"Normal"))
+                MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateNormal[0], mp->clockRateNormal[1]);
+            else if (!strcmp(mp->clockRatePr,"Lognormal"))
+                MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateLognormal[0], mp->clockRateLognormal[1]);
+            else
+                {
+                assert (!strcmp(mp->clockRatePr,"Gamma"));
+                MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->clockRateGamma[0], mp->clockRateGamma[1]);
+                }
+            MrBayesPrint ("                    Exponential/Gamma            \n");
+
+            MrBayesPrint ("   Clockvarpr       Strict/Cpp/TK02/Igr/Mixed    %s\n", mp->clockVarPr);
+
+            MrBayesPrint ("   Cppratepr        Fixed/Exponential            %s", mp->cppRatePr);
+            if (!strcmp(mp->cppRatePr, "Fixed"))
+                MrBayesPrint ("(%1.2lf)\n", mp->cppRateFix);
+            else /* if (!strcmp(mp->cppRatePr,"Exponential")) */
+                MrBayesPrint ("(%1.2lf)\n", mp->cppRateExp);
+
+            MrBayesPrint ("   Cppmultdevpr     Fixed                        %s", mp->cppMultDevPr);
+            MrBayesPrint ("(%1.2lf)\n", mp->cppMultDevFix);
+
+            MrBayesPrint ("   TK02varpr        Fixed/Exponential/Uniform    %s", mp->tk02varPr);
+            if (!strcmp(mp->tk02varPr, "Fixed"))
+                MrBayesPrint ("(%1.2lf)\n", mp->tk02varFix);
+            else if (!strcmp(mp->tk02varPr,"Exponential"))
+                MrBayesPrint ("(%1.2lf)\n", mp->tk02varExp);
+            else
+                {
+                assert (!strcmp(mp->tk02varPr,"Uniform"));
+                MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->tk02varUni[0], mp->tk02varUni[1]);
+                }
+
+            MrBayesPrint ("   Igrvarpr         Fixed/Exponential/Uniform    %s", mp->igrvarPr);
+            if (!strcmp(mp->igrvarPr, "Fixed"))
+                MrBayesPrint ("(%1.2lf)\n", mp->igrvarFix);
+            else if (!strcmp(mp->igrvarPr,"Exponential"))
+                MrBayesPrint ("(%1.2lf)\n", mp->igrvarExp);
+            else
+                {
+                assert (!strcmp(mp->igrvarPr,"Uniform"));
+                MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->igrvarUni[0], mp->igrvarUni[1]);
+                }
+            
+            /*  MrBayesPrint ("   Mixedvarpr       Fixed/Exponential/Uniform    %s", mp->mixedvarPr);
+            if (!strcmp(mp->mixedvarPr, "Fixed"))
+                MrBayesPrint ("(%1.2lf)\n", mp->mixedvarFix);
+            else if (!strcmp(mp->mixedvarPr,"Exponential"))
+                MrBayesPrint ("(%1.2lf)\n", mp->mixedvarExp);
+            else
+                {
+                assert (!strcmp(mp->mixedvarPr,"Uniform"));
+                MrBayesPrint ("(%1.2lf,%1.2lf)\n", mp->mixedvarUni[0], mp->mixedvarUni[1]);
+                }  */
+
+            MrBayesPrint ("   Ratepr           Fixed/Variable=Dirichlet     %s", mp->ratePr);
+            if (!strcmp(mp->ratePr, "Dirichlet"))
+                MrBayesPrint ("(...,%1.1lf,...)\n", mp->ratePrDir);
+            else
+                MrBayesPrint ("\n");
+
+            MrBayesPrint ("   Generatepr       Fixed/Variable=Dirichlet     %s", mp->generatePr);
+            if (!strcmp(mp->generatePr, "Dirichlet"))
+                MrBayesPrint ("(...,%1.1lf,...)\n", mp->generatePrDir);
+            else
+                MrBayesPrint ("\n");
+
+            MrBayesPrint ("   ------------------------------------------------------------------            \n");
+            MrBayesPrint ("                                                                                 \n");
+            }
+        }
+    else if (!strcmp(helpTkn, "Ctype"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Ctype                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command sets the character ordering for standard-type data. The          \n");
+        MrBayesPrint ("   correct usage is:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      ctype <ordering>:<characters>                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The available options for the <ordering> specifier are:                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("     unordered    -- Movement directly from one state to another is              \n");
+        MrBayesPrint ("                     allowed in an instant of time.                              \n");
+        MrBayesPrint ("     ordered      -- Movement is only allowed between adjacent characters.       \n");
+        MrBayesPrint ("                     For example, perhaps only between 0 <-> 1 and 1 <-> 2       \n");
+        MrBayesPrint ("                     for a three state character ordered as 0 - 1 - 2.           \n");
+        MrBayesPrint ("     irreversible -- Rates of change for losses are 0.                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The characters to which the ordering is applied is specified in manner        \n");
+        MrBayesPrint ("   that is identical to commands such as \"include\" or \"exclude\". For         \n");
+        MrBayesPrint ("   example,                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      ctype ordered: 10 23 45                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   defines charactes 10, 23, and 45 to be of type ordered. Similarly,            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      ctype irreversible: 54 - 67  71-92                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   defines characters 54 to 67 and characters 71 to 92 to be of type             \n");
+        MrBayesPrint ("   irreversible. You can use the \".\" to denote the last character, and         \n");
+        MrBayesPrint ("   \"all\" to denote all of the characters. Finally, you can use the             \n");
+        MrBayesPrint ("   specifier \"\\\" to apply the ordering to every n-th character or             \n");
+        MrBayesPrint ("   you can use predefined charsets to specify the character.                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Only one ordering can be used on any specific application of ctype.           \n");
+        MrBayesPrint ("   If you want to apply different orderings to different characters, then        \n");
+        MrBayesPrint ("   you need to use ctype multiple times. For example,                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      ctype ordered: 1-50                                                        \n");
+        MrBayesPrint ("      ctype irreversible: 51-100                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   sets characters 1 to 50 to be ordered and characters 51 to 100 to be          \n");
+        MrBayesPrint ("   irreversible.                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The ctype command is only sensible with morphological (here called            \n");
+        MrBayesPrint ("   \"standard\") characters. The program ignores attempts to apply char-         \n");
+        MrBayesPrint ("   acter orderings to other types of characters, such as DNA characters.         \n");
+
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Propset"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Propset                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command allows the user to change the details of the MCMC samplers       \n");
+        MrBayesPrint ("   (moves) that update the state of the chain. The useage is:                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      propset  <move_name>$<tuning-parameter>=<value>                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Assume we have a topology parameter called 'Tau{all}', which is sampled by    \n");
+        MrBayesPrint ("   the move 'ExtTBR(Tau{all})' (note that the parameter name is included in the  \n");
+        MrBayesPrint ("   move name). This move has three tuning parameters: (1) 'prob', the relative   \n");
+        MrBayesPrint ("   proposal probability (a weight defining its probability relative to other     \n");
+        MrBayesPrint ("   moves); (2) 'p_ext', the extension probability; and (3) 'lambda', the tuning  \n");
+        MrBayesPrint ("   parameter of the branch length multiplier. A list of the tuning parameters is \n");
+        MrBayesPrint ("   available by using 'Showmoves' (see below). To change the relative proposal   \n");
+        MrBayesPrint ("   probability to 20 and the extension probability to 0.7, use:                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      propset etbr(tau{all})$prob=20 etbr(tau{all})$p_ext=0.7                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This change would apply to all chains in all runs. It is also possible to set \n");
+        MrBayesPrint ("   the tuning parameters of individual runs and chains using the format:         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      propset  <move_name>$<tuning-parameter>(<run>,<chain>)=<value>             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   where <run> and <chain> are the index numbers of the run and chain for which  \n");
+        MrBayesPrint ("   you want to change the value. If you leave out the index of the run, the      \n");
+        MrBayesPrint ("   change will apply to all runs; if you leave out the index of the chain, the   \n");
+        MrBayesPrint ("   change will similarly apply to all chains. To switch off the exttbr(tau{all}) \n");
+        MrBayesPrint ("   move in chain 2 of all runs, use:                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      propset  etbr(tau{all})$prob(,2)=0                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   It is important to note that all moves are not available until the model has  \n");
+        MrBayesPrint ("   been completely defined. Any change to the model will cause all proposal      \n");
+        MrBayesPrint ("   tuning parameters to return to their default values. To see a list of all the \n");
+        MrBayesPrint ("   moves that are currently switched on for the model, use 'showmoves'. You can  \n");
+        MrBayesPrint ("   also see other available moves by using 'showmoves allavailable=yes'. A list  \n");
+        MrBayesPrint ("   of the moves for each parameter in the model is available by using the command\n");
+        MrBayesPrint ("   'Showparams'. If you change proposal probabilities, make sure that all        \n");
+        MrBayesPrint ("   parameters that are not fixed in your model have at least one move switched   \n");
+        MrBayesPrint ("   on.                                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   One word of warning: You should be extremely careful when modifying any       \n");
+        MrBayesPrint ("   of the chain parameters using 'propset'. It is quite possible to completely   \n");
+        MrBayesPrint ("   wreck any hope of achieving convergence by inappropriately setting the        \n");
+        MrBayesPrint ("   tuning parameters. In general, you want to set move tuning parameters such    \n");
+        MrBayesPrint ("   that the acceptance rate of the move is intermediate (we suggest targeting    \n");
+        MrBayesPrint ("   the range 10%% to 70%% acceptance, if possible). If the acceptance rate is    \n");
+        MrBayesPrint ("   outside of this range, the MCMC chain will probably not sample that parameter \n");
+        MrBayesPrint ("   very efficiently. The acceptance rates for all moves in the cold chain(s) are \n");
+        MrBayesPrint ("   summarized at the end of each run in the screen output. The acceptance rates  \n");
+        MrBayesPrint ("   (potentially for all chains, cold and heated) are also printed to the .mcmc   \n");
+        MrBayesPrint ("   file if Mcmc convergence diagnostics are turned on (using 'Mcmc' or 'Mcmcp'). \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Log"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Log                                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command allows output to the screen to also be output to a file.         \n");
+        MrBayesPrint ("   The useage is:                                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      log start/stop filename=<name> append/replace                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The options are:                                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Start/Stop     -- Starts or stops logging of output to file.                  \n");
+        MrBayesPrint ("   Append/Replace -- Either append to or replace existing file.                  \n");
+        MrBayesPrint ("   Filename       -- Name of log file (currently, the name of the log            \n");
+        MrBayesPrint ("                     file is \"%s\").\n", logFileName);
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Translate"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Translate                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used by MrBayes to specify the mapping between taxon names    \n");
+        MrBayesPrint ("   and taxon numbers in a Nexus tree file. For instance,                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      translate                                                                  \n");
+        MrBayesPrint ("         1 Homo,                                                                 \n");
+        MrBayesPrint ("         2 Pan,                                                                  \n");
+        MrBayesPrint ("         3 Gorilla,                                                              \n");
+        MrBayesPrint ("         4 Hylobates;                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   establishes that the taxon labeled 1 in the trees that follow is Homo, the    \n");
+        MrBayesPrint ("   taxon labeled 2 is Pan, etc.                                                  \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Usertree"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Usertree                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command allows you to specify a user tree. The user tree can then be     \n");
+        MrBayesPrint ("   used as a starting tree for a MCMC analysis. The format for the command is    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      usertree = <tree in Newick format>                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example,                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      usertree = (A,B,(C,D))                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   specifies an unrooted tree of four species. Note that the program re-         \n");
+        MrBayesPrint ("   quires that trees are binary (i.e., strictly bifurcating). Hence, there       \n");
+        MrBayesPrint ("   can be only one three-way split, as shown in the example. If the tree         \n");
+        MrBayesPrint ("   is not binary, the program will return an error.                              \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Mcmc"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Mcmc                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command starts the Markov chain Monte Carlo (MCMC) analysis. The         \n");
+        MrBayesPrint ("   posterior probability of phylogenetic trees (and other parameters of the      \n");
+        MrBayesPrint ("   substitution model) cannot be determined analytically. Instead, MCMC is       \n");
+        MrBayesPrint ("   used to approximate the posterior probabilities of trees by drawing           \n");
+        MrBayesPrint ("   (dependent) samples from the posterior distribution. This program can         \n");
+        MrBayesPrint ("   implement a variant of MCMC called \"Metropolis-coupled Markov chain Monte    \n");
+        MrBayesPrint ("   Carlo\", or MCMCMC for short. Basically, \"Nchains\" are run, with            \n");
+        MrBayesPrint ("   Nchains - 1 of them heated. The chains are labelled 1, 2, ..., Nchains.       \n");
+        MrBayesPrint ("   The heat that is applied to the i-th chain is B = 1 / (1 + temp X i). B       \n");
+        MrBayesPrint ("   is the power to which the posterior probability is raised. When B = 0, all    \n");
+        MrBayesPrint ("   trees have equal probability and the chain freely visits trees. B = 1 is      \n");
+        MrBayesPrint ("   the \"cold\" chain (or the distribution of interest). MCMCMC can mix          \n");
+        MrBayesPrint ("   better than ordinary MCMC; after all of the chains have gone through          \n");
+        MrBayesPrint ("   one cycle, two chains are chosen at random and an attempt is made to          \n");
+        MrBayesPrint ("   swap the states (with the probability of a swap being determined by the       \n");
+        MrBayesPrint ("   Metropolis et al. equation). This allows the chain to potentially jump        \n");
+        MrBayesPrint ("   a valley in a single bound. The correct usage is                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      mcmc <parameter> = <value> ... <parameter> = <value>                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example,                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      mcmc ngen=100000 nchains=4 temp=0.5                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   performs a MCMCMC analysis with four chains with the temperature set to       \n");
+        MrBayesPrint ("   0.5. The chains would be run for 100,000 cycles.                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Ngen         -- This option sets the number of cycles for the MCMC alg-       \n");
+        MrBayesPrint ("                   orithm. This should be a big number as you want the chain     \n");
+        MrBayesPrint ("                   to first reach stationarity, and then remain there for        \n");
+        MrBayesPrint ("                   enough time to take lots of samples.                          \n");
+        MrBayesPrint ("   Nruns        -- How many independent analyses are started simultaneously.     \n");
+        MrBayesPrint ("   Nchains      -- How many chains are run for each analysis for the MCMCMC      \n");
+        MrBayesPrint ("                   variant. The default is 4: 1 cold chain and 3 heated chains.  \n");
+        MrBayesPrint ("                   If Nchains is set to 1, MrBayes will use regular MCMC sam-    \n");
+        MrBayesPrint ("                   pling, without heating.                                       \n");
+        MrBayesPrint ("   Temp         -- The temperature parameter for heating the chains. The higher  \n");
+        MrBayesPrint ("                   the temperature, the more likely the heated chains are to     \n");
+        MrBayesPrint ("                   move between isolated peaks in the posterior distribution.    \n");
+        MrBayesPrint ("                   However, excessive heating may lead to very low acceptance    \n");
+        MrBayesPrint ("                   rates for swaps between different chains. Before changing the \n");
+        MrBayesPrint ("                   default setting, however, note that the acceptance rates of   \n");
+        MrBayesPrint ("                   swaps tend to fluctuate during the burn-in phase of the run.  \n");
+        MrBayesPrint ("   Reweight     -- Here, you specify three numbers, that respectively represent  \n");
+        MrBayesPrint ("                   the percentage of characters to decrease in weight, the       \n");
+        MrBayesPrint ("                   percentage of characters to increase in weight, and the       \n");
+        MrBayesPrint ("                   increment. An increase/decrease in weight is acheived by      \n");
+        MrBayesPrint ("                   replicating/removing a character in the matrix. This is       \n");
+        MrBayesPrint ("                   only done to non-cold chains. The format for this parameter   \n");
+        MrBayesPrint ("                   is \"reweight=(<number>,<number>)\" or \"reweight=(<number>,  \n");
+        MrBayesPrint ("                   <number>,<number>)\".                                         \n");
+        MrBayesPrint ("   Swapfreq     -- This specifies how often swaps of states between chains are   \n");
+        MrBayesPrint ("                   attempted. You must be running at least two chains for this   \n");
+        MrBayesPrint ("                   option to be relevant. The default is Swapfreq=1, resulting   \n");
+        MrBayesPrint ("                   in Nswaps (see below) swaps being tried each generation of    \n");
+        MrBayesPrint ("                   the run. If Swapfreq is set to 10, then Nswaps swaps will be  \n");
+        MrBayesPrint ("                   tried every tenth generation of the run.                      \n");
+        MrBayesPrint ("   Nswaps       -- The number of swaps tried for each swapping generation of the \n");
+        MrBayesPrint ("                   chain (see also Swapfreq).                                    \n");
+        MrBayesPrint ("   Samplefreq   -- This specifies how often the Markov chain is sampled. You     \n");
+        MrBayesPrint ("                   can sample the chain every cycle, but this results in very    \n");
+        MrBayesPrint ("                   large output files. Thinning the chain is a way of making     \n");
+        MrBayesPrint ("                   these files smaller and making the samples more independent.  \n");
+        MrBayesPrint ("   Printfreq    -- This specifies how often information about the chain is       \n");
+        MrBayesPrint ("                   printed to the screen.                                        \n");
+        MrBayesPrint ("   Printall     -- If set to NO, only cold chains in a MCMC analysis are printed \n");
+        MrBayesPrint ("                   to screen. If set to YES, both cold and heated chains will be \n");
+        MrBayesPrint ("                   output. This setting only affects the printing to screen, it  \n");
+        MrBayesPrint ("                   does not change the way values are written to file.           \n");
+        MrBayesPrint ("   Printmax     -- The maximum number of chains to print to screen.              \n");
+        MrBayesPrint ("   Mcmcdiagn    -- Determines whether acceptance ratios of moves and swaps will  \n");
+        MrBayesPrint ("                   be printed to file. The file will be named similarly to the   \n");
+        MrBayesPrint ("                   '.p' and '.t' files, but will have the ending '.mcmc'. If     \n");
+        MrBayesPrint ("                   more than one independent analysis is run simultaneously (see \n");
+        MrBayesPrint ("                   Nruns below), convergence diagnostics for tree topology will  \n");
+        MrBayesPrint ("                   also be printed to this file. The convergence diagnostic used \n");
+        MrBayesPrint ("                   is the average standard deviation in partition frequency      \n");
+        MrBayesPrint ("                   values across independent analyses. The Burnin setting (see   \n");
+        MrBayesPrint ("                   below) determines how many samples will be discarded as burnin\n");
+        MrBayesPrint ("                   before calculating the partition frequencies. The Minpartfreq \n");
+        MrBayesPrint ("                   setting (see below) determines the minimum partition frequency\n");
+        MrBayesPrint ("                   required for a partition to be included in the calculation. As\n");
+        MrBayesPrint ("                   the independent analyses approach stationarity (converge), the\n");
+        MrBayesPrint ("                   value of the diagnostic is expected to approach zero.         \n");
+        MrBayesPrint ("   Diagnfreq    -- The number of generations between the calculation of MCMC     \n");
+        MrBayesPrint ("                   diagnostics (see Mcmcdiagn above).                            \n");
+        MrBayesPrint ("   Diagnstat    -- The statistic to use for run-time convergence diagnostics.    \n");
+        MrBayesPrint ("                   Choices are 'Avgstddev' for average standard deviation of     \n");
+        MrBayesPrint ("                   split frequencies and 'Maxstddev' for maximum standard devia- \n");
+        MrBayesPrint ("                   tion of split frequencies.                                    \n");
+        MrBayesPrint ("   Savetrees    -- If you are using a relative burnin for run-time convergence   \n");
+        MrBayesPrint ("                   diagnostics, tree samples need to be deleted from split       \n");
+        MrBayesPrint ("                   frequency counters as the cut-off point for the burnin moves  \n");
+        MrBayesPrint ("                   during the run. If 'Savetrees' is set to 'No', tree samples   \n");
+        MrBayesPrint ("                   to be discarded are read back in from file. If 'Savetrees' is \n");
+        MrBayesPrint ("                   set to 'Yes', the tree samples to be removed will be stored   \n");
+        MrBayesPrint ("                   in the internal memory instead. This can use up a lot of      \n");
+        MrBayesPrint ("                   memory in large analyses.                                     \n");
+        MrBayesPrint ("   Minpartfreq  -- The minimum frequency required for a partition to be included \n");
+        MrBayesPrint ("                   in the calculation of the topology convergence diagnostic. The\n");
+        MrBayesPrint ("                   partition is included if the minimum frequency is reached in  \n");
+        MrBayesPrint ("                   at least one of the independent tree samples that are com-    \n");
+        MrBayesPrint ("                   pared.                                                        \n");
+        MrBayesPrint ("   Allchains    -- If this option is set to YES, acceptance ratios for moves are \n");
+        MrBayesPrint ("                   recorded for all chains, cold or heated. By default, only the \n");
+        MrBayesPrint ("                   acceptance ratios for the cold chain are recorded.            \n");
+        MrBayesPrint ("   Allcomps     -- If this option is set to YES, topological convergence diag-   \n");
+        MrBayesPrint ("                   nostics are calculated over all pairwise comparisons of runs. \n");
+        MrBayesPrint ("                   If it is set to NO, only the overall value is reported.       \n");
+        MrBayesPrint ("   Relburnin    -- If this option is set to YES, then a proportion of the sampled\n");
+        MrBayesPrint ("                   values will be discarded as burnin when calculating the con-  \n");
+        MrBayesPrint ("                   vergence diagnostic. The proportion to be discarded is set    \n");
+        MrBayesPrint ("                   with Burninfrac (see below). When the Relburnin option is set \n");
+        MrBayesPrint ("                   to NO, then a specific number of samples will be discarded    \n");
+        MrBayesPrint ("                   instead. This number is set by Burnin (see below).            \n");
+        MrBayesPrint ("   Burnin       -- Determines the number of samples (not generations) that will  \n");
+        MrBayesPrint ("                   be discarded when convergence diagnostics are calculated.     \n");
+        MrBayesPrint ("                   The value of this option is only relevant when Relburnin is   \n");
+        MrBayesPrint ("                   set to NO.                                                    \n");
+        MrBayesPrint ("   BurninFrac   -- Determines the fraction of samples that will be discarded     \n");
+        MrBayesPrint ("                   when convergence diagnostics are calculated. The value of     \n");
+        MrBayesPrint ("                   this option is only relevant when Relburnin is set to YES.    \n");
+        MrBayesPrint ("                   Example: A value for this option of 0.25 means that 25%% of   \n");
+        MrBayesPrint ("                   the samples will be discarded.                                \n");
+        MrBayesPrint ("   Stoprule     -- If this option is set to NO, then the chain is run the number \n");
+        MrBayesPrint ("                   of generations determined by Ngen. If it is set to YES, and   \n");
+        MrBayesPrint ("                   topological convergence diagnostics are calculated (Mcmcdiagn \n");
+        MrBayesPrint ("                   is set to YES), then the chain will be stopped before the pre-\n");
+        MrBayesPrint ("                   determined number of generations if the convergence diagnostic\n");
+        MrBayesPrint ("                   falls below the stop value.                                   \n");
+        MrBayesPrint ("   Stopval      -- The critical value for the topological convergence diagnostic.\n");
+        MrBayesPrint ("                   Only used when Stoprule and Mcmcdiagn are set to yes, and     \n");
+        MrBayesPrint ("                   more than one analysis is run simultaneously (Nruns > 1).     \n");
+        MrBayesPrint ("   Checkpoint   -- If this parameter is set to 'Yes', all the current parameter  \n");
+        MrBayesPrint ("                   values of all chains will be printed to a check-pointing file \n");
+        MrBayesPrint ("                   every 'Checkfreq' generation of the analysis. The file will be\n");
+        MrBayesPrint ("                   named <Filename>.ckp and allows you to restart the analysis   \n");
+        MrBayesPrint ("                   from the last check point. This can be handy if you are       \n");
+        MrBayesPrint ("                   running a long analysis and want to extend it, or if there is \n");
+        MrBayesPrint ("                   a risk that a long analysis will be inadvertently interupted  \n");
+        MrBayesPrint ("                   by hardware failure or other factors that are out of your     \n");
+        MrBayesPrint ("                   control.                                                      \n");
+        MrBayesPrint ("   Checkfreq    -- The number of generations between check-pointing. See the     \n");
+        MrBayesPrint ("                   'Checkpoint' parameter above for more information.            \n");
+        MrBayesPrint ("   Filename     -- The name of the files that will be generated. Two files       \n");
+        MrBayesPrint ("                   are generated: \"<Filename>.t\" and \"<Filename>.p\".         \n");
+        MrBayesPrint ("                   The .t file contains the trees whereas the .p file con-       \n");
+        MrBayesPrint ("                   tains the sampled values of the parameters.                   \n");
+        MrBayesPrint ("   Startparams  -- The starting values for the model parameters are set to       \n");
+        MrBayesPrint ("                   arbitrary or random values when the parameters are created.   \n");
+        MrBayesPrint ("                   These starting values can be altered using the 'Startvals'    \n");
+        MrBayesPrint ("                   command. The 'Startparams=reset' option allows you to reset   \n");
+        MrBayesPrint ("                   the starting values to the default at the start of the ana-   \n");
+        MrBayesPrint ("                   lysis, overriding any previous user-defined starting values.  \n");
+        MrBayesPrint ("                   Under the default option, 'current', the chains will use the  \n");
+        MrBayesPrint ("                   current starting values.                                      \n");
+        MrBayesPrint ("   Starttree    -- The starting tree(s) for the chain can either be randomly     \n");
+        MrBayesPrint ("                   selected or user-defined. It might be a good idea to          \n");
+        MrBayesPrint ("                   start from randomly chosen trees; convergence seems           \n");
+        MrBayesPrint ("                   likely if independently run chains, each of which             \n");
+        MrBayesPrint ("                   started from different random trees, converge to the same     \n");
+        MrBayesPrint ("                   answer. If you want the chain to start from user-defined      \n");
+        MrBayesPrint ("                   trees instead, you first need to read in your tree(s) from a  \n");
+        MrBayesPrint ("                   Nexus file with a 'trees' block, and then you need to set the \n");
+        MrBayesPrint ("                   starting tree(s) using the 'Startvals' command. Finally, you  \n");
+        MrBayesPrint ("                   need to make sure that 'Starttree' is set to 'current'. If    \n");
+        MrBayesPrint ("                   you do not set the starting tree(s), the chains will start    \n");
+        MrBayesPrint ("                   with random trees. Setting 'Starttree' to 'random' causes     \n");
+        MrBayesPrint ("                   new starting trees to be drawn randomly at the start of the   \n");
+        MrBayesPrint ("                   run, overwriting any previous user-defined starting trees.    \n");
+        MrBayesPrint ("   Nperts       -- This is the number of random perturbations to apply to the    \n");
+        MrBayesPrint ("                   user starting tree. This allows you to have something         \n");
+        MrBayesPrint ("                   between completely random and user-defined trees start        \n");
+        MrBayesPrint ("                   the chain.                                                    \n");
+/*      MrBayesPrint ("   Savebrlens   -- This specifies whether branch length information is           \n");
+        MrBayesPrint ("                   saved on the trees.                                           \n"); */
+        MrBayesPrint ("   Data         -- When Data is set to NO, the chain is run without data. This   \n");
+        MrBayesPrint ("                   should be used only for examining induced priors. DO NOT SET  \n");
+        MrBayesPrint ("                   'DATA' TO 'NO' UNLESS YOU KNOW WHAT YOU ARE DOING!            \n");
+        MrBayesPrint ("   Ordertaxa    -- Determines whether taxa should be ordered before trees are    \n");
+        MrBayesPrint ("                   printed to file. If set to 'Yes', terminals in the sampled    \n");
+        MrBayesPrint ("                   trees will be reordered to match the order of the taxa in the \n");
+        MrBayesPrint ("                   data matrix as closely as possible. By default, trees will be \n");
+        MrBayesPrint ("                   printed without reordering of taxa.                           \n");
+        MrBayesPrint ("   Append       -- Set this to 'Yes' to append the results of the current run to \n");
+        MrBayesPrint ("                   a previous run. MrBayes will first read in the results of the \n");
+        MrBayesPrint ("                   previous run (number of generations and sampled splits) and   \n");
+        MrBayesPrint ("                   will then continue that run where you left it off. Make sure  \n");
+        MrBayesPrint ("                   that the output file names used in the previous run are the   \n");
+        MrBayesPrint ("                   same as those in the current run.                             \n");
+        MrBayesPrint ("   Autotune     -- Set this to 'Yes' to autotune the proposals that change       \n");
+        MrBayesPrint ("                   substitution model parameters. When set to 'No', the tuning   \n");
+        MrBayesPrint ("                   parameters are fixed to their starting values. Note that the  \n");
+        MrBayesPrint ("                   autotuning occurs independently for each chain. The target    \n");
+        MrBayesPrint ("                   acceptance rate for each move can be changed using the        \n");
+        MrBayesPrint ("                   'Propset' command.                                            \n");
+        MrBayesPrint ("   Tunefreq     -- When a proposal has been tried 'Tunefreq' times, its tuning   \n");
+        MrBayesPrint ("                   parameter is adjusted to reach the target acceptance rate     \n");
+        MrBayesPrint ("                   if 'Autotune' is set to 'Yes'.                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        PrintSettings ("Mcmc");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Mcmcp"))
+        {
+        // PrintYesNo (chainParams.saveBrlens, yesNoStr);
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Mcmcp                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command sets the parameters of the Markov chain Monte Carlo (MCMC)       \n");
+        MrBayesPrint ("   analysis without actually starting the chain. This command is identical       \n");
+        MrBayesPrint ("   in all respects to Mcmc, except that the analysis will not start after        \n");
+        MrBayesPrint ("   this command is issued. For more details on the options, check the help       \n");
+        MrBayesPrint ("   menu for Mcmc.\n");
+        MrBayesPrint ("                                                                                 \n");
+        PrintSettings ("Mcmc");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Ss"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Ss                                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to start stepping-stone sampling, which is an efficient  \n");
+        MrBayesPrint ("   and accurate method for estimating the marginal likelihood of the currently   \n");
+        MrBayesPrint ("   specified model. It is considerably more accurate than the harmonic mean of   \n");
+        MrBayesPrint ("   the likelihoods from a standard MCMC run on the model (calculated by the      \n");
+        MrBayesPrint ("   'Sump' command) but it requires a separate MCMC-like run. To be more specific,\n");
+        MrBayesPrint ("   stepping-stone sampling uses importance sampling to estimate each ratio in a  \n");
+        MrBayesPrint ("   series of discrete steps bridging the posterior and prior distributions.      \n");
+        MrBayesPrint ("   The importance distributions that are used are called power posterior distri- \n");
+        MrBayesPrint ("   butions, and are defined as prior*(likelihood^beta). By varying beta from 1 to\n");
+        MrBayesPrint ("   0, we get a series of distributions that connect the posterior (beta = 1) to  \n");
+        MrBayesPrint ("   the prior (beta = 0).                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The power posterior distributions are sampled using MCMC. First, we start a   \n");
+        MrBayesPrint ("   standard MCMC chain on the posterior distribution, and let it run until we    \n");
+        MrBayesPrint ("   have reached the criterion specified by the 'Burninss' option. After this, we \n");
+        MrBayesPrint ("   step through the power posterior distributions until we reach the prior dis-  \n");
+        MrBayesPrint ("   tribution. In each of the 'Nsteps' steps, we sample from a new power poster-  \n");
+        MrBayesPrint ("   ior distribution with a distinct beta value. The beta values correspond to    \n");
+        MrBayesPrint ("   'Nsteps' evenly spaced quantiles in a Beta distribution with the parameters   \n");
+        MrBayesPrint ("   'Alpha' and 1.0. For the first sampling step, the beta value is equal to the  \n");
+        MrBayesPrint ("   last quantile, i.e., it is close to 1.0. For each successive step, the beta   \n");
+        MrBayesPrint ("   value takes on the value of the next quantile, in decreasing order, until it  \n");
+        MrBayesPrint ("   reaches the value of 0.0. If you change value of 'FromPrior' from default 'No'\n");
+        MrBayesPrint ("   to 'Yes' then the direction of power posterior change during SS analizes is   \n");
+        MrBayesPrint ("   opposite to the one described above, i.e. we start from sampling prior and    \n");
+        MrBayesPrint ("   finish close to posterior.                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The 'Ss' procedure uses the same machinery as the standard 'Mcmc' algorithm,  \n");
+        MrBayesPrint ("   and shares most of its parameters with the 'Mcmc' and 'Mcmcp' commands. All   \n");
+        MrBayesPrint ("   'Mcmc' parameters, except those related to burnin, have the same meaning and  \n");
+        MrBayesPrint ("   usage in the 'Ss' command as they have in the 'Mcmc' command. The 'Mcmc'      \n");
+        MrBayesPrint ("   burnin parameters are used to set up burnin within each step. The 'Ss' command\n");
+        MrBayesPrint ("   also uses its own burnin parameter, 'Burninss' (see below for details). The   \n");
+        MrBayesPrint ("   'Ss' command also has its own parameters for specifying the number of steps   \n");
+        MrBayesPrint ("   and the shape of the Beta distribution from which the beta values are computed\n");
+        MrBayesPrint ("   (see below).                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that the 'Ngen' parameter of 'Mcmc' is used to set the maximum number of \n");
+        MrBayesPrint ("   generations processed, including both the burnin and the following steps in   \n");
+        MrBayesPrint ("   the stepping-stone sampling phase. For instance, assume that 'Burninss' is set\n");
+        MrBayesPrint ("   to '-1', 'Nsteps' to '49', 'Ngen' to '1000000' and 'Samplefreq' to '1000'.    \n");
+        MrBayesPrint ("   We will then get 1,000 samples in total (1,000,000 / 1,000). These will fall  \n");
+        MrBayesPrint ("   into 50 bins, one of which represents the burnin and is discarded. Each step  \n");
+        MrBayesPrint ("   in the algorithm will thus be represented by 20 samples.                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   More information on 'Mcmc' parameters is available in the help for the 'Mcmc' \n");
+        MrBayesPrint ("   and 'Mcmcp' commands. Only the exclusive 'Ss' parameters are listed below.    \n");
+        MrBayesPrint ("   These can only be set up using the 'Ss' command, while the parameters shared  \n");
+        MrBayesPrint ("   with 'Mcmc' and 'Mcmcp' can also be set up using those commands.              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The correct usage is                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      ss <parameter>=<value> ... <parameter>=<value>                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that a command:                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      ss <setting parameters shared with mcmc> <setting exclusive ss parameters> \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   would be equivalent to executing two commands:                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("     mcmcp <setting parameters shared with mcmc>;                                \n");
+        MrBayesPrint ("     ss <setting exclusive ss parameters>;                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For more information on the stepping-stone algorithm, see:                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Xie, W., P. O. Lewis, Y. Fan, L. Kuo, and M.-H. Chen. 2011. Improving marginal\n");
+        MrBayesPrint ("      likelihood estimation for Bayesian phylogenetic model selection. Systematic\n");
+        MrBayesPrint ("      Biology 60:150-160.                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Available options:                                                            \n");
+        MrBayesPrint ("   (NB: Only exclusive ss parameters listed here. For additional parameters, see \n");
+        MrBayesPrint ("        help on 'mcmc' or 'mcmcp'.                                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Alpha        -- The beta values used in the stepping-stone sampling procedure \n");
+        MrBayesPrint ("                   correspond to evenly spaced quantiles from a Beta('Alpha',1.0)\n");
+        MrBayesPrint ("                   distribution. The parameter 'Alpha' determines the skewness of\n");
+        MrBayesPrint ("                   the beta values. If 'Alpha' is set to '1.0', the beta values  \n");
+        MrBayesPrint ("                   would be spaced uniformly on the interval (0.0,1.0). However, \n");
+        MrBayesPrint ("                   better results are obtained if the beta values are skewed.    \n");
+        MrBayesPrint ("                   Empirically, it was observed that 'Alpha' values in the range \n");
+        MrBayesPrint ("                   of 0.3 to 0.5 produce the most accurate results.              \n");
+        MrBayesPrint ("   Burninss     -- Fixed number of samples discarded before sampling of the first\n");
+        MrBayesPrint ("                   step starts. 'Burninss' can be specified using either a pos-  \n");
+        MrBayesPrint ("                   itive or a negative number. If the number is positive, it is  \n");
+        MrBayesPrint ("                   interpreted as the number of samples to discard as burnin. If \n");
+        MrBayesPrint ("                   the number is negative, its absolute value is interpreted as  \n");
+        MrBayesPrint ("                   the length of the burnin in terms of the length of each of the\n");
+        MrBayesPrint ("                   following steps in the stepping-stone algorithm. For instance,\n");
+        MrBayesPrint ("                   a value of '-1' means that the length of the burnin is the    \n");
+        MrBayesPrint ("                   same as the length of each of the subsequent steps.           \n");
+        MrBayesPrint ("   Nsteps       -- Number of steps in the stepping-stone algorithm. Typically, a \n");
+        MrBayesPrint ("                   number above 30 is sufficient for accurate results.           \n");
+        MrBayesPrint ("   FromPrior    -- If it is set to 'Yes', it indicates that in the first step we \n"); 
+        MrBayesPrint ("                   sample from the prior, with each consequtive step we sample   \n");
+        MrBayesPrint ("                   closer to the posterior. 'No' indicates the opposite direction\n");
+        MrBayesPrint ("                   of power posterior change, i.e. in the first step we sample   \n");
+        MrBayesPrint ("                   close to the posterior, and with each consequtive step we     \n");
+        MrBayesPrint ("                   sample closer to the prior.                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter          Options               Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Alpha              <number>              %1.2lf\n", chainParams.alphaSS);
+        MrBayesPrint ("   BurninSS           <number>              %d\n", chainParams.burninSS);
+        MrBayesPrint ("   Nsteps             <number>              %d\n", chainParams.numStepsSS);
+        MrBayesPrint ("   FromPrior           Yes/No               %s                                   \n", chainParams.startFromPriorSS == YES ? "Yes" : "No");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+else if (!strcmp(helpTkn, "Ssp"))
+        {
+        // PrintYesNo (chainParams.saveBrlens, yesNoStr);
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Ssp                                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command sets the parameters of the stepping-stone sampling               \n");
+        MrBayesPrint ("   analysis without actually starting the chain. This command is identical       \n");
+        MrBayesPrint ("   in all respects to Ss, except that the analysis will not start after          \n");
+        MrBayesPrint ("   this command is issued. For more details on the options, check the help       \n");
+        MrBayesPrint ("   menu for Ss.\n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter          Options               Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Alpha              <number>              %1.2lf\n", chainParams.alphaSS);
+        MrBayesPrint ("   BurninSS           <number>              %d\n", chainParams.burninSS);
+        MrBayesPrint ("   Nsteps             <number>              %d\n", chainParams.numStepsSS);
+        MrBayesPrint ("   FromPrior           Yes/No               %s                                   \n", chainParams.startFromPriorSS == YES ? "Yes" : "No");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+else if (!strcmp(helpTkn, "Set"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Set                                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to set some general features of the model or program     \n");
+        MrBayesPrint ("   behavior. The correct usage is                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      set <parameter>=<value> ... <parameter>=<value>                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Available options:                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Seed         -- Sets the seed number for the random number generator. The     \n");
+        MrBayesPrint ("                   random number seed is initialized haphazardly at the beg-     \n");
+        MrBayesPrint ("                   inning of each MrBayes session. This option allows you to     \n");
+        MrBayesPrint ("                   set the seed to some specific value, thereby allowing you     \n");
+        MrBayesPrint ("                   to exactly repeat an analysis. If the analysis uses swapping  \n");
+        MrBayesPrint ("                   between cold and heated chains, you must also set the swap    \n");
+        MrBayesPrint ("                   seed (see below) to exactly repeat the analysis.              \n");
+        MrBayesPrint ("   Swapseed     -- Sets the seed used for generating the swapping sequence       \n");
+        MrBayesPrint ("                   when Metropolis-coupled heated chains are used. This seed     \n");
+        MrBayesPrint ("                   is initialized haphazardly at the beginning of each MrBayes   \n");
+        MrBayesPrint ("                   session. This option allows you to set the seed to some       \n");
+        MrBayesPrint ("                   specific value, thereby allowing you to exactly repeat a      \n");
+        MrBayesPrint ("                   swap sequence. See also the 'Seed' option.                    \n");
+        MrBayesPrint ("   Dir          -- The working directory. Specifies the absolute or relative path\n");
+        MrBayesPrint ("                   to the working directory. If left empty, the working directory\n");
+        MrBayesPrint ("                   is the current directory.                                     \n");
+        MrBayesPrint ("   Partition    -- Set this option to a valid partition id, either the number or \n");
+        MrBayesPrint ("                   name of a defined partition, to enforce a specific partition- \n");
+        MrBayesPrint ("                   ing of the data. When a data matrix is read in, a partition   \n");
+        MrBayesPrint ("                   called \"Default\" is automatically created. It divides the   \n");
+        MrBayesPrint ("                   data into one part for each data type. If you only have one   \n");
+        MrBayesPrint ("                   data type, DNA for instance, the default partition will not   \n");
+        MrBayesPrint ("                   divide up the data at all. The default partition is always    \n");
+        MrBayesPrint ("                   the first partition, so 'set partition=1' is the same as      \n");
+        MrBayesPrint ("                   'set partition=default'.                                      \n");
+        MrBayesPrint ("   Speciespartition -- Set this option to a valid speciespartition id, either the\n");
+        MrBayesPrint ("                   number or name of a defined speciespartition, to enforce a    \n");
+        MrBayesPrint ("                   specific partitioning of taxa to species. When a data matrix  \n");
+        MrBayesPrint ("                   is read in, a speciespartition called \"Default\" is auto-    \n");
+        MrBayesPrint ("                   matically created. It assigns one taxon for each species. The \n"); 
+        MrBayesPrint ("                   default speciespartition is always the first speciespartition,\n");
+        MrBayesPrint ("                   so 'set speciespartition=1' is the same as                    \n");
+        MrBayesPrint ("                   'set speciespartition=default'.                               \n");
+        MrBayesPrint ("   Autoclose    -- If autoclose is set to 'yes', then the program will not prompt\n");
+        MrBayesPrint ("                   you during the course of executing a file. This is particular-\n");
+        MrBayesPrint ("                   ly useful when you run MrBayes in batch mode.                 \n");
+        MrBayesPrint ("   Nowarnings   -- If nowarnings is set to yes, then the program will not prompt \n");
+        MrBayesPrint ("                   you when overwriting or appending an ouput file that is al-   \n");
+        MrBayesPrint ("                   ready present. If 'nowarnings=no' (the default setting), then \n");
+        MrBayesPrint ("                   the program propts the user before overwriting output files.  \n");
+        MrBayesPrint ("   Autoreplace  -- When nowarnings is set to yes, then MrBayes will by default   \n");
+        MrBayesPrint ("                   overwrite output files that already exists. This may cause    \n");
+        MrBayesPrint ("                   irrecoverable loss of previous results if you have not removed\n");
+        MrBayesPrint ("                   or renamed the files from previous runs. To override this be- \n");
+        MrBayesPrint ("                   havior, set autoreplace to no, in which case new output will  \n");
+        MrBayesPrint ("                   be appended to existing files instead.                        \n");
+        MrBayesPrint ("   Quitonerror  -- If quitonerror is set to yes, then the program will quit when \n");
+        MrBayesPrint ("                   an error is encountered, after printing an error message. If  \n");
+        MrBayesPrint ("                   quitonerror is set to no (the default setting), then the      \n");
+        MrBayesPrint ("                   program will wait for additional commands from the command    \n");
+        MrBayesPrint ("                   line after the error message is printed.                      \n");
+        MrBayesPrint ("   Scientific   -- Set this option to 'Yes' to write sampled values to file in   \n");
+        MrBayesPrint ("                   scientific format and to 'No' to write them in fixed format.  \n");
+        MrBayesPrint ("                   Fixed format is easier for humans to read but you risk losing \n");
+        MrBayesPrint ("                   precision for small numbers. For instance, sampled values that\n");
+        MrBayesPrint ("                   are less than 1E-6 will print to file as '0.000000' if fixed  \n");
+        MrBayesPrint ("                   format is used and 'precision' is set to 6.                   \n");
+        MrBayesPrint ("   Precision    -- Precision allows you to set the number of decimals to be prin-\n");
+        MrBayesPrint ("                   ted when sampled values are written to file. Precision must be\n");
+        MrBayesPrint ("                   in the range 3 to 15.                                         \n");
+#   if defined (BEAGLE_ENABLED)
+        MrBayesPrint ("   Usebeagle    -- Set this option to 'Yes' to attempt to use the BEAGLE library \n");
+        MrBayesPrint ("                   to compute the phylogenetic likelihood on a variety of high-  \n");
+        MrBayesPrint ("                   performance hardware including multicore CPUs and GPUs. Some  \n"); 
+        MrBayesPrint ("                   models in MrBayes are not yet supported by BEAGLE.            \n");               
+        MrBayesPrint ("   Beagleresource -- Set this option to the number of a specific resource you    \n");
+        MrBayesPrint ("                   wish to use with BEAGLE (use 'Showbeagle' to see the list of  \n");
+        MrBayesPrint ("                   available resources). Set to '99' for auto-resource selection.\n");
+        MrBayesPrint ("   Beagledevice -- Set this option to 'GPU' or 'CPU' to select processor.        \n"); 
+        MrBayesPrint ("   Beagleprecision -- Selection 'Single' or 'Double' precision computation.      \n");
+        MrBayesPrint ("   Beaglescaling -- 'Always' rescales partial likelihoods at each evaluation.    \n");
+        MrBayesPrint ("                    'Dynamic' rescales less frequently and should run faster.    \n");
+        MrBayesPrint ("   Beaglesse    -- Use SSE instructions on Intel CPU processors.                 \n");
+        MrBayesPrint ("   Beagleopenmp -- Use OpenMP to parallelize across multi-core CPU processors.   \n");
+#   endif
+#   if defined (THREADS_ENABLED)
+        MrBayesPrint ("   Beaglethreads -- Set this option to 'Yes' to employ multiple threads to drive \n");
+        MrBayesPrint ("                   multiple BEAGLE resource simultaneously. This is highly       \n");
+        MrBayesPrint ("                   recommended for more than one GPU, and for sufficiently large \n");
+        MrBayesPrint ("                   data partitions, multi-core CPUs should also demonstrate      \n");
+        MrBayesPrint ("                   speed-ups.                                                    \n");
+#   endif
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter          Options               Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Seed               <number>              %ld                                  \n", globalSeed);
+        MrBayesPrint ("   Swapseed           <number>              %ld                                  \n", swapSeed);
+        MrBayesPrint ("   Dir                <name>                \"%s\"\n", workingDir);
+        if (defMatrix == YES)
+            MrBayesPrint ("   Partition          <name>                %s\n", partitionNames[partitionNum]);
+        else
+            MrBayesPrint ("   Partition          <name>                \"\"\n");
+        if (defTaxa == YES)
+            MrBayesPrint ("   Speciespartition   <name>                %s\n", speciespartitionNames[speciespartitionNum]);
+        else
+            MrBayesPrint ("   Speciespartition   <name>                \"\"\n");
+        MrBayesPrint ("   Autoclose          Yes/No                %s                                   \n", autoClose == YES ? "Yes" : "No");
+        MrBayesPrint ("   Nowarnings         Yes/No                %s                                   \n", noWarn == YES ? "Yes" : "No");
+        MrBayesPrint ("   Autoreplace        Yes/No                %s                                   \n", autoOverwrite == YES ? "Yes" : "No");
+        MrBayesPrint ("   Quitonerror        Yes/No                %s                                   \n", quitOnError == YES ? "Yes" : "No");
+        MrBayesPrint ("   Scientific         Yes/No                %s                                   \n", scientific == YES ? "Yes" : "No");
+        MrBayesPrint ("   Precision          <number>              %d                                   \n", precision);
+#   if defined (BEAGLE_ENABLED)
+        MrBayesPrint ("   Usebeagle          Yes/No                %s                                   \n", tryToUseBEAGLE == YES ? "Yes" : "No");
+        MrBayesPrint ("   Beagleresource     <number>              %d                                   \n", beagleResourceNumber);
+        MrBayesPrint ("   Beagledevice       CPU/GPU               %s                                   \n", beagleFlags & BEAGLE_FLAG_PROCESSOR_GPU ? "GPU" : "CPU");
+        MrBayesPrint ("   Beagleprecision    Single/Double         %s                                   \n", beagleFlags & BEAGLE_FLAG_PRECISION_SINGLE ? "Single" : "Double");
+        MrBayesPrint ("   Beaglescaling      Always/Dynamic        %s                                   \n", beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS ? "Always" : "Dynamic");
+        MrBayesPrint ("   Beaglesse          Yes/No                %s                                   \n", beagleFlags & BEAGLE_FLAG_VECTOR_SSE ? "Yes" : "No");
+        MrBayesPrint ("   Beagleopenmp       Yes/No                %s                                   \n", beagleFlags & BEAGLE_FLAG_THREADING_OPENMP ? "Yes" : "No");        
+#   endif
+#   if defined (THREADS_ENABLED)
+        MrBayesPrint ("   Beaglethreads      Yes/No                %s                                   \n", tryToUseThreads == YES ? "Yes" : "No");
+#   endif
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Charset"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Charset                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command defines a character set. The format for the charset command      \n"); 
+        MrBayesPrint ("   is                                                                            \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      charset <name> = <character numbers>                                       \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example, \"charset first_pos = 1-720\\3\" defines a character set         \n");
+        MrBayesPrint ("   called \"first_pos\" that includes every third site from 1 to 720.            \n");
+        MrBayesPrint ("   The character set name cannot have any spaces in it. The slash (\\)           \n");
+        MrBayesPrint ("   is a nifty way of telling the program to assign every third (or               \n");
+        MrBayesPrint ("   second, or fifth, or whatever) character to the character set.                \n");
+        MrBayesPrint ("   This option is best used not from the command line, but rather as a           \n");
+        MrBayesPrint ("   line in the mrbayes block of a file. Note that you can use \".\" to           \n");
+        MrBayesPrint ("   stand in for the last character (e.g., charset 1-.\\3).                       \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Outgroup"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Outgroup                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command assigns a taxon to the outgroup. The correct usage is:           \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      outgroup <number>/<taxon name>                                             \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example, \"outgroup 3\" assigns the third taxon in the matrix to be       \n");
+        MrBayesPrint ("   the outgroup. Similarly, \"outgroup Homo_sapiens\" assings the taxon          \n");
+        MrBayesPrint ("   \"Homo_sapiens\" to be the outgroup (assuming that there is a taxon named     \n");
+        MrBayesPrint ("   \"Homo_sapiens\" in the matrix). Only a single taxon can be assigned to       \n");
+        MrBayesPrint ("   be the outgroup.                                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        if (defTaxa == YES)
+            MrBayesPrint ("   Current outgroup: %s (taxon no. %d)\n", taxaNames[outGroupNum], outGroupNum+1);
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showusertrees"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showusertrees                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the currently defined user trees. The correct usage        \n");
+        MrBayesPrint ("   is \"showusertrees\".                                                         \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showmcmctrees"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showmcmctrees                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the current trees used by the Markov chains.               \n");
+        MrBayesPrint ("   is \"showmcmctrees\".                                                         \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Deroot"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Deroot                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command deroots the user tree. If the tree is already unrooted, a        \n");
+        MrBayesPrint ("   warning is issued. The correct usage is \"deroot\".                           \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Root"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Root                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command roots the tree. If the tree is already rooted, a warning         \n");
+        MrBayesPrint ("   is issued. The tree is rooted at the midpoint between the outgroup species    \n");
+        MrBayesPrint ("   and the ingroup species. The correct usage is \"root\".                       \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Taxset"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Taxset                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command defines a taxon set. The format for the taxset command           \n"); 
+        MrBayesPrint ("   is                                                                            \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      taxset <name> = <taxon names or numbers>                                   \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example, \"taxset apes = Homo Pan Gorilla Orang gibbon\" defines a        \n");
+        MrBayesPrint ("   taxon set called \"apes\" that includes five taxa (namely, apes).             \n");
+        MrBayesPrint ("   You can assign up to 30 taxon sets. This option is best used                  \n");
+        MrBayesPrint ("   not from the command line but rather as a line in the mrbayes block           \n");
+        MrBayesPrint ("   of a file.                                                                    \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Taxlabels"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Taxlabels                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command defines taxon labels. It could be used within taxa block.        \n"); 
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Charstat"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Charstat                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the status of all the characters. The correct usage        \n");
+        MrBayesPrint ("   is                                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      charstat                                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   After typing \"charstat\", the character number, whether it is excluded       \n");
+        MrBayesPrint ("   or included, and the partition identity are shown. The output is paused       \n");
+        MrBayesPrint ("   every 100 characters. This pause can be turned off by setting autoclose       \n");
+        MrBayesPrint ("   to \"yes\" (set autoclose=yes).                                               \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Taxastat"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Taxastat                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the status of all the taxa. The correct usage is           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      taxastat                                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   After typing \"taxastat\", the taxon number, name, and whether it is          \n");
+        MrBayesPrint ("   excluded or included are shown.                                               \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Partition"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Partition                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command allows you to specify a character partition. The format for      \n"); 
+        MrBayesPrint ("   this command is                                                               \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      partition <name> = <num parts>:<chars in first>, ...,<chars in last>       \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example, \"partition by_codon = 3:1st_pos,2nd_pos,3rd_pos\" specifies     \n"); 
+        MrBayesPrint ("   a partition called \"by_codon\" which consists of three parts (first,         \n"); 
+        MrBayesPrint ("   second, and third codon positions). Here, we are assuming that the sites      \n"); 
+        MrBayesPrint ("   in each partition were defined using the charset command. You can specify     \n"); 
+        MrBayesPrint ("   a partition without using charset as follows:                                 \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      partition by_codon = 3:1 4 6 9 12,2 5 7 10 13,3 6 8 11 14                  \n"); 
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   However, we recommend that you use the charsets to define a set of char-      \n"); 
+        MrBayesPrint ("   acters and then use these predefined sets when defining the partition.        \n"); 
+        MrBayesPrint ("   Also, it makes more sense to define a partition as a line in the mrbayes      \n"); 
+        MrBayesPrint ("   block than to issue the command from the command line (then again, you        \n"); 
+        MrBayesPrint ("   may be a masochist, and want to do extra work).                               \n"); 
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Exclude"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Exclude                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command excludes characters from the analysis. The correct usage is      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exclude <number> <number> <number>                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or                                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exclude <number> - <number>                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or                                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exclude <charset>                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or some combination thereof. Moreover, you can use the specifier \"\\\" to    \n");
+        MrBayesPrint ("   exclude every nth character. For example, the following                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exclude 1-100\\3                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   would exclude every third character. As a specific example,                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exclude 2 3 10-14 22                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   excludes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also,      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      exclude all                                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   excludes all of the characters from the analysis. Excluding all characters    \n");
+        MrBayesPrint ("   does not leave you much information for inferring phylogeny.                  \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Include"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Include                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command includes characters that were previously excluded from the       \n");
+        MrBayesPrint ("   analysis. The correct usage is                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      include <number> <number> <number>                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or                                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      include <number> - <number>                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or                                                                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      include <charset>                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   or some combination thereof. Moreover, you can use the specifier \"\\\" to    \n");
+        MrBayesPrint ("   include every nth character. For example, the following                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      include 1-100\\3                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   would include every third character. As a specific example,                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      include 2 3 10-14 22                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   includes sites 2, 3, 10, 11, 12, 13, 14, and 22 from the analysis. Also,      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      include all                                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   includes all of the characters in the analysis. Including all of the          \n");
+        MrBayesPrint ("   characters (even if many of them are bad) is a very total-evidence-like       \n");
+        MrBayesPrint ("   thing to do. Doing this will make a certain group of people very happy.       \n");
+        MrBayesPrint ("   On the other hand, simply using this program would make those same people     \n");
+        MrBayesPrint ("   unhappy.                                                                      \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Delete"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Delete                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command deletes taxa from the analysis. The correct usage is:            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      delete <name and/or number and/or taxset> ...                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A list of the taxon names or taxon numbers (labelled 1 to ntax in the order   \n");
+        MrBayesPrint ("   in the matrix) or taxset(s) can be used.  For example, the following:         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      delete 1 2 Homo_sapiens                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   deletes taxa 1, 2, and the taxon labelled Homo_sapiens from the analysis.     \n");
+        MrBayesPrint ("   You can also use \"all\" to delete all of the taxa. For example,              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      delete all                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   deletes all of the taxa from the analysis. Of course, a phylogenetic anal-    \n");
+        MrBayesPrint ("   ysis that does not include any taxa is fairly uninteresting.                  \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Restore"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Restore                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command restores taxa to the analysis. The correct usage is:             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      restore <name and/or number and/or taxset> ...                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A list of the taxon names or taxon numbers (labelled 1 to ntax in the order   \n");
+        MrBayesPrint ("   in the matrix) or taxset(s) can be used.  For example, the following:         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      restore 1 2 Homo_sapiens                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   restores taxa 1, 2, and the taxon labelled Homo_sapiens to the analysis.      \n");
+        MrBayesPrint ("   You can also use \"all\" to restore all of the taxa. For example,             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      restore all                                                                \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   restores all of the taxa to the analysis.                                     \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Quit"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Quit                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command quits the program. The correct usage is:                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      quit                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   It is a very easy command to use properly.                                    \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Disclaimer"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Disclaimer                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the disclaimer for the program. In short, the disclaimer   \n");
+        MrBayesPrint ("   states that the authors are not responsible for any silly things you may do   \n");
+        MrBayesPrint ("   to your computer or any unforseen but possibly nasty things the computer      \n");
+        MrBayesPrint ("   program may inadvertently do to you.                                          \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Unlink"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Unlink                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command unlinks model parameters across partitions of the data. The      \n");
+        MrBayesPrint ("   correct usage is:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      unlink <parameter name> = (<all> or <partition list>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A little background is necessary to understand this command. Upon exe-        \n");
+        MrBayesPrint ("   cution of a file, a default partition is set up. This partition refer-        \n");
+        MrBayesPrint ("   enced either by its name (\"default\") or number (0). If your data are        \n");
+        MrBayesPrint ("   all of one type, then this default partition does not actually divide up      \n");
+        MrBayesPrint ("   your characters. However, if your datatype is mixed, then the default         \n");
+        MrBayesPrint ("   partition contains as many divisions as there are datatypes in your           \n");
+        MrBayesPrint ("   character matrix. Of course, you can also define other partitions, and        \n");
+        MrBayesPrint ("   switch among them using the set command (\"set partition=<name/number>\").    \n");
+        MrBayesPrint ("   Importantly, you can also assign model parameters to individual part-         \n");
+        MrBayesPrint ("   itions or to groups of them using the \"applyto\" option in lset and          \n");
+        MrBayesPrint ("   prset. When the program attempts to perform an analysis, the model is         \n");
+        MrBayesPrint ("   set for individual partitions. If the same parameter applies to differ-       \n");
+        MrBayesPrint ("   partitions and if that parameter has the same prior, then the program         \n");
+        MrBayesPrint ("   will link the parameters: that is, it will use a single value for the         \n");
+        MrBayesPrint ("   parameter. The program's default, then, is to strive for parsimony.           \n");
+        MrBayesPrint ("   However, there are lots of cases where you may want unlink a parameter        \n");
+        MrBayesPrint ("   across partitions. For example, you may want a different transition/          \n");
+        MrBayesPrint ("   transversion rate ratio to apply to different partitions. This command        \n");
+        MrBayesPrint ("   allows you to unlink the parameters, or to make them different across         \n");
+        MrBayesPrint ("   partitions. The converse of this command is \"link\", which links to-         \n");
+        MrBayesPrint ("   gether parameters that were previously told to be different. The list         \n");
+        MrBayesPrint ("   of parameters that can be unlinked includes:                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      Tratio          -- Transition/transversion rate ratio                      \n");
+        MrBayesPrint ("      Revmat          -- Substitution rates of GTR model                         \n");
+        MrBayesPrint ("      Omega           -- Nonsynonymous/synonymous rate ratio                     \n");
+        MrBayesPrint ("      Statefreq       -- Character state frequencies                             \n");
+        MrBayesPrint ("      Shape           -- Gamma/LNorm shape parameter                             \n");
+        MrBayesPrint ("      Pinvar          -- Proportion of invariable sites                          \n");
+        MrBayesPrint ("      Correlation     -- Correlation parameter of autodiscrete gamma             \n");
+        MrBayesPrint ("      Ratemultiplier  -- Rate multiplier for partitions                          \n");
+        MrBayesPrint ("      Switchrates     -- Switching rates for covarion model                      \n");
+        MrBayesPrint ("      Topology        -- Topology of tree                                        \n");
+        MrBayesPrint ("      Brlens          -- Branch lengths of tree                                  \n");
+        MrBayesPrint ("      Speciationrate  -- Speciation rates for birth-death process                \n");
+        MrBayesPrint ("      Extinctionrate  -- Extinction rates for birth-death process                \n");
+    //  MrBayesPrint ("   Fossilizationrate  -- Fossilization rates for fossilized birth-death process  \n");
+        MrBayesPrint ("      Popsize         -- Population size for coalescence process                 \n");
+        MrBayesPrint ("      Growthrate      -- Growth rate of coalescence process                      \n"); 
+        MrBayesPrint ("      Aamodel         -- Aminoacid rate matrix                                   \n"); 
+        MrBayesPrint ("      Cpprate         -- Rate of Compound Poisson Process (CPP)                  \n"); 
+        MrBayesPrint ("      Cppmultdev      -- Standard dev. of CPP rate multipliers (log scale)       \n"); 
+        MrBayesPrint ("      Cppevents       -- CPP events                                              \n"); 
+        MrBayesPrint ("      TK02var         -- Variance increase in TK02 relaxed clock model           \n"); 
+        MrBayesPrint ("      Igrvar          -- Variance increase in IGR relaxed clock model            \n");
+        MrBayesPrint ("      Mixedvar        -- Variance increase in Mixed relaxed clock model          \n");
+    //  MrBayesPrint ("      TK02branchrates -- Branch rates of TK02  relaxed clock model               \n");
+    //  MrBayesPrint ("      Igrbranchrates  -- Branch rates of IGR   relaxed clock model               \n");
+    //  MrBayesPrint ("      Mixedbrchrates  -- Branch rates of Mixed relaxed clock model               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example,                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      unlink shape=(all)                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   unlinks the gamma/lnorm shape parameter across all partitions of the data.    \n");
+        MrBayesPrint ("   You can use \"showmodel\" to see the current linking status of the            \n");
+        MrBayesPrint ("   characters.                                                                   \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Link"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Link                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command links model parameters across partitions of the data. The        \n");
+        MrBayesPrint ("   correct usage is:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      link <parameter name> = (<all> or <partition list>)                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The list of parameters that can be linked includes:                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      Tratio          -- Transition/transversion rate ratio                      \n");
+        MrBayesPrint ("      Revmat          -- Substitution rates of GTR model                         \n");
+        MrBayesPrint ("      Omega           -- Nonsynonymous/synonymous rate ratio                     \n");
+        MrBayesPrint ("      Statefreq       -- Character state frequencies                             \n");
+        MrBayesPrint ("      Shape           -- Gamma/LNorm shape parameter                             \n");
+        MrBayesPrint ("      Pinvar          -- Proportion of invariable sites                          \n");
+        MrBayesPrint ("      Correlation     -- Correlation parameter of autodiscrete gamma             \n");
+        MrBayesPrint ("      Ratemultiplier  -- Rate multiplier for partitions                          \n");
+        MrBayesPrint ("      Switchrates     -- Switching rates for covarion model                      \n");
+        MrBayesPrint ("      Topology        -- Topology of tree                                        \n");
+        MrBayesPrint ("      Brlens          -- Branch lengths of tree                                  \n");
+        MrBayesPrint ("      Speciationrate  -- Speciation rates for birth-death process                \n");
+        MrBayesPrint ("      Extinctionrate  -- Extinction rates for birth-death process                \n");
+    //  MrBayesPrint ("   Fossilizationrate  -- Fossilization rates for fossilized birth-death process  \n");
+        MrBayesPrint ("      Popsize         -- Population size for coalescence process                 \n");
+        MrBayesPrint ("      Growthrate      -- Growth rate of coalescence process                      \n");
+        MrBayesPrint ("      Aamodel         -- Aminoacid rate matrix                                   \n");
+        MrBayesPrint ("      Cpprate         -- Rate of Compound Poisson Process (CPP)                  \n");
+        MrBayesPrint ("      Cppmultdev      -- Standard dev. of CPP rate multipliers (log scale)       \n");
+        MrBayesPrint ("      Cppevents       -- CPP events                                              \n");
+        MrBayesPrint ("      TK02var         -- Variance increase in TK02 relaxed clock model           \n");
+        MrBayesPrint ("      Igrvar          -- Variance increase in IGR relaxed clock model            \n");
+        MrBayesPrint ("      Mixedvar        -- Variance increase in Mixed relaxed clock model          \n");
+    //  MrBayesPrint ("      TK02branchrates -- Branch rates of TK02  relaxed clock model               \n");
+    //  MrBayesPrint ("      Igrbranchrates  -- Branch rates of IGR   relaxed clock model               \n");
+    //  MrBayesPrint ("      Mixedbrchrates  -- Branch rates of Mixed relaxed clock model               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   For example,                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      link shape=(all)                                                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   links the gamma/lnorm shape parameter across all partitions of the data.      \n");
+        MrBayesPrint ("   You can use \"showmodel\" to see the current linking status of the            \n");
+        MrBayesPrint ("   characters. For more information on this command, see the help menu           \n");
+        MrBayesPrint ("   for link's converse, unlink (\"help unlink\");                                \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Help"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Help                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command provides useful information on the use of this program. The      \n");
+        MrBayesPrint ("   correct usage is                                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      help                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   which gives a list of all available commands with a brief description of      \n");
+        MrBayesPrint ("   each or                                                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      help <command>                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   which gives detailed information on the use of <command>.                     \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Sump"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Sump                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   During an MCMC analysis, MrBayes prints the sampled parameter values to one or\n");
+        MrBayesPrint ("   more tab-delimited text files, one for each independent run in your analysis. \n");
+        MrBayesPrint ("   The command 'Sump' summarizes the information in this parameter file or these \n");
+        MrBayesPrint ("   parameter files. By default, the root of the parameter file name(s) is assumed\n");
+        MrBayesPrint ("   to be the name of the last matrix-containing nexus file. MrBayes also remem-  \n");
+        MrBayesPrint ("   bers the number of independent runs in the last analysis that you set up, re- \n");
+        MrBayesPrint ("   gardless of whether you actually ran it. For instance, if there were two in-  \n");
+        MrBayesPrint ("   dependent runs, which is the initial setting when you read in a new matrix,   \n");
+        MrBayesPrint ("   MrBayes will assume that there are two parameter files with the endings       \n");
+        MrBayesPrint ("   '.run1.p' and '.run2.p'. You can change the root of the file names and the    \n");
+        MrBayesPrint ("   number of runs using the 'Filename' and 'Nruns' settings.                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   When you invoke the 'Sump' command, three items are output: (1) a generation  \n");
+        MrBayesPrint ("   plot of the likelihood values; (2) estimates of the marginal likelihood of    \n");
+        MrBayesPrint ("   the model; and (3) a table with the mean, variance, and 95 percent credible   \n");
+        MrBayesPrint ("   interval for the sampled parameters. All three items are output to screen.    \n");
+        MrBayesPrint ("   The table of marginal likelihoods is also printed to a file with the ending   \n");
+        MrBayesPrint ("   '.lstat' and the parameter table to a file with the ending '.pstat'. For some \n");
+        MrBayesPrint ("   model parameters, there may also be a '.mstat' file.                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   When running 'Sump' you typically want to discard a specified number or       \n");
+        MrBayesPrint ("   fraction of samples from the beginning of the chain as the burn in. This is   \n");
+        MrBayesPrint ("   done using the same mechanism used by the 'mcmc' command. That is, if you     \n");
+        MrBayesPrint ("   run an mcmc analysis with a relative burn in of 25 %% of samples for con-     \n");
+        MrBayesPrint ("   vergence diagnostics, then the same burn in will be used for a subsequent     \n");
+        MrBayesPrint ("   sump command, unless a different burn in is specified. That is, issuing       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   sump                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   immediately after 'mcmc', will result in using the same burn in settings as   \n");
+        MrBayesPrint ("   for the 'mcmc' command. All burnin settings are reset to default values every \n");
+        MrBayesPrint ("   time a new matrix is read in, namely relative burnin ('relburnin=yes') with   \n");
+        MrBayesPrint ("   25 %% of samples discarded ('burninfrac = 0.25').                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Relburnin    -- If this option is set to 'Yes', then a proportion of the      \n");
+        MrBayesPrint ("                   samples will be discarded as burnin when calculating summary  \n");
+        MrBayesPrint ("                   statistics. The proportion to be discarded is set with        \n");
+        MrBayesPrint ("                   'Burninfrac' (see below). When the 'Relburnin' option is set  \n");
+        MrBayesPrint ("                   to 'No', then a specific number of samples is discarded       \n");
+        MrBayesPrint ("                   instead. This number is set by 'Burnin' (see below). Note that\n");
+        MrBayesPrint ("                   the burnin setting is shared across the 'sumt', 'sump', and   \n");
+        MrBayesPrint ("                   'mcmc' commands.                                              \n");
+        MrBayesPrint ("   Burnin       -- Determines the number of samples (not generations) that will  \n");
+        MrBayesPrint ("                   be discarded when summary statistics are calculated. The      \n");
+        MrBayesPrint ("                   value of this option is only applicable when 'Relburnin' is   \n");
+        MrBayesPrint ("                   set to 'No'.                                                  \n");
+        MrBayesPrint ("   Burninfrac   -- Determines the fraction of samples that will be discarded when\n");
+        MrBayesPrint ("                   summary statistics are calculated. The setting only takes     \n");
+        MrBayesPrint ("                   effect if 'Relburnin' is set to 'Yes'.                        \n");
+        MrBayesPrint ("   Nruns        -- Determines how many '.p' files from independent analyses that \n");
+        MrBayesPrint ("                   will be summarized. If Nruns > 1 then the names of the files  \n");
+        MrBayesPrint ("                   are derived from 'Filename' by adding '.run1.p', '.run2.p',   \n");
+        MrBayesPrint ("                   etc. If Nruns=1, then the single file name is obtained by     \n");
+        MrBayesPrint ("                   adding '.p' to 'Filename'.                                    \n");
+        MrBayesPrint ("   Filename     -- The name of the file to be summarized. This is the base of the\n");
+        MrBayesPrint ("                   file name to which endings are added according to the current \n");
+        MrBayesPrint ("                   setting of the 'Nruns' parameter. If 'Nruns' is 1, then only  \n");
+        MrBayesPrint ("                   '.p' is added to the file name. Otherwise, the endings will   \n");
+        MrBayesPrint ("                   be '.run1.p', '.run2.p', etc.                                 \n");
+        MrBayesPrint ("   Outputname   -- Base name of the file(s) to which 'Sump' results will be      \n");
+        MrBayesPrint ("                   printed.                                                      \n");
+        MrBayesPrint ("   Hpd          -- Determines whether credibility intervals will be given as the \n");
+        MrBayesPrint ("                   region of Highest Posterior Density ('Yes') or as the interval\n");
+        MrBayesPrint ("                   containing the median 95 %% of sampled values ('No').         \n");
+        MrBayesPrint ("   Minprob      -- Determines the minimum probability of submodels to be included\n");
+        MrBayesPrint ("                   in summary statistics. Only applicable to models that explore \n");
+        MrBayesPrint ("                   submodel spaces, like 'nst=mixed' and 'aamodelpr=mixed'.      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter       Options                  Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Relburnin       Yes/No                   %s                                   \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
+        MrBayesPrint ("   Burnin          <number>                 %d                                   \n", chainParams.chainBurnIn);
+        MrBayesPrint ("   Burninfrac      <number>                 %1.2lf                               \n", chainParams.burninFraction);
+        MrBayesPrint ("   Nruns           <number>                 %d                                   \n", sumpParams.numRuns);
+        if (sumpParams.numRuns == 1)
+            MrBayesPrint ("   Filename        <name>                   %s<.p>\n", sumpParams.sumpFileName);
+        else
+            MrBayesPrint ("   Filename        <name>                   %s<.run<i>.p>\n", sumpParams.sumpFileName);
+        MrBayesPrint ("   Outputname      <name>                   %s<.pstat etc>\n", sumpParams.sumpOutfile);
+        MrBayesPrint ("   Hpd             Yes/No                   %s                                   \n", sumpParams.HPD == YES ? "Yes" : "No");
+        MrBayesPrint ("   Minprob         <number>                 %1.3lf                               \n", sumpParams.minProb);
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Sumss"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Sumss                                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command summarizes results of stepping stone analyses. It is a tool to   \n");
+        MrBayesPrint ("   investigate the obtained results, and to help find the proper step burn-in.   \n");
+        MrBayesPrint ("   To get more help information on stepping-stone analyses, use 'help ss'.       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   During stepping-stone analysis, MrBayes collects the sampled likelihoods in   \n");
+        MrBayesPrint ("   order to estimate the marginal likelihood at the end. It also prints the sam- \n");
+        MrBayesPrint ("   pled parameter values to one or more tab-delimited text files, one for each   \n");
+        MrBayesPrint ("   independent run in your analysis. The command 'Sumss' summarizes likelihood   \n");
+        MrBayesPrint ("   values stored in these parameter files and calculates marginal likelihood es- \n");
+        MrBayesPrint ("   timates. The names of the files that are summarized are exactly the same as   \n");
+        MrBayesPrint ("   the names of the files used for the 'sump' command. In fact, the 'filename'   \n");
+        MrBayesPrint ("   setting is a shared setting for the 'sump' and 'sumss' commands. That is, if  \n");
+        MrBayesPrint ("   you change the setting in one of the commands, it would change the setting in \n");
+        MrBayesPrint ("   the other command as well.                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   When you invoke the 'Sumss' command, three items are output: (1) 'Step contri-\n");
+        MrBayesPrint ("   bution table' - summarizes the contribution of each step to the overall esti- \n");
+        MrBayesPrint ("   mate; (2) 'Step plot' - plot of the likelihood values for the initial burn-in \n");
+        MrBayesPrint ("   phase or a chosen step in the stepping-stone algorithm; (3) 'Joined plot' -   \n");
+        MrBayesPrint ("   summarizes sampling across all steps in the algorithm.                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Step contribution table                                                       \n");
+        MrBayesPrint ("   The printed table is similar to the one output to the .ss file. The main pur- \n");
+        MrBayesPrint ("   pose of the table is to summarize marginal likelihood for different values of \n");
+        MrBayesPrint ("   the step burn-in after the stepping stone  analysis has finished. The burn-in \n");
+        MrBayesPrint ("   is controlled by the 'Relburnin', 'Burnin' and 'Burninfrac' settings.         \n");
+        MrBayesPrint ("   Note that during stepping-stone analyses, step contributions to marginal      \n");
+        MrBayesPrint ("   likelihood are calculated based on all generations excluding burn-in. 'Sumss' \n");
+        MrBayesPrint ("   on the other hand makes estimates based only on the sampled generations. This \n");
+        MrBayesPrint ("   may lead to slight difference in results compared to the one printed to the   \n");
+        MrBayesPrint ("   .ss file.                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Step plot                                                                     \n");
+        MrBayesPrint ("   The main objective of the plot is to provide a close look at a given step in  \n");
+        MrBayesPrint ("   the analysis. Which step is printed here is defined by the 'Steptoplot' set-  \n");
+        MrBayesPrint ("   ting. The plot could be used to inspect if the chosen step burn-in is appro-  \n");
+        MrBayesPrint ("   priate for the given step. It could also be used to check if the initial burn-\n");
+        MrBayesPrint ("   in phase has converged. Note that the amount of discarded samples is controled\n");
+        MrBayesPrint ("   by the 'Discardfrac' setting, and not by the ordinary burn-in settings.       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Joined plot                                                                   \n");
+        MrBayesPrint ("   Different steps sample from different power posterior distributions. When we  \n");
+        MrBayesPrint ("   switch from one distribution to another, it takes some number of generations  \n");
+        MrBayesPrint ("   before the chain settles at the correct stationary distribution. This lag is  \n");
+        MrBayesPrint ("   called a 'temperature lag' and if the corresponding samples are not removed,  \n");
+        MrBayesPrint ("   it will result in a biased estimate. It is difficult to determine the lag be- \n");
+        MrBayesPrint ("   forehand, but MrBayes allows you to explore different step burn-in settings   \n");
+        MrBayesPrint ("   after you have finished the stepping-stone algorithm, without having to rerun \n");
+        MrBayesPrint ("   the whole analysis. The 'Joined plot' helps to facilitate the choice of the   \n");
+        MrBayesPrint ("   right step burn-in. The plot summarizes samples across all steps and gives you\n");
+        MrBayesPrint ("   a quick overview of the whole analysis.                                       \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Specifically, the following procedure is used to obtain the joined plot. Each \n");
+        MrBayesPrint ("   step has the same number N of samples taken. We number each sample 1 to N     \n");
+        MrBayesPrint ("   within steps according to the order in which the samples are taken. The first \n"); 
+        MrBayesPrint ("   sample in each step is numbered 1, and the last sample is N. For each number i\n");
+        MrBayesPrint ("   in [1,..., N], we sum up log likelihoods for all samples numbered i across all\n");
+        MrBayesPrint ("   steps. The joined plot is a graph of the step number versus the normalized    \n");
+        MrBayesPrint ("   sums we get in the procedure describe above. This directly visualizes the tem-\n");
+        MrBayesPrint ("   perature lag and allows you to select the appropriate step burn-in.           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Ideally, after you discard the appropriate step burn-in, the graph should     \n");
+        MrBayesPrint ("   appear as white noise around the estimated value. If you see an increasing or \n");
+        MrBayesPrint ("   decreasing tendency in the beginning of the graph, you should increase the    \n");
+        MrBayesPrint ("   step burn-in. If you see an increasing or decreasing tendency across the whole\n");
+        MrBayesPrint ("   graph, then the initial burn-in phase was not long enough. In this case, you  \n");
+        MrBayesPrint ("   need to rerun the analysis with a longer initial burn-in.                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   To make it easier to observe tendencies in the plotted graph you can choose   \n");
+        MrBayesPrint ("   different levels of curve smoothing. If 'Smoothing' is set to k, it means that\n");
+        MrBayesPrint ("   for each step i we take an average over step i and k neighboring samples in   \n");
+        MrBayesPrint ("   both directions, i.e., the k-smoothed estimate for step i is an average over  \n");
+        MrBayesPrint ("   values for steps [i-k,...,i+k].                                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Allruns      -- If set to 'Yes', it forces all runs to be printed on the same \n");
+        MrBayesPrint ("                   graph when drawing joined and step plots. If set to 'No', each\n");
+        MrBayesPrint ("                   run is printed on a separat plot.                             \n");
+        MrBayesPrint ("   Askmore      -- Long analyses may produce huge .p files. Reading in them may  \n");
+        MrBayesPrint ("                   take several minutes. If you want to investigate different    \n");
+        MrBayesPrint ("                   aspects of your analyses, it could be very inconvenient to    \n");
+        MrBayesPrint ("                   wait for several minutes each time you want to get a new sum- \n");
+        MrBayesPrint ("                   mary for different settings. If you set 'Askmore' to 'YES',   \n");
+        MrBayesPrint ("                   sumss will read .p files only once. After responding to the   \n");
+        MrBayesPrint ("                   original query, it will interactivaly ask you if you wish to  \n");
+        MrBayesPrint ("                   produce more tables and plots for different settings of       \n");
+        MrBayesPrint ("                   'Burnin' or 'Smoothing' (see below).                          \n");
+        MrBayesPrint ("   Relburnin    -- If this option is set to 'Yes', then a proportion of the      \n");
+        MrBayesPrint ("                   samples from each step will be discarded as burnin when calcu-\n");
+        MrBayesPrint ("                   lsting summary statistics. The proportion to be discarded is  \n");
+        MrBayesPrint ("                   set with 'Burninfrac' (see below). When the 'Relburnin' option\n");
+        MrBayesPrint ("                   is set to 'No', then a specific number of samples is discarded\n");
+        MrBayesPrint ("                   instead. This number is set by 'Burnin'. Note that the burnin \n");
+        MrBayesPrint ("                   settings --- 'Relburnin', 'Burnin', and 'Burninfrac' --- are  \n");
+        MrBayesPrint ("                   shared across the 'sumt', 'sump', 'sumss' and 'mcmc' commands.\n");
+        MrBayesPrint ("   Burnin       -- Determines the number of samples (not generations) that will  \n");
+        MrBayesPrint ("                   be discarded from each step when summary statistics are calcu-\n");
+        MrBayesPrint ("                   lated. The value of this option is only applicable when       \n");
+        MrBayesPrint ("                   'Relburnin' is set to 'No'.                                   \n");
+        MrBayesPrint ("   Burninfrac   -- Determines the fraction of samples that will be discarded from\n");
+        MrBayesPrint ("                   each step when summary statistics are calculated. The setting \n");
+        MrBayesPrint ("                   only takes effect if 'Relburnin' is set to 'Yes'.             \n");
+        MrBayesPrint ("   Discardfrac  -- Determines the fraction of samples that will be discarded when\n");
+        MrBayesPrint ("                   a step plot is printed. It is similar to the 'Burninfrac' set-\n");
+        MrBayesPrint ("                   ting, but unlike 'Burninfrac' it is used only for better vis- \n");
+        MrBayesPrint ("                   ualization of the step plot. It has no effect on the number of\n");
+        MrBayesPrint ("                   samples discarded during marginal likelihood computation.     \n");
+        MrBayesPrint ("   Filename     -- The name of the file to be summarized. This is the base of the\n");
+        MrBayesPrint ("                   file name to which endings are added according to the current \n");
+        MrBayesPrint ("                   setting of the 'Nruns' parameter. If 'Nruns' is 1, then only  \n");
+        MrBayesPrint ("                   '.p' is added to the file name. Otherwise, the endings will   \n");
+        MrBayesPrint ("                   be '.run1.p', '.run2.p', etc. Note that the 'Filename' setting\n");
+        MrBayesPrint ("                   is shared with 'sump' command.                                \n");
+        MrBayesPrint ("   Nruns        -- Determines how many '.p' files from independent analyses that \n");
+        MrBayesPrint ("                   will be summarized. If Nruns > 1 then the names of the files  \n");
+        MrBayesPrint ("                   are derived from 'Filename' by adding '.run1.p', '.run2.p',   \n");
+        MrBayesPrint ("                   etc. If Nruns=1, then the single file name is obtained by     \n");
+        MrBayesPrint ("                   adding '.p' to 'Filename'.                                    \n");
+        MrBayesPrint ("   Steptoplot   -- Defines which step will be printed in the step plot.If the    \n");
+        MrBayesPrint ("                   value is set to 0, then the initial sample from the posterior \n");
+        MrBayesPrint ("                   will be used.                                                 \n");
+        MrBayesPrint ("   Smoothing    -- Determines smoothing of the joined plot (see above). A value  \n");
+        MrBayesPrint ("                   equal to 0 results in no smoothing.                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter       Options                  Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Allruns         Yes/No                   %s                                   \n", sumssParams.allRuns == YES ? "Yes" : "No");
+        MrBayesPrint ("   Askmore         Yes/No                   %s                                   \n", sumssParams.askForMorePlots == YES ? "Yes" : "No");
+        MrBayesPrint ("   Relburnin       Yes/No                   %s                                   \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
+        MrBayesPrint ("   Burnin          <number>                 %d                                   \n", chainParams.chainBurnIn);
+        MrBayesPrint ("   Burninfrac      <number>                 %1.2lf                               \n", chainParams.burninFraction);
+        MrBayesPrint ("   Discardfrac     <number>                 %1.2lf                               \n", sumssParams.discardFraction);
+        if (sumpParams.numRuns == 1)
+            MrBayesPrint ("   Filename        <name>                   %s<.p>\n", sumpParams.sumpFileName);
+        else
+            MrBayesPrint ("   Filename        <name>                   %s<.run<i>.p>\n", sumpParams.sumpFileName);        
+        MrBayesPrint ("   Nruns           <number>                 %d                                   \n", sumpParams.numRuns);
+        MrBayesPrint ("   Steptoplot      <number>                 %d                                   \n", sumssParams.stepToPlot);
+        MrBayesPrint ("   Smoothing       <number>                 %d                                   \n", sumssParams.smoothing);
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Comparetree"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Comparetree                                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command compares the trees in two files, called \"filename1\" and        \n");
+        MrBayesPrint ("   \"filename2\". It will output a bivariate plot of the split frequencies       \n");
+        MrBayesPrint ("   as well as plots of the tree distance as a function of the generation. The    \n");
+        MrBayesPrint ("   plots can be used to get a quick indication of whether two runs have con-     \n");
+        MrBayesPrint ("   verged onto the same set of trees. The \"Comparetree\" command will also      \n");
+        MrBayesPrint ("   produce a \".pairs\" file and a \".dists\" file (these file endings are added \n");
+        MrBayesPrint ("   to the end of the \"Outputname\"). The \".pairs\" file contains the paired    \n");
+        MrBayesPrint ("   split frequencies from the two tree samples; the \".dists\" file contains the \n");
+        MrBayesPrint ("   tree distance values.                                                         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Note that the \"Sumt\" command provides a different set of convergence diag-  \n");
+        MrBayesPrint ("   nostics tools that you may also want to explore. Unlike \"Comparetree\",      \n");
+        MrBayesPrint ("   \"Sumt\" can compare more than two tree samples and will calculate consensus  \n");
+        MrBayesPrint ("   trees and split frequencies from the pooled samples.                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Relburnin     -- If this option is set to 'Yes', then a proportion of the     \n");
+        MrBayesPrint ("                    samples will be discarded as burnin when calculating summary \n");
+        MrBayesPrint ("                    statistics. The proportion to be discarded is set with       \n");
+        MrBayesPrint ("                    Burninfrac (see below). When the Relburnin option is set to  \n");
+        MrBayesPrint ("                    'No', then a specific number of samples is discarded instead.\n");
+        MrBayesPrint ("                    This number is set by Burnin (see below). Note that the      \n");
+        MrBayesPrint ("                    burnin setting is shared with the 'mcmc', 'sumt', 'sump' and \n");
+        MrBayesPrint ("                    'plot' commands.                                             \n");
+        MrBayesPrint ("   Burnin        -- Determines the number of samples (not generations) that will \n");
+        MrBayesPrint ("                    be discarded when summary statistics are calculated. The     \n");
+        MrBayesPrint ("                    value of this option is only relevant when Relburnin is set  \n");
+        MrBayesPrint ("                    to 'No'.                                                     \n");
+        MrBayesPrint ("   BurninFrac    -- Determines the fraction of samples that will be discarded    \n");
+        MrBayesPrint ("                    when summary statistics are calculated. The value of this    \n");
+        MrBayesPrint ("                    option is only relevant when Relburnin is set to 'Yes'.      \n");
+        MrBayesPrint ("                    Example: A value for this option of 0.25 means that 25%% of  \n");
+        MrBayesPrint ("                    the samples will be discarded.                               \n");
+        MrBayesPrint ("   Minpartfreq   -- The minimum probability of partitions to include in summary  \n");
+        MrBayesPrint ("                    statistics.                                                  \n");
+        MrBayesPrint ("   Filename1     -- The name of the first tree file to compare.                  \n");
+        MrBayesPrint ("   Filename2     -- The name of the second tree file to compare.                 \n");
+        MrBayesPrint ("   Outputname    -- Name of the file to which 'comparetree' results will be      \n");
+        MrBayesPrint ("                    printed.                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter       Options                  Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Relburnin       Yes/No                   %s                                   \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
+        MrBayesPrint ("   Burnin          <number>                 %d                                   \n", chainParams.chainBurnIn);
+        MrBayesPrint ("   Burninfrac      <number>                 %1.2lf                               \n", chainParams.burninFraction);
+        MrBayesPrint ("   Minpartfreq     <number>                 %1.2lf                               \n", comptreeParams.minPartFreq);
+        MrBayesPrint ("   Filename1       <name>                   %s                                   \n", comptreeParams.comptFileName1);
+        MrBayesPrint ("   Filename2       <name>                   %s                                   \n", comptreeParams.comptFileName2);
+        MrBayesPrint ("   Outputname      <name>                   %s                                   \n", comptreeParams.comptOutfile);
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Sumt"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Sumt                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used to produce summary statistics for trees sampled during   \n");
+        MrBayesPrint ("   a Bayesian MCMC analysis. You can either summarize trees from one individual  \n");
+        MrBayesPrint ("   analysis, or trees coming from several independent analyses. In either case,  \n");
+        MrBayesPrint ("   all the sampled trees are read in and the proportion of the time any single   \n");
+        MrBayesPrint ("   taxon bipartition (split) is found is counted. The proportion of the time that\n");
+        MrBayesPrint ("   the bipartition is found is an approximation of the posterior probability of  \n");
+        MrBayesPrint ("   the bipartition. (Remember that a taxon bipartition is defined by removing a  \n");
+        MrBayesPrint ("   branch on the tree, dividing the tree into those taxa to the left and right   \n");
+        MrBayesPrint ("   of the removed branch. This set is called a taxon bipartition.) The branch    \n");
+        MrBayesPrint ("   length of the bipartition is also recorded, if branch lengths have been saved \n");
+        MrBayesPrint ("   to file. The result is a list of the taxon bipartitions found, the frequency  \n");
+        MrBayesPrint ("   with which they were found, the posterior probability of the bipartition      \n");
+        MrBayesPrint ("   and, the mean and variance of the branch lengths or node depths, and various  \n");
+        MrBayesPrint ("   other statistics.                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The key to the partitions is output to a file with the suffix '.parts'. The   \n");
+        MrBayesPrint ("   summary statistics pertaining to bipartition probabilities are output to a    \n");
+        MrBayesPrint ("   file with the suffix '.tstat', and the statistics pertaining to branch or node\n");
+        MrBayesPrint ("   parameters are output to a file with the suffix '.vstat'.                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   A consensus tree is also printed to a file with the suffix '.con.tre' and     \n");
+        MrBayesPrint ("   printed to the screen as a cladogram, and as a phylogram if branch lengths    \n");
+        MrBayesPrint ("   have been saved. The consensus tree is either a 50 percent majority rule tree \n");
+        MrBayesPrint ("   or a majority rule tree showing all compatible partitions. If branch lengths  \n");
+        MrBayesPrint ("   have been recorded during the run, the '.con.tre' file will contain a consen- \n");
+        MrBayesPrint ("   sus tree with branch lengths and interior nodes labelled with support values. \n");
+        MrBayesPrint ("   By default, the consensus tree will also contain other summary information in \n");
+        MrBayesPrint ("   a format understood by the program 'FigTree'. To use a simpler format under-  \n");
+        MrBayesPrint ("   stood by other tree-drawing programs, such as 'TreeView', set 'Conformat' to  \n");
+        MrBayesPrint ("   'Simple'.                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   MrBayes alo produces a file with the ending \".trprobs\" that contains a list \n");
+        MrBayesPrint ("   of all the trees that were found during the MCMC analysis, sorted by their    \n");
+        MrBayesPrint ("   probabilities. This list of trees can be used to construct a credible set of  \n");
+        MrBayesPrint ("   trees. For example, if you want to construct a 95 percent credible set of     \n");
+        MrBayesPrint ("   trees, you include all of those trees whose cumulative probability is less    \n");
+        MrBayesPrint ("   than or equal to 0.95. You have the option of displaying the trees to the     \n");
+        MrBayesPrint ("   screen using the \"Showtreeprobs\" option. The default is to not display the  \n");
+        MrBayesPrint ("   trees to the screen; the number of different trees sampled by the chain can   \n");
+        MrBayesPrint ("   be quite large. If you are analyzing a large set of taxa, you may actually    \n");
+        MrBayesPrint ("   want to skip the calculation of tree probabilities entirely by setting        \n");
+        MrBayesPrint ("   'Calctreeprobs' to 'No'.                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   When calculating summary statistics you probably want to skip those trees that\n");
+        MrBayesPrint ("   were sampled in the initial part of the run, the so-called burn-in period. The\n");
+        MrBayesPrint ("   number of skipped samples is controlled by the 'Relburnin', 'Burnin', and     \n");
+        MrBayesPrint ("   'Burninfrac' settings, just as for the 'Mcmc' command. Since version 3.2.0,   \n");
+        MrBayesPrint ("   the burn-in settings are shared across the 'Sumt', 'Sump' and 'Mcmc' commands.\n");
+        MrBayesPrint ("   That is, changing the burn-in setting for one command will change the settings\n");
+        MrBayesPrint ("   for subsequent calls to any of the other commands.                            \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   If you are summarizing the trees sampled in several independent analyses,     \n");
+        MrBayesPrint ("   such as those resulting from setting the 'Nruns' option of the 'Mcmc' command \n");
+        MrBayesPrint ("   to a value larger than 1, MrBayes will also calculate convergence diagnostics \n");
+        MrBayesPrint ("   for the sampled topologies and branch lengths. These values can help you      \n");
+        MrBayesPrint ("   determine whether it is likely that your chains have converged.               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The 'Sumt' command expands the 'Filename' according to the current values of  \n");
+        MrBayesPrint ("   the 'Nruns' and 'Ntrees' options. For instance, if both 'Nruns' and 'Ntrees'  \n");
+        MrBayesPrint ("   are set to 1, 'Sumt' will try to open a file named '<Filename>.t'. If 'Nruns' \n");
+        MrBayesPrint ("   is set to 2 and 'Ntrees' to 1, then 'Sumt' will open two files, the first     \n");
+        MrBayesPrint ("   named '<Filename>.run1.t' and the second '<Filename>.run2.t', etc. By default,\n");
+        MrBayesPrint ("   the 'Filename' option is set such that 'Sumt' automatically summarizes all the\n");
+        MrBayesPrint ("   results from your immediately preceding 'Mcmc' command. You can also use the  \n");
+        MrBayesPrint ("   'Sumt' command to summarize tree samples in older analyses. If you want to do \n");
+        MrBayesPrint ("   that, remember to first read in a matrix so that MrBayes knows what taxon     \n");
+        MrBayesPrint ("   names to expect in the trees. Then set the 'Nruns', 'Ntrees' and 'Filename'   \n");
+        MrBayesPrint ("   options appropriately if they differ from the MrBayes defaults.               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Relburnin     -- If this option is set to YES, then a proportion of the       \n");
+        MrBayesPrint ("                    samples will be discarded as burnin when calculating summary \n");
+        MrBayesPrint ("                    statistics. The proportion to be discarded is set with       \n");
+        MrBayesPrint ("                    Burninfrac (see below). When the Relburnin option is set to  \n");
+        MrBayesPrint ("                    NO, then a specific number of samples is discarded instead.  \n");
+        MrBayesPrint ("                    This number is set by Burnin (see below). Note that the      \n");
+        MrBayesPrint ("                    burnin setting is shared across the 'sumt', 'sump', and      \n");
+        MrBayesPrint ("                    'mcmc' commands.                                             \n");
+        MrBayesPrint ("   Burnin        -- Determines the number of samples (not generations) that will \n");
+        MrBayesPrint ("                    be discarded when summary statistics are calculated. The     \n");
+        MrBayesPrint ("                    value of this option is only relevant when Relburnin is set  \n");
+        MrBayesPrint ("                    to NO.                                                       \n");
+        MrBayesPrint ("   BurninFrac    -- Determines the fraction of samples that will be discarded    \n");
+        MrBayesPrint ("                    when summary statistics are calculated. The value of this    \n");
+        MrBayesPrint ("                    option is only relevant when Relburnin is set to YES.        \n");
+        MrBayesPrint ("                    Example: A value for this option of 0.25 means that 25%% of  \n");
+        MrBayesPrint ("                    the samples will be discarded.                               \n");
+        MrBayesPrint ("   Nruns         -- Determines how many '.t' files from independent analyses that\n");
+        MrBayesPrint ("                    will be summarized. If Nruns > 1 then the names of the files \n");
+        MrBayesPrint ("                    are derived from 'Filename' by adding '.run1.t', '.run2.t',  \n");
+        MrBayesPrint ("                    etc. If Nruns=1 and Ntrees=1 (see below), then only '.t' is  \n");
+        MrBayesPrint ("                    added to 'Filename'.                                         \n");
+        MrBayesPrint ("   Ntrees        -- Determines how many trees there are in the sampled model. If \n");
+        MrBayesPrint ("                    'Ntrees' > 1 then the names of the files are derived from    \n");
+        MrBayesPrint ("                    'Filename' by adding '.tree1.t', '.tree2.t', etc. If there   \n");
+        MrBayesPrint ("                    are both multiple trees and multiple runs, the filenames will\n");
+        MrBayesPrint ("                    be '<Filename>.tree1.run1.t', '<Filename>.tree1.run2.t', etc.\n");
+        MrBayesPrint ("   Filename      -- The name of the file(s) to be summarized. This is the base of\n");
+        MrBayesPrint ("                    the file name, to which endings are added according to the   \n");
+        MrBayesPrint ("                    current settings of the 'Nruns' and 'Ntrees' options.        \n");
+        MrBayesPrint ("   Minpartfreq   -- The minimum probability of partitions to include in summary  \n");
+        MrBayesPrint ("                    statistics.                                                  \n");
+        MrBayesPrint ("   Contype       -- Type of consensus tree. 'Halfcompat' results in a 50%% major-\n");
+        MrBayesPrint ("                    ity rule tree, 'Allcompat' adds all compatible groups to such\n");
+        MrBayesPrint ("                    a tree.                                                      \n");
+        MrBayesPrint ("   Conformat     -- Format of consensus tree. The 'Figtree' setting results in a \n");
+        MrBayesPrint ("                    consensus tree formatted for the program FigTree, with rich  \n");
+        MrBayesPrint ("                    summary statistics. The 'Simple' setting results in a simple \n");
+        MrBayesPrint ("                    consensus tree written in a format read by a variety of pro- \n");
+        MrBayesPrint ("                    grams.                                                       \n");
+        MrBayesPrint ("   Outputname    -- Base name of the file(s) to which 'sumt' results will be     \n");
+        MrBayesPrint ("                    printed. The default is the same as 'Filename'.              \n");
+        MrBayesPrint ("   Calctreeprobs -- Determines whether tree probabilities should be calculated.  \n");
+        MrBayesPrint ("   Showtreeprobs -- Determines whether tree probabilities should be displayed on \n");
+        MrBayesPrint ("                    screen.                                                      \n");
+        MrBayesPrint ("   Hpd           -- Determines whether credibility intervals will be given as the\n");
+        MrBayesPrint ("                    region of Highest Posterior Density ('Yes') or as the inter- \n");
+        MrBayesPrint ("                    val containing the median 95 %% of sampled values ('No').    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Current settings:                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter       Options                  Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Relburnin       Yes/No                   %s                                   \n", chainParams.relativeBurnin == YES ? "Yes" : "No");
+        MrBayesPrint ("   Burnin          <number>                 %d                                   \n", chainParams.chainBurnIn);
+        MrBayesPrint ("   Burninfrac      <number>                 %1.2lf                               \n", chainParams.burninFraction);
+        MrBayesPrint ("   Nruns           <number>                 %d                                   \n", sumtParams.numRuns);
+        MrBayesPrint ("   Ntrees          <number>                 %d                                   \n", sumtParams.numTrees);
+        if (sumtParams.numRuns == 1 && sumtParams.numTrees == 1)
+            MrBayesPrint ("   Filename        <name>                   %s<.t>\n", sumtParams.sumtFileName);
+        else if (sumtParams.numRuns == 1 && sumtParams.numTrees > 1)
+            MrBayesPrint ("   Filename        <name>                   %s<.tree<i>.t>\n", sumtParams.sumtFileName);
+        else if (sumtParams.numRuns > 1 && sumtParams.numTrees == 1)
+            MrBayesPrint ("   Filename        <name>                   %s<.run<i>.t>\n", sumtParams.sumtFileName);
+        else if (sumtParams.numRuns > 1 && sumtParams.numTrees > 1)
+            MrBayesPrint ("   Filename        <name>                   %s<.tree<i>.run<i>.t>\n", sumtParams.sumtFileName);
+        MrBayesPrint ("   Minpartfreq     <number>                 %1.2lf                               \n", sumtParams.minPartFreq);
+        MrBayesPrint ("   Contype         Halfcompat/Allcompat     %s\n", sumtParams.sumtConType);
+        MrBayesPrint ("   Conformat       Figtree/Simple           %s                                   \n", sumtParams.consensusFormat == SIMPLE ? "Simple" : "Figtree");
+        MrBayesPrint ("   Outputname      <name>                   %s<.parts etc>\n", sumtParams.sumtOutfile);
+        MrBayesPrint ("   Calctreeprobs   Yes/No                   %s                                   \n", sumtParams.calcTreeprobs == YES ? "Yes" : "No");
+        MrBayesPrint ("   Showtreeprobs   Yes/No                   %s                                   \n", sumtParams.showSumtTrees == YES ? "Yes" : "No");
+        MrBayesPrint ("   Hpd             Yes/No                   %s                                   \n", sumtParams.HPD == YES ? "Yes" : "No");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Tree"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Tree                                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command is used by MrBayes to write trees to a nexus tree file. Trees    \n");
+        MrBayesPrint ("   are written in the Newick format. For instance,                               \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      tree ((1,2),3,4);                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   describes an unrooted tree with taxa 1 and 2 being more closely related to    \n");
+        MrBayesPrint ("   each other than to taxa 3 and 4. If branch lengths are saved to file, they    \n");
+        MrBayesPrint ("   are given after a colon sign immediately following the terminal taxon or the  \n");
+        MrBayesPrint ("   interior node they refer to. An example of an unrooted tree with branch       \n");
+        MrBayesPrint ("   lengths is:                                                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      tree ((1:0.064573,2:0.029042):0.041239,3:0.203988,4:0.187654);             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Trees that are rooted (clock trees) are written with a basal dichotomy        \n");
+        MrBayesPrint ("   instead of a basal trichotomy. If the tree described above had been rooted    \n");
+        MrBayesPrint ("   on the branch leading to taxon 4, it would have been represented as:          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      tree (((1,2),3),4);                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Report"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Report                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command allows you to control how the posterior distribution is          \n");
+        MrBayesPrint ("   reported. For rate parameters, it allows you to choose among several popular  \n");
+        MrBayesPrint ("   parameterizations. The report command also allows you to request printing of  \n");
+        MrBayesPrint ("   some model aspects that are usually not reported. For instance, if a node is  \n");
+        MrBayesPrint ("   constrained in the analysis, MrBayes can print the probabilities of the       \n");
+        MrBayesPrint ("   ancestral states at that node. Similarly, if there is rate variation in the   \n");
+        MrBayesPrint ("   model, MrBayes can print the inferred site rates, and if there is omega varia-\n");
+        MrBayesPrint ("   tion, MrBayes can print the inferred omega (positive selection) values for    \n");
+        MrBayesPrint ("   each codon. In a complex model with several partitions, each partition is     \n");
+        MrBayesPrint ("   controlled separately using the same 'Applyto' mechanism as in the 'Lset' and \n");
+        MrBayesPrint ("   'Prset' commands.                                                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Options:                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Applyto   -- This option allows you to apply the report commands to specific  \n");
+        MrBayesPrint ("                partitions. This command should be the first in the list of      \n");
+        MrBayesPrint ("                commands specified in 'report'.                                  \n");
+        MrBayesPrint ("                For example,                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                   report applyto=(1,2) tratio=ratio                             \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                   report applyto=(3) tratio=dirichlet                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("                would result in the transition and transversion rates of the     \n");
+        MrBayesPrint ("                first and second partitions in the model being reported as a     \n");
+        MrBayesPrint ("                ratio and the transition and transversion rates of the third     \n");
+        MrBayesPrint ("                partition being reported as proportions of the rate sum (the     \n");
+        MrBayesPrint ("                Dirichlet parameterization).                                     \n");
+        MrBayesPrint ("   Tratio    -- This specifies the report format for the transition and trans-   \n");
+        MrBayesPrint ("                version rates of a nucleotide substituion model with nst=2.      \n");
+        MrBayesPrint ("                If 'ratio' is selected, the rates will be reported as a ratio    \n");
+        MrBayesPrint ("                (transition rate/transversion rate). If 'dirichlet' is selected, \n");
+        MrBayesPrint ("                the transition and transversion rates will instead be reported   \n");
+        MrBayesPrint ("                as proportions of the rate sum. For example, if the transition   \n");
+        MrBayesPrint ("                rate is three times the transversion rate and 'ratio' is selec-  \n");
+        MrBayesPrint ("                ted, this will reported as a single value, '3.0'. If 'dirichlet' \n");
+        MrBayesPrint ("                is selected instead, the same rates will be reported using two   \n");
+        MrBayesPrint ("                values, '0.75 0.25'. The sum of the Dirichlet values is always 1.\n");
+        MrBayesPrint ("                Although the Dirichlet format may be unfamiliar to some users,   \n");
+        MrBayesPrint ("                it is more convenient for specifying priors than the ratio       \n");
+        MrBayesPrint ("                format.                                                          \n");
+        MrBayesPrint ("   Revmat    -- This specifies the report format for the substitution rates of   \n");
+        MrBayesPrint ("                a GTR substitution model for nucleotide or amino acid data. If   \n");
+        MrBayesPrint ("                'ratio' is selected, the rates will be reported scaled to the    \n");
+        MrBayesPrint ("                G-T rate (for nucleotides) or the Y-V rate (for amino acids). If \n");
+        MrBayesPrint ("                'dirichlet' is specified instead, the rates are reported as pro- \n");
+        MrBayesPrint ("                portions of the rate sum. For instance, assume that the C-T rate \n");
+        MrBayesPrint ("                is twice the A-G rate and four times the transversion rates,     \n");
+        MrBayesPrint ("                which are equal. If the report format is set to 'ratio', this    \n");
+        MrBayesPrint ("                would be reported as '1.0 2.0 1.0 1.0 4.0 1.0' since the rates   \n");
+        MrBayesPrint ("                are reported in the order rAC, rAG, rAT, rCG, rCT, rGT and scaled\n");
+        MrBayesPrint ("                relative to the last rate, the G-T rate. If 'dirichlet' is selec-\n");
+        MrBayesPrint ("                ted instead, the same rates would have been reported as '0.1 0.2 \n");
+        MrBayesPrint ("                0.1 0.1 0.4 0.1' since the rates are now scaled so that they sum \n");
+        MrBayesPrint ("                to 1.0. The Dirichlet format is the parameterization used for    \n");
+        MrBayesPrint ("                formulating priors on the rates.                                 \n");
+        MrBayesPrint ("   Ratemult  -- This specifies the report format used for the rate multiplier of \n");
+        MrBayesPrint ("                different model partitions. Three formats are available. If      \n");
+        MrBayesPrint ("                'scaled' is selected, then rates are scaled such that the mean   \n");
+        MrBayesPrint ("                rate per site across partitions is 1.0. If 'ratio' is chosen,    \n");
+        MrBayesPrint ("                the rates are scaled relative to the rate of the first parti-    \n");
+        MrBayesPrint ("                tion. Finally, if 'dirichlet' is chosen, the rates are given as  \n");
+        MrBayesPrint ("                proportions of the rate sum. The latter is the format used       \n");
+        MrBayesPrint ("                when formulating priors on the rate multiplier.                  \n");
+        MrBayesPrint ("   Tree      -- This specifies the report format used for the tree(s). Two op-   \n");
+        MrBayesPrint ("                tions are available. 'Topology' results in only the topology     \n");
+        MrBayesPrint ("                being printed to file, whereas 'brlens' causes branch lengths to \n");
+        MrBayesPrint ("                to be printed as well.                                           \n");
+        MrBayesPrint ("   Ancstates -- If this option is set to 'yes', MrBayes will print the pro-      \n");
+        MrBayesPrint ("                bability of the ancestral states at all constrained nodes. Typ-  \n");
+        MrBayesPrint ("                ically, you are interested in the ancestral states of only a few \n");
+        MrBayesPrint ("                characters and only at one node in the tree. To perform such     \n");
+        MrBayesPrint ("                an analysis, first define and enforce a topology constraint      \n");
+        MrBayesPrint ("                using 'constraint' and 'prset topologypr = constraints (...)'.   \n");
+        MrBayesPrint ("                Then put the character(s) of interest in a separate partition and\n");
+        MrBayesPrint ("                set MrBayes to report the ancestral states for that partition.   \n");
+        MrBayesPrint ("                For instance, if the characters of interest are in partition 2,  \n");
+        MrBayesPrint ("                use 'report applyto=(2) ancstates=yes' to force MrBayes to print \n");
+        MrBayesPrint ("                the probability of the ancestral states of those characters at   \n");
+        MrBayesPrint ("                the constrained node to the '.p' file.                           \n");
+        MrBayesPrint ("   Siterates -- If this option is set to 'yes' and the relevant model has rate   \n");
+        MrBayesPrint ("                variation across sites, then the site rates, weighted over rate  \n");
+        MrBayesPrint ("                categories, will be reported to the '.p' file.                   \n");
+        MrBayesPrint ("   Possel    -- If this option is set to 'yes' and the relevant model has omega  \n");
+        MrBayesPrint ("                variation across sites, the probability that each model site     \n");
+        MrBayesPrint ("                (codon in this case) is positively selected will be written to   \n");
+        MrBayesPrint ("                file.                                                            \n");
+        MrBayesPrint ("   Siteomega -- If this option is set to 'yes' and the relevant model has omega  \n");
+        MrBayesPrint ("                variation across sites, the weighted omega value (over omega     \n");
+        MrBayesPrint ("                categories) for each model site will be reported to file.        \n");
+        MrBayesPrint ("                                                                                 \n");
+        if (numCurrentDivisions == 0)
+            tempInt = 1;
+        else
+            tempInt = numCurrentDivisions;
+        for (i=0; i<tempInt; i++)
+            {
+            if (numCurrentDivisions == 0)
+                {
+                MrBayesPrint ("   Default report settings:                                                       \n");
+                mp = &defaultModel;
+                }
+            else
+                {
+                MrBayesPrint ("   Current report settings for partition %d:                                              \n", i+1);
+                mp = &modelParams[i];
+                }
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   Parameter       Options                  Current Setting                      \n");
+            MrBayesPrint ("   --------------------------------------------------------                      \n");
+            MrBayesPrint ("   Tratio          Ratio/Dirichlet          %s                                   \n", mp->tratioFormat);
+            MrBayesPrint ("   Revmat          Ratio/Dirichlet          %s                                   \n", mp->revmatFormat);
+            MrBayesPrint ("   Ratemult        Scaled/Ratio/Dirichlet   %s                                   \n", mp->ratemultFormat);
+            MrBayesPrint ("   Tree            Brlens/Topology          %s                                   \n", mp->treeFormat);
+            MrBayesPrint ("   Ancstates       Yes/No                   %s                                   \n", mp->inferAncStates);
+            MrBayesPrint ("   Siterates       Yes/No                   %s                                   \n", mp->inferSiteRates);
+            MrBayesPrint ("   Possel          Yes/No                   %s                                   \n", mp->inferPosSel);
+            MrBayesPrint ("   Siteomega       Yes/No                   %s                                   \n", mp->inferSiteOmegas);
+            MrBayesPrint ("                                                                                 \n");
+            MrBayesPrint ("   ------------------------------------------------------------------            \n");       
+            }
+        }
+    else if (!strcmp(helpTkn, "Manual"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Manual                                                                        \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command allows you to generate a text file containing help information   \n");
+        MrBayesPrint ("   on all the available commands. This text file can be used as an up-to-date    \n");
+        MrBayesPrint ("   command reference. You can set the name of the text file using the            \n");
+        MrBayesPrint ("   \"filename\" option; the default is \"commref_mb<version>.txt\".              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Parameter       Options                  Current Setting                      \n");
+        MrBayesPrint ("   --------------------------------------------------------                      \n");
+        MrBayesPrint ("   Filename        <name>                   %s                                   \n", manFileName);
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showmoves"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showmoves                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows the MCMC samplers (moves) that are switched on for the     \n");
+        MrBayesPrint ("   parameters in the current model. The basic usage is                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      showmoves                                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   If you want to see all available moves, use                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      showmoves allavailable=yes                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   If you want to change any of the tuning parameters for the moves, use the     \n");
+        MrBayesPrint ("   'propset' command.                                                            \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Showparams"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Showparams                                                                    \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This command shows all of the parameters in the current model. The basic      \n");
+        MrBayesPrint ("   usage is                                                                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      showparams                                                                 \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The parameters are listed together with their priors, the available moves,    \n");
+        MrBayesPrint ("   and the current value(s), which will be used as the starting values in the    \n");
+        MrBayesPrint ("   next mcmc analysis.                                                           \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else if (!strcmp(helpTkn, "Startvals"))
+        {
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        MrBayesPrint ("   Startvals                                                                     \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   Use this command to change the current values for parameters in your model.   \n");
+        MrBayesPrint ("   These values will be used as the starting values in the next mcmc analysis.   \n");
+        MrBayesPrint ("   The basic format is:                                                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      startvals <param>=(<value_1>,<value_2>,...,<value_n>)                      \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   for all substitution model parameters. The format is slightly different for   \n");
+        MrBayesPrint ("   parameters that are written to a tree file:                                   \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      startvals <param>=<tree_name>                                              \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   This version of the command will look for a tree with the specified name      \n");
+        MrBayesPrint ("   among the trees read in previously when parsing a tree block. The information \n");
+        MrBayesPrint ("   stored in that tree will be used to set the starting value of the parameter.  \n");
+        MrBayesPrint ("   The parameters that are set using this mechanism include topology and branch  \n");
+        MrBayesPrint ("   length parameters, as well as relaxed clock branch rates, cpp events and      \n");
+        MrBayesPrint ("   cpp branch rate multipliers.                                                  \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   The above versions of the command will set the value for all runs and chains. \n");
+        MrBayesPrint ("   You can also set the value for an individual run and chain by using the format\n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      startvals <param>(<run>,<chain>)=(<value_1>,...)                           \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   where <run> is the index of the run and <chain> the index of the chain. If    \n");
+        MrBayesPrint ("   the run index is omitted, the values will be changed for all runs. Similarly, \n");
+        MrBayesPrint ("   if the chain index is omitted, all chains will be set to the specified value. \n");
+        MrBayesPrint ("   For example, if we wanted to set the values of the stationary frequency       \n");
+        MrBayesPrint ("   parameter pi{1} to (0.1,0.1,0.4,0.4) for all chains in run 1, and to          \n");
+        MrBayesPrint ("   (0.3,0.3,0.2,0.2) for chain 3 of run 2, we would use                          \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("      startvals pi{1}(1,)=(0.1,0.1,0.4,0.4) pi{1}(2,3)=(0.3,0.3,0.2,0.2)         \n");
+        MrBayesPrint ("                                                                                 \n");
+        MrBayesPrint ("   ---------------------------------------------------------------------------   \n");
+        }
+    else
+        {
+        return (ERROR);
+        }
+        
+    return (NO_ERROR);
+}
+
+
+/* IsAmbig: This function returns YES if character is set as ambiguous
+   either by using parenthetic notation or by ambiguity codes. It returns
+   NO if character is unambiguous, missing or gapped */ 
+int IsAmbig (int charCode, int dType)
+{
+    if (dType == DNA || dType == RNA || dType == STANDARD || dType == RESTRICTION || dType == PROTEIN)
+        {
+        if (charCode != MISSING && charCode != GAP)
+            if (NBits(charCode) > 1)
+                return (YES);
+        }
+    else if (dType == CONTINUOUS)
+        {
+        /* do nothing, these cannot be partly ambiguous */
+        }
+    else
+        {
+        MrBayesPrint ("Unknown datatype in \"IsAmbig\"\n", spacer);
+        }
+
+    return (NO);
+}
+
+
+int IsArgValid (char *tk, char *validArg)
+{
+    int         i, j, k, tkLen, targetLen, numDiff, numStrMatches;
+    char        tempStr[100];
+    ParmInfoPtr p;
+
+    p = paramPtr;
+    tkLen = (int) strlen(tk);
+
+    numStrMatches = i = j = 0;
+    do
+        {
+        if (p->valueList[i] == '|' || p->valueList[i] == '\0')
+            {
+            tempStr[j++] = '\0';
+            targetLen = (int) strlen(tempStr);
+            if (tkLen <= targetLen)
+                {
+                numDiff = 0;
+                for (k=0; k<tkLen; k++)
+                    if (ChangeCase(tk[k]) != ChangeCase(tempStr[k]))
+                        numDiff++;
+                if (numDiff == 0)
+                    {
+                    numStrMatches++;
+                    strcpy (validArg, tempStr);
+                    }
+                }
+            j = 0;
+            }
+        else
+            tempStr[j++] = p->valueList[i];
+        i++;
+        }
+    while (p->valueList[i] != '\0');
+        
+    if (numStrMatches == 0)
+        {
+        MrBayesPrint ("%s   No valid match for argument \"%s\"\n", spacer, tk);
+        return (ERROR);
+        }
+    else if (numStrMatches == 1)
+        {
+        return (NO_ERROR);
+        }
+    else
+        {
+        MrBayesPrint ("%s   Argument \"%s\" is ambiguous\n", spacer, tk);
+        return (ERROR);
+        }
+}
+
+
+int IsIn (char ch, char *s)
+{
+    while (*s)
+        {
+        if (*s++ == ch)
+            return 1;
+        }
+    return 0;
+}
+
+
+int IsMissing (int charCode, int dType)
+{
+    if (dType == DNA || dType == RNA)
+        {
+        if (charCode == 15 || charCode == 16)
+            return (YES);
+        }
+    else if (dType == STANDARD || dType == PROTEIN)
+        {
+        if (charCode == MISSING || charCode == GAP)
+            return (YES);
+        }
+    else if (dType == RESTRICTION)
+        {
+        if (charCode == 3 || charCode == 4)
+            return (YES);
+        }
+    else if (dType == CONTINUOUS)
+        {
+
+        }
+    else
+        {
+        MrBayesPrint ("Unknown datatype in \"IsMissing\"\n", spacer);
+        }
+    return (NO);
+}
+
+
+int IsSame (char *s1, char *s2)
+{
+    int         i, nDiff, isIdentical, len;
+    
+    isIdentical = YES;
+    if (strlen(s1) != strlen(s2))
+        isIdentical = NO; /* strings cannot be identical because they are different lengths */
+    
+    /* now, we go through both strings, one character at a time, to see if
+       any are different */
+    if (strlen(s1) > strlen(s2))
+        len = (int) strlen(s2);
+    else
+        len = (int) strlen(s1);
+    i = nDiff = 0;
+    while (i < len)
+        {
+        if (tolower(s1[i]) != tolower(s2[i]))
+            nDiff++;
+        i++;
+        }
+    if (nDiff == 0 && isIdentical == YES)
+        return (SAME);
+    else if (nDiff == 0 && isIdentical == NO)
+        return (CONSISTENT_WITH);
+    else
+        return (DIFFERENT);
+}
+
+
+int IsWhite (char c)
+{
+    if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
+        {
+        if (c == '\n' || c == '\r')
+            return 2;
+        return 1;
+        }
+    return 0;
+}
+
+
+int NucID (char nuc)
+{
+    char        n;
+    
+    if (nuc == 'U' || nuc == 'u')
+        n = 'T';
+    else
+        n = nuc;
+
+    if (n == 'A' || n == 'a')
+        {
+        return 1;
+        }
+    else if (n == 'C' || n == 'c')
+        {
+        return 2;
+        }
+    else if (n == 'G' || n == 'g')
+        {
+        return 4;
+        }
+    else if (n == 'T' || n == 't')
+        {
+        return 8;
+        }
+    else if (n == 'R' || n == 'r')
+        {
+        return 5;
+        }
+    else if (n == 'Y' || n == 'y')
+        {
+        return 10;
+        }
+    else if (n == 'M' || n == 'm')
+        {
+        return 3;
+        }
+    else if (n == 'K' || n == 'k')
+        {
+        return 12;
+        }
+    else if (n == 'S' || n == 's')
+        {
+        return 6;
+        }
+    else if (n == 'W' || n == 'w')
+        {
+        return 9;
+        }
+    else if (n == 'H' || n == 'h')
+        {
+        return 11;
+        }
+    else if (n == 'B' || n == 'b')
+        {
+        return 14;
+        }
+    else if (n == 'V' || n == 'v')
+        {
+        return 7;
+        }
+    else if (n == 'D' || n == 'd')
+        {
+        return 13;
+        }
+    else if (n == 'N' || n == 'n')
+        {
+        return 15;
+        }
+    else if (n == gapId)
+        {
+        return GAP;
+        }
+    else if (n == missingId)
+        {
+        return MISSING;
+        }
+    else
+        return -1;
+}
+
+
+/*-------| ParseCommand |------------------------------------------------
+|
+|   This function is used to parse a file. The expected format is:
+|   
+|      command parameter=value parameter=value ... ;
+|
+|   For example, the following is a valid line for this parser:
+|
+|      lset nst=2;
+|
+|   In some cases, however, the format is:
+|
+|      command stuff more stuff ... ;
+|
+|   For example, when reading a data file, the matrix command might be:
+|
+|      matrix
+|         taxon_1 data
+|         taxon_2 data
+|         taxon_3 data
+|         ;
+|
+|   Like before, the command and all of the stuff for that command are
+|   terminated by a semicolon.
+|
+*/
+int ParseCommand (char *s)
+{
+    int             rc, tokenType, inError, numMatches, skipCmd;
+    char            errStr[100];
+
+    numMatches = 0;     /* Avoid gcc warnings (actually set in call to FindValidCommand) */
+    cmdStr = s;
+    tokenP = &s[0];
+
+#   if defined (ECHO_PROCESSED_COMMANDS)
+        MrBayesPrint ("Currently processing command: %s\n", s);
+#   endif
+    
+    inError = skipCmd = NO;
+    do
+        {
+        /* Get the next token. A token is a valid word in a line. Token type is defined in "bayes.h". */
+        if (GetToken (token, &tokenType, &tokenP))
+            {
+            inError = YES; 
+            break;
+            }
+        if (strlen(token) > 0 || tokenType == ALPHA)
+            {
+#           if defined (SHOW_TOKENS)
+            MrBayesPrint ("%s\n", token);
+#           endif
+            if (tokenType == LEFTCOMMENT)
+                {
+                /* If the token is a left comment "[", then we don't want to
+                   actually process commands until we find a right comment.  */
+                /* The exception is if readComment is set to YES, in which case
+                   we will leave it to the parser functions to decide on whether
+                   they want to read the comment or not */
+                if (readComment == NO || inComment == YES)
+                    {
+                    inComment = YES;
+                    numComments++;
+                    }
+                }
+            if (inComment == NO && inForeignBlock == NO)
+                {
+                if (tokenType != SEMICOLON)
+                    {
+                    /* If the token is not a semicolon, then we will be processing 
+                       either a command or a parameter. */
+                    if (expecting == Expecting(COMMAND))
+                        {
+                        /* We are expecting to find a command (defined above in "commands[]"). Find the 
+                           correct command and set a pointer to that command. */
+                        commandPtr = NULL;
+                        if (FindValidCommand (token, &numMatches) == ERROR)
+                            {
+                            /* We couldn't find the command or the user did not specify enough letters
+                               to unambiguously determine the command. The command pointer (commandPtr)
+                               is NULL. */
+                            if (numMatches == 0)    
+                                MrBayesPrint ("%s   Could not find command \"%s\"\n", spacer, token);
+                            else 
+                                MrBayesPrint ("%s   Ambiguous command \"%s\"\n", spacer, token);
+                            inError = YES;
+                            }
+                        else
+                            {
+                            /* We did find a valid command. Set what we are expecting to see next. */
+                            expecting = commandPtr->expect;
+                            
+                            /* Check to see if we have one of the so-called special cases in which a 
+                               command is not necessarily followed by a parameter (e.g., matrix). If we
+                               do have a special case, then we want to set the parameter pointer (paramPtr)
+                               appropriately. In this case, simply go to the first parameter in the parmList. */
+                            if (commandPtr->specialCmd == YES)
+                                {
+                                isFirstMatrixRead = YES;
+                                foundFirst = NO;
+                                paramPtr = paramTable + commandPtr->parmList[0];
+                                }
+                            if (strcmp(commandPtr->string, "Execute")==0)
+                                {
+                                /* set the tokenizer to recognize quoted strings */
+                                readWord = YES;
+                                }
+                            }
+                        }
+                    else 
+                        {
+                        /* We are expecting to find a parameter or a value for the parameter, not a command. */
+                        if ((expecting & Expecting(PARAMETER)) == Expecting(PARAMETER) && 
+                            (expecting & Expecting(tokenType)) != Expecting(tokenType))
+                            {
+                            /* Specifically, if we are here, we need to go through the parameter list,
+                               checking to see if the token is a valid parameter. */
+                            expecting = (expecting & Expecting(PARAMETER));
+                            if (FindValidParam (token, &numMatches) == ERROR)
+                                {
+                                /* The token is not a valid parameter. */
+                                if (numMatches == 0)
+                                    MrBayesPrint ("%s   Could not find parameter \"%s\"\n", spacer, token);
+                                else 
+                                    MrBayesPrint ("%s   Ambiguous parameter \"%s\"\n", spacer, token);
+                                inError = YES;
+                                }
+                            else
+                                {
+                                /* The token is a valid parameter. Call the appropriate function ("DoXxxxParm"). */
+                                if ((paramPtr->fp)(paramPtr->string, token) == ERROR)
+                                    {
+                                    if (strcmp("Xxxxxxxxxx", paramPtr->string))
+                                        MrBayesPrint ("%s   Error when setting parameter \"%s\" (1)\n", spacer, paramPtr->string);
+                                    inError = YES;
+                                    }
+                                }
+                            }
+                        else
+                            {
+                            /* Otherwise, we are expecting a value for the parameter. Call the appropriate function ("DoXxxxParm"). */
+                            if ((expecting & Expecting(tokenType)) != 0)
+                                expecting = (expecting & Expecting(tokenType));
+                            if ((Expecting(tokenType) & expecting) == Expecting(tokenType))
+                                {
+                                if ((paramPtr->fp)(paramPtr->string, token) == ERROR)
+                                    {
+                                    if (strcmp("Xxxxxxxxxx", paramPtr->string))
+                                        MrBayesPrint ("%s   Error when setting parameter \"%s\" (2)\n", spacer, paramPtr->string);
+                                    inError = YES;
+                                    }
+                                }
+                            else
+                                {
+                                inError = YES;
+                                WhatVariableExp (expecting, errStr);
+                                MrBayesPrint ("%s   Expecting '%s'\n", spacer, errStr+1);  /* there will be an initial space in errStr so print from pos 1 */
+                                if (numOpenExeFiles > 0)
+                                    MrBayesPrint ("%s   Instead found '%s' in command '%s'\n",
+                                        spacer, token, commandPtr->string);
+                                else
+                                    MrBayesPrint ("%s   Instead found '%s' in command '%s' at position %d\n",
+                                        spacer, token, commandPtr->string, tokenP - cmdStr - strlen(token)+1);
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    /* The token is a semicolon. This means that we are at the end of processing one command. We
+                       need to clean things up. We do this by calling the finishing function ("DoXxxx"). */
+                    if ((Expecting(SEMICOLON) & expecting) == Expecting(SEMICOLON))
+                        {
+                        if (commandPtr->cmdFxnPtr != NULL)
+                            {
+                            /* Finish up the command here. */
+                            rc = (commandPtr->cmdFxnPtr) ();
+                            if (rc  == ERROR || rc == ABORT)
+                                {
+                                if (rc == ABORT)
+                                    {
+                                    MrBayesPrint ("   Mcmc run aborted\n");
+                                    }
+                                else if (rc == SKIP_COMMAND)
+                                    {
+                                    MrBayesPrint ("   Cancelled execution of command\n");
+                                    skipCmd = YES;
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Error in command \"%s\"\n", spacer, commandPtr->string);
+                                    inError = YES;
+                                    }
+                                }
+                            }
+                        /* if the user typed "quit", then we want to bail out of this loop, with a NO_ERROR_QUIT */
+                        if (!strcmp(commandPtr->string, "Quit"))
+                            return (NO_ERROR_QUIT);
+                        expecting = Expecting(COMMAND);
+                        }
+                    else
+                        {
+                        inError = YES;
+                        WhatVariableExp (expecting, errStr);
+                        MrBayesPrint ("%s   Expecting %s\n", spacer, errStr);
+                        }
+                    }
+                }
+            /* Check to see if a comment is terminated. A comment can either be a right comment "]" or, if we were in a foreign nexus block
+               (e.g., a "paup" block) the terminating comment will be "end". */
+            if (tokenType == RIGHTCOMMENT)
+                {
+                if (inComment == NO && readComment == NO)
+                    {
+                    MrBayesPrint ("%s   Found \"]\", without having previously found \"[\"\n", spacer);
+                    inError = YES; 
+                    }
+                else if (inComment == NO && readComment == YES)
+                    {
+                    /* This is OK, we just pass through and rely on the command to handle the RIGHTCOMMENT */
+                    }
+                else
+                    {
+                    numComments--;
+                    if (numComments == 0)
+                        inComment = NO;
+                    }
+                }
+            if ((IsSame(token, "end") == SAME || IsSame(token, "endblock") == SAME) && inForeignBlock == YES)
+                {
+                strcpy (spacer, "");
+                inForeignBlock = NO;
+                }
+            }
+        
+        } while ((*token || tokenType == ALPHA) && inError == NO && skipCmd == NO);
+        
+    if (inError == YES)
+        {
+        readComment = NO;   /* reset this in case it is set to YES in command and we get an error exit */
+        return (ERROR);
+        }
+    else
+        return (NO_ERROR);
+}
+
+
+void PrintSettings (char *command)
+{
+    char yesNoStr[20];
+
+    if (!strcmp(command,"Mcmc"))
+        {
+        MrBayesPrint ("   Parameter       Options               Current Setting                         \n");
+        MrBayesPrint ("   -----------------------------------------------------                         \n");
+        MrBayesPrint ("   Ngen            <number>              %d                                      \n", chainParams.numGen);
+        MrBayesPrint ("   Nruns           <number>              %d                                      \n", chainParams.numRuns);
+        MrBayesPrint ("   Nchains         <number>              %d                                      \n", chainParams.numChains);
+        MrBayesPrint ("   Temp            <number>              %lf                                     \n", chainParams.chainTemp);
+        MrBayesPrint ("   Reweight        <number>,<number>     %1.2lf v %1.2lf ^                       \n", chainParams.weightScheme[0], chainParams.weightScheme[1]);
+        MrBayesPrint ("   Swapfreq        <number>              %d                                      \n", chainParams.swapFreq);
+        MrBayesPrint ("   Nswaps          <number>              %d                                      \n", chainParams.numSwaps);
+        MrBayesPrint ("   Samplefreq      <number>              %d                                      \n", chainParams.sampleFreq);
+        MrBayesPrint ("   Printfreq       <number>              %d                                      \n", chainParams.printFreq);
+        PrintYesNo (chainParams.printAll, yesNoStr);
+        MrBayesPrint ("   Printall        Yes/No                %s                                      \n", yesNoStr);
+        MrBayesPrint ("   Printmax        <number>              %d                                      \n", chainParams.printMax);
+        PrintYesNo (chainParams.mcmcDiagn, yesNoStr);
+        MrBayesPrint ("   Mcmcdiagn       Yes/No                %s                                      \n", yesNoStr);
+        MrBayesPrint ("   Diagnfreq       <number>              %d                                      \n", chainParams.diagnFreq);
+        if (chainParams.diagnStat == AVGSTDDEV)
+            strcpy (yesNoStr, "Avgstddev");
+        else
+            strcpy (yesNoStr, "Maxstddev");
+        MrBayesPrint ("   Diagnstat       Avgstddev/Maxstddev   %s                                     \n", yesNoStr);
+        MrBayesPrint ("   Minpartfreq     <number>              %1.2lf                                 \n", chainParams.minPartFreq);
+        PrintYesNo (chainParams.allChains, yesNoStr);
+        MrBayesPrint ("   Allchains       Yes/No                %s                                     \n", yesNoStr);
+        PrintYesNo (chainParams.allComps, yesNoStr);
+        MrBayesPrint ("   Allcomps        Yes/No                %s                                     \n", yesNoStr);
+        PrintYesNo (chainParams.relativeBurnin, yesNoStr);
+        MrBayesPrint ("   Relburnin       Yes/No                %s                                     \n", yesNoStr);
+        MrBayesPrint ("   Burnin          <number>              %d                                     \n", chainParams.chainBurnIn);
+        MrBayesPrint ("   Burninfrac      <number>              %1.2lf                                 \n", chainParams.burninFraction);
+        PrintYesNo (chainParams.stopRule, yesNoStr);
+        MrBayesPrint ("   Stoprule        Yes/No                %s                                     \n", yesNoStr);
+        MrBayesPrint ("   Stopval         <number>              %1.2lf                                 \n", chainParams.stopVal);
+        PrintYesNo (chainParams.saveTrees, yesNoStr);
+        MrBayesPrint ("   Savetrees       Yes/No                %s                                     \n", yesNoStr);
+        PrintYesNo (chainParams.checkPoint, yesNoStr);
+        MrBayesPrint ("   Checkpoint      Yes/No                %s                                     \n", yesNoStr);
+        MrBayesPrint ("   Checkfreq       <number>              %d                                     \n", chainParams.checkFreq);
+        MrBayesPrint ("   Filename        <name>                %s.<p/t>\n", chainParams.chainFileName);
+        MrBayesPrint ("   Startparams     Current/Reset         %s                                     \n", chainParams.startParams);
+        MrBayesPrint ("   Starttree       Current/Random/       %s                                     \n", chainParams.startTree);
+        MrBayesPrint ("                   Parsimony                                                    \n");
+        MrBayesPrint ("   Nperts          <number>              %d                                     \n", chainParams.numStartPerts);
+        PrintYesNo (chainParams.runWithData, yesNoStr);
+        MrBayesPrint ("   Data            Yes/No                %s                                     \n", yesNoStr);
+        MrBayesPrint ("   Ordertaxa       Yes/No                %s                                     \n", chainParams.orderTaxa == YES? "Yes" : "No");
+        MrBayesPrint ("   Append          Yes/No                %s                                     \n", chainParams.append == YES? "Yes" : "No");
+        MrBayesPrint ("   Autotune        Yes/No                %s                                     \n", chainParams.autotune == YES? "Yes" : "No");
+        MrBayesPrint ("   Tunefreq        <number>              %d                                     \n", chainParams.tuneFreq);
+        MrBayesPrint ("                                                                                \n");
+        }
+}
+
+
+void PrintYesNo (int yn, char s[4])
+{
+    if (yn == YES)
+        strcpy (s, "Yes");
+    else
+        strcpy (s, "No");
+}
+
+
+int ProtID (char aa)
+{
+    if (aa == 'A' || aa == 'a')      /* Ala */
+        {
+        return 1;
+        }
+    else if (aa == 'R' || aa == 'r') /* Arg */
+        {
+        return 2;
+        }
+    else if (aa == 'N' || aa == 'n') /* Asn */
+        {
+        return 4;
+        }
+    else if (aa == 'D' || aa == 'd') /* Asp */
+        {
+        return 8;
+        }
+    else if (aa == 'C' || aa == 'c') /* Cys */
+        {
+        return 16;
+        }
+    else if (aa == 'Q' || aa == 'q') /* Gln */
+        {
+        return 32;
+        }
+    else if (aa == 'E' || aa == 'e') /* Glu */
+        {
+        return 64;
+        }
+    else if (aa == 'G' || aa == 'g') /* Gly */
+        {
+        return 128;
+        }
+    else if (aa == 'H' || aa == 'h') /* His */
+        {
+        return 256;
+        }
+    else if (aa == 'I' || aa == 'i') /* Ile */
+        {
+        return 512;
+        }
+    else if (aa == 'L' || aa == 'l') /* Leu */
+        {
+        return 1024;
+        }
+    else if (aa == 'K' || aa == 'k') /* Lys */
+        {
+        return 2048;
+        }
+    else if (aa == 'M' || aa == 'm') /* Met */
+        {
+        return 4096;
+        }
+    else if (aa == 'F' || aa == 'f') /* Phe */
+        {
+        return 8192;
+        }
+    else if (aa == 'P' || aa == 'p') /* Pro */
+        {
+        return 16384;
+        }
+    else if (aa == 'S' || aa == 's') /* Ser */
+        {
+        return 32768;
+        }
+    else if (aa == 'T' || aa == 't') /* Thr */
+        {
+        return 65536;
+        }
+    else if (aa == 'W' || aa == 'w') /* Trp */
+        {
+        return 131072;
+        }
+    else if (aa == 'Y' || aa == 'y') /* Tyr */
+        {
+        return 262144;
+        }
+    else if (aa == 'V' || aa == 'v') /* Val */
+        {
+        return 524288;
+        }
+    else if (aa == 'X' || aa == 'x') /* Nonidentified */
+        {
+        return MISSING;
+        }
+    else if (aa == gapId)
+        {
+        return GAP;
+        }
+    else if (aa == missingId)
+        {
+        return MISSING;
+        }
+    else
+        return -1;
+}
+
+
+int RemoveLastFromString (char *s1)
+{
+    int     i, j, numPrev, numRemoved;
+    
+    /* We remove the last name from the string simply by deleting the last "|". */
+       
+    i = numPrev = 0;
+    while (s1[i] != '\0')
+        {
+        if (s1[i] == '|')
+            numPrev++;
+        i++;
+        }
+        
+    i = j = numRemoved = 0;
+    while (s1[i] != '\0')
+        {
+        if (s1[i] == '|')
+            j++;
+        if (numPrev == j)
+            {
+            s1[i] = ' ';
+            numRemoved++;
+            break;
+            }
+        i++;
+        }
+
+    if (numRemoved != 1)
+        {
+        MrBayesPrint ("%s   Could not find name to remove\n", spacer);
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int MBResID (char nuc)
+{
+    char        n;
+    
+    n = nuc;
+
+    if (n == '0' || n == 'a' || n == 'A')
+        {
+        return 1;
+        }
+    else if (n == '1' || n == 'b' || n == 'B')
+        {
+        return 2;
+        }
+    else if (n == gapId)
+        {
+        return GAP;
+        }
+    else if (n == missingId)
+        {
+        return MISSING;
+        }
+    else
+        return -1;
+}
+
+
+/* Reset character flags */
+void ResetCharacterFlags (void)
+{
+    /* reset all characters flags */
+    numChar              = 0;                        /* number of defined characters                  */
+    defChars             = NO;                       /* flag for whether number of characters is known*/
+    defMatrix            = NO;                       /* flag for whether matrix is successfull read   */
+    matrixHasPoly        = NO;                       /* flag for whether matrix has polymorphisms     */
+    isInAmbig            = NO;                       /* flag for whether the parser is within ()      */
+    isInPoly             = NO;                       /* flag for whether the parser is within {}      */
+    defPartition         = NO;                       /* flag for whether character partition is read  */
+    defPairs             = NO;                       /* flag indicating whether pairs have been defnd */
+    numDefinedPartitions = 0;                        /* number of defined partitions                  */
+    partitionNum         = 0;                        /* partition number currently enforced           */
+    numCurrentDivisions  = 0;                        /* number of partitions of data                  */
+    numCharSets          = 0;                        /* holds number of character sets                */
+    numDivisions         = 1;                        /* holds number of partitions                    */
+    isMixed              = NO;                       /* are data mixed ?                              */
+    dataType             = NONE;                     /* holds datatype                                */
+    matchId              = '\0';                     /* no default for match character                */
+    gapId                = '\0';                     /* no default for gap character                  */
+    missingId            = '\0';                     /* no default for missing characters             */
+}
+
+
+/* Reset taxa flags */
+void ResetTaxaFlags (void)
+{
+    numTaxa                 = 0;                         /* number of taxa                                */
+    numNamedTaxa            = 0;                         /* number of named taxa                          */
+    defTaxa                 = NO;                        /* flag for whether number of taxa is known      */
+    isTaxsetDef             = NO;                        /* is a taxlabels set defined                    */
+    numDefinedConstraints   = 0;                         /* holds number of defined constraints           */
+    definedConstraint       = NULL;
+    definedConstraintTwo    = NULL;
+    definedConstraintPruned       = NULL;
+    definedConstraintTwoPruned    = NULL;
+    constraintNames         = NULL;
+    nodeCalibration         = NULL;
+    tempActiveConstraints   = NULL;                      /* holds temp info on active constraints         */
+    outGroupNum             = 0;                         /* default outgroup                              */
+    numTaxaSets             = 0;                         /* holds number of taxa sets                     */
+}
+
+
+/* SetPartition: Set model partition */
+int SetPartition (int part)
+{
+    int     i, j;
+    
+    /* Free space for modelParams and modelSettings */
+    if (memAllocs[ALLOC_MODEL] == YES)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+          free (modelParams[i].activeConstraints);
+        free (modelParams);
+        free (modelSettings);
+        modelParams = NULL;
+        modelSettings = NULL;
+        memAllocs[ALLOC_MODEL] = NO;
+        }
+
+    /* Set model partition */
+    partitionNum = part;
+    numCurrentDivisions = 0;
+
+    /* Set numCurrentDivisions to maximum division a character belongs to in partition part */
+    for (i=0; i<numChar; i++)
+        {
+        j = partitionId[i][part];
+        if (j > numCurrentDivisions)
+            numCurrentDivisions = j;
+        }
+
+    /* Allocate space for partition models */
+    modelParams = (Model *) SafeCalloc (numCurrentDivisions, sizeof (Model));
+    modelSettings = (ModelInfo *) SafeCalloc (numCurrentDivisions, sizeof (ModelInfo));
+    if (!modelParams || !modelSettings)
+        {
+        MrBayesPrint ("%s   Could not allocate modelParams or modelSettings\n", spacer);
+        if (modelParams)
+            free (modelParams);
+        if (modelSettings)
+            free (modelSettings);
+        return (ERROR);
+        }
+    memAllocs[ALLOC_MODEL] = YES;
+
+    numVars = (int *) SafeRealloc ((void *) numVars, 3 * (size_t)numCurrentDivisions * sizeof(int));
+    tempLinkUnlinkVec = numVars + numCurrentDivisions;
+    activeParts       = numVars + 2*numCurrentDivisions;
+
+    tempNum = (MrBFlt *) SafeRealloc ((void *) tempNum, 6 * sizeof(MrBFlt));
+
+    activeParams[0] = (int *) SafeRealloc ((void *) (activeParams[0]), (size_t)NUM_LINKED * (size_t)numCurrentDivisions * sizeof(int));
+    for (i=1; i<NUM_LINKED; i++)
+        activeParams[i] = activeParams[0] + i*numCurrentDivisions;
+    linkTable[0] = (int *) SafeRealloc ((void *) (linkTable[0]), 3 * (size_t)NUM_LINKED * (size_t)numCurrentDivisions * sizeof(int));
+    tempLinkUnlink[0] = linkTable[0] + NUM_LINKED*numCurrentDivisions;
+    for (i=1; i<NUM_LINKED; i++)
+        {
+        linkTable[i]      = linkTable[0] + i*numCurrentDivisions;
+        tempLinkUnlink[i] = tempLinkUnlink[0] + i*numCurrentDivisions;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* SetSpeciespartition: Set speciespartition */
+int SetSpeciespartition (int part)
+{
+    int     i, j;
+    
+    /* Set model partition */
+    speciespartitionNum = part;
+    numSpecies = 0;
+
+    /* Set numSpecies to maximum species a taxon belongs to in partition part */
+    for (i=0; i<numTaxa; i++)
+        {
+        j = speciespartitionId[i][part];
+        if (j > numSpecies)
+            numSpecies = j;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int SetTaxaFromTranslateTable (void)
+{
+    int     i;
+
+    if (numTaxa != 0)
+        return ERROR;
+
+    for (i=0; i<numTranslates; i++)
+        {
+        if (strlen(transFrom[i])>99)
+            {
+            MrBayesPrint ("%s   Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, transFrom[i]);
+            return (ERROR);
+            }
+        AddString(&taxaNames, numTaxa, transFrom[i]);
+        numTaxa++;
+        }
+    
+    return NO_ERROR;
+}
+
+
+void SetUpParms (void)
+{
+    ParmInfoPtr p = paramTable;
+
+    PARAM   (0, "NEXUS",          DoNexusParm,       "NEXUS|\0");
+    PARAM   (1, "Data",           DoBeginParm,       "\0");
+    PARAM   (2, "Mrbayes",        DoBeginParm,       "\0");
+    PARAM   (3, "Trees",          DoBeginParm,       "\0");
+    PARAM   (4, "Ntax",           DoDimensionsParm,  "\0");
+    PARAM   (5, "Nchar",          DoDimensionsParm,  "\0");
+    PARAM   (6, "Interleave",     DoFormatParm,      "Yes|No|\0");
+    PARAM   (7, "Datatype",       DoFormatParm,      "Dna|Rna|Protein|Restriction|Standard|Continuous|Mixed|\0");
+    PARAM   (8, "Gap",            DoFormatParm,      "\0");
+    PARAM   (9, "Missing",        DoFormatParm,      "\0");
+    PARAM  (10, "Matchchar",      DoFormatParm,      "\0");
+    PARAM  (11, "MatrixInfo",     DoMatrixParm,      "\0");
+    PARAM  (12, "Filename",       DoExecuteParm,     "\0");
+    PARAM  (13, "Autoclose",      DoSetParm,         "Yes|No|\0");
+    PARAM  (14, "Partition",      DoSetParm,         "\0");
+    PARAM  (15, "Xxxxxxxxxx",     DoCharsetParm,     "\0");
+    PARAM  (16, "Xxxxxxxxxx",     DoPartitionParm,   "\0");
+    PARAM  (17, "Seed",           DoMcmcParm,        "\0");
+    PARAM  (18, "Ngen",           DoMcmcParm,        "\0");
+    PARAM  (19, "Samplefreq",     DoMcmcParm,        "\0");
+    PARAM  (20, "Printfreq",      DoMcmcParm,        "\0");
+    PARAM  (21, "Nchains",        DoMcmcParm,        "\0");
+    PARAM  (22, "Temp",           DoMcmcParm,        "\0");
+    PARAM  (23, "Filename",       DoMcmcParm,        "\0");
+    PARAM  (24, "Burnin",         DoMcmcParm,        "\0");
+    PARAM  (25, "Starttree",      DoMcmcParm,        "Random|Current|User|Parsimony|NJ|\0");
+    PARAM  (26, "Nperts",         DoMcmcParm,        "\0");
+    PARAM  (27, "Savebrlens",     DoMcmcParm,        "Yes|No|\0");
+    PARAM  (28, "Nucmodel",       DoLsetParm,        "4by4|Doublet|Codon|Protein|\0");
+    PARAM  (29, "Nst",            DoLsetParm,        "1|2|6|Mixed|\0");
+    PARAM  (30, "Aamodel",        DoLsetParm,        "Poisson|Equalin|Jones|Dayhoff|Mtrev|Mtmam|Wag|Rtrev|Cprev|Vt|Blosum|Blossum|LG|\0");
+    PARAM  (31, "Parsmodel",      DoLsetParm,        "Yes|No|\0");
+    PARAM  (32, "Omegavar",       DoLsetParm,        "Equal|Ny98|M3|M10|\0");
+    PARAM  (33, "Code",           DoLsetParm,        "Universal|Vertmt|Invermt|Mycoplasma|Yeast|Ciliate|Echinoderm|Euplotid|Metmt|\0");
+    PARAM  (34, "Coding",         DoLsetParm,        "All|Variable|Informative|Nosingletons|Noabsencesites|Nopresencesites|Nosingletonpresence|Nosingletonabsence|\0");
+    PARAM  (35, "Seqerror",       DoPrsetParm,       "\0");
+    PARAM  (36, "Tratiopr",       DoPrsetParm,       "Beta|Fixed|\0");
+    PARAM  (37, "Revmatpr",       DoPrsetParm,       "Dirichlet|Fixed|\0");
+    PARAM  (38, "Omegapr",        DoPrsetParm,       "Dirichlet|Fixed|\0");
+    PARAM  (39, "Statefreqpr",    DoPrsetParm,       "Dirichlet|Fixed|\0");
+    PARAM  (40, "Ngammacat",      DoLsetParm,        "\0");
+    PARAM  (41, "Shapepr",        DoPrsetParm,       "Uniform|Exponential|Fixed|\0");
+    PARAM  (42, "Ratecorrpr",     DoPrsetParm,       "Uniform|Fixed|\0");
+    PARAM  (43, "Pinvarpr",       DoPrsetParm,       "Uniform|Fixed|\0");
+    PARAM  (44, "Covswitchpr",    DoPrsetParm,       "Uniform|Exponential|Fixed|\0");
+    PARAM  (45, "Xxxxxxxxxx",     DoExcludeParm,     "\0");
+    PARAM  (46, "Xxxxxxxxxx",     DoIncludeParm,     "\0");
+    PARAM  (47, "Xxxxxxxxxx",     DoDeleteParm,      "\0");
+    PARAM  (48, "Xxxxxxxxxx",     DoRestoreParm,     "\0");
+    PARAM  (49, "Xxxxxxxxxx",     DoTaxasetParm,     "\0");
+    PARAM  (50, "Xxxxxxxxxx",     DoHelpParm,        "\0");
+    PARAM  (51, "Applyto",        DoLsetParm,        "\0");
+    PARAM  (52, "Rates",          DoLsetParm,        "Equal|Gamma|LNorm|Propinv|Invgamma|Adgamma|\0");
+    PARAM  (53, "Covarion",       DoLsetParm,        "Yes|No|\0");
+    PARAM  (54, "Applyto",        DoPrsetParm,       "\0");
+    PARAM  (55, "Tratio",         DoLinkParm,        "\0");
+    PARAM  (56, "Revmat",         DoLinkParm,        "\0");
+    PARAM  (57, "Omega",          DoLinkParm,        "\0");
+    PARAM  (58, "Statefreq",      DoLinkParm,        "\0");
+    PARAM  (59, "Shape",          DoLinkParm,        "\0");
+    PARAM  (60, "Pinvar",         DoLinkParm,        "\0");
+    PARAM  (61, "Correlation",    DoLinkParm,        "\0");
+    PARAM  (62, "Ratemultiplier", DoLinkParm,        "\0");
+    PARAM  (63, "Switchrates",    DoLinkParm,        "\0");
+    PARAM  (64, "Symdirihyperpr", DoPrsetParm,       "Uniform|Exponential|Fixed|\0");
+    PARAM  (65, "Xxxxxxxxxx",     DoCtypeParm,       "\0");
+    PARAM  (66, "Xxxxxxxxxx",     DoConstraintParm,  "\0");
+    PARAM  (67, "Topologypr",     DoPrsetParm,       "Uniform|Constraints|Fixed|Speciestree|\0");
+    PARAM  (68, "Brlenspr",       DoPrsetParm,       "Unconstrained|Clock|Relaxedclock|Fixed|\0");
+    PARAM  (69, "Speciationpr",   DoPrsetParm,       "Uniform|Exponential|Fixed|\0");
+    PARAM  (70, "Extinctionpr",   DoPrsetParm,       "Beta|Fixed|\0");
+    PARAM  (71, "Popsizepr",      DoPrsetParm,       "Lognormal|Uniform|Gamma|Normal|Fixed|\0");
+    PARAM  (72, "Topology",       DoLinkParm,        "\0");
+    PARAM  (73, "Brlens",         DoLinkParm,        "\0");
+    PARAM  (74, "Speciationrate", DoLinkParm,        "\0");
+    PARAM  (75, "Extinctionrate", DoLinkParm,        "\0");
+    PARAM  (76, "Popsize",        DoLinkParm,        "\0");
+    PARAM  (77, "Ratepr",         DoPrsetParm,       "Variable|Dirichlet|Fixed|\0");
+    PARAM  (78, "Xxxxxxxxxx",     DoOutgroupParm,    "\0");
+    PARAM  (79, "Xxxxxxxxxx",     DoTreeParm,        "\0");
+    PARAM  (80, "Filename",       DoSumtParm,        "\0");
+    PARAM  (81, "Burnin",         DoSumtParm,        "\0");
+    PARAM  (82, "Contype",        DoSumtParm,        "Halfcompat|Allcompat|\0");
+    PARAM  (83, "Xxxxxxxxxx",     DoTranslateParm,   "\0");
+    PARAM  (84, "Swapfreq",       DoMcmcParm,        "\0");
+    PARAM  (85, "Start",          DoLogParm,         "\0");
+    PARAM  (86, "Stop",           DoLogParm,         "\0");
+    PARAM  (87, "Filename",       DoLogParm,         "\0");
+    PARAM  (88, "Append",         DoLogParm,         "\0");
+    PARAM  (89, "Replace",        DoLogParm,         "\0");
+    PARAM  (90, "Nbetacat",       DoLsetParm,        "\0");
+    PARAM  (91, "Augment",        DoLsetParm,        "Yes|No|\0");
+    PARAM  (92, "Xxxxxxxxxx",     DoPairsParm,       "\0");
+    PARAM  (93, "Xxxxxxxxxx",     DoBreaksParm,      "\0");
+    PARAM  (94, "Nowarnings",     DoSetParm,         "Yes|No|\0");
+    PARAM  (95, "Showtreeprobs",  DoSumtParm,        "Yes|No|\0");
+    PARAM  (96, "Filename",       DoSumpParm,        "\0");
+    PARAM  (97, "Burnin",         DoSumpParm,        "\0");
+    PARAM  (98, "Reweight",       DoMcmcParm,        "\0");
+    PARAM  (99, "Noop",           DoMcmcParm,        "\0");
+    PARAM (100, "Ny98omega1pr",   DoPrsetParm,       "Beta|Fixed|\0");
+    PARAM (101, "Ny98omega3pr",   DoPrsetParm,       "Uniform|Exponential|Fixed|\0");
+    PARAM (102, "Codoncatfreqs",  DoPrsetParm,       "Dirichlet|Fixed|\0");
+    PARAM (103, "Sampleprob",     DoPrsetParm,       "\0");
+    PARAM (104, "Aamodelpr",      DoPrsetParm,       "Fixed|Mixed|\0");
+    PARAM (105, "Aamodel",        DoLinkParm,        "\0");
+    PARAM (106, "Filename",       DoPlotParm,        "\0");
+    PARAM (107, "Parameter",      DoPlotParm,        "\0");
+    PARAM (108, "Match",          DoPlotParm,        "Perfect|Consistentwith|All|\0");
+    PARAM (109, "Burnin",         DoPlotParm,        "\0");
+    PARAM (110, "Brownscalepr",   DoPrsetParm,       "Uniform|Gamma|Gammamean|Fixed|\0");
+    PARAM (111, "Browncorrpr",    DoPrsetParm,       "Uniform|Fixed|\0");
+    PARAM (112, "Pbf",            DoMcmcParm,        "Yes|No|\0");
+    PARAM (113, "Pbfinitburnin",  DoMcmcParm,        "\0");
+    PARAM (114, "Pbfsamplefreq",  DoMcmcParm,        "\0");
+    PARAM (115, "Pbfsampletime",  DoMcmcParm,        "\0");
+    PARAM (116, "Pbfsampleburnin",DoMcmcParm,        "\0");
+    PARAM (117, "Growthpr",       DoPrsetParm,       "Uniform|Exponential|Fixed|Normal|\0");
+    PARAM (118, "Growthrate",     DoLinkParm,        "\0");
+    PARAM (119, "Xxxxxxxxxx",     DoCalibrateParm,   "Unconstrained|Fixed|Uniform|Offsetexponential|Truncatednormal|Lognormal|Offsetlognormal|Gamma|Offsetgamma|\0");
+    PARAM (120, "Calwaitpr",      DoPrsetParm,       "Exponential|Fixed|\0");     /* not used but leave it in to not destroy mapping to commands */
+    PARAM (121, "M3omegapr",      DoPrsetParm,       "Exponential|Fixed|\0");
+    PARAM (122, "Applyto",        DoReportParm,      "\0");
+    PARAM (123, "Tratio",         DoReportParm,      "Dirichlet|Ratio|\0");
+    PARAM (124, "Revmat",         DoReportParm,      "Dirichlet|Ratio|\0");
+    PARAM (125, "Ratemult",       DoReportParm,      "Dirichlet|Scaled|Ratio|\0");
+    PARAM (126, "Filename",       DoManualParm,      "\0");
+    PARAM (127, "Filename1",      DoCompareTreeParm, "\0");
+    PARAM (128, "Filename2",      DoCompareTreeParm, "\0");
+    PARAM (129, "Outputname",     DoCompareTreeParm, "\0");
+    PARAM (130, "Burnin",         DoCompareTreeParm, "\0");
+    PARAM (131, "Ploidy",         DoLsetParm,        "Haploid|Diploid|Zlinked|\0");
+    PARAM (132, "Swapadjacent",   DoMcmcParm,        "Yes|No|\0");
+    PARAM (133, "Treeagepr",      DoPrsetParm,       "Fixed|Uniform|Offsetexponential|Truncatednormal|Lognormal|Offsetlognormal|Gamma|Offsetgamma|\0");
+    PARAM (134, "Ancstates",      DoReportParm,      "Yes|No|\0");
+    PARAM (135, "Siterates",      DoReportParm,      "Yes|No|\0");
+    PARAM (136, "Possel",         DoReportParm,      "Yes|No|\0");
+    PARAM (137, "Plot",           DoSumpParm,        "Yes|No|\0");
+    PARAM (138, "Table",          DoSumpParm,        "Yes|No|\0");
+    PARAM (139, "Minprob",        DoSumpParm,        "\0");
+    PARAM (140, "Printtofile",    DoSumpParm,        "Yes|No|\0");
+    PARAM (141, "Outputname",     DoSumpParm,        "\0");
+    PARAM (142, "Redirect",       DoMcmcParm,        "Yes|No|\0");
+    PARAM (143, "Swapseed",       DoMcmcParm,        "\0");
+    PARAM (144, "Runidseed",      DoMcmcParm,        "\0");
+    PARAM (145, "Quitonerror",    DoSetParm,         "Yes|No|\0");
+    PARAM (146, "Printbrlens",    DoSumtParm,        "Yes|No|\0");
+    PARAM (147, "Brlensgeq",      DoSumtParm,        "\0");
+    PARAM (148, "Minpartfreq",    DoMcmcParm,        "\0");
+    PARAM (149, "Allchains",      DoMcmcParm,        "Yes|No|\0");
+    PARAM (150, "Mcmcdiagn",      DoMcmcParm,        "Yes|No|\0");
+    PARAM (151, "Diagnfreq",      DoMcmcParm,        "\0");
+    PARAM (152, "Nruns",          DoMcmcParm,        "\0");
+    PARAM (153, "Stoprule",       DoMcmcParm,        "Yes|No|\0");
+    PARAM (154, "Stopval",        DoMcmcParm,        "\0");
+    PARAM (155, "Relburnin",      DoMcmcParm,        "Yes|No|\0");
+    PARAM (156, "Burninfrac",     DoMcmcParm,        "\0");
+    PARAM (157, "Allcomps",       DoMcmcParm,        "Yes|No|\0");
+    PARAM (158, "Printall",       DoMcmcParm,        "Yes|No|\0");
+    PARAM (159, "Printmax",       DoMcmcParm,        "\0");
+    PARAM (160, "Data",           DoMcmcParm,        "Yes|No|\0");
+    PARAM (161, "Nruns",          DoSumpParm,        "\0");
+    PARAM (162, "Allruns",        DoSumpParm,        "Yes|No|\0");
+    PARAM (163, "Nruns",          DoSumtParm,        "\0");
+    PARAM (164, "Ntrees",         DoSumtParm,        "\0");
+    PARAM (165, "Calctreeprobs",  DoSumtParm,        "Yes|No|\0");
+    PARAM (166, "Ordertaxa",      DoMcmcParm,        "Yes|No|\0");
+    PARAM (167, "Ordertaxa",      DoSumtParm,        "Yes|No|\0");
+    PARAM (168, "Aarevmatpr",     DoPrsetParm,       "Dirichlet|Fixed|\0");
+    PARAM (169, "Nswaps",         DoMcmcParm,        "\0");
+    PARAM (170, "Autoreplace",    DoSetParm,         "Yes|No|\0");
+    PARAM (171, "Npthreads",      DoSetParm,         "\0");
+    PARAM (172, "Cppratepr",      DoPrsetParm,       "Fixed|Exponential|\0");
+    PARAM (173, "Cppmultdevpr",   DoPrsetParm,       "Fixed|\0");
+    PARAM (174, "TK02varpr",      DoPrsetParm,       "Fixed|Exponential|Uniform|\0");
+    PARAM (175, "Pfile",          DoSumtParm,        "\0");
+    PARAM (176, "Pfile",          DoSumtParm,        "\0");
+    PARAM (177, "Autocomplete",   DoSumtParm,        "Yes|No|\0");
+    PARAM (178, "Autocomplete",   DoSumpParm,        "Yes|No|\0");
+    PARAM (179, "Userlevel",      DoSetParm,         "Standard|Developer|\0");
+    PARAM (180, "Allavailable",   DoShowmovesParm,   "Yes|No|\0");
+    PARAM (181, "Seed",           DoSetParm,         "\0");
+    PARAM (182, "Swapseed",       DoSetParm,         "\0");
+    PARAM (183, "Clockratepr",    DoPrsetParm,       "Fixed|Normal|Lognormal|Exponential|Gamma|\0");
+    PARAM (184, "Nodeagepr",      DoPrsetParm,       "Unconstrained|Calibrated|\0");
+    PARAM (185, "Clockvarpr",     DoPrsetParm,       "Strict|Cpp|TK02|Igr|Bm|Ibr|Mixed|\0");
+    PARAM (186, "Xxxxxxxxxx",     DoPropsetParm,     "\0");
+    PARAM (187, "Xxxxxxxxxx",     DoStartvalsParm,   "\0");
+    PARAM (188, "Usegibbs",       DoLsetParm,        "Yes|No|\0");
+    PARAM (189, "Gibbsfreq",      DoLsetParm,        "\0");
+    PARAM (190, "Checkpoint",     DoMcmcParm,        "Yes|No|\0");
+    PARAM (191, "Checkfreq",      DoMcmcParm,        "\0");
+    PARAM (192, "Tree",           DoReportParm,      "Topology|Brlens|\0");
+    PARAM (193, "Cpprate",        DoLinkParm,        "\0");
+    PARAM (194, "Cppmultdev",     DoLinkParm,        "\0");
+    PARAM (195, "Cppevents",      DoLinkParm,        "\0");
+    PARAM (196, "TK02var",        DoLinkParm,        "\0");
+    PARAM (197, "TK02branchrates",DoLinkParm,        "\0");
+    PARAM (198, "Savetrees",      DoMcmcParm,        "Yes|No|\0");
+    PARAM (199, "Diagnstat",      DoMcmcParm,        "Avgstddev|Maxstddev|\0");
+    PARAM (200, "Startparams",    DoMcmcParm,        "Reset|Current|\0");
+    PARAM (201, "Characters",     DoBeginParm,       "\0");
+    PARAM (202, "Startingtrees",  DoMcmcParm,        "\0");
+    PARAM (203, "Xxxxxxxxxx",     DoUserTreeParm,    "\0");
+    PARAM (204, "Outputname",     DoSumtParm,        "\0");
+    PARAM (205, "Table",          DoSumtParm,        "Yes|No|\0");
+    PARAM (206, "Summary",        DoSumtParm,        "Yes|No|\0");
+    PARAM (207, "Consensus",      DoSumtParm,        "Yes|No|\0");
+    PARAM (208, "Minpartfreq",    DoSumtParm,        "\0");
+    PARAM (209, "Relburnin",      DoSumtParm,        "Yes|No|\0");
+    PARAM (210, "Burninfrac",     DoSumtParm,        "\0");
+    PARAM (211, "Relburnin",      DoSumpParm,        "Yes|No|\0");
+    PARAM (212, "Burninfrac",     DoSumpParm,        "\0");
+    PARAM (213, "Append",         DoMcmcParm,        "Yes|No|\0");
+    PARAM (214, "Autotune",       DoMcmcParm,        "Yes|No|\0");
+    PARAM (215, "Tunefreq",       DoMcmcParm,        "\0");
+    PARAM (216, "Scientific",     DoSetParm,         "Yes|No|\0");
+    PARAM (217, "Siteomega",      DoReportParm,      "Yes|No|\0");
+    PARAM (218, "Igrvarpr",       DoPrsetParm,       "Fixed|Exponential|Uniform|\0");
+    PARAM (219, "Symbols",        DoFormatParm,      "\0");
+    PARAM (220, "Equate",         DoFormatParm,      "\0");
+    PARAM (221, "Relburnin",      DoCompareTreeParm, "Yes|No|\0");
+    PARAM (222, "Burninfrac",     DoCompareTreeParm, "\0");
+    PARAM (223, "Minpartfreq",    DoCompareTreeParm, "\0");
+    PARAM (224, "Relburnin",      DoPlotParm,        "Yes|No|\0");
+    PARAM (225, "Burninfrac",     DoPlotParm,        "\0");
+    PARAM (226, "Taxa",           DoBeginParm,       "\0");
+    PARAM (227, "Xxxxxxxxxx",     DoBeginParm,       "\0");
+    PARAM (228, "Xxxxxxxxxx",     DoTaxlabelsParm,   "\0");
+    PARAM (229, "Dir",            DoSetParm,         "\0");
+    PARAM (230, "Conformat",      DoSumtParm,        "Figtree|Simple|\0");
+    PARAM (231, "Hpd",            DoSumpParm,        "Yes|No|\0");
+    PARAM (232, "Hpd",            DoSumtParm,        "Yes|No|\0");
+    PARAM (233, "Usebeagle",      DoSetParm,         "Yes|No|\0");
+    PARAM (234, "Beagledevice",   DoSetParm,         "Cpu|Gpu|\0");
+    PARAM (235, "Beagleprecision",DoSetParm,         "Single|Double|\0");
+    PARAM (236, "Beaglesse",      DoSetParm,         "Yes|No|\0");
+    PARAM (237, "Beagleopenmp",   DoSetParm,         "Yes|No|\0");
+    PARAM (238, "Beaglethreads",  DoSetParm,         "Yes|No|\0");
+    PARAM (239, "Beaglescaling",  DoSetParm,         "Always|Dynamic|\0");
+    PARAM (240, "Beaglefreq",     DoSetParm,         "\0");
+    PARAM (241, "Popvarpr",       DoPrsetParm,       "Equal|Variable|\0");
+    PARAM (242, "Igrvar",         DoLinkParm,        "\0");
+    PARAM (243, "Igrbranchrates", DoLinkParm,        "\0");
+    PARAM (244, "Xxxxxxxxxx",     DoSpeciespartitionParm,   "\0");
+    PARAM (245, "Speciespartition",  DoSetParm,      "\0");
+    PARAM (246, "Revratepr",      DoPrsetParm,       "Symdir|\0");
+    PARAM (247, "Samplestrat",    DoPrsetParm,       "Random|Diversity|Cluster|FossilTip|\0");
+    PARAM (248, "Burninss",       DoSsParm,          "\0");
+    PARAM (249, "Nsteps",         DoSsParm,          "\0");
+    PARAM (250, "Alpha",          DoSsParm,          "\0");
+    PARAM (251, "Bmvarpr",        DoPrsetParm,       "Fixed|Exponential|Uniform|\0");
+    PARAM (252, "Bmvar",          DoLinkParm,        "\0");
+    PARAM (253, "Bmbranchrates",  DoLinkParm,        "\0");
+    PARAM (254, "Ibrvarpr",       DoPrsetParm,       "Fixed|Exponential|Uniform|\0");
+    PARAM (255, "Ibrvar",         DoLinkParm,        "\0");
+    PARAM (256, "Ibrbranchlens",  DoLinkParm,        "\0");
+    PARAM (257, "FromPrior",      DoSsParm,          "Yes|No|\0");
+    PARAM (258, "Filename",       DoSumSsParm,       "\0");
+    PARAM (259, "Burnin",         DoSumSsParm,       "\0");
+    PARAM (260, "Nruns",          DoSumSsParm,       "\0");
+    PARAM (261, "Allruns",        DoSumSsParm,       "Yes|No|\0");
+    PARAM (262, "Askmore",        DoSumSsParm,       "Yes|No|\0");
+    PARAM (263, "Relburnin",      DoSumSsParm,       "Yes|No|\0");
+    PARAM (264, "Burninfrac",     DoSumSsParm,       "\0");
+    PARAM (265, "Discardfrac",    DoSumSsParm,       "\0");
+    PARAM (266, "Smoothing",      DoSumSsParm,       "\0");
+    PARAM (267, "Steptoplot",     DoSumSsParm,       "\0");
+    PARAM (268, "Precision",      DoSetParm,         "\0");
+    PARAM (269, "Fossilizationpr",   DoPrsetParm,    "Beta|Fixed|\0");
+    PARAM (270, "Fossilizationrate", DoLinkParm,     "\0");
+    PARAM (271, "Generatepr",     DoPrsetParm,       "Variable|Fixed|\0");
+    PARAM (272, "Mixedvarpr",     DoPrsetParm,       "Fixed|Exponential|Uniform|\0");
+    PARAM (273, "Mixedvar",       DoLinkParm,        "\0");
+    PARAM (274, "Mixedbrchrates", DoLinkParm,        "\0");
+    PARAM (275, "Beagleresource", DoSetParm,         "\0");
+
+    /* NOTE: If a change is made to the parameter table, make certain you change
+            NUMPARAMS (now 276; one more than last index) at the top of this file. */
+    /* CmdType commands[] */
+}
+
+
+void ShowNodes (TreeNode *p, int indent, int isThisTreeRooted)
+{
+    if (p != NULL)
+        {
+        printf ("   ");
+        if (p->left == NULL && p->right == NULL && p->anc != NULL)
+            {
+            printf ("%*cN %d (l=%d r=%d a=%d) %1.15lf (%s) scalerNode=%d isDated=%d ",
+            indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->length, p->label, p->scalerNode, p->isDated);
+            }
+        else if (p->left != NULL && p->right == NULL && p->anc == NULL)
+            {
+            if (isThisTreeRooted == NO)
+                {
+                if (p->label[0] == '\0' || p->label[0] == '\n' || p->label[0] == ' ')
+                    printf ("%*cN %d (l=%d r=%d a=%d) (---) scalerNode=%d ",
+                    indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode);
+                else
+                    printf ("%*cN %d (l=%d r=%d a=%d) (%s) scalerNode=%d ",
+                    indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->label, p->scalerNode);
+                }
+            else
+                {
+                printf ("%*cN %d (l=%d r=%d a=%d) X.XXXXXX scalerNode=%d ",
+                indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode);
+                }
+            }
+        else
+            {
+            if (p->anc != NULL)
+                {
+                if (p->anc->anc == NULL && isThisTreeRooted == YES)
+                    printf ("%*cN %d (l=%d r=%d a=%d) X.XXXXXX scalerNode=%d ",
+                    indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->scalerNode);
+                else    
+                    printf ("%*cN %d (l=%d r=%d a=%d) %1.15lf scalerNode=%d ",
+                    indent, ' ', Dex(p), Dex(p->left), Dex(p->right), Dex(p->anc), p->length, p->scalerNode);
+                }
+            }
+        if (isThisTreeRooted == YES)
+            printf ("depth=%1.15lf\n", p->nodeDepth);
+        else
+            printf ("\n");
+        ShowNodes (p->left,  indent + 2, isThisTreeRooted);
+        ShowNodes (p->right, indent + 2, isThisTreeRooted);
+        }
+}
+
+
+int StandID (char nuc)
+{
+    char        n;
+    
+    /* Note that if you change how many states are recognized, you need 
+       to look at IsMissing */
+    n = nuc;
+
+    if (n == '0')
+        {
+        return 1;
+        }
+    else if (n == '1')
+        {
+        return 2;
+        }
+    else if (n == '2')
+        {
+        return 4;
+        }
+    else if (n == '3')
+        {
+        return 8;
+        }
+    else if (n == '4')
+        {
+        return 16;
+        }
+    else if (n == '5')
+        {
+        return 32;
+        }
+    else if (n == '6')
+        {
+        return 64;
+        }
+    else if (n == '7')
+        {
+        return 128;
+        }
+    else if (n == '8')
+        {
+        return 256;
+        }
+    else if (n == '9')
+        {
+        return 512;
+        }
+    else if (n == missingId)
+        {
+        return MISSING;
+        }
+    else if (n == gapId)
+        {
+        return GAP;
+        }
+    else
+        return -1;
+}
+
+
+void State_CODON (char *state, int code, int division)
+{
+    state[0] = StateCode_NUC4(modelParams[division].codonNucs[code][0]);
+    state[1] = StateCode_NUC4(modelParams[division].codonNucs[code][1]);
+    state[2] = StateCode_NUC4(modelParams[division].codonNucs[code][2]);
+    state[3] = '\0';
+}
+
+
+void State_DOUBLET (char *state, int code)
+{
+    state[0] = code/4 + 'A';
+    state[1] = code%4 + 'A';
+    state[2] = '\0';
+}
+
+
+int StateCode_AA (int n)
+{
+    if (n == 0)
+        return 'A';      /* Ala */
+    else if (n == 1)
+        return 'R';      /* Arg */
+    else if (n == 2)
+        return 'N';      /* Asn */
+    else if (n == 3)
+        return 'D';      /* Asp */
+    else if (n == 4)
+        return 'C';      /* Cys */
+    else if (n == 5)
+        return 'Q';      /* Gln */
+    else if (n == 6)
+        return 'E';      /* Glu */
+    else if (n == 7)
+        return 'G';      /* Gly */
+    else if (n == 8)
+        return 'H';      /* His */
+    else if (n == 9)
+        return 'I';      /* Ile */
+    else if (n == 10)
+        return 'L';      /* Leu */
+    else if (n == 11)
+        return 'K';      /* Lys */
+    else if (n == 12)
+        return 'M';      /* Met */
+    else if (n == 13)
+        return 'F';      /* Phe */
+    else if (n == 14)
+        return 'P';      /* Pro */
+    else if (n == 15)
+        return 'S';      /* Ser */
+    else if (n == 16)
+        return 'T';      /* Thr */
+    else if (n == 17)
+        return 'W';      /* Trp */
+    else if (n == 18)
+        return 'Y';      /* Tyr */
+    else if (n == 19)
+        return 'V';      /* Val */
+    else
+        return '?';
+}
+
+
+int StateCode_NUC4 (int n)
+{
+    if (n == 0)
+        return 'A';
+    else if (n == 1)
+        return 'C';
+    else if (n == 2)
+        return 'G';
+    else if (n == 3)
+        return 'T';
+    else return '?';
+}
+
+
+int StateCode_Std (int n)
+{
+    if (n <= 9 && n >= 0)
+        return '0' + n;
+    else return '?';
+}
+
+
+void WhatVariableExp (BitsLong exp, char *st)
+{
+    int         n;
+    
+    strcpy (st, "");
+    n = 0;
+    if (exp == 0)
+        strcat(st, " nothing");
+    else
+        {
+        if ((exp & Expecting(COMMAND)) == Expecting(COMMAND))
+            {
+            strcat(st, " command");
+            n++;
+            }
+        if ((exp & Expecting(PARAMETER)) == Expecting(PARAMETER))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " parameter");
+            n++;
+            }
+        if ((exp & Expecting(EQUALSIGN)) == Expecting(EQUALSIGN))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " =");
+            n++;
+            }
+        if ((exp & Expecting(COLON)) == Expecting(COLON))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " :");
+            n++;
+            }
+        if ((exp & Expecting(SEMICOLON)) == Expecting(SEMICOLON))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " ;");
+            n++;
+            }
+        if ((exp & Expecting(COMMA)) == Expecting(COMMA))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " ,");
+            n++;
+            }
+        if ((exp & Expecting(POUNDSIGN)) == Expecting(POUNDSIGN))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " #");
+            n++;
+            }
+        if ((exp & Expecting(QUESTIONMARK)) == Expecting(QUESTIONMARK))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " ?");
+            n++;
+            }
+        if ((exp & Expecting(DASH)) == Expecting(DASH))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " -");
+            n++;
+            }
+        if ((exp & Expecting(LEFTPAR)) == Expecting(LEFTPAR))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " (");
+            n++;
+            }
+        if ((exp & Expecting(RIGHTPAR)) == Expecting(RIGHTPAR))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " )");
+            n++;
+            }
+        if ((exp & Expecting(LEFTCOMMENT)) == Expecting(LEFTCOMMENT))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " [");
+            n++;
+            }
+        if ((exp & Expecting(RIGHTCOMMENT)) == Expecting(RIGHTCOMMENT))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " ]");
+            n++;
+            }
+        if ((exp & Expecting(ALPHA)) == Expecting(ALPHA))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " <name>");
+            n++;
+            }
+        if ((exp & Expecting(NUMBER)) == Expecting(NUMBER))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " <number>");
+            n++;
+            }
+        if ((exp & Expecting(RETURNSYMBOL)) == Expecting(RETURNSYMBOL))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " return");
+            n++;
+            }
+        if ((exp & Expecting(ASTERISK)) == Expecting(ASTERISK))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " *");
+            n++;
+            }
+        if ((exp & Expecting(BACKSLASH)) == Expecting(BACKSLASH))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " /");
+            n++;
+            }
+        if ((exp & Expecting(BACKSLASH)) == Expecting(BACKSLASH))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " \\");
+            n++;
+            }
+        if ((exp & Expecting(EXCLAMATIONMARK)) == Expecting(EXCLAMATIONMARK))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " !");
+            n++;
+            }
+        if ((exp & Expecting(PERCENT)) == Expecting(PERCENT))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " %");
+            n++;
+            }
+        if ((exp & Expecting(LEFTCURL)) == Expecting(LEFTCURL))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " {");
+            n++;
+            }
+        if ((exp & Expecting(RIGHTCURL)) == Expecting(RIGHTCURL))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " }");
+            n++;
+            }
+        if ((exp & Expecting(WEIRD)) == Expecting(WEIRD))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " <whatever>");
+            n++;
+            }
+        if ((exp & Expecting(VERTICALBAR)) == Expecting(VERTICALBAR))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " |");
+            n++;
+            }
+        if ((exp & Expecting(UNKNOWN_TOKEN_TYPE)) == Expecting(UNKNOWN_TOKEN_TYPE))
+            {
+            if (n > 0)
+                strcat(st, " or");
+            strcat(st, " no clue");
+            n++;
+            }
+        }
+}
+
+
+char WhichAA (int x)
+{
+    if (x == 1)
+        return ('A');
+    else if (x == 2)
+        return ('R');
+    else if (x == 4)
+        return ('N');
+    else if (x == 8)
+        return ('D');
+    else if (x == 16)
+        return ('C');
+    else if (x == 32)
+        return ('Q');
+    else if (x == 64)
+        return ('E');
+    else if (x == 128)
+        return ('G');
+    else if (x == 256)
+        return ('H');
+    else if (x == 512)
+        return ('I');
+    else if (x == 1024)
+        return ('L');
+    else if (x == 2048)
+        return ('K');
+    else if (x == 4096)
+        return ('M');
+    else if (x == 8192)
+        return ('F');
+    else if (x == 16384)
+        return ('P');
+    else if (x == 32768)
+        return ('S');
+    else if (x == 65536)
+        return ('T');
+    else if (x == 131072)
+        return ('W');
+    else if (x == 262144)
+        return ('Y');
+    else if (x == 524288)
+        return ('V');
+    else if (x > 0 && x < 524288)
+        return ('*');
+    else if (x == MISSING)
+        return ('?');
+    else if (x == GAP)
+        return ('-');
+    else 
+        return (' ');
+}
+
+
+MrBFlt WhichCont (int x)
+{
+    return ((MrBFlt)(x / 1000.0));
+}
+
+
+char WhichNuc (int x)
+{
+    if (x == 1)
+        return ('A');
+    else if (x == 2)
+        return ('C');
+    else if (x == 3)
+        return ('M');
+    else if (x == 4)
+        return ('G');
+    else if (x == 5)
+        return ('R');
+    else if (x == 6)
+        return ('S');
+    else if (x == 7)
+        return ('V');
+    else if (x == 8)
+        return ('T');
+    else if (x == 9)
+        return ('W');
+    else if (x == 10)
+        return ('Y');
+    else if (x == 11)
+        return ('H');
+    else if (x == 12)
+        return ('K');
+    else if (x == 13)
+        return ('D');
+    else if (x == 14)
+        return ('B');
+    else if (x == 15)
+        return ('N');
+    else if (x == MISSING)
+        return ('?');
+    else if (x == GAP)
+        return ('-');
+    else 
+        return (' ');
+}
+
+
+char WhichRes (int x)
+{
+    if (x == 1)
+        return ('0');
+    else if (x == 2)
+        return ('1');
+    else if (x == 3)
+        return ('*');
+    else if (x == MISSING)
+        return ('N');
+    else if (x == GAP)
+        return ('-');
+    else 
+        return (' ');
+}
+
+
+char WhichStand (int x)
+{
+    if (x == 1)
+        return ('0');
+    else if (x == 2)
+        return ('1');
+    else if (x == 4)
+        return ('2');
+    else if (x == 8)
+        return ('3');
+    else if (x == 16)
+        return ('4');
+    else if (x == 32)
+        return ('5');
+    else if (x == 64)
+        return ('6');
+    else if (x == 128)
+        return ('7');
+    else if (x == 256)
+        return ('8');
+    else if (x == 512)
+        return ('9');
+    else if (x > 0 && x < 512)
+        return ('*');
+    else if (x == MISSING)
+        return ('N');
+    else if (x == GAP)
+        return ('-');
+    else 
+        return (' ');
+}
+
diff --git a/src/command.h b/src/command.h
new file mode 100644 (file)
index 0000000..a9fdb26
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __COMMAND_H__
+#define __COMMAND_H__
+
+int         AddString (char ***list, int len, char *token);
+BitsLong    Expecting (int y);
+int         CheckString (char **list, int len, char *token, int *matchIndex);
+int         CheckStringValidity (char *s);
+int         DoExecute (void);
+int         FreeMatrix (void);
+int         GetToken (char *token, int *tokenType, char **sourceH);
+int         FindValidCommand (char *tk, int *numMatches);
+int         IsArgValid (char *s, char *validArg);
+int         IsIn (char ch, char *s);
+int         IsSame (char *s1, char *s2);
+int         IsWhite (char c);
+int         ParseCommand (char *s);
+void        ResetCharacterFlags (void);
+void        ResetTaxaFlags (void);
+int         RootUserTree (TreeNode *p);
+void        SetUpParms (void);
+void        ShowNodes (TreeNode *p, int indent, int isThisTreeRooted);
+int         ShowTree (Tree *t);
+void        State_CODON (char *state, int code, int division);
+void        State_DOUBLET (char *state, int code);
+int         StateCode_AA (int n);
+int         StateCode_NUC4 (int n);
+int         StateCode_Std (int n);
+char        WhichAA (int x);
+char        WhichNuc (int x);
+char        WhichRes (int x);
+char        WhichStand (int x);
+
+#endif  /* __COMMAND_H__ */
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644 (file)
index 0000000..d6c2bdf
--- /dev/null
@@ -0,0 +1,40 @@
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to 1 if you have the `readline' library (-lreadline). */
+#undef HAVE_LIBREADLINE
+
+/* Define to 1 if you have a recent version of readline */
+#undef COMPLETIONMATCHES
+
+/* Define to 1 if you want to compile the parallel version */
+#undef MPI_ENABLED
+
+/* Define to 1 if you want to compile SSE-enabled version */
+#undef SSE_ENABLED
+
+/* Define one of the UNIX, MAC or WINDOWS */
+#undef UNIX_VERSION
+#undef MAC_VERSION
+#undef WINDOWS_VERSION
+
+/* Define if used on a 64bit cpu */
+#undef _64BIT
+
+/* Define to enable beagle library */
+#undef BEAGLE_ENABLED
+
+/* Define to enable threads in BEAGLE library */
+#undef THREADS_ENABLED
diff --git a/src/configure.in b/src/configure.in
new file mode 100644 (file)
index 0000000..acdae5a
--- /dev/null
@@ -0,0 +1,181 @@
+AC_INIT(mrbayes, 3.2, http://www.mrbayes.net)
+AC_CONFIG_SRCDIR(bayes.c)
+AC_CONFIG_HEADER(config.h)
+
+AC_ARG_ENABLE(debug, 
+    [--enable-debug=[no/yes] compile with debug support [default="no"]]
+    ,,enable_debug="no")
+CFLAGS_DEFINED="NOTICE: Because the variable \$CFLAGS is defined in your shell, the 
+default MrBayes flags will be overridden. To ensure optimal performance, please check 
+that your \$CFLAGS variable is set correctly. Alternatively, unset the \$CFLAGS 
+variable in your shell in order to use the default MrBayes compiler options."
+if test -n "${CFLAGS+x}"; then
+    AC_MSG_NOTICE([$CFLAGS_DEFINED]);
+fi
+if test "x$enable_debug" == "xyes"; then
+    : ${CFLAGS="-ggdb -Wall"}
+else
+    : ${CFLAGS="-O3"}; CFLAGS=$CFLAGS" -DNDEBUG";
+fi
+AC_PROG_CC
+
+AC_HEADER_STDC
+AC_CHECK_LIB([m], [exp])
+AC_PROG_INSTALL
+
+NOMPICC="No compiler for mpi has been found. If this is incorrect, please adjust your 
+path and rerun configure."
+AC_ARG_ENABLE(mpi, 
+    [--enable-mpi=[no/yes] compile the parallel version of mrbayes [default="no"]]
+    ,,enable_mpi="no")
+if test "x$enable_mpi" == "xyes"; then
+    AC_CHECK_PROG(mpicc,mpicc,yes,no)
+    if test "x$mpicc" == "xno"; then
+        AC_MSG_ERROR($NOMPICC);
+    fi
+    AC_DEFINE(MPI_ENABLED)
+fi
+
+# AC_ARG_ENABLE(fastlog, 
+#     [--enable-fastlog=[no/yes] enable fast log operations [default="no"]]
+#     ,,enable_fastlog="no")
+# if test "x$enable_fastlog" == "xyes"; then
+#     AC_DEFINE(FAST_VERSION)
+# fi
+
+AC_LANG_C
+
+AC_ARG_ENABLE(sse, 
+    [--enable-sse=[no/yes] enable sse instructions [default="yes"]]
+    ,,enable_sse="yes")
+if test "x$enable_sse" == "xyes"; then
+    AC_MSG_CHECKING(for SSE support)
+    AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+    [
+    #include <xmmintrin.h>
+    int main(){
+    int res;
+    __m128          m1, m2;
+    void *ptr = (void *) NULL;
+    const size_t align = 32;
+    res = posix_memalign(&ptr, align, align);
+    m1 = _mm_add_ps (m2, m1);
+    return 0;
+    }
+    ])],
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(SSE_ENABLED)
+    , AC_MSG_RESULT(no)
+    )
+fi
+
+# ------------------------------------------------------------------------------
+# Setup BEAGLE
+# ------------------------------------------------------------------------------
+
+AC_ARG_WITH([beagle],
+    [AS_HELP_STRING([--with-beagle[[=PATH]]],
+    [enable beagle and optionally set prefix where beagle is installed if not 
+    /usr/local @<:@default=yes@:>@])],
+    [],
+    [with_beagle=yes])
+   
+AC_ARG_ENABLE(threads, 
+    [--enable-threads=[no/yes] enable thread-support when using BEAGLE [default="no"]]
+    ,,enable_threads="no")  
+
+if test "x$with_beagle" != "xno"
+then
+    if test "x$with_beagle" == "xyes"
+    then
+        with_beagle=/usr/local
+    fi
+
+    AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/beagle.h,
+       [BEAGLE_CFLAGS="-I$with_beagle/include/libhmsbeagle"],
+       [AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/beagle.h,
+        [BEAGLE_CFLAGS="-I$with_beagle/include/libhmsbeagle-1"],   
+        [AC_MSG_ERROR([beagle's library include file beagle.h is not found neither in 
+         ${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in 
+         ${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install 
+         beagle library from http://code.google.com/p/beagle-lib/ or disable use of 
+         beagle library by invoking configure script with option --with-beagle=no. 
+         Note: without beagle library MrBayes may run slower.)])])
+    AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/platform.h,,
+       [AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/platform.h,,   
+        [AC_MSG_ERROR([beagle's library include file platform.h is not found neither in 
+         ${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in 
+         ${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install 
+         beagle library from http://code.google.com/p/beagle-lib/ or disable use of 
+         beagle library by invoking configure script with option --with-beagle=no. 
+         Note: without beagle library MrBayes may run slower.)])])
+    AC_CHECK_FILE($with_beagle/lib,[BEAGLE_LIBS="-L$with_beagle/lib -lhmsbeagle"],
+       [AC_MSG_ERROR([beagle library is not found in ${with_beagle}]. You should either 
+        install beagle library from http://code.google.com/p/beagle-lib/ or disable use 
+        of beagle library by invoking configure script with option --with-beagle=no. 
+        Note: without beagle library MrBayes may run slower.)])
+
+    AC_DEFINE(BEAGLE_ENABLED)
+    CFLAGS="${CFLAGS} ${BEAGLE_CFLAGS}"
+    LDFLAGS="${LDFLAGS} ${BEAGLE_LIBS}"
+   
+    # ----- Check for pthreads compatibility -------
+   
+    if test "x$enable_threads" == "xyes"
+    then
+        AC_CHECK_LIB(pthread,pthread_create,[THREAD_LIB="-lpthread"],
+        [AC_MSG_ERROR([pthreads library not found])])
+        AC_DEFINE(THREADS_ENABLED)
+    fi
+fi
+# ------------------------------------------------------------------------------
+
+dnl check OS 
+dnl case $host in
+dnl i386-*-gnu*) 
+dnl     bla;;
+dnl esac
+AC_DEFINE(UNIX_VERSION)
+
+dnl use c for custom tests
+AC_LANG_C
+
+dnl check readline
+AC_CHECK_LIB([readline], [readline])
+if test $ac_cv_lib_readline_readline = yes; then
+    LDFLAGS=${LDFLAGS}" -lreadline"
+    AC_MSG_CHECKING(for rl_completion_matches function)
+    AC_LINK_IFELSE(
+    [AC_LANG_SOURCE([
+    #include <stdio.h>
+    #include <readline/readline.h>
+    #include <readline/history.h>
+    char *f(const char *a, int f) { return "a"; }
+    int main() {
+      char *text="a";
+      extern char *f(const char *, int);
+      char **matches = rl_completion_matches (text, f);
+      return 0;
+    }
+    ])],
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(COMPLETIONMATCHES), AC_MSG_RESULT(no))
+fi
+
+dnl check for 64 bit
+AC_MSG_CHECKING(for 32 or 64 bits cpu)
+AC_RUN_IFELSE(
+    [AC_LANG_SOURCE([
+    int main() { return sizeof(long)==4?1:0; }
+    ])],
+    AC_MSG_RESULT(64)
+    AC_DEFINE(_64BIT), AC_MSG_RESULT(32))
+
+dnl finish
+if test "x$enable_mpi" == "xyes"; then
+    CC=mpicc
+fi
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/src/gpl.txt b/src/gpl.txt
new file mode 100644 (file)
index 0000000..818433e
--- /dev/null
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE\r
+                       Version 3, 29 June 2007\r
+\r
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+                            Preamble\r
+\r
+  The GNU General Public License is a free, copyleft license for\r
+software and other kinds of works.\r
+\r
+  The licenses for most software and other practical works are designed\r
+to take away your freedom to share and change the works.  By contrast,\r
+the GNU General Public License is intended to guarantee your freedom to\r
+share and change all versions of a program--to make sure it remains free\r
+software for all its users.  We, the Free Software Foundation, use the\r
+GNU General Public License for most of our software; it applies also to\r
+any other work released this way by its authors.  You can apply it to\r
+your programs, too.\r
+\r
+  When we speak of free software, we are referring to freedom, not\r
+price.  Our General Public Licenses are designed to make sure that you\r
+have the freedom to distribute copies of free software (and charge for\r
+them if you wish), that you receive source code or can get it if you\r
+want it, that you can change the software or use pieces of it in new\r
+free programs, and that you know you can do these things.\r
+\r
+  To protect your rights, we need to prevent others from denying you\r
+these rights or asking you to surrender the rights.  Therefore, you have\r
+certain responsibilities if you distribute copies of the software, or if\r
+you modify it: responsibilities to respect the freedom of others.\r
+\r
+  For example, if you distribute copies of such a program, whether\r
+gratis or for a fee, you must pass on to the recipients the same\r
+freedoms that you received.  You must make sure that they, too, receive\r
+or can get the source code.  And you must show them these terms so they\r
+know their rights.\r
+\r
+  Developers that use the GNU GPL protect your rights with two steps:\r
+(1) assert copyright on the software, and (2) offer you this License\r
+giving you legal permission to copy, distribute and/or modify it.\r
+\r
+  For the developers' and authors' protection, the GPL clearly explains\r
+that there is no warranty for this free software.  For both users' and\r
+authors' sake, the GPL requires that modified versions be marked as\r
+changed, so that their problems will not be attributed erroneously to\r
+authors of previous versions.\r
+\r
+  Some devices are designed to deny users access to install or run\r
+modified versions of the software inside them, although the manufacturer\r
+can do so.  This is fundamentally incompatible with the aim of\r
+protecting users' freedom to change the software.  The systematic\r
+pattern of such abuse occurs in the area of products for individuals to\r
+use, which is precisely where it is most unacceptable.  Therefore, we\r
+have designed this version of the GPL to prohibit the practice for those\r
+products.  If such problems arise substantially in other domains, we\r
+stand ready to extend this provision to those domains in future versions\r
+of the GPL, as needed to protect the freedom of users.\r
+\r
+  Finally, every program is threatened constantly by software patents.\r
+States should not allow patents to restrict development and use of\r
+software on general-purpose computers, but in those that do, we wish to\r
+avoid the special danger that patents applied to a free program could\r
+make it effectively proprietary.  To prevent this, the GPL assures that\r
+patents cannot be used to render the program non-free.\r
+\r
+  The precise terms and conditions for copying, distribution and\r
+modification follow.\r
+\r
+                       TERMS AND CONDITIONS\r
+\r
+  0. Definitions.\r
+\r
+  "This License" refers to version 3 of the GNU General Public License.\r
+\r
+  "Copyright" also means copyright-like laws that apply to other kinds of\r
+works, such as semiconductor masks.\r
+\r
+  "The Program" refers to any copyrightable work licensed under this\r
+License.  Each licensee is addressed as "you".  "Licensees" and\r
+"recipients" may be individuals or organizations.\r
+\r
+  To "modify" a work means to copy from or adapt all or part of the work\r
+in a fashion requiring copyright permission, other than the making of an\r
+exact copy.  The resulting work is called a "modified version" of the\r
+earlier work or a work "based on" the earlier work.\r
+\r
+  A "covered work" means either the unmodified Program or a work based\r
+on the Program.\r
+\r
+  To "propagate" a work means to do anything with it that, without\r
+permission, would make you directly or secondarily liable for\r
+infringement under applicable copyright law, except executing it on a\r
+computer or modifying a private copy.  Propagation includes copying,\r
+distribution (with or without modification), making available to the\r
+public, and in some countries other activities as well.\r
+\r
+  To "convey" a work means any kind of propagation that enables other\r
+parties to make or receive copies.  Mere interaction with a user through\r
+a computer network, with no transfer of a copy, is not conveying.\r
+\r
+  An interactive user interface displays "Appropriate Legal Notices"\r
+to the extent that it includes a convenient and prominently visible\r
+feature that (1) displays an appropriate copyright notice, and (2)\r
+tells the user that there is no warranty for the work (except to the\r
+extent that warranties are provided), that licensees may convey the\r
+work under this License, and how to view a copy of this License.  If\r
+the interface presents a list of user commands or options, such as a\r
+menu, a prominent item in the list meets this criterion.\r
+\r
+  1. Source Code.\r
+\r
+  The "source code" for a work means the preferred form of the work\r
+for making modifications to it.  "Object code" means any non-source\r
+form of a work.\r
+\r
+  A "Standard Interface" means an interface that either is an official\r
+standard defined by a recognized standards body, or, in the case of\r
+interfaces specified for a particular programming language, one that\r
+is widely used among developers working in that language.\r
+\r
+  The "System Libraries" of an executable work include anything, other\r
+than the work as a whole, that (a) is included in the normal form of\r
+packaging a Major Component, but which is not part of that Major\r
+Component, and (b) serves only to enable use of the work with that\r
+Major Component, or to implement a Standard Interface for which an\r
+implementation is available to the public in source code form.  A\r
+"Major Component", in this context, means a major essential component\r
+(kernel, window system, and so on) of the specific operating system\r
+(if any) on which the executable work runs, or a compiler used to\r
+produce the work, or an object code interpreter used to run it.\r
+\r
+  The "Corresponding Source" for a work in object code form means all\r
+the source code needed to generate, install, and (for an executable\r
+work) run the object code and to modify the work, including scripts to\r
+control those activities.  However, it does not include the work's\r
+System Libraries, or general-purpose tools or generally available free\r
+programs which are used unmodified in performing those activities but\r
+which are not part of the work.  For example, Corresponding Source\r
+includes interface definition files associated with source files for\r
+the work, and the source code for shared libraries and dynamically\r
+linked subprograms that the work is specifically designed to require,\r
+such as by intimate data communication or control flow between those\r
+subprograms and other parts of the work.\r
+\r
+  The Corresponding Source need not include anything that users\r
+can regenerate automatically from other parts of the Corresponding\r
+Source.\r
+\r
+  The Corresponding Source for a work in source code form is that\r
+same work.\r
+\r
+  2. Basic Permissions.\r
+\r
+  All rights granted under this License are granted for the term of\r
+copyright on the Program, and are irrevocable provided the stated\r
+conditions are met.  This License explicitly affirms your unlimited\r
+permission to run the unmodified Program.  The output from running a\r
+covered work is covered by this License only if the output, given its\r
+content, constitutes a covered work.  This License acknowledges your\r
+rights of fair use or other equivalent, as provided by copyright law.\r
+\r
+  You may make, run and propagate covered works that you do not\r
+convey, without conditions so long as your license otherwise remains\r
+in force.  You may convey covered works to others for the sole purpose\r
+of having them make modifications exclusively for you, or provide you\r
+with facilities for running those works, provided that you comply with\r
+the terms of this License in conveying all material for which you do\r
+not control copyright.  Those thus making or running the covered works\r
+for you must do so exclusively on your behalf, under your direction\r
+and control, on terms that prohibit them from making any copies of\r
+your copyrighted material outside their relationship with you.\r
+\r
+  Conveying under any other circumstances is permitted solely under\r
+the conditions stated below.  Sublicensing is not allowed; section 10\r
+makes it unnecessary.\r
+\r
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\r
+\r
+  No covered work shall be deemed part of an effective technological\r
+measure under any applicable law fulfilling obligations under article\r
+11 of the WIPO copyright treaty adopted on 20 December 1996, or\r
+similar laws prohibiting or restricting circumvention of such\r
+measures.\r
+\r
+  When you convey a covered work, you waive any legal power to forbid\r
+circumvention of technological measures to the extent such circumvention\r
+is effected by exercising rights under this License with respect to\r
+the covered work, and you disclaim any intention to limit operation or\r
+modification of the work as a means of enforcing, against the work's\r
+users, your or third parties' legal rights to forbid circumvention of\r
+technological measures.\r
+\r
+  4. Conveying Verbatim Copies.\r
+\r
+  You may convey verbatim copies of the Program's source code as you\r
+receive it, in any medium, provided that you conspicuously and\r
+appropriately publish on each copy an appropriate copyright notice;\r
+keep intact all notices stating that this License and any\r
+non-permissive terms added in accord with section 7 apply to the code;\r
+keep intact all notices of the absence of any warranty; and give all\r
+recipients a copy of this License along with the Program.\r
+\r
+  You may charge any price or no price for each copy that you convey,\r
+and you may offer support or warranty protection for a fee.\r
+\r
+  5. Conveying Modified Source Versions.\r
+\r
+  You may convey a work based on the Program, or the modifications to\r
+produce it from the Program, in the form of source code under the\r
+terms of section 4, provided that you also meet all of these conditions:\r
+\r
+    a) The work must carry prominent notices stating that you modified\r
+    it, and giving a relevant date.\r
+\r
+    b) The work must carry prominent notices stating that it is\r
+    released under this License and any conditions added under section\r
+    7.  This requirement modifies the requirement in section 4 to\r
+    "keep intact all notices".\r
+\r
+    c) You must license the entire work, as a whole, under this\r
+    License to anyone who comes into possession of a copy.  This\r
+    License will therefore apply, along with any applicable section 7\r
+    additional terms, to the whole of the work, and all its parts,\r
+    regardless of how they are packaged.  This License gives no\r
+    permission to license the work in any other way, but it does not\r
+    invalidate such permission if you have separately received it.\r
+\r
+    d) If the work has interactive user interfaces, each must display\r
+    Appropriate Legal Notices; however, if the Program has interactive\r
+    interfaces that do not display Appropriate Legal Notices, your\r
+    work need not make them do so.\r
+\r
+  A compilation of a covered work with other separate and independent\r
+works, which are not by their nature extensions of the covered work,\r
+and which are not combined with it such as to form a larger program,\r
+in or on a volume of a storage or distribution medium, is called an\r
+"aggregate" if the compilation and its resulting copyright are not\r
+used to limit the access or legal rights of the compilation's users\r
+beyond what the individual works permit.  Inclusion of a covered work\r
+in an aggregate does not cause this License to apply to the other\r
+parts of the aggregate.\r
+\r
+  6. Conveying Non-Source Forms.\r
+\r
+  You may convey a covered work in object code form under the terms\r
+of sections 4 and 5, provided that you also convey the\r
+machine-readable Corresponding Source under the terms of this License,\r
+in one of these ways:\r
+\r
+    a) Convey the object code in, or embodied in, a physical product\r
+    (including a physical distribution medium), accompanied by the\r
+    Corresponding Source fixed on a durable physical medium\r
+    customarily used for software interchange.\r
+\r
+    b) Convey the object code in, or embodied in, a physical product\r
+    (including a physical distribution medium), accompanied by a\r
+    written offer, valid for at least three years and valid for as\r
+    long as you offer spare parts or customer support for that product\r
+    model, to give anyone who possesses the object code either (1) a\r
+    copy of the Corresponding Source for all the software in the\r
+    product that is covered by this License, on a durable physical\r
+    medium customarily used for software interchange, for a price no\r
+    more than your reasonable cost of physically performing this\r
+    conveying of source, or (2) access to copy the\r
+    Corresponding Source from a network server at no charge.\r
+\r
+    c) Convey individual copies of the object code with a copy of the\r
+    written offer to provide the Corresponding Source.  This\r
+    alternative is allowed only occasionally and noncommercially, and\r
+    only if you received the object code with such an offer, in accord\r
+    with subsection 6b.\r
+\r
+    d) Convey the object code by offering access from a designated\r
+    place (gratis or for a charge), and offer equivalent access to the\r
+    Corresponding Source in the same way through the same place at no\r
+    further charge.  You need not require recipients to copy the\r
+    Corresponding Source along with the object code.  If the place to\r
+    copy the object code is a network server, the Corresponding Source\r
+    may be on a different server (operated by you or a third party)\r
+    that supports equivalent copying facilities, provided you maintain\r
+    clear directions next to the object code saying where to find the\r
+    Corresponding Source.  Regardless of what server hosts the\r
+    Corresponding Source, you remain obligated to ensure that it is\r
+    available for as long as needed to satisfy these requirements.\r
+\r
+    e) Convey the object code using peer-to-peer transmission, provided\r
+    you inform other peers where the object code and Corresponding\r
+    Source of the work are being offered to the general public at no\r
+    charge under subsection 6d.\r
+\r
+  A separable portion of the object code, whose source code is excluded\r
+from the Corresponding Source as a System Library, need not be\r
+included in conveying the object code work.\r
+\r
+  A "User Product" is either (1) a "consumer product", which means any\r
+tangible personal property which is normally used for personal, family,\r
+or household purposes, or (2) anything designed or sold for incorporation\r
+into a dwelling.  In determining whether a product is a consumer product,\r
+doubtful cases shall be resolved in favor of coverage.  For a particular\r
+product received by a particular user, "normally used" refers to a\r
+typical or common use of that class of product, regardless of the status\r
+of the particular user or of the way in which the particular user\r
+actually uses, or expects or is expected to use, the product.  A product\r
+is a consumer product regardless of whether the product has substantial\r
+commercial, industrial or non-consumer uses, unless such uses represent\r
+the only significant mode of use of the product.\r
+\r
+  "Installation Information" for a User Product means any methods,\r
+procedures, authorization keys, or other information required to install\r
+and execute modified versions of a covered work in that User Product from\r
+a modified version of its Corresponding Source.  The information must\r
+suffice to ensure that the continued functioning of the modified object\r
+code is in no case prevented or interfered with solely because\r
+modification has been made.\r
+\r
+  If you convey an object code work under this section in, or with, or\r
+specifically for use in, a User Product, and the conveying occurs as\r
+part of a transaction in which the right of possession and use of the\r
+User Product is transferred to the recipient in perpetuity or for a\r
+fixed term (regardless of how the transaction is characterized), the\r
+Corresponding Source conveyed under this section must be accompanied\r
+by the Installation Information.  But this requirement does not apply\r
+if neither you nor any third party retains the ability to install\r
+modified object code on the User Product (for example, the work has\r
+been installed in ROM).\r
+\r
+  The requirement to provide Installation Information does not include a\r
+requirement to continue to provide support service, warranty, or updates\r
+for a work that has been modified or installed by the recipient, or for\r
+the User Product in which it has been modified or installed.  Access to a\r
+network may be denied when the modification itself materially and\r
+adversely affects the operation of the network or violates the rules and\r
+protocols for communication across the network.\r
+\r
+  Corresponding Source conveyed, and Installation Information provided,\r
+in accord with this section must be in a format that is publicly\r
+documented (and with an implementation available to the public in\r
+source code form), and must require no special password or key for\r
+unpacking, reading or copying.\r
+\r
+  7. Additional Terms.\r
+\r
+  "Additional permissions" are terms that supplement the terms of this\r
+License by making exceptions from one or more of its conditions.\r
+Additional permissions that are applicable to the entire Program shall\r
+be treated as though they were included in this License, to the extent\r
+that they are valid under applicable law.  If additional permissions\r
+apply only to part of the Program, that part may be used separately\r
+under those permissions, but the entire Program remains governed by\r
+this License without regard to the additional permissions.\r
+\r
+  When you convey a copy of a covered work, you may at your option\r
+remove any additional permissions from that copy, or from any part of\r
+it.  (Additional permissions may be written to require their own\r
+removal in certain cases when you modify the work.)  You may place\r
+additional permissions on material, added by you to a covered work,\r
+for which you have or can give appropriate copyright permission.\r
+\r
+  Notwithstanding any other provision of this License, for material you\r
+add to a covered work, you may (if authorized by the copyright holders of\r
+that material) supplement the terms of this License with terms:\r
+\r
+    a) Disclaiming warranty or limiting liability differently from the\r
+    terms of sections 15 and 16 of this License; or\r
+\r
+    b) Requiring preservation of specified reasonable legal notices or\r
+    author attributions in that material or in the Appropriate Legal\r
+    Notices displayed by works containing it; or\r
+\r
+    c) Prohibiting misrepresentation of the origin of that material, or\r
+    requiring that modified versions of such material be marked in\r
+    reasonable ways as different from the original version; or\r
+\r
+    d) Limiting the use for publicity purposes of names of licensors or\r
+    authors of the material; or\r
+\r
+    e) Declining to grant rights under trademark law for use of some\r
+    trade names, trademarks, or service marks; or\r
+\r
+    f) Requiring indemnification of licensors and authors of that\r
+    material by anyone who conveys the material (or modified versions of\r
+    it) with contractual assumptions of liability to the recipient, for\r
+    any liability that these contractual assumptions directly impose on\r
+    those licensors and authors.\r
+\r
+  All other non-permissive additional terms are considered "further\r
+restrictions" within the meaning of section 10.  If the Program as you\r
+received it, or any part of it, contains a notice stating that it is\r
+governed by this License along with a term that is a further\r
+restriction, you may remove that term.  If a license document contains\r
+a further restriction but permits relicensing or conveying under this\r
+License, you may add to a covered work material governed by the terms\r
+of that license document, provided that the further restriction does\r
+not survive such relicensing or conveying.\r
+\r
+  If you add terms to a covered work in accord with this section, you\r
+must place, in the relevant source files, a statement of the\r
+additional terms that apply to those files, or a notice indicating\r
+where to find the applicable terms.\r
+\r
+  Additional terms, permissive or non-permissive, may be stated in the\r
+form of a separately written license, or stated as exceptions;\r
+the above requirements apply either way.\r
+\r
+  8. Termination.\r
+\r
+  You may not propagate or modify a covered work except as expressly\r
+provided under this License.  Any attempt otherwise to propagate or\r
+modify it is void, and will automatically terminate your rights under\r
+this License (including any patent licenses granted under the third\r
+paragraph of section 11).\r
+\r
+  However, if you cease all violation of this License, then your\r
+license from a particular copyright holder is reinstated (a)\r
+provisionally, unless and until the copyright holder explicitly and\r
+finally terminates your license, and (b) permanently, if the copyright\r
+holder fails to notify you of the violation by some reasonable means\r
+prior to 60 days after the cessation.\r
+\r
+  Moreover, your license from a particular copyright holder is\r
+reinstated permanently if the copyright holder notifies you of the\r
+violation by some reasonable means, this is the first time you have\r
+received notice of violation of this License (for any work) from that\r
+copyright holder, and you cure the violation prior to 30 days after\r
+your receipt of the notice.\r
+\r
+  Termination of your rights under this section does not terminate the\r
+licenses of parties who have received copies or rights from you under\r
+this License.  If your rights have been terminated and not permanently\r
+reinstated, you do not qualify to receive new licenses for the same\r
+material under section 10.\r
+\r
+  9. Acceptance Not Required for Having Copies.\r
+\r
+  You are not required to accept this License in order to receive or\r
+run a copy of the Program.  Ancillary propagation of a covered work\r
+occurring solely as a consequence of using peer-to-peer transmission\r
+to receive a copy likewise does not require acceptance.  However,\r
+nothing other than this License grants you permission to propagate or\r
+modify any covered work.  These actions infringe copyright if you do\r
+not accept this License.  Therefore, by modifying or propagating a\r
+covered work, you indicate your acceptance of this License to do so.\r
+\r
+  10. Automatic Licensing of Downstream Recipients.\r
+\r
+  Each time you convey a covered work, the recipient automatically\r
+receives a license from the original licensors, to run, modify and\r
+propagate that work, subject to this License.  You are not responsible\r
+for enforcing compliance by third parties with this License.\r
+\r
+  An "entity transaction" is a transaction transferring control of an\r
+organization, or substantially all assets of one, or subdividing an\r
+organization, or merging organizations.  If propagation of a covered\r
+work results from an entity transaction, each party to that\r
+transaction who receives a copy of the work also receives whatever\r
+licenses to the work the party's predecessor in interest had or could\r
+give under the previous paragraph, plus a right to possession of the\r
+Corresponding Source of the work from the predecessor in interest, if\r
+the predecessor has it or can get it with reasonable efforts.\r
+\r
+  You may not impose any further restrictions on the exercise of the\r
+rights granted or affirmed under this License.  For example, you may\r
+not impose a license fee, royalty, or other charge for exercise of\r
+rights granted under this License, and you may not initiate litigation\r
+(including a cross-claim or counterclaim in a lawsuit) alleging that\r
+any patent claim is infringed by making, using, selling, offering for\r
+sale, or importing the Program or any portion of it.\r
+\r
+  11. Patents.\r
+\r
+  A "contributor" is a copyright holder who authorizes use under this\r
+License of the Program or a work on which the Program is based.  The\r
+work thus licensed is called the contributor's "contributor version".\r
+\r
+  A contributor's "essential patent claims" are all patent claims\r
+owned or controlled by the contributor, whether already acquired or\r
+hereafter acquired, that would be infringed by some manner, permitted\r
+by this License, of making, using, or selling its contributor version,\r
+but do not include claims that would be infringed only as a\r
+consequence of further modification of the contributor version.  For\r
+purposes of this definition, "control" includes the right to grant\r
+patent sublicenses in a manner consistent with the requirements of\r
+this License.\r
+\r
+  Each contributor grants you a non-exclusive, worldwide, royalty-free\r
+patent license under the contributor's essential patent claims, to\r
+make, use, sell, offer for sale, import and otherwise run, modify and\r
+propagate the contents of its contributor version.\r
+\r
+  In the following three paragraphs, a "patent license" is any express\r
+agreement or commitment, however denominated, not to enforce a patent\r
+(such as an express permission to practice a patent or covenant not to\r
+sue for patent infringement).  To "grant" such a patent license to a\r
+party means to make such an agreement or commitment not to enforce a\r
+patent against the party.\r
+\r
+  If you convey a covered work, knowingly relying on a patent license,\r
+and the Corresponding Source of the work is not available for anyone\r
+to copy, free of charge and under the terms of this License, through a\r
+publicly available network server or other readily accessible means,\r
+then you must either (1) cause the Corresponding Source to be so\r
+available, or (2) arrange to deprive yourself of the benefit of the\r
+patent license for this particular work, or (3) arrange, in a manner\r
+consistent with the requirements of this License, to extend the patent\r
+license to downstream recipients.  "Knowingly relying" means you have\r
+actual knowledge that, but for the patent license, your conveying the\r
+covered work in a country, or your recipient's use of the covered work\r
+in a country, would infringe one or more identifiable patents in that\r
+country that you have reason to believe are valid.\r
+\r
+  If, pursuant to or in connection with a single transaction or\r
+arrangement, you convey, or propagate by procuring conveyance of, a\r
+covered work, and grant a patent license to some of the parties\r
+receiving the covered work authorizing them to use, propagate, modify\r
+or convey a specific copy of the covered work, then the patent license\r
+you grant is automatically extended to all recipients of the covered\r
+work and works based on it.\r
+\r
+  A patent license is "discriminatory" if it does not include within\r
+the scope of its coverage, prohibits the exercise of, or is\r
+conditioned on the non-exercise of one or more of the rights that are\r
+specifically granted under this License.  You may not convey a covered\r
+work if you are a party to an arrangement with a third party that is\r
+in the business of distributing software, under which you make payment\r
+to the third party based on the extent of your activity of conveying\r
+the work, and under which the third party grants, to any of the\r
+parties who would receive the covered work from you, a discriminatory\r
+patent license (a) in connection with copies of the covered work\r
+conveyed by you (or copies made from those copies), or (b) primarily\r
+for and in connection with specific products or compilations that\r
+contain the covered work, unless you entered into that arrangement,\r
+or that patent license was granted, prior to 28 March 2007.\r
+\r
+  Nothing in this License shall be construed as excluding or limiting\r
+any implied license or other defenses to infringement that may\r
+otherwise be available to you under applicable patent law.\r
+\r
+  12. No Surrender of Others' Freedom.\r
+\r
+  If conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License.  If you cannot convey a\r
+covered work so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you may\r
+not convey it at all.  For example, if you agree to terms that obligate you\r
+to collect a royalty for further conveying from those to whom you convey\r
+the Program, the only way you could satisfy both those terms and this\r
+License would be to refrain entirely from conveying the Program.\r
+\r
+  13. Use with the GNU Affero General Public License.\r
+\r
+  Notwithstanding any other provision of this License, you have\r
+permission to link or combine any covered work with a work licensed\r
+under version 3 of the GNU Affero General Public License into a single\r
+combined work, and to convey the resulting work.  The terms of this\r
+License will continue to apply to the part which is the covered work,\r
+but the special requirements of the GNU Affero General Public License,\r
+section 13, concerning interaction through a network will apply to the\r
+combination as such.\r
+\r
+  14. Revised Versions of this License.\r
+\r
+  The Free Software Foundation may publish revised and/or new versions of\r
+the GNU General Public License from time to time.  Such new versions will\r
+be similar in spirit to the present version, but may differ in detail to\r
+address new problems or concerns.\r
+\r
+  Each version is given a distinguishing version number.  If the\r
+Program specifies that a certain numbered version of the GNU General\r
+Public License "or any later version" applies to it, you have the\r
+option of following the terms and conditions either of that numbered\r
+version or of any later version published by the Free Software\r
+Foundation.  If the Program does not specify a version number of the\r
+GNU General Public License, you may choose any version ever published\r
+by the Free Software Foundation.\r
+\r
+  If the Program specifies that a proxy can decide which future\r
+versions of the GNU General Public License can be used, that proxy's\r
+public statement of acceptance of a version permanently authorizes you\r
+to choose that version for the Program.\r
+\r
+  Later license versions may give you additional or different\r
+permissions.  However, no additional obligations are imposed on any\r
+author or copyright holder as a result of your choosing to follow a\r
+later version.\r
+\r
+  15. Disclaimer of Warranty.\r
+\r
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\r
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\r
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY\r
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\r
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\r
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\r
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
+\r
+  16. Limitation of Liability.\r
+\r
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\r
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\r
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\r
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\r
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\r
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\r
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\r
+SUCH DAMAGES.\r
+\r
+  17. Interpretation of Sections 15 and 16.\r
+\r
+  If the disclaimer of warranty and limitation of liability provided\r
+above cannot be given local legal effect according to their terms,\r
+reviewing courts shall apply local law that most closely approximates\r
+an absolute waiver of all civil liability in connection with the\r
+Program, unless a warranty or assumption of liability accompanies a\r
+copy of the Program in return for a fee.\r
+\r
+                     END OF TERMS AND CONDITIONS\r
+\r
+            How to Apply These Terms to Your New Programs\r
+\r
+  If you develop a new program, and you want it to be of the greatest\r
+possible use to the public, the best way to achieve this is to make it\r
+free software which everyone can redistribute and change under these terms.\r
+\r
+  To do so, attach the following notices to the program.  It is safest\r
+to attach them to the start of each source file to most effectively\r
+state the exclusion of warranty; and each file should have at least\r
+the "copyright" line and a pointer to where the full notice is found.\r
+\r
+    <one line to give the program's name and a brief idea of what it does.>\r
+    Copyright (C) <year>  <name of author>\r
+\r
+    This program is free software: you can redistribute it and/or modify\r
+    it under the terms of the GNU General Public License as published by\r
+    the Free Software Foundation, either version 3 of the License, or\r
+    (at your option) any later version.\r
+\r
+    This program is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+    GNU General Public License for more details.\r
+\r
+    You should have received a copy of the GNU General Public License\r
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+  If the program does terminal interaction, make it output a short\r
+notice like this when it starts in an interactive mode:\r
+\r
+    <program>  Copyright (C) <year>  <name of author>\r
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r
+    This is free software, and you are welcome to redistribute it\r
+    under certain conditions; type `show c' for details.\r
+\r
+The hypothetical commands `show w' and `show c' should show the appropriate\r
+parts of the General Public License.  Of course, your program's commands\r
+might be different; for a GUI interface, you would use an "about box".\r
+\r
+  You should also get your employer (if you work as a programmer) or school,\r
+if any, to sign a "copyright disclaimer" for the program, if necessary.\r
+For more information on this, and how to apply and follow the GNU GPL, see\r
+<http://www.gnu.org/licenses/>.\r
+\r
+  The GNU General Public License does not permit incorporating your program\r
+into proprietary programs.  If your program is a subroutine library, you\r
+may consider it more useful to permit linking proprietary applications with\r
+the library.  If this is what you want to do, use the GNU Lesser General\r
+Public License instead of this License.  But first, please read\r
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.\r
diff --git a/src/install-sh b/src/install-sh
new file mode 100644 (file)
index 0000000..aa44ce2
--- /dev/null
@@ -0,0 +1,238 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) instcmd="$cpprog"
+           shift
+           continue;;
+
+       -d) dir_arg=true
+           shift
+           continue;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           shift
+           continue;;
+
+       -o) chowncmd="$chownprog $2"
+           shift
+           shift
+           continue;;
+
+       -g) chgrpcmd="$chgrpprog $2"
+           shift
+           shift
+           continue;;
+
+       -s) stripcmd="$stripprog"
+           shift
+           continue;;
+
+       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+           shift
+           continue;;
+
+       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+           shift
+           continue;;
+
+       *)  if [ x"$src" = x ]
+           then
+               src=$1
+           else
+               # this colon is to work around a 386BSD /bin/sh bug
+               :
+               dst=$1
+           fi
+           shift
+           continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+       echo "install:  no input file specified"
+       exit 1
+else
+       true
+fi
+
+if [ x"$dir_arg" != x ]; then
+       dst=$src
+       src=""
+       
+       if [ -d $dst ]; then
+               instcmd=:
+       else
+               instcmd=mkdir
+       fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+       if [ -f $src -o -d $src ]
+       then
+               true
+       else
+               echo "install:  $src does not exist"
+               exit 1
+       fi
+       
+       if [ x"$dst" = x ]
+       then
+               echo "install:  no destination specified"
+               exit 1
+       else
+               true
+       fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+       if [ -d $dst ]
+       then
+               dst="$dst"/`basename $src`
+       else
+               true
+       fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS=''
+
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+       pathcomp="${pathcomp}${1}"
+       shift
+
+       if [ ! -d "${pathcomp}" ] ;
+        then
+               $mkdirprog "${pathcomp}"
+       else
+               true
+       fi
+
+       pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+       $doit $instcmd $dst &&
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+       if [ x"$transformarg" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               dstfile=`basename $dst $transformbasename | 
+                       sed $transformarg`$transformbasename
+       fi
+
+# don't allow the sed command to completely eliminate the filename
+
+       if [ x"$dstfile" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               true
+       fi
+
+# Make a temp file name in the proper directory.
+
+       dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+       $doit $instcmd $src $dsttmp &&
+
+       trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+       $doit $rmcmd -f $dstdir/$dstfile &&
+       $doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/src/likelihood.c b/src/likelihood.c
new file mode 100644 (file)
index 0000000..8fb631c
--- /dev/null
@@ -0,0 +1,9765 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "likelihood.h"
+#include "mbbeagle.h"
+#include "model.h"
+#include "utils.h"
+
+const char* const svnRevisionLikeliC = "$Rev: 1003 $";   /* Revision keyword which is expanded/updated by svn on each commit/update */
+
+#define LIKE_EPSILON                1.0e-300
+
+extern int      *chainId;
+extern int      numLocalChains;
+extern int      rateProbRowSize;            /* size of rate probs for one chain one state   */
+extern MrBFlt   **rateProbs;                /* pointers to rate probs used by adgamma model */
+
+/* local prototypes */
+void      CopySiteScalers (ModelInfo *m, int chain);
+void      FlipCondLikeSpace (ModelInfo *m, int chain, int nodeIndex);
+void      FlipCijkSpace (ModelInfo *m, int chain);
+void      FlipNodeScalerSpace (ModelInfo *m, int chain, int nodeIndex);
+void      FlipSiteScalerSpace (ModelInfo *m, int chain);
+void      FlipTiProbsSpace (ModelInfo *m, int chain, int nodeIndex);
+MrBFlt    GetRate (int division, int chain);
+int       RemoveNodeScalers(TreeNode *p, int division, int chain);
+int       RemoveNodeScalers_SSE(TreeNode *p, int division, int chain);
+void      ResetSiteScalers (ModelInfo *m, int chain);
+int       UpDateCijk (int whichPart, int whichChain);
+
+
+#if !defined (SSE_ENABLED) || 1
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_Bin: binary model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_Bin (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *clL, *clR, *clP, *pL, *pR, *tiPL, *tiPR;
+    ModelInfo       *m;
+    
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* Flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    tiPL = pL;
+    tiPR = pR;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            *(clP++) = (tiPL[0]*clL[0] + tiPL[1]*clL[1])
+                      *(tiPR[0]*clR[0] + tiPR[1]*clR[1]);
+            *(clP++) = (tiPL[2]*clL[0] + tiPL[3]*clL[1])
+                      *(tiPR[2]*clR[0] + tiPR[3]*clR[1]);
+
+            clL += 2;
+            clR += 2;
+            }
+        tiPL += 4;
+        tiPR += 4;
+        }
+
+    return NO_ERROR;
+    
+}
+#endif
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_Bin_SSE: binary model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_Bin_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *pL, *pR, *tiPL, *tiPR;
+    __m128          *clL, *clR, *clP;
+    __m128          m1, m2, m3, m4, m5, m6;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    tiPL = pL;
+    tiPR = pR;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        for (c=0; c<m->numSSEChars; c++)
+            {
+            m1 = _mm_load1_ps (&tiPL[0]);
+            m2 = _mm_load1_ps (&tiPR[0]);
+            m5 = _mm_mul_ps (m1, clL[0]);
+            m6 = _mm_mul_ps (m2, clR[0]);
+
+            m1 = _mm_load1_ps (&tiPL[1]);
+            m2 = _mm_load1_ps (&tiPR[1]);
+            m3 = _mm_mul_ps (m1, clL[1]);
+            m4 = _mm_mul_ps (m2, clR[1]);
+
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            *clP++ = _mm_mul_ps (m5, m6);
+
+            m1 = _mm_load1_ps (&tiPL[2]);
+            m2 = _mm_load1_ps (&tiPR[2]);
+            m5 = _mm_mul_ps (m1, clL[0]);
+            m6 = _mm_mul_ps (m2, clR[0]);
+
+            m1 = _mm_load1_ps (&tiPL[3]);
+            m2 = _mm_load1_ps (&tiPR[3]);
+            m3 = _mm_mul_ps (m1, clL[1]);
+            m4 = _mm_mul_ps (m2, clR[1]);
+
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+           
+            *clP++ = _mm_mul_ps (m5, m6);
+            clL += 2;
+            clR += 2;
+            }
+        tiPL += 4;
+        tiPR += 4;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_Gen: general n-state model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_Gen (TreeNode *p, int division, int chain)
+{
+    int             a, b, c, h, i, k, j, shortCut, *lState=NULL, *rState=NULL,
+                    nObsStates, nStates, nStatesSquared, preLikeJump;
+    CLFlt           likeL, likeR, *pL, *pR, *tiPL, *tiPR, *clL, *clR, *clP;
+    ModelInfo       *m;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int catStart;
+#   endif
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nObsStates = m->numStates;
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+    preLikeJump = nObsStates * nStates;
+
+    /* flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeL[a++] += tiPL[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeR[a++] += tiPR[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+#   endif
+    switch (shortCut)
+        {
+        case 0:
+            tiPL = pL;
+            tiPR = pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h]*clL[j];
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = likeL * likeR;
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = lState[c] + k*(preLikeJump+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = preLikeL[a++] * likeR;
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(preLikeJump+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h++]*clL[j];
+                            }
+                        *(clP++) = preLikeR[a++] * likeL;
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(preLikeJump+nStates);
+                    b = lState[c] + k*(preLikeJump+nStates);
+                    for (i=0; i<nStates; i++)
+                        {
+                        *(clP++) = preLikeR[a++] * preLikeL[b++];
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_Gen_SSE: general n-state model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_Gen_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, c1, h, i, j, k, t, shortCut, *lState=NULL, *rState=NULL, nStates, nStatesSquared, nObsStates, preLikeJump;
+    CLFlt           *pL, *pR, *tiPL, *tiPR;
+    __m128          *clL, *clR, *clP;
+    __m128          mTiPL, mTiPR, mL, mR, mAcumL, mAcumR;
+    ModelInfo       *m;
+    CLFlt           *preLikeRV[FLOATS_PER_VEC];
+    CLFlt           *preLikeLV[FLOATS_PER_VEC];
+
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int             a, b, catStart;
+#   endif
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nObsStates = m->numStates;
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+    preLikeJump = nObsStates * nStates;
+
+    /* Flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeL[a++] += tiPL[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeR[a++] += tiPR[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+#   endif
+
+    switch (shortCut)
+        {
+        case 0:
+            tiPL = pL;
+            tiPR = pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numSSEChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        mAcumL = _mm_setzero_ps();
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h]);
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumR);
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        *(clP++) = _mm_mul_ps (mAcumL,mAcumR);
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        mAcumL = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            }
+                        *(clP++) = _mm_mul_ps (mAcumL,mAcumR);
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(preLikeJump+nStates)];
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following 2 statments we assume that SSE register can hold exactly 4 ClFlts. */
+                        mL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        *(clP++) = _mm_mul_ps (mL,mR);
+                        }
+                    }
+                }
+            break;
+        }
+    return NO_ERROR;
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_Gen_GibbsGamma: general n-state model with rate
+|       variation modeled using discrete gamma with Gibbs resampling
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_Gen_GibbsGamma (TreeNode *p, int division, int chain)
+{
+    int             a, b, c, i, j, r, *rateCat, shortCut, *lState=NULL, *rState=NULL,
+                    nObsStates, nStates, nStatesSquared, nGammaCats;
+    CLFlt           likeL, likeR, *pL, *pR, *tiPL, *tiPR, *clL, *clR, *clP;
+    ModelInfo       *m;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int k, catStart;
+#   endif
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nObsStates = m->numStates;
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find rate category index and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<nGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeL[a++] += tiPL[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<nGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeR[a++] += tiPR[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+#   endif
+
+    switch (shortCut)
+        {
+        case 0:
+            for (c=0; c<m->numChars; c++)
+                {
+                r = (*rateCat++);
+                if (r < nGammaCats)
+                    {
+                    tiPL = pL + r*nStatesSquared;
+                    tiPR = pR + r*nStatesSquared;
+                    for (i=0; i<nStates; i++)
+                        {
+                        likeL = likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += (*tiPL++) * clL[j];
+                            likeR += (*tiPR++) * clR[j];
+                            }
+                        *(clP++) = likeL * likeR;
+                        }
+                    }
+                else
+                    clP += nStates;
+                clL += nStates;
+                clR += nStates;
+                }
+            break;
+        case 1:
+            for (c=0; c<m->numChars; c++)
+                {
+                r = (*rateCat++);
+                if (r < nGammaCats)
+                    {
+                    tiPR = pR + r*nStatesSquared;
+                    a = lState[c] + r*(nStatesSquared+nStates);
+                    for (i=0; i<nStates; i++)
+                        {
+                        likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += (*tiPR++)*clR[j];
+                            }
+                        *(clP++) = preLikeL[a++] * likeR;
+                        }
+                    }
+                else
+                    clP += nStates;
+                clR += nStates;
+                }
+            break;
+        case 2:
+            for (c=0; c<m->numChars; c++)
+                {
+                r = (*rateCat++);
+                if (r < nGammaCats)
+                    {
+                    tiPL = pL + r*nStatesSquared;
+                    a = rState[c] + r*(nStatesSquared+nStates);
+                    for (i=0; i<nStates; i++)
+                        {
+                        likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += (*tiPL++)*clL[j];
+                            }
+                        *(clP++) = preLikeR[a++] * likeL;
+                        }
+                    }
+                else
+                    clP += nStates;
+                clL += nStates;
+                }
+            break;
+        case 3:
+            for (c=0; c<m->numChars; c++)
+                {
+                r = (*rateCat++);
+                if (r < nGammaCats)
+                    {
+                    a = lState[c] + r*(nStatesSquared+nStates);
+                    b = rState[c] + r*(nStatesSquared+nStates);
+                    for (i=0; i<nStates; i++)
+                        *(clP++) = preLikeL[a++]*preLikeR[b++];
+                    }
+                else
+                    clP += nStates;
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_NUC4: 4by4 nucleotide model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_NUC4 (TreeNode *p, int division, int chain)
+{
+    int             c, h, i, j, k, shortCut, *lState=NULL, *rState=NULL;
+    CLFlt           *clL, *clR, *clP, *pL, *pR, *tiPL, *tiPR;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* flip space so that we do not overwrite old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=j=0; k<m->numGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeL[j++] = tiPL[0];
+                preLikeL[j++] = tiPL[4];
+                preLikeL[j++] = tiPL[8];
+                preLikeL[j++] = tiPL[12];
+                tiPL++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeL[j++] = 1.0;
+            tiPL += 12;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=j=0; k<m->numGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeR[j++] = tiPR[0];
+                preLikeR[j++] = tiPR[4];
+                preLikeR[j++] = tiPR[8];
+                preLikeR[j++] = tiPR[12];
+                tiPR++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeR[j++] = 1.0;
+            tiPR += 12;
+            }
+        }
+#   endif
+
+    switch (shortCut)
+        {
+        case 0:
+            tiPL = pL;
+            tiPR = pR;
+            for (k=h=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                                *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T]);
+                    clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                                *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T]);
+                    clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                                *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T]);
+                    clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                                *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T]);
+                    clL += 4;
+                    clR += 4;
+                    }
+                tiPL += 16;
+                tiPR += 16;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=h=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    i = lState[c] + k*20;
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T]);
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T]);
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T]);
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T]);
+                    clR += 4;
+                    }
+                tiPR += 16;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=h=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    i = rState[c] + k*20;
+                    clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                                *preLikeR[i++];
+                    clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                                *preLikeR[i++];
+                    clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                                *preLikeR[i++];
+                    clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                                *preLikeR[i++];
+                    clL += 4;
+                    }
+                tiPL += 16;
+                }
+            break;
+        case 3:
+            for (k=h=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    i = j = k*20;
+                    i += lState[c];
+                    j += rState[c];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    }
+                }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_NUC4_GibbsGamma: 4by4 nucleotide model with rate
+|       variation approximated using Gibbs sampling of gamma
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_NUC4_GibbsGamma (TreeNode *p, int division, int chain)
+{
+    int             c, h, i, j, r, *rateCat, shortCut, *lState=NULL, *rState=NULL,
+                    nGammaCats;
+    CLFlt           *clL, *clR, *clP, *pL, *pR, *tiPL, *tiPR;
+    ModelInfo       *m;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int k;
+#   endif
+    
+    m = &modelSettings[division];
+
+    /* flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find rate category index  and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=j=0; k<nGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeL[j++] = tiPL[0];
+                preLikeL[j++] = tiPL[4];
+                preLikeL[j++] = tiPL[8];
+                preLikeL[j++] = tiPL[12];
+                tiPL++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeL[j++] = 1.0;
+            tiPL += 12;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState =  m->termState[p->right->index];
+        tiPR = pR;
+        for (k=j=0; k<nGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeR[j++] = tiPR[0];
+                preLikeR[j++] = tiPR[4];
+                preLikeR[j++] = tiPR[8];
+                preLikeR[j++] = tiPR[12];
+                tiPR++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeR[j++] = 1.0;
+            tiPR += 12;
+            }
+        }
+#   endif
+
+    switch (shortCut)
+        {
+        case 0:
+            for (c=h=0; c<m->numChars; c++)
+                {
+                r = rateCat[c];
+                if (r < nGammaCats)
+                    {
+                    tiPL = pL + r * 16;
+                    tiPR = pR + r * 16;
+                    clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                                *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T]);
+                    clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                                *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T]);
+                    clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                                *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T]);
+                    clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                                *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T]);
+                    }
+                else
+                    h += 4;
+                clL += 4;
+                clR += 4;
+                }
+            break;
+        case 1:
+            for (c=h=0; c<m->numChars; c++)
+                {
+                r = rateCat[c];
+                if (r < nGammaCats)
+                    {
+                    tiPR = pR + r * 16;
+                    i = lState[c] + r * 20;
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T]);
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T]);
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T]);
+                    clP[h++] =   preLikeL[i++]
+                                *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T]);
+                    }
+                else
+                    h += 4;
+                clR += 4;
+                }
+            break;
+        case 2:
+            for (c=h=0; c<m->numChars; c++)
+                {
+                r = rateCat[c];
+                if (r < nGammaCats)
+                    {
+                    tiPL = pL + r * 16;
+                    i = rState[c] + r * 20;
+                    clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                                *preLikeR[i++];
+                    clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                                *preLikeR[i++];
+                    clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                                *preLikeR[i++];
+                    clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                                *preLikeR[i++];
+                    }
+                else
+                    h += 4;
+                clL += 4;
+                }
+            break;
+        case 3:
+            for (c=h=0; c<m->numChars; c++)
+                {
+                r = rateCat[c];
+                if (r < nGammaCats)
+                    {
+                    i = lState[c] + r * 20;
+                    j = rState[c] + r * 20;
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    clP[h++] =   preLikeL[i++]*preLikeR[j++];
+                    }
+                else
+                    h += 4;
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_NUC4_SSE: 4by4 nucleotide model with or without rate
+|       variation, using SSE instructions
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_NUC4_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *pL, *pR, *tiPL, *tiPR;
+    __m128          *clL, *clR, *clP;
+    __m128          m1, m2, m3, m4, m5, m6;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    tiPL = pL;
+    tiPR = pR;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        for (c=0; c<m->numSSEChars; c++)
+            {
+            m1 = _mm_load1_ps (&tiPL[AA]);
+            m2 = _mm_load1_ps (&tiPR[AA]);
+            m5 = _mm_mul_ps (m1, clL[A]);
+            m6 = _mm_mul_ps (m2, clR[A]);
+
+            m1 = _mm_load1_ps (&tiPL[AC]);
+            m2 = _mm_load1_ps (&tiPR[AC]);
+            m3 = _mm_mul_ps (m1, clL[C]);
+            m4 = _mm_mul_ps (m2, clR[C]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[AG]);
+            m2 = _mm_load1_ps (&tiPR[AG]);
+            m3 = _mm_mul_ps (m1, clL[G]);
+            m4 = _mm_mul_ps (m2, clR[G]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[AT]);
+            m2 = _mm_load1_ps (&tiPR[AT]);
+            m3 = _mm_mul_ps (m1, clL[T]);
+            m4 = _mm_mul_ps (m2, clR[T]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            *clP++ = _mm_mul_ps (m5, m6);
+
+            m1 = _mm_load1_ps (&tiPL[CA]);
+            m2 = _mm_load1_ps (&tiPR[CA]);
+            m5 = _mm_mul_ps (m1, clL[A]);
+            m6 = _mm_mul_ps (m2, clR[A]);
+
+            m1 = _mm_load1_ps (&tiPL[CC]);
+            m2 = _mm_load1_ps (&tiPR[CC]);
+            m3 = _mm_mul_ps (m1, clL[C]);
+            m4 = _mm_mul_ps (m2, clR[C]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[CG]);
+            m2 = _mm_load1_ps (&tiPR[CG]);
+            m3 = _mm_mul_ps (m1, clL[G]);
+            m4 = _mm_mul_ps (m2, clR[G]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[CT]);
+            m2 = _mm_load1_ps (&tiPR[CT]);
+            m3 = _mm_mul_ps (m1, clL[T]);
+            m4 = _mm_mul_ps (m2, clR[T]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            *clP++ = _mm_mul_ps (m5, m6);
+
+            m1 = _mm_load1_ps (&tiPL[GA]);
+            m2 = _mm_load1_ps (&tiPR[GA]);
+            m5 = _mm_mul_ps (m1, clL[A]);
+            m6 = _mm_mul_ps (m2, clR[A]);
+
+            m1 = _mm_load1_ps (&tiPL[GC]);
+            m2 = _mm_load1_ps (&tiPR[GC]);
+            m3 = _mm_mul_ps (m1, clL[C]);
+            m4 = _mm_mul_ps (m2, clR[C]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[GG]);
+            m2 = _mm_load1_ps (&tiPR[GG]);
+            m3 = _mm_mul_ps (m1, clL[G]);
+            m4 = _mm_mul_ps (m2, clR[G]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[GT]);
+            m2 = _mm_load1_ps (&tiPR[GT]);
+            m3 = _mm_mul_ps (m1, clL[T]);
+            m4 = _mm_mul_ps (m2, clR[T]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            *clP++ = _mm_mul_ps (m5, m6);
+
+            m1 = _mm_load1_ps (&tiPL[TA]);
+            m2 = _mm_load1_ps (&tiPR[TA]);
+            m5 = _mm_mul_ps (m1, clL[A]);
+            m6 = _mm_mul_ps (m2, clR[A]);
+
+            m1 = _mm_load1_ps (&tiPL[TC]);
+            m2 = _mm_load1_ps (&tiPR[TC]);
+            m3 = _mm_mul_ps (m1, clL[C]);
+            m4 = _mm_mul_ps (m2, clR[C]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[TG]);
+            m2 = _mm_load1_ps (&tiPR[TG]);
+            m3 = _mm_mul_ps (m1, clL[G]);
+            m4 = _mm_mul_ps (m2, clR[G]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            m1 = _mm_load1_ps (&tiPL[TT]);
+            m2 = _mm_load1_ps (&tiPR[TT]);
+            m3 = _mm_mul_ps (m1, clL[T]);
+            m4 = _mm_mul_ps (m2, clR[T]);
+            m5 = _mm_add_ps (m3, m5);
+            m6 = _mm_add_ps (m4, m6);
+
+            *clP++ = _mm_mul_ps (m5, m6);
+            clL += 4;
+            clR += 4;
+            }
+        tiPL += 16;
+        tiPR += 16;
+        }
+
+    return NO_ERROR;
+    
+}
+#endif
+
+
+#if !defined (SSE_ENABLED) || 1
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_NY98: codon model with omega variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_NY98 (TreeNode *p, int division, int chain)
+{
+    int             a, b, c, h, i, j, k, shortCut, *lState=NULL, *rState=NULL, nStates, nStatesSquared;
+    CLFlt           likeL, likeR, *pL, *pR, *tiPL, *tiPR, *clL, *clR, *clP;
+    ModelInfo       *m;
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* Flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+#   endif
+
+    switch (shortCut)
+        {
+        case 0:
+            tiPL = pL;
+            tiPR = pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h]*clL[j];
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = likeL * likeR;
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = lState[c] + k*(nStatesSquared+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = preLikeL[a++] * likeR;
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(nStatesSquared+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h++]*clL[j];
+                            }
+                        *(clP++) = preLikeR[a++] * likeL;
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(nStatesSquared+nStates);
+                    b = lState[c] + k*(nStatesSquared+nStates);
+                    for (i=0; i<nStates; i++)
+                        {
+                        *(clP++) = preLikeR[a++] * preLikeL[b++];
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_NY98_SSE: codon model with omega variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_NY98_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, c1, h, i, j, k, t, shortCut, *lState=NULL, *rState=NULL, nStates, nStatesSquared;
+    CLFlt           *pL, *pR, *tiPL, *tiPR;
+    __m128          *clL, *clR, *clP;
+    __m128          mTiPL, mTiPR, mL, mR, mAcumL, mAcumR;
+    ModelInfo       *m;
+    CLFlt           *preLikeRV[FLOATS_PER_VEC];
+    CLFlt           *preLikeLV[FLOATS_PER_VEC];
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int             a;
+#   endif
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* Flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+#   endif
+
+    switch (shortCut)
+        {
+        case 0:
+            tiPL = pL;
+            tiPR = pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numSSEChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        mAcumL = _mm_setzero_ps();
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h]);
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumR);
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        *(clP++) = _mm_mul_ps (mAcumL,mAcumR);
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        mAcumL = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            }
+                        *(clP++) = _mm_mul_ps (mAcumL,mAcumR);
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(nStatesSquared+nStates)];
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following 2 statments we assume that SSE register can hold exactly 4 ClFlts. */
+                        mL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        *(clP++) = _mm_mul_ps (mL,mR);
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeDown_Std: variable number of states model
+|       with or without rate variation
+|
+-----------------------------------------------------------------*/
+int CondLikeDown_Std (TreeNode *p, int division, int chain)
+{
+    int             a, c, h, i, j, k, nStates, nCats, tmp;
+    CLFlt           *clL, *clR, *clP, *pL, *pR, *tiPL, *tiPR, likeL, likeR;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* Flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+
+    /* Conditional likelihood space is assumed to be arranged in numGammaCats blocks of data. Each block contains all data for one gamma category.
+    Each gamma cat block consist of numChars sequences of data, each of this sequences corresponds to a character of data matrix. 
+    A sequence consists of nStates for all non-binary data, otherwise length of sequence is nStates*numBetaCats (i.e. 2*numBetaCats) */
+
+    /* calculate ancestral probabilities */
+    for (k=h=0; k<m->numGammaCats; k++)
+        {
+        /* calculate ancestral probabilities */
+        for (c=0; c<m->numChars; c++)
+            {
+            nStates = m->nStates[c];
+        
+            /* the following lines ensure that nCats is 1 unless */
+            /* the character is binary and beta categories are used  */
+            if (nStates == 2)
+                nCats = m->numBetaCats;
+            else
+                nCats = 1;
+
+            tmp = k*nStates*nStates; /* tmp contains offset to skip gamma cats that already processed*/
+            tiPL = pL + m->tiIndex[c] + tmp;
+            tiPR = pR + m->tiIndex[c] + tmp;
+            tmp = (m->numGammaCats-1)*2*2; /* tmp contains size of block of tpi matrices across all gamma cats (minus one) for single beta category. Further used only if character is binary to jump to next beta category */
+                
+            for (j=0; j<nCats;j++)
+                {
+                for (a=0; a<nStates; a++)
+                    {
+                    likeL = likeR = 0.0;
+                    for (i=0; i<nStates; i++)
+                        {
+                        likeL += *(tiPL++) * clL[i];
+                        likeR += *(tiPR++) * clR[i];
+                        }
+                    clP[h++] = likeL * likeR;
+                    }
+                clL += nStates;
+                clR += nStates;
+        
+                tiPL += tmp;
+                tiPR += tmp;
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+#if !defined (SSE_ENABLED) || 1
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_Bin: binary model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_Bin (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *clL, *clR, *clP, *clA, *pL, *pR, *pA, *tiPL, *tiPR, *tiPA;
+    ModelInfo       *m;
+
+    /* find model settings for this division */
+    m = &modelSettings[division];
+    
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    tiPL = pL;
+    tiPR = pR;
+    tiPA = pA;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            *(clP++) = (tiPL[0]*clL[0] + tiPL[1]*clL[1])
+                      *(tiPR[0]*clR[0] + tiPR[1]*clR[1])
+                      *(tiPA[0]*clA[0] + tiPA[1]*clA[1]);
+            *(clP++) = (tiPL[2]*clL[0] + tiPL[3]*clL[1])
+                      *(tiPR[2]*clR[0] + tiPR[3]*clR[1])
+                      *(tiPA[2]*clA[0] + tiPA[3]*clA[1]);
+
+            clA += 2;
+            clL += 2;
+            clR += 2;
+            }
+        tiPA += 4;
+        tiPL += 4;
+        tiPR += 4;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_Bin_SSE:binary model with or without rate
+|       variation 
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_Bin_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *pL, *pR, *pA, *tiPL, *tiPR, *tiPA;
+    __m128          *clL, *clR, *clP, *clA;
+    __m128          m1, m2, m3, m4, m5, m6, m7;
+    ModelInfo       *m;
+
+    m = &modelSettings[division];
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    tiPL = pL;
+    tiPR = pR;
+    tiPA = pA;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        for (c=0; c<m->numSSEChars; c++)
+            {
+            m1 = _mm_load1_ps (&tiPL[0]);
+            m5 = *clL++;
+            m2 = _mm_mul_ps (m1, m5);
+            m1 = _mm_load1_ps (&tiPL[2]);
+            m6 = _mm_mul_ps (m1, m5);
+
+            m1 = _mm_load1_ps (&tiPL[1]);
+            m5 = *clL++;
+            m3 = _mm_mul_ps (m1, m5);
+            m1 = _mm_load1_ps (&tiPL[3]);
+            m5 = _mm_mul_ps (m1, m5);
+
+            m4 = _mm_add_ps (m2, m3); /* in m4 we get (tiPL[0]*clL[0] + tiPL[1]*clL[1]) */
+            m6 = _mm_add_ps (m5, m6); /* in m6 we get (tiPL[2]*clL[0] + tiPL[3]*clL[1]) */
+
+            m1 = _mm_load1_ps (&tiPR[0]);
+            m5 = *clR++;
+            m2 = _mm_mul_ps (m1, m5);
+            m1 = _mm_load1_ps (&tiPR[2]);
+            m7 = _mm_mul_ps (m1, m5);
+
+            m1 = _mm_load1_ps (&tiPR[1]);
+            m5 = *clR++;
+            m3 = _mm_mul_ps (m1, m5);
+            m1 = _mm_load1_ps (&tiPR[3]);
+            m5 = _mm_mul_ps (m1, m5);
+
+            m1 = _mm_add_ps (m2, m3); /* in m1 we get (tiPR[0]*clR[0] + tiPR[1]*clR[1]) */
+            m7 = _mm_add_ps (m5, m7); /* in m7 we get (tiPR[2]*clR[0] + tiPR[3]*clR[1]) */
+
+            m4 = _mm_mul_ps (m1, m4); /* in m4 we get (tiPL[0]*clL[0] + tiPL[1]*clL[1])*(tiPR[0]*clR[0] + tiPR[1]*clR[1]) */
+            m7 = _mm_mul_ps (m6, m7); /* in m7 we get (tiPL[2]*clL[0] + tiPL[3]*clL[1])*(tiPR[2]*clR[0] + tiPR[3]*clR[1]) */
+
+            m1 = _mm_load1_ps (&tiPA[0]);
+            m5 = *clA++;
+            m2 = _mm_mul_ps (m1, m5);
+            m1 = _mm_load1_ps (&tiPA[2]);
+            m6 = _mm_mul_ps (m1, m5);
+
+            m1 = _mm_load1_ps (&tiPA[1]);
+            m5 = *clA++;
+            m3 = _mm_mul_ps (m1, m5);
+            m1 = _mm_load1_ps (&tiPA[3]);
+            m1 = _mm_mul_ps (m1, m5);
+
+            m2 = _mm_add_ps (m2, m3); /* in m1 we get (tiPA[0]*clA[0] + tiPA[1]*clA[1]) */
+            m1 = _mm_add_ps (m1, m6); /* in m1 we get (tiPA[2]*clA[0] + tiPA[3]*clA[1]) */
+
+            *clP++ = _mm_mul_ps (m2, m4);
+            *clP++ = _mm_mul_ps (m1, m7);
+
+            }
+        tiPL += 4;
+        tiPR += 4;
+        tiPA += 4;
+        }
+
+    return NO_ERROR;
+    
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_Gen: general n-state model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_Gen (TreeNode *p, int division, int chain)
+{
+    int             a, b, c, d, h, i, j, k, shortCut, *lState=NULL, *rState=NULL, *aState=NULL,
+                    nObsStates, nStates, nStatesSquared, preLikeJump;
+    CLFlt           likeL, likeR, likeA, *clL, *clR, *clP, *clA, *pL, *pR, *pA,
+                    *tiPL, *tiPR, *tiPA;
+    ModelInfo       *m;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int catStart;
+#   endif
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nObsStates = m->numStates;
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+    preLikeJump = nObsStates * nStates;
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeL[a++] += tiPL[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeR[a++] += tiPR[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeA[a++] = tiPA[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeA[a++] += tiPA[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeA[a++] = 1.0;
+            tiPA += nStatesSquared;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+
+    //shortCut = 4;
+    switch (shortCut)
+        {
+        case 4:
+            tiPL = pL;
+            tiPR = pR;
+            tiPA = pA;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = likeR = likeA = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h]*clL[j];
+                            likeR += tiPR[h]*clR[j];
+                            likeA += tiPA[h++]*clA[j];
+                            }
+                        *(clP++) = likeL * likeR * likeA;
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    clA += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                tiPA += nStatesSquared;
+                }
+            break;
+        case 0:
+            tiPR = pR;
+            tiPL = pL;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = aState[c] + k*(preLikeJump+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeR = likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += tiPR[h]*clR[j];
+                            likeL += tiPL[h++]*clL[j];
+                            }
+                        *(clP++) = preLikeA[a++] * likeR * likeL;
+                        }
+                    clR += nStates;
+                    clL += nStates;
+                    }
+                tiPR += nStatesSquared;
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = lState[c] + k*(preLikeJump+nStates);
+                    b = aState[c] + k*(preLikeJump+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = preLikeL[a++] * preLikeA[b++] * likeR;
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(preLikeJump+nStates);
+                    b = aState[c] + k*(preLikeJump+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h++]*clL[j];
+                            }
+                        *(clP++) = preLikeR[a++] * preLikeA[b++] * likeL;
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;  
+        case 3:
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(preLikeJump+nStates);
+                    b = lState[c] + k*(preLikeJump+nStates);
+                    d = aState[c] + k*(preLikeJump+nStates);
+                    for (i=0; i<nStates; i++)
+                        {
+                        *(clP++) = preLikeR[a++] * preLikeL[b++] * preLikeA[d++];
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_Gen_SSE:general n-state model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_Gen_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, c1, t, h, i, j, k, shortCut, *lState=NULL, *rState=NULL, *aState=NULL, nObsStates, preLikeJump,
+                    nStates, nStatesSquared;
+    CLFlt           *pL, *pR, *pA,
+                    *tiPL, *tiPR, *tiPA;
+    __m128          *clL, *clR, *clP, *clA;
+    __m128          mTiPL, mTiPR, mTiPA, mL, mR, mA, mAcumL, mAcumR, mAcumA;
+    ModelInfo       *m;
+    CLFlt           *preLikeRV[FLOATS_PER_VEC];
+    CLFlt           *preLikeLV[FLOATS_PER_VEC];
+    CLFlt           *preLikeAV[FLOATS_PER_VEC];
+
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int a, b, catStart;
+#   endif
+
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nObsStates = m->numStates;
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+    preLikeJump = nObsStates * nStates;
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeL[a++] += tiPL[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeR[a++] += tiPR[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=a=0; k<m->numGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeA[a++] = tiPA[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeA[a++] += tiPA[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeA[a++] = 1.0;
+            tiPA += nStatesSquared;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+
+        switch (shortCut)
+        {
+        case 4:
+            tiPL = pL;
+            tiPR = pR;
+            tiPA = pA;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=0; c<m->numSSEChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        mAcumL = _mm_setzero_ps();
+                        mAcumR = _mm_setzero_ps();
+                        mAcumA = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h]);
+                            mTiPR  = _mm_load1_ps (&tiPR[h]);
+                            mTiPA  = _mm_load1_ps (&tiPA[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mA     = _mm_mul_ps (mTiPA, clA[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            mAcumA = _mm_add_ps (mA, mAcumA);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumA);
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    clA += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                tiPA += nStatesSquared;
+                }
+            break;
+        case 0:
+            tiPL =pL;
+            tiPR =pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mAcumL = _mm_setzero_ps();
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumA);
+                        }
+                    clR += nStates;
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(preLikeJump+nStates)];
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mAcumA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumA);
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(preLikeJump+nStates)];
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        mAcumA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mAcumL = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL,mAcumA);
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(preLikeJump+nStates)];
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(preLikeJump+nStates)];
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(preLikeJump+nStates)];
+                        }
+                    for (i=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following 2 statments we assume that SSE register can hold exactly 4 ClFlts. */
+                        mL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        mA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mL = _mm_mul_ps (mL,mR);
+                        *(clP++) = _mm_mul_ps (mL,mA);
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_Gen_GibbsGamma: general n-state model with rate
+|       variation modeled using a discrete gamma distribution with
+|       Gibbs resampling of rate categories
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_Gen_GibbsGamma (TreeNode *p, int division, int chain)
+{
+    int             a, b, c, i, j, r, *rateCat, shortCut, *lState=NULL,
+                    *rState=NULL, *aState=NULL, nObsStates, nStates,
+                    nStatesSquared, nGammaCats;
+    CLFlt           likeL, likeR, likeA, *clL, *clR, *clP, *clA, *pL, *pR, *pA,
+                    *tiPL, *tiPR, *tiPA;
+    ModelInfo       *m;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int k, catStart;
+#endif
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nObsStates = m->numStates;
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find rate category index and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<nGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeL[a++] += tiPL[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<nGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeR[a++] += tiPR[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=a=0; k<nGammaCats; k++)
+            {
+            catStart = a;
+            for (i=0; i<nObsStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeA[a++] = tiPA[j];
+            for (b=1; b<nStates/nObsStates; b++)
+                {
+                a = catStart;
+                for (i=0; i<nObsStates; i++)
+                    {
+                    for (j=i+b*nObsStates; j<nStatesSquared; j+=nStates)
+                        preLikeA[a++] += tiPA[j];
+                    }
+                }
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeA[a++] = 1.0;
+            tiPA += nStatesSquared;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+
+    switch (shortCut)
+        {
+    case 4:
+        for (c=0; c<m->numChars; c++)
+            {
+            r = (*rateCat++);
+            if (r < nGammaCats)
+                {
+                tiPL = pL + r*nStatesSquared;
+                tiPR = pR + r*nStatesSquared;
+                tiPA = pA + r*nStatesSquared;
+                for (i=0; i<nStates; i++)
+                    {
+                    likeL = likeR = likeA = 0.0;
+                    for (j=0; j<nStates; j++)
+                        {
+                        likeL += (*tiPL++) * clL[j];
+                        likeR += (*tiPR++) * clR[j];
+                        likeA += (*tiPA++) * clA[j];
+                        }
+                    *(clP++) = likeL * likeR * likeA;
+                    }
+                }
+            else
+                clP += nStates;
+            clL += nStates;
+            clR += nStates;
+            clA += nStates;
+            }
+        break;
+    case 0:
+    case 3:
+        for (c=0; c<m->numChars; c++)
+            {
+            r = (*rateCat++);
+            if (r < nGammaCats)
+                {
+                tiPL = pL + r*nStatesSquared;
+                tiPR = pR + r*nStatesSquared;
+                a = aState[c] + r*(nStatesSquared+nStates);
+                for (i=0; i<nStates; i++)
+                    {
+                    likeL = likeR = 0.0;
+                    for (j=0; j<nStates; j++)
+                        {
+                        likeL += (*tiPL++) * clL[j];
+                        likeR += (*tiPR++) * clR[j];
+                        }
+                    *(clP++) = likeL * likeR * preLikeA[a++];
+                    }
+                }
+            else
+                clP += nStates;
+            clL += nStates;
+            clR += nStates;
+            }
+        break;
+    case 1:
+        for (c=0; c<m->numChars; c++)
+            {
+            r = (*rateCat++);
+            if (r < nGammaCats)
+                {
+                tiPR = pR + r*nStatesSquared;
+                a = lState[c] + r*(nStatesSquared+nStates);
+                b = aState[c] + r*(nStatesSquared+nStates);
+                for (i=0; i<nStates; i++)
+                    {
+                    likeR = 0.0;
+                    for (j=0; j<nStates; j++)
+                        {
+                        likeR += (*tiPR++) * clR[j];
+                        }
+                    *(clP++) = preLikeL[a++] * likeR * preLikeA[b++];
+                    }
+                }
+            else
+                clP += nStates;
+            clR += nStates;
+            }
+        break;
+    case 2:
+        for (c=0; c<m->numChars; c++)
+            {
+            r = (*rateCat++);
+            if (r < nGammaCats)
+                {
+                tiPL = pL + r*nStatesSquared;
+                a = rState[c] + r*(nStatesSquared+nStates);
+                b = aState[c] + r*(nStatesSquared+nStates);
+                for (i=0; i<nStates; i++)
+                    {
+                    likeL = 0.0;
+                    for (j=0; j<nStates; j++)
+                        {
+                        likeL += (*tiPL++) * clL[j];
+                        }
+                    *(clP++) = likeL * preLikeR[a++] * preLikeA[b++];
+                    }
+                }
+            else
+                clP += nStates;
+            clL += nStates;
+            }
+        break;
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_NUC4: 4by4 nucleotide model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_NUC4 (TreeNode *p, int division, int chain)
+{
+    int             a, c, h, i, j, k, shortCut, *lState=NULL, *rState=NULL, *aState=NULL;
+    CLFlt           *clL, *clR, *clP, *clA, *pL, *pR, *pA, *tiPL, *tiPR, *tiPA;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=j=0; k<m->numGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeL[j++] = tiPL[0];
+                preLikeL[j++] = tiPL[4];
+                preLikeL[j++] = tiPL[8];
+                preLikeL[j++] = tiPL[12];
+                tiPL++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeL[j++] = 1.0;
+            tiPL += 12;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=j=0; k<m->numGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeR[j++] = tiPR[0];
+                preLikeR[j++] = tiPR[4];
+                preLikeR[j++] = tiPR[8];
+                preLikeR[j++] = tiPR[12];
+                tiPR++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeR[j++] = 1.0;
+            tiPR += 12;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=j=0; k<m->numGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeA[j++] = tiPA[0];
+                preLikeA[j++] = tiPA[4];
+                preLikeA[j++] = tiPA[8];
+                preLikeA[j++] = tiPA[12];
+                tiPA++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeA[j++] = 1.0;
+            tiPA += 12;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+
+    switch (shortCut)
+        {
+    case 4:
+        tiPL = pL;
+        tiPR = pR;
+        tiPA = pA;
+        for (k=h=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                            *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T])
+                            *(tiPA[AA]*clA[A] + tiPA[AC]*clA[C] + tiPA[AG]*clA[G] + tiPA[AT]*clA[T]);
+                clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                            *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T])
+                            *(tiPA[CA]*clA[A] + tiPA[CC]*clA[C] + tiPA[CG]*clA[G] + tiPA[CT]*clA[T]);
+                clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                            *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T])
+                            *(tiPA[GA]*clA[A] + tiPA[GC]*clA[C] + tiPA[GG]*clA[G] + tiPA[GT]*clA[T]);
+                clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                            *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T])
+                            *(tiPA[TA]*clA[A] + tiPA[TC]*clA[C] + tiPA[TG]*clA[G] + tiPA[TT]*clA[T]);
+                clL += 4;
+                clR += 4;
+                clA += 4;
+                }
+            tiPL += 16;
+            tiPR += 16;
+            tiPA += 16;
+            }
+        break;
+
+    case 0:
+        tiPL = pL;
+        tiPR = pR;
+        for (k=h=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                i = aState[c] + k*20;
+                clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                            *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T])
+                            *preLikeA[i++];
+                clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                            *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T])
+                            *preLikeA[i++];
+                clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                            *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T])
+                            *preLikeA[i++];
+                clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                            *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T])
+                            *preLikeA[i++];
+                clL += 4;
+                clR += 4;
+                }
+            tiPL += 16;
+            tiPR += 16;
+            }
+        break;
+
+    case 1:
+        tiPR = pR;
+        for (k=h=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                i = lState[c] + k*20;
+                j = aState[c] + k*20;
+                clP[h++] =   (tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clP[h++] =   (tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clP[h++] =   (tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clP[h++] =   (tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clR += 4;
+                }
+            tiPR += 16;
+            }
+        break;
+
+    case 2:
+        tiPL = pL;
+        for (k=h=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                i = rState[c] + k*20;
+                j = aState[c] + k*20;
+                clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clL += 4;
+                }
+            tiPL += 16;
+            }
+        break;
+
+    case 3:
+        for (k=h=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                a = lState[c] + k*20;
+                i = rState[c] + k*20;
+                j = aState[c] + k*20;
+                clP[h++] =   preLikeL[a++]*preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   preLikeL[a++]*preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   preLikeL[a++]*preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   preLikeL[a++]*preLikeR[i++]*preLikeA[j++];
+                }
+            }
+        break;
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_NUC4_GibbsGamma: 4by4 nucleotide model with rate
+|       variation approimated by Gibbs sampling from gamma
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_NUC4_GibbsGamma (TreeNode *p, int division, int chain)
+{
+    int             c, h, i, j, r, *rateCat, shortCut, *lState=NULL, *rState=NULL, *aState=NULL,
+                    nGammaCats;
+    CLFlt           *clL, *clR, *clP, *clA, *pL, *pR, *pA, *tiPL, *tiPR, *tiPA;
+    ModelInfo       *m;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int k;
+#   endif
+    
+    m = &modelSettings[division];
+
+    /* flip conditional likelihood space */
+    FlipCondLikeSpace (m, chain, p->index);
+
+        /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find rate category index and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=j=0; k<nGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeL[j++] = tiPL[0];
+                preLikeL[j++] = tiPL[4];
+                preLikeL[j++] = tiPL[8];
+                preLikeL[j++] = tiPL[12];
+                tiPL++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeL[j++] = 1.0;
+            tiPL += 12;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=j=0; k<nGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeR[j++] = tiPR[0];
+                preLikeR[j++] = tiPR[4];
+                preLikeR[j++] = tiPR[8];
+                preLikeR[j++] = tiPR[12];
+                tiPR++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeR[j++] = 1.0;
+            tiPR += 12;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=j=0; k<nGammaCats; k++)
+            {
+            for (i=0; i<4; i++)
+                {
+                preLikeA[j++] = tiPA[0];
+                preLikeA[j++] = tiPA[4];
+                preLikeA[j++] = tiPA[8];
+                preLikeA[j++] = tiPA[12];
+                tiPA++;
+                }
+            /* for ambiguous */
+            for (i=0; i<4; i++)
+                preLikeA[j++] = 1.0;
+            tiPA += 12;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+
+    switch (shortCut)
+        {
+    case 4:
+        for (c=h=0; c<m->numChars; c++)
+            {
+            r = rateCat[c];
+            if (r < nGammaCats)
+                {
+                tiPL = pL + r * 16;
+                tiPR = pR + r * 16;
+                tiPA = pA + r * 16;
+                clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                            *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T])
+                            *(tiPA[AA]*clA[A] + tiPA[AC]*clA[C] + tiPA[AG]*clA[G] + tiPA[AT]*clA[T]);
+                clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                            *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T])
+                            *(tiPA[CA]*clA[A] + tiPA[CC]*clA[C] + tiPA[CG]*clA[G] + tiPA[CT]*clA[T]);
+                clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                            *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T])
+                            *(tiPA[GA]*clA[A] + tiPA[GC]*clA[C] + tiPA[GG]*clA[G] + tiPA[GT]*clA[T]);
+                clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                            *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T])
+                            *(tiPA[TA]*clA[A] + tiPA[TC]*clA[C] + tiPA[TG]*clA[G] + tiPA[TT]*clA[T]);
+                }
+            else
+                h += 4;
+            clL += 4;
+            clR += 4;
+            clA += 4;
+            }
+        break;
+
+    case 0:
+    case 3:
+        for (c=h=0; c<m->numChars; c++)
+            {
+            r = rateCat[c];
+            if (r < nGammaCats)
+                {
+                tiPL = pL + r * 16;
+                tiPR = pR + r * 16;
+                i = aState[c] + r * 20;
+                clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                            *(tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T])
+                            *preLikeA[i++];
+                clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                            *(tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T])
+                            *preLikeA[i++];
+                clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                            *(tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T])
+                            *preLikeA[i++];
+                clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                            *(tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T])
+                            *preLikeA[i++];
+                }
+            else
+                h += 4;
+            clL += 4;
+            clR += 4;
+            }
+        break;
+
+    case 1:
+        for (c=h=0; c<m->numChars; c++)
+            {
+            r = rateCat[c];
+            if (r < nGammaCats)
+                {
+                tiPR = pR + r * 16;
+                i = lState[c] + r * 20;
+                j = aState[c] + r * 20;
+                clP[h++] =   (tiPR[AA]*clR[A] + tiPR[AC]*clR[C] + tiPR[AG]*clR[G] + tiPR[AT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clP[h++] =   (tiPR[CA]*clR[A] + tiPR[CC]*clR[C] + tiPR[CG]*clR[G] + tiPR[CT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clP[h++] =   (tiPR[GA]*clR[A] + tiPR[GC]*clR[C] + tiPR[GG]*clR[G] + tiPR[GT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                clP[h++] =   (tiPR[TA]*clR[A] + tiPR[TC]*clR[C] + tiPR[TG]*clR[G] + tiPR[TT]*clR[T])
+                            *preLikeL[i++]*preLikeA[j++];
+                }
+            else
+                h += 4;
+            clR += 4;
+            }
+        break;
+
+    case 2:
+        for (c=h=0; c<m->numChars; c++)
+            {
+            r = rateCat[c];
+            if (r < nGammaCats)
+                {
+                tiPL = pL + r * 16;
+                i = rState[c] + r * 20;
+                j = aState[c] + r * 20;
+                clP[h++] =   (tiPL[AA]*clL[A] + tiPL[AC]*clL[C] + tiPL[AG]*clL[G] + tiPL[AT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   (tiPL[CA]*clL[A] + tiPL[CC]*clL[C] + tiPL[CG]*clL[G] + tiPL[CT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   (tiPL[GA]*clL[A] + tiPL[GC]*clL[C] + tiPL[GG]*clL[G] + tiPL[GT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                clP[h++] =   (tiPL[TA]*clL[A] + tiPL[TC]*clL[C] + tiPL[TG]*clL[G] + tiPL[TT]*clL[T])
+                            *preLikeR[i++]*preLikeA[j++];
+                }
+            else
+                h += 4;
+            clL += 4;
+            }
+        break;
+        }
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_NUC4_SSE: 4by4 nucleotide model with or without rate
+|       variation using SSE instructions
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_NUC4_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *pL, *pR, *pA, *tiPL, *tiPR, *tiPA;
+    __m128          *clL, *clR, *clP, *clA;
+    __m128          m1, m2, m3, m4, m5, m6, m7, m8, m9;
+    ModelInfo       *m;
+
+    m = &modelSettings[division];
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    tiPL = pL;
+    tiPR = pR;
+    tiPA = pA;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        for (c=0; c<m->numSSEChars; c++)
+            {
+            m1 = _mm_load1_ps (&tiPL[AA]);
+            m2 = _mm_load1_ps (&tiPR[AA]);
+            m3 = _mm_load1_ps (&tiPA[AA]);
+            m7 = _mm_mul_ps (m1, clL[A]);
+            m8 = _mm_mul_ps (m2, clR[A]);
+            m9 = _mm_mul_ps (m3, clA[A]);
+
+            m1 = _mm_load1_ps (&tiPL[AC]);
+            m2 = _mm_load1_ps (&tiPR[AC]);
+            m3 = _mm_load1_ps (&tiPA[AC]);
+            m4 = _mm_mul_ps (m1, clL[C]);
+            m5 = _mm_mul_ps (m2, clR[C]);
+            m6 = _mm_mul_ps (m3, clA[C]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[AG]);
+            m2 = _mm_load1_ps (&tiPR[AG]);
+            m3 = _mm_load1_ps (&tiPA[AG]);
+            m4 = _mm_mul_ps (m1, clL[G]);
+            m5 = _mm_mul_ps (m2, clR[G]);
+            m6 = _mm_mul_ps (m3, clA[G]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[AT]);
+            m2 = _mm_load1_ps (&tiPR[AT]);
+            m3 = _mm_load1_ps (&tiPA[AT]);
+            m4 = _mm_mul_ps (m1, clL[T]);
+            m5 = _mm_mul_ps (m2, clR[T]);
+            m6 = _mm_mul_ps (m3, clA[T]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m7 = _mm_mul_ps (m7, m8);
+            *clP++ = _mm_mul_ps (m7, m9);
+
+            m1 = _mm_load1_ps (&tiPL[CA]);
+            m2 = _mm_load1_ps (&tiPR[CA]);
+            m3 = _mm_load1_ps (&tiPA[CA]);
+            m7 = _mm_mul_ps (m1, clL[A]);
+            m8 = _mm_mul_ps (m2, clR[A]);
+            m9 = _mm_mul_ps (m3, clA[A]);
+
+            m1 = _mm_load1_ps (&tiPL[CC]);
+            m2 = _mm_load1_ps (&tiPR[CC]);
+            m3 = _mm_load1_ps (&tiPA[CC]);
+            m4 = _mm_mul_ps (m1, clL[C]);
+            m5 = _mm_mul_ps (m2, clR[C]);
+            m6 = _mm_mul_ps (m3, clA[C]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[CG]);
+            m2 = _mm_load1_ps (&tiPR[CG]);
+            m3 = _mm_load1_ps (&tiPA[CG]);
+            m4 = _mm_mul_ps (m1, clL[G]);
+            m5 = _mm_mul_ps (m2, clR[G]);
+            m6 = _mm_mul_ps (m3, clA[G]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[CT]);
+            m2 = _mm_load1_ps (&tiPR[CT]);
+            m3 = _mm_load1_ps (&tiPA[CT]);
+            m4 = _mm_mul_ps (m1, clL[T]);
+            m5 = _mm_mul_ps (m2, clR[T]);
+            m6 = _mm_mul_ps (m3, clA[T]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m7 = _mm_mul_ps (m7, m8);
+            *clP++ = _mm_mul_ps (m7, m9);
+
+            m1 = _mm_load1_ps (&tiPL[GA]);
+            m2 = _mm_load1_ps (&tiPR[GA]);
+            m3 = _mm_load1_ps (&tiPA[GA]);
+            m7 = _mm_mul_ps (m1, clL[A]);
+            m8 = _mm_mul_ps (m2, clR[A]);
+            m9 = _mm_mul_ps (m3, clA[A]);
+
+            m1 = _mm_load1_ps (&tiPL[GC]);
+            m2 = _mm_load1_ps (&tiPR[GC]);
+            m3 = _mm_load1_ps (&tiPA[GC]);
+            m4 = _mm_mul_ps (m1, clL[C]);
+            m5 = _mm_mul_ps (m2, clR[C]);
+            m6 = _mm_mul_ps (m3, clA[C]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[GG]);
+            m2 = _mm_load1_ps (&tiPR[GG]);
+            m3 = _mm_load1_ps (&tiPA[GG]);
+            m4 = _mm_mul_ps (m1, clL[G]);
+            m5 = _mm_mul_ps (m2, clR[G]);
+            m6 = _mm_mul_ps (m3, clA[G]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[GT]);
+            m2 = _mm_load1_ps (&tiPR[GT]);
+            m3 = _mm_load1_ps (&tiPA[GT]);
+            m4 = _mm_mul_ps (m1, clL[T]);
+            m5 = _mm_mul_ps (m2, clR[T]);
+            m6 = _mm_mul_ps (m3, clA[T]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m7 = _mm_mul_ps (m7, m8);
+            *clP++ = _mm_mul_ps (m7, m9);
+
+            m1 = _mm_load1_ps (&tiPL[TA]);
+            m2 = _mm_load1_ps (&tiPR[TA]);
+            m3 = _mm_load1_ps (&tiPA[TA]);
+            m7 = _mm_mul_ps (m1, clL[A]);
+            m8 = _mm_mul_ps (m2, clR[A]);
+            m9 = _mm_mul_ps (m3, clA[A]);
+
+            m1 = _mm_load1_ps (&tiPL[TC]);
+            m2 = _mm_load1_ps (&tiPR[TC]);
+            m3 = _mm_load1_ps (&tiPA[TC]);
+            m4 = _mm_mul_ps (m1, clL[C]);
+            m5 = _mm_mul_ps (m2, clR[C]);
+            m6 = _mm_mul_ps (m3, clA[C]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[TG]);
+            m2 = _mm_load1_ps (&tiPR[TG]);
+            m3 = _mm_load1_ps (&tiPA[TG]);
+            m4 = _mm_mul_ps (m1, clL[G]);
+            m5 = _mm_mul_ps (m2, clR[G]);
+            m6 = _mm_mul_ps (m3, clA[G]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m1 = _mm_load1_ps (&tiPL[TT]);
+            m2 = _mm_load1_ps (&tiPR[TT]);
+            m3 = _mm_load1_ps (&tiPA[TT]);
+            m4 = _mm_mul_ps (m1, clL[T]);
+            m5 = _mm_mul_ps (m2, clR[T]);
+            m6 = _mm_mul_ps (m3, clA[T]);
+            m7 = _mm_add_ps (m4, m7);
+            m8 = _mm_add_ps (m5, m8);
+            m9 = _mm_add_ps (m6, m9);
+
+            m7 = _mm_mul_ps (m7, m8);
+            *clP++ = _mm_mul_ps (m7, m9);
+
+            clL += 4;
+            clR += 4;
+            clA += 4;
+            }
+        tiPL += 16;
+        tiPR += 16;
+        tiPA += 16;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+#if !defined (SSE_ENABLED) || 1
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_NY98: codon model with omega variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_NY98 (TreeNode *p, int division, int chain)
+{
+    int             a, b, c, d, h, i, j, k, shortCut, *lState=NULL, *rState=NULL, *aState=NULL,
+                    nStates, nStatesSquared;
+    CLFlt           likeL, likeR, likeA, *clL, *clR, *clP, *clA, *pL, *pR, *pA,
+                    *tiPL, *tiPR, *tiPA;
+    ModelInfo       *m;
+    
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeA[a++] = tiPA[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeA[a++] = 1.0;
+            tiPA += nStatesSquared;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+
+        switch (shortCut)
+        {
+        case 4:
+            tiPL = pL;
+            tiPR = pR;
+            tiPA = pA;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = likeR = likeA = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeA += tiPA[h]*clA[j];
+                            likeL += tiPL[h]*clL[j];
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = likeL * likeR * likeA;
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    clA += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                tiPA += nStatesSquared;
+                }
+            break;
+        case 0:
+            tiPR = pR;
+            tiPL = pL;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    b = aState[c] + k*(nStatesSquared+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeR = likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += tiPR[h]*clR[j];
+                            likeL += tiPL[h++]*clL[j];
+                            }
+                        *(clP++) =  preLikeA[b++] * likeL * likeR;
+                        }
+                    clR += nStates;
+                    clL += nStates;
+                    }
+                tiPR += nStatesSquared;
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = lState[c] + k*(nStatesSquared+nStates);
+                    b = aState[c] + k*(nStatesSquared+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeR = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeR += tiPR[h++]*clR[j];
+                            }
+                        *(clP++) = preLikeL[a++] * preLikeA[b++] * likeR;
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(nStatesSquared+nStates);
+                    b = aState[c] + k*(nStatesSquared+nStates);
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        likeL = 0.0;
+                        for (j=0; j<nStates; j++)
+                            {
+                            likeL += tiPL[h++]*clL[j];
+                            }
+                        *(clP++) = preLikeR[a++] * preLikeA[b++] * likeL;
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    a = rState[c] + k*(nStatesSquared+nStates);
+                    b = lState[c] + k*(nStatesSquared+nStates);
+                    d = aState[c] + k*(nStatesSquared+nStates);
+                    for (i=0; i<nStates; i++)
+                        {
+                        *(clP++) = preLikeR[a++] * preLikeL[b++] * preLikeA[d++];
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_NY98_SSE: codon model with omega variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_NY98_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, c1, t, h, i, j, k, shortCut, *lState=NULL, *rState=NULL, *aState=NULL,
+                    nStates, nStatesSquared;
+    CLFlt           *pL, *pR, *pA,
+                    *tiPL, *tiPR, *tiPA;
+    __m128          *clL, *clR, *clP, *clA;
+    __m128          mTiPL, mTiPR, mTiPA, mL, mR, mA, mAcumL, mAcumR, mAcumA;
+    ModelInfo       *m;
+    CLFlt           *preLikeRV[FLOATS_PER_VEC];
+    CLFlt           *preLikeLV[FLOATS_PER_VEC];
+    CLFlt           *preLikeAV[FLOATS_PER_VEC];
+
+#   if !defined (DEBUG_NOSHORTCUTS)
+    int             a;
+
+#   endif
+
+    /* find model settings for this division and nStates, nStatesSquared */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* find likelihoods of site patterns for left branch if terminal */
+    shortCut = 0;
+#   if !defined (DEBUG_NOSHORTCUTS)
+    if (p->left->left == NULL && m->isPartAmbig[p->left->index] == NO)
+        {
+        shortCut |= 1;
+        lState = m->termState[p->left->index];
+        tiPL = pL;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeL[a++] = tiPL[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeL[a++] = 1.0;
+            tiPL += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for right branch if terminal */
+    if (p->right->left == NULL && m->isPartAmbig[p->right->index] == NO)
+        {
+        shortCut |= 2;
+        rState = m->termState[p->right->index];
+        tiPR = pR;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeR[a++] = tiPR[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeR[a++] = 1.0;
+            tiPR += nStatesSquared;
+            }
+        }
+
+    /* find likelihoods of site patterns for anc branch, always terminal */
+    if (m->isPartAmbig[p->anc->index] == YES)
+        {
+        shortCut = 4;
+        }
+    else 
+        {
+        aState = m->termState[p->anc->index];
+        tiPA = pA;
+        for (k=a=0; k<m->numOmegaCats; k++)
+            {
+            for (i=0; i<nStates; i++)
+                for (j=i; j<nStatesSquared; j+=nStates)
+                    preLikeA[a++] = tiPA[j];
+            /* for ambiguous */
+            for (i=0; i<nStates; i++)
+                preLikeA[a++] = 1.0;
+            tiPA += nStatesSquared;
+            }
+        }
+#   else
+    shortCut = 4;
+#   endif
+        switch (shortCut)
+        {
+        case 4:
+            tiPL = pL;
+            tiPR = pR;
+            tiPA = pA;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=0; c<m->numSSEChars; c++)
+                    {
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        mAcumL = _mm_setzero_ps();
+                        mAcumR = _mm_setzero_ps();
+                        mAcumA = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h]);
+                            mTiPR  = _mm_load1_ps (&tiPR[h]);
+                            mTiPA  = _mm_load1_ps (&tiPA[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mA     = _mm_mul_ps (mTiPA, clA[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            mAcumA = _mm_add_ps (mA, mAcumA);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumA);
+                        }
+                    clL += nStates;
+                    clR += nStates;
+                    clA += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                tiPA += nStatesSquared;
+                }
+            break;
+        case 0:
+            tiPL =pL;
+            tiPR =pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mAcumL = _mm_setzero_ps();
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumA);
+                        }
+                    clR += nStates;
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 1:
+            tiPR = pR;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(nStatesSquared+nStates)];
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mAcumA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mAcumR = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPR  = _mm_load1_ps (&tiPR[h++]);
+                            mR     = _mm_mul_ps (mTiPR, clR[j]);
+                            mAcumR = _mm_add_ps (mR, mAcumR);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL, mAcumA);
+                        }
+                    clR += nStates;
+                    }
+                tiPR += nStatesSquared;
+                }
+            break;
+        case 2:
+            tiPL = pL;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(nStatesSquared+nStates)];
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=h=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following statment we assume that SSE register can hold exactly 4 ClFlts. */
+                        mAcumR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        mAcumA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mAcumL = _mm_setzero_ps();
+                        for (j=0; j<nStates; j++)
+                            {
+                            mTiPL  = _mm_load1_ps (&tiPL[h++]);
+                            mL     = _mm_mul_ps (mTiPL, clL[j]);
+                            mAcumL = _mm_add_ps (mL, mAcumL);
+                            }
+                        mAcumL = _mm_mul_ps (mAcumL, mAcumR);
+                        *(clP++) = _mm_mul_ps (mAcumL,mAcumA);
+                        }
+                    clL += nStates;
+                    }
+                tiPL += nStatesSquared;
+                }
+            break;
+        case 3:
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                for (c=t=0; c<m->numSSEChars; c++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++,t++)
+                        {
+                        preLikeRV[c1] = &preLikeR[rState[t] + k*(nStatesSquared+nStates)];
+                        preLikeLV[c1] = &preLikeL[lState[t] + k*(nStatesSquared+nStates)];
+                        preLikeAV[c1] = &preLikeA[aState[t] + k*(nStatesSquared+nStates)];
+                        }
+                    for (i=0; i<nStates; i++)
+                        {
+                        assert (FLOATS_PER_VEC == 4); /* In the following 2 statments we assume that SSE register can hold exactly 4 ClFlts. */
+                        mL = _mm_set_ps (*(preLikeLV[3]++), *(preLikeLV[2]++), *(preLikeLV[1]++), *(preLikeLV[0]++));
+                        mR = _mm_set_ps (*(preLikeRV[3]++), *(preLikeRV[2]++), *(preLikeRV[1]++), *(preLikeRV[0]++));
+                        mA = _mm_set_ps (*(preLikeAV[3]++), *(preLikeAV[2]++), *(preLikeAV[1]++), *(preLikeAV[0]++));
+                        mL = _mm_mul_ps (mL,mR);
+                        *(clP++) = _mm_mul_ps (mL,mA);
+                        }
+                    }
+                }
+            break;
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeRoot_Std: variable number of states model
+|       with or without rate variation
+|
+-----------------------------------------------------------------*/
+int CondLikeRoot_Std (TreeNode *p, int division, int chain)
+{
+    int             a, c, h, i, j, k, nStates=0, nCats=0, tmp;
+    CLFlt           *clL, *clR, *clP, *clA, *pL, *pR, *pA, *tiPL, *tiPR, *tiPA,
+                    likeL, likeR, likeA;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* flip state of node so that we are not overwriting old cond likes */
+    FlipCondLikeSpace (m, chain, p->index);
+    
+    /* find conditional likelihood pointers */
+    clL = m->condLikes[m->condLikeIndex[chain][p->left->index ]];
+    clR = m->condLikes[m->condLikeIndex[chain][p->right->index]];
+    clP = m->condLikes[m->condLikeIndex[chain][p->index       ]];
+    clA = m->condLikes[m->condLikeIndex[chain][p->anc->index  ]];
+
+    /* find transition probabilities (or calculate instead) */
+    pL = m->tiProbs[m->tiProbsIndex[chain][p->left->index ]];
+    pR = m->tiProbs[m->tiProbsIndex[chain][p->right->index]];
+    pA = m->tiProbs[m->tiProbsIndex[chain][p->index       ]];
+
+    /* calculate ancestral probabilities */
+    for (k=h=0; k<m->numGammaCats; k++)
+        {
+        /* calculate ancestral probabilities */
+        for (c=0; c<m->numChars; c++)
+            {
+            nStates = m->nStates[c];
+        
+            /* the following lines ensure that nCats is 1 unless */
+            /* the character is binary and beta categories are used  */
+            if (nStates == 2)
+                nCats = m->numBetaCats;
+            else
+                nCats = 1;
+
+            tmp = k*nStates*nStates; /* tmp contains offset to skip gamma cats that already processed*/
+            tiPL = pL + m->tiIndex[c] + tmp;
+            tiPR = pR + m->tiIndex[c] + tmp;
+            tiPA = pA + m->tiIndex[c] + tmp;
+            tmp = (m->numGammaCats-1)*2*2; /* tmp contains size of block of tpi matrices across all gamma cats (minus one) for single beta category. Further used only if character is binary to jump to next beta category */
+                
+            for (j=0; j<nCats;j++)
+                {
+                for (a=0; a<nStates; a++)
+                    {
+                    likeL = likeR = likeA = 0.0;
+                    for (i=0; i<nStates; i++)
+                        {
+                        likeL += *(tiPL++) * clL[i];
+                        likeR += *(tiPR++) * clR[i];
+                        likeA += *(tiPA++) * clA[i];
+                        }
+                    clP[h++] = likeL * likeR * likeA;
+                    }
+                clL += nStates;
+                clR += nStates;
+                clA += nStates;
+        
+                tiPL += tmp;
+                tiPR += tmp;
+                tiPA += tmp;
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeUp_Bin: pull likelihoods up and calculate scaled
+|       finals, binary model with or without rate variation
+|
+-----------------------------------------------------------------*/
+int CondLikeUp_Bin (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *clFA, *clFP, *clDP, *tiP, condLikeUp[2], sum[2];
+    ModelInfo       *m;
+    
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    if (p->anc->anc == NULL)
+        {
+        /* this is the root node */
+        /* find conditional likelihood pointers = down cond likes */
+        /* use conditional likelihood scratch space for final cond likes */
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                *(clFP++) = *(clDP++);
+                *(clFP++) = *(clDP++);
+                }
+            }
+        }
+    else
+        {
+        /* find conditional likelihood pointers */
+        /* use conditional likelihood scratch space for final cond likes */
+        clFA = m->condLikes[m->condLikeScratchIndex[p->anc->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index     ]];
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index     ]];
+        
+        /* find transition probabilities */
+        tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                condLikeUp[0] = condLikeUp[1] = 0.0;
+                
+                sum[0] = tiP[0]*clDP[0] + tiP[1]*clDP[1];
+                sum[1] = tiP[2]*clDP[0] + tiP[3]*clDP[1];
+
+                if (sum[0] != 0.0) condLikeUp[0] = clFA[0] / sum[0];
+                if (sum[1] != 0.0) condLikeUp[1] = clFA[1] / sum[1];
+                
+                *(clFP++) = (condLikeUp[0]*tiP[0] + condLikeUp[1]*tiP[1])*clDP[0];
+                *(clFP++) = (condLikeUp[0]*tiP[2] + condLikeUp[1]*tiP[3])*clDP[1];
+                
+                clFA += 2;
+                clDP += 2;
+                }
+            tiP += 4;
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeUp_Gen: pull likelihoods up and calculate scaled
+|       finals for an interior node
+|
+-----------------------------------------------------------------*/
+int CondLikeUp_Gen (TreeNode *p, int division, int chain)
+{
+    int             a, c, i, j, k, nStates, nStatesSquared, nGammaCats;
+    CLFlt           *clFA, *clFP, *clDP, *tiP, *condLikeUp, sum;
+    ModelInfo       *m;
+    
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* find number of states in the model */
+    nStates = m->numModelStates;
+    nStatesSquared = nStates * nStates;
+
+    /* find number of gamma cats */
+    nGammaCats = m->numGammaCats;
+    if (m->gibbsGamma == YES)
+        nGammaCats = 1;
+
+    /* use preallocated scratch space */
+    condLikeUp = m->ancStateCondLikes;
+
+    /* calculate final states */
+    if (p->anc->anc == NULL)
+        {
+        /* this is the root node */
+        /* find conditional likelihood pointers = down cond likes */
+        /* use conditional likelihood scratch space for final cond likes */
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+        
+        /* final cond likes = downpass cond likes */
+        for (k=0; k<nGammaCats; k++)
+            {
+            /* copy cond likes */ 
+            for (c=0; c<m->numChars*nStates; c++)
+                *(clFP++) = *(clDP++);
+            }
+        }
+    else
+        {
+        /* find conditional likelihood pointers */
+        /* use conditional likelihood scratch space for final cond likes */
+        clFA = m->condLikes[m->condLikeScratchIndex[p->anc->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index     ]];
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index     ]];
+        
+        /* find transition probabilities */
+        tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+        
+        for (k=0; k<nGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                for (a=j=0; a<nStates; a++)
+                    {
+                    sum = 0.0;
+                    for (i=0; i<nStates; i++)
+                        sum += tiP[j++]*clDP[i];
+                    if (sum != 0.0) condLikeUp[a] = clFA[a] / sum;
+                    }
+                    
+                for (a=j=0; a<nStates; a++)
+                    {
+                    sum = 0.0;
+                    for (i=0; i<nStates; i++)
+                        {
+                        sum += condLikeUp[i] * tiP[j++];
+                        }
+                    *(clFP++) = sum * clDP[a];
+                    }
+
+                clFA += nStates;
+                clDP += nStates;
+                }
+            tiP += nStatesSquared;
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeUp_NUC4: pull likelihoods up and calculate scaled
+|       finals for an interior node
+|
+-----------------------------------------------------------------*/
+int     CondLikeUp_NUC4 (TreeNode *p, int division, int chain)
+{
+    int             c, k, nGammaCats;
+    CLFlt           *clFA, *clFP, *clDP, *tiP, condLikeUp[4], sum[4];
+    ModelInfo       *m;
+    
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* find number of gamma cats */
+    nGammaCats = m->numGammaCats;
+    if (m->gibbsGamma == YES)
+        nGammaCats = 1;
+
+    /* calculate final states */
+    if (p->anc->anc == NULL)
+        {
+        /* this is the root node */
+        /* find conditional likelihood pointers = down cond likes */
+        /* use conditional likelihood scratch space for final cond likes */
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+        
+        /* final cond likes = downpass cond likes */
+        for (k=0; k<nGammaCats; k++)
+            {
+            /* copy cond likes */ 
+            for (c=0; c<m->numChars; c++)
+                {
+                *(clFP++) = *(clDP++);
+                *(clFP++) = *(clDP++);
+                *(clFP++) = *(clDP++);
+                *(clFP++) = *(clDP++);
+                }
+            }
+        }
+    else
+        {
+        /* find conditional likelihood pointers */
+        /* use conditional likelihood scratch space for final cond likes */
+        clFA = m->condLikes[m->condLikeScratchIndex[p->anc->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index     ]];
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index     ]];
+        
+        /* find transition probabilities */
+        tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+        
+        for (k=0; k<nGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                condLikeUp[A] = condLikeUp[C] = condLikeUp[G] = condLikeUp[T] = 0.0;
+
+                sum[A] = (tiP[AA]*clDP[A] + tiP[AC]*clDP[C] + tiP[AG]*clDP[G] + tiP[AT]*clDP[T]);
+                sum[C] = (tiP[CA]*clDP[A] + tiP[CC]*clDP[C] + tiP[CG]*clDP[G] + tiP[CT]*clDP[T]);
+                sum[G] = (tiP[GA]*clDP[A] + tiP[GC]*clDP[C] + tiP[GG]*clDP[G] + tiP[GT]*clDP[T]);
+                sum[T] = (tiP[TA]*clDP[A] + tiP[TC]*clDP[C] + tiP[TG]*clDP[G] + tiP[TT]*clDP[T]);
+
+                if (sum[A] != 0.0) condLikeUp[A] = clFA[A] / sum[A];
+                if (sum[C] != 0.0) condLikeUp[C] = clFA[C] / sum[C];
+                if (sum[G] != 0.0) condLikeUp[G] = clFA[G] / sum[G];
+                if (sum[T] != 0.0) condLikeUp[T] = clFA[T] / sum[T];
+
+/*
+                clFP[A] = (condLikeUp[A]*tiP[AA] + condLikeUp[C]*tiP[CA] + condLikeUp[G]*tiP[GA] + condLikeUp[T]*tiP[TA])*clDP[A];
+                clFP[C] = (condLikeUp[A]*tiP[AC] + condLikeUp[C]*tiP[CC] + condLikeUp[G]*tiP[GC] + condLikeUp[T]*tiP[TC])*clDP[C];
+                clFP[G] = (condLikeUp[A]*tiP[AG] + condLikeUp[C]*tiP[CG] + condLikeUp[G]*tiP[GG] + condLikeUp[T]*tiP[TG])*clDP[G];
+                clFP[T] = (condLikeUp[A]*tiP[AT] + condLikeUp[C]*tiP[CT] + condLikeUp[G]*tiP[GT] + condLikeUp[T]*tiP[TT])*clDP[T];
+*/
+
+                clFP[A] = (condLikeUp[A]*tiP[AA] + condLikeUp[C]*tiP[AC] + condLikeUp[G]*tiP[AG] + condLikeUp[T]*tiP[AT])*clDP[A];
+                clFP[C] = (condLikeUp[A]*tiP[CA] + condLikeUp[C]*tiP[CC] + condLikeUp[G]*tiP[CG] + condLikeUp[T]*tiP[CT])*clDP[C];
+                clFP[G] = (condLikeUp[A]*tiP[GA] + condLikeUp[C]*tiP[GC] + condLikeUp[G]*tiP[GG] + condLikeUp[T]*tiP[GT])*clDP[G];
+                clFP[T] = (condLikeUp[A]*tiP[TA] + condLikeUp[C]*tiP[TC] + condLikeUp[G]*tiP[TG] + condLikeUp[T]*tiP[TT])*clDP[T];
+
+                clFA += 4;
+                clFP += 4;
+                clDP += 4;
+                }
+            tiP += 16;
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeUp_Std: pull likelihoods up and calculate scaled
+|       finals for an interior node
+|
+-----------------------------------------------------------------*/
+int     CondLikeUp_Std (TreeNode *p, int division, int chain)
+{
+    int             a, c, i, j, k, t, nStates, nCats, coppySize,tmp;
+    CLFlt           *clFA, *clFP, *clDP, *pA, *tiP, condLikeUp[10], sum;
+    ModelInfo       *m;
+    
+    /* find model settings for this division */
+    m = &modelSettings[division];
+    
+    /* calculate final states */
+    if (p->anc->anc == NULL)
+        {
+        /* this is the root node */
+        /* find conditional likelihood pointers = down cond likes */
+        /* use conditional likelihood scratch space for final cond likes */
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+        
+        coppySize=0;
+        /* final cond likes = downpass cond likes */
+        for (c=0; c<m->numChars; c++)
+            {
+            /* calculate nStates and nCats */
+            nStates = m->nStates[c];
+            
+            /* the following lines ensure that nCats is 1 unless */
+            /* the character is binary and beta categories are used  */
+            if (nStates == 2)
+                nCats = m->numBetaCats;
+            else
+                nCats = 1;
+
+            coppySize+=nCats*nStates;
+            }
+
+        /* finally multiply with the gamma cats */
+        coppySize *= m->numGammaCats;
+
+        /* copy cond likes */ 
+        for (k=0; k<coppySize; k++)
+            *(clFP++) = *(clDP++);
+        }
+    else
+        {
+        /* find conditional likelihood pointers */
+        /* use conditional likelihood scratch space for final cond likes */
+        clFA = m->condLikes[m->condLikeScratchIndex[p->anc->index]];
+        clFP = m->condLikes[m->condLikeScratchIndex[p->index     ]];
+        clDP = m->condLikes[m->condLikeIndex[chain][p->index     ]];
+
+        /* find transition probabilities */
+        pA = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+        
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+
+                /* calculate nStates and nCats */
+                nStates = m->nStates[c];
+                
+                /* the following lines ensure that nCats is 1 unless */
+                /* the character is binary and beta categories are used  */
+                if (nStates == 2)
+                    nCats = m->numBetaCats;
+                else
+                    nCats = 1;
+
+                tmp = k*nStates*nStates; /* tmp contains offset to skip gamma cats that already processed*/
+                tiP = pA + m->tiIndex[c] + tmp;
+                tmp = (m->numGammaCats-1)*2*2; /* tmp contains size of block of tpi matrices across all gamma cats (minus one) for single beta category. Further used only if character is binary to jump to next beta category */
+
+                /* finally multiply with the gamma cats */
+                //nCats *= m->numGammaCats;
+
+                /* now calculate the final cond likes */
+                for (t=0; t<nCats; t++)
+                    {
+                    for (a=j=0; a<nStates; a++)
+                        {
+                        sum = 0.0;
+                        for (i=0; i<nStates; i++)
+                            sum += tiP[j++]*clDP[i];
+                        if (sum == 0.0)
+                            condLikeUp[a] = 0.0;    /* we lost the conditional likelihood in the downpass (can occur in gamma model) */
+                        else
+                            condLikeUp[a] = clFA[a] / sum;
+                        }
+                        
+                    for (a=j=0; a<nStates; a++)
+                        {
+                        sum = 0.0;
+                        for (i=0; i<nStates; i++)
+                            {
+                            sum += condLikeUp[i] * tiP[j++];
+                            }
+                        clFP[a] = sum * clDP[a];
+                        }
+
+                    clFP += nStates;
+                    clFA += nStates;
+                    clDP += nStates;
+                    tiP += tmp;
+                    }
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_Gen: general n-state model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_Gen (TreeNode *p, int division, int chain)
+{
+    int             c, k, n, nStates;
+    CLFlt           scaler, **clP, *clPtr, *scP, *lnScaler;
+    ModelInfo       *m;
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    assert (p->scalerNode == YES);
+
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale */
+    for (c=0; c<m->numChars; c++)
+        {
+        scaler = 0.0;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                if (clP[k][n] > scaler)
+                    scaler = clP[k][n];
+                }
+            }
+
+#   if defined (FAST_LOG)
+        frexp (scaler, &index);
+        index = 1-index;
+        scaler = scalerValue[index];
+#   endif
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                clP[k][n] /= scaler;
+            clP[k] += n;
+            }
+
+#   if defined (FAST_LOG)
+        scP[c]       = logValue[index];         /* store node scaler */
+        lnScaler[c] += scP[c];              /* add into tree scaler  */
+#   else
+        scP[c]       = (CLFlt) log (scaler);    /* store node scaler */
+        lnScaler[c] += scP[c];  /* add into tree scaler  */
+#   endif
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+
+    return (NO_ERROR);
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_Gen_SSE: general n-state model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_Gen_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k, n, nStates;
+    CLFlt           *scP, *lnScaler;
+    __m128          *clPtr, **clP, m1;
+    ModelInfo       *m;
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP_SSE;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * m->numModelStates;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+    //scP_SSE = (__m128 *) scP;
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale */
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        //scaler = 0.0;
+        m1 = _mm_setzero_ps ();
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                m1 = _mm_max_ps (m1, clP[k][n]);
+                }
+            }
+        _mm_store_ps (scP,  m1);
+        scP += FLOATS_PER_VEC;
+
+#   if defined (FAST_LOG)
+        frexp (scaler, &index);
+        index = 1-index;
+        scaler = scalerValue[index];
+#   endif
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                *clP[k] = _mm_div_ps (*clP[k], m1);
+                clP[k]++;
+                }
+            }
+        }
+    
+    /* Reset scP to original position*/
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+    for (c=0; c<m->numChars; c++)
+        {
+#   if defined (FAST_LOG)
+        scP[c]       = logValue[index];         /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   else
+        scP[c]       = (CLFlt) log (scP[c]);    /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   endif
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+
+    return (NO_ERROR);
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_Gen_GibbsGamma: general n-state model with Gibbs
+|       sampling of rate categories in discrete gamma
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_Gen_GibbsGamma (TreeNode *p, int division, int chain)
+{
+    int             c, i, j, n, nStates, *rateCat, nGammaCats;
+    CLFlt           scaler, *clP, *scP, *lnScaler;
+    ModelInfo       *m;
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    assert (p->scalerNode ==  YES);
+
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+
+    /* flip node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* find rate category index and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* scale */
+    i = j = 0;
+    for (c=0; c<m->numChars; c++)
+        {
+        if (rateCat[c] < nGammaCats)
+            {
+            scaler = 0.0;
+            for (n=0; n<nStates; n++)
+                {
+                if (clP[i] > scaler)
+                    scaler = clP[i];
+                i++;
+                }
+
+#   if defined (FAST_LOG)
+            frexp (scaler, &index);
+            index = 1-index;
+            scaler = scalerValue[index];
+#   endif
+
+            for (n=0; n<nStates; n++)
+                clP[j++] /= scaler;
+
+#   if defined (FAST_LOG)
+            scP[c]       = logValue[index];         /* store node scaler */
+            lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   else
+            scP[c]       = (CLFlt) log (scaler);    /* store node scaler */
+            lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   endif
+
+            }
+        else
+            {
+            scP[c] = 0.0;
+            /* no need to add it to the lnScaler */
+            i += nStates;
+            j += nStates;
+            }
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_NUC4: 4by4 nucleotide model with or without rate
+|       variation
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_NUC4 (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           scaler, *scP, *lnScaler, *clPtr, **clP;
+    ModelInfo       *m;
+    
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    m = &modelSettings[division];
+    assert (p->scalerNode == YES);
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale values */
+    for (c=0; c<m->numChars; c++)
+        {
+        scaler = 0.0;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            if (clP[k][A] > scaler)
+                scaler = clP[k][A];
+            if (clP[k][C] > scaler)
+                scaler = clP[k][C];
+            if (clP[k][G] > scaler)
+                scaler = clP[k][G];
+            if (clP[k][T] > scaler)
+                scaler = clP[k][T];
+            }
+
+#   if defined (FAST_LOG)
+        frexp (scaler, &index);
+        index = 1-index;
+        scaler = scalerValue[index];
+#   endif
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            clP[k][A] /= scaler;
+            clP[k][C] /= scaler;
+            clP[k][G] /= scaler;
+            clP[k][T] /= scaler;
+            clP[k] += 4;
+            }
+
+#   if defined (FAST_LOG)
+        scP[c]       = logValue[index];     /* store node scaler */
+        lnScaler[c] += scP[c];              /* add into tree scaler  */
+#   else
+        scP[c]       = (CLFlt) log(scaler); /* store node scaler */
+        lnScaler[c] += scP[c];  /* add into tree scaler  */
+#   endif
+        }
+
+    m->scalersSet[chain][p->index] = YES;   /* set flag marking scalers set */
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_NUC4_SSE: 4by4 nucleotide model with or without rate
+|       variation using SSE code
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_NUC4_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k;
+    CLFlt           *scP, *lnScaler;
+    __m128          *clPtr, **clP, *scP_SSE, m1;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+    assert (p->scalerNode == YES);
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP_SSE;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * m->numModelStates;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+    scP_SSE = (__m128 *) scP;
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale */
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        m1 = _mm_setzero_ps ();
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            m1 = _mm_max_ps (m1, clP[k][A]);
+            m1 = _mm_max_ps (m1, clP[k][C]);
+            m1 = _mm_max_ps (m1, clP[k][G]);
+            m1 = _mm_max_ps (m1, clP[k][T]);
+            }
+
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            *clP[k] = _mm_div_ps (*clP[k], m1);
+            clP[k]++;
+            *clP[k] = _mm_div_ps (*clP[k], m1);
+            clP[k]++;
+            *clP[k] = _mm_div_ps (*clP[k], m1);
+            clP[k]++;
+            *clP[k] = _mm_div_ps (*clP[k], m1);
+            clP[k]++;
+            }
+
+        (*scP_SSE++) = m1;
+        }
+
+    /* update site scalers */
+    for (c=0; c<m->numChars; c++)
+        lnScaler[c] += (scP[c] = (CLFlt)(log (scP[c])));    /* add log of new scaler into tree scaler  */
+
+    m->scalersSet[chain][p->index] = YES;   /* set flag marking scalers set */
+
+    return NO_ERROR;
+    
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_NUC4_GibbsGamma: 4by4 nucleotide model with rate
+|       variation approximated by Gibbs sampling from gamma
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_NUC4_GibbsGamma (TreeNode *p, int division, int chain)
+{
+    int             c, i, j, nGammaCats, *rateCat;
+    CLFlt           scaler, *clP, *scP, *lnScaler;
+    ModelInfo       *m;
+    
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    assert (p->scalerNode == YES);
+
+    m = &modelSettings[division];
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* find rate category index and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* scale */
+    i = j = 0;
+    for (c=0; c<m->numChars; c++)
+        {
+        if (rateCat[c] < nGammaCats)
+            {
+            scaler = 0.0;
+            if (clP[i] > scaler)
+                scaler = clP[i];
+            i++;
+            if (clP[i] > scaler)
+                scaler = clP[i];
+            i++;
+            if (clP[i] > scaler)
+                scaler = clP[i];
+            i++;
+            if (clP[i] > scaler)
+                scaler = clP[i];
+            i++;
+
+#   if defined (FAST_LOG)
+            frexp (scaler, &index);
+            index = 1-index;
+            scaler = scalerValue[index];
+#   endif
+
+            clP[j++] /= scaler;
+            clP[j++] /= scaler;
+            clP[j++] /= scaler;
+            clP[j++] /= scaler;
+
+#   if defined (FAST_LOG)
+            scP[c]       = logValue[index];         /* store node scaler */
+            lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   else
+            scP[c]       = (CLFlt) log (scaler);    /* store node scaler */
+            lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   endif
+            }
+        else
+            {
+            scP[c] = 0.0;   /* store node scaler */
+            /* no need to add it to the lnScaler */
+            i += 4;
+            j += 4;
+            }
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+
+    return NO_ERROR;
+}
+
+
+#if !defined (SSE_ENABLED) || 1
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_NY98: codon model with omega variation
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_NY98 (TreeNode *p, int division, int chain)
+{
+    int             c, k, n, nStates;
+    CLFlt           scaler, **clP, *clPtr, *scP, *lnScaler;
+    ModelInfo       *m;
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP;
+    for (k=0; k<m->numOmegaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale */
+    for (c=0; c<m->numChars; c++)
+        {
+        scaler = 0.0;
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                if (clP[k][n] > scaler)
+                    scaler = clP[k][n];
+                }
+            }
+
+#   if defined (FAST_LOG)
+        frexp (scaler, &index);
+        index = 1-index;
+        scaler = scalerValue[index];
+#   endif
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                clP[k][n] /= scaler;
+                }
+            clP[k] += n;
+            }
+
+#   if defined (FAST_LOG)
+        scP[c]       = logValue[index];         /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   else
+        scP[c]       = (CLFlt) log (scaler);    /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   endif
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+
+    return (NO_ERROR);
+}
+#endif
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_NY98_SSE: codon model with omega variation
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_NY98_SSE (TreeNode *p, int division, int chain)
+{
+    int             c, k, n, nStates;
+    CLFlt           *scP, *lnScaler;
+    __m128          *clPtr, **clP, m1;
+    ModelInfo       *m;
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP_SSE;
+    for (k=0; k<m->numOmegaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * m->numModelStates;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+    //scP_SSE = (__m128 *) scP;
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale */
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        //scaler = 0.0;
+        m1 = _mm_setzero_ps ();
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                m1 = _mm_max_ps (m1, clP[k][n]);
+                }
+            }
+        _mm_store_ps (scP,  m1);
+        scP += FLOATS_PER_VEC;
+
+#   if defined (FAST_LOG)
+        frexp (scaler, &index);
+        index = 1-index;
+        scaler = scalerValue[index];
+#   endif
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                *clP[k] = _mm_div_ps (*clP[k], m1);
+                clP[k]++;
+                }
+            }
+        }
+    
+    /* Reset scP to original position*/
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+    for (c=0; c<m->numChars; c++)
+        {
+#   if defined (FAST_LOG)
+        scP[c]       = logValue[index];         /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   else
+        scP[c]       = (CLFlt) log (scP[c]);    /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   endif
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+
+    return (NO_ERROR);
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   CondLikeScaler_Std: variable states model with or without
+|       rate variation
+|
+-----------------------------------------------------------------*/
+int CondLikeScaler_Std (TreeNode *p, int division, int chain)
+{
+    int             c, n, k, nStates, numReps;
+    CLFlt           scaler, *clPtr, **clP, *scP, *lnScaler;
+    ModelInfo       *m;
+#   if defined (FAST_LOG)
+    int             index;
+#   endif
+
+    assert (p->scalerNode == YES);
+
+    m = &modelSettings[division];
+
+    numReps=0;
+    for (c=0; c<m->numChars; c++)
+        {
+        if (m->nStates[c] == 2)
+            numReps += m->numBetaCats * 2;
+        else
+            numReps += m->nStates[c];
+        }
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += numReps;
+        }
+    
+    /* find node scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* rescale */
+    for (c=0; c<m->numChars; c++)
+        {
+        scaler = 0.0;
+        nStates = m->nStates[c];
+        if (nStates == 2)
+            nStates = m->numBetaCats * 2;
+
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                {
+                if (clP[k][n] > scaler)
+                    scaler = clP[k][n];
+                }
+            }
+
+#   if defined (FAST_LOG)
+        frexp (scaler, &index);
+        index = 1-index;
+        scaler = scalerValue[index];
+#   endif
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            for (n=0; n<nStates; n++)
+                clP[k][n] /= scaler;
+            clP[k] += nStates;
+            }
+
+#   if defined (FAST_LOG)
+        scP[c]       = logValue[index];         /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   else
+        scP[c]       = (CLFlt) log (scaler);    /* store node scaler */
+        lnScaler[c] += scP[c];                  /* add into tree scaler  */
+#   endif
+        }
+
+    m->scalersSet[chain][p->index] = YES;
+        
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Adgamma: all n-state models with autocorrelated
+|        discrete gamma rate variation, NOT morph, restriction,
+|        codon or doublet models; just fill in rateProbs
+|
+-------------------------------------------------------------------*/
+int Likelihood_Adgamma (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, j, k, i, nStates, nStatesDiv2;
+    MrBFlt          *bs, *swr, s01, s10, probOn, probOff, covBF[40];
+    MrBFlt          like, *rP;
+    CLFlt           *clP;
+    ModelInfo       *m;
+    
+    /* NOTE: whichSitePats offsets numSitesOfPat by whichSitePats X numCompressedChars.
+       This is done so we can use the character reweighting scheme for "heating" chains. This was easy to
+       accomplish for all of the models except this one, which doesn't use numSitesOfPat when calculating
+       likelihoods. Either we disallow autocorrelated rates when using MCMC with character reweighting, or
+       we properly calculate likelihoods when some site patterns have increased or decreased weight. For
+       now, we do not allow MCMCMC with character reweighting with this HMM; we bail out in the function
+       FillNumSitesOfPat if we have Adgamma rate variation and reweighting. */
+    k = whichSitePats;
+    
+    /* find model settings */
+    m = &modelSettings[division];
+    
+    /* get the number of states */
+    nStates = m->numModelStates;
+    nStatesDiv2 = nStates / 2;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+
+    /* find pointer to rate probabilities */
+    rP = rateProbs[chain] + state[chain] * rateProbRowSize + m->rateProbStart;
+
+    /* loop over characters and calculate rate probs */
+    if (m->switchRates != NULL)
+        {
+        swr = GetParamVals (m->switchRates, chain, state[chain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        probOff =  1.0 - probOn;
+        for (j=0; j<nStatesDiv2; j++)
+            {
+            covBF[j] = bs[j] * probOn;
+            covBF[j+nStatesDiv2] = bs[j] * probOff;
+            }
+        bs = covBF;
+        }
+
+    for (c=i=0; c<m->numChars; c++)
+        {
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            like =  0.0;
+            for (j=0; j<nStates; j++)
+                like += (*(clP++)) *  bs[j];
+            rP[i++] = like;
+            }
+        }
+
+    /* reset lnL, likelihood calculated later for this model */
+    *lnL =  0.0;
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Gen: general n-state models with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_Gen (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, j, k, nStates, hasPInvar;
+    MrBFlt          s01, s10, probOn, probOff, *swr;
+    MrBFlt          covBF[40], freq, *bs, like, likeI, pInvar=0.0, lnLike;
+    CLFlt           *clPtr, **clP, *lnScaler, *nSitesOfPat, *clInvar=NULL;
+    ModelInfo       *m;
+    
+    /* find model settings and nStates, pInvar, invar cond likes */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    if (m->pInvar == NULL)
+        {
+        hasPInvar = NO;
+        }
+    else
+        {
+        hasPInvar = YES;
+        pInvar =  *(GetParamVals (m->pInvar, chain, state[chain]));
+        clInvar = m->invCondLikes;
+        }
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* if covarion model, adjust base frequencies */
+    if (m->switchRates != NULL)
+        {
+        /* find the stationary frequencies */
+        swr = GetParamVals(m->switchRates, chain, state[chain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        probOff =  1.0 - probOn;
+
+        /* now adjust the base frequencies; on-state stored first in cond likes */
+        for (j=0; j<nStates/2; j++)
+            {
+            covBF[j] = bs[j] * probOn;
+            covBF[j+nStates/2] = bs[j] * probOff;
+            }
+
+        /* finally set bs pointer to adjusted values */
+        bs = covBF;
+        }
+
+    /* find category frequencies */
+    if (hasPInvar == NO)
+        freq =  1.0 /  m->numGammaCats;
+    else
+        freq = (1.0 - pInvar) /  m->numGammaCats;
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* loop over characters */
+    if (hasPInvar == NO)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            like = 0.0;
+            for (k=0; k<m->numGammaCats; k++)
+                for (j=0; j<nStates; j++)
+                    {
+                    like += (*(clP[k]++)) * bs[j];
+#   ifdef DEBUG_LIKELIHOOD
+                    // printf ("char=%d cat=%d j=%d like %E\n",c, k,j,like);
+#   endif
+                    }
+            like *= freq;
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+                }
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=0; c<m->numChars; c++)
+            {
+            likeI = like = 0.0;
+            for (k=0; k<m->numGammaCats; k++)
+                for (j=0; j<nStates; j++)
+                    {
+                    like += (*(clP[k]++)) * bs[j];
+                    }
+            like *= freq;
+            for (j=0; j<nStates; j++)
+                likeI += (*(clInvar++)) * bs[j] * pInvar;
+            if (lnScaler[c] < -200.0)
+                {
+                /* we are not going to be able to exponentiate the scaling factor */
+                if (likeI > 1E-70)
+                    {
+                    /* forget about like; it is going to be insignificant compared to likeI */
+                    lnLike = log(likeI);
+                    }
+                else
+                    {
+                    /* treat likeI as if 0.0, that is, ignore it completely */
+                    lnLike = log(like) + lnScaler[c];
+                    }
+                }
+            else
+                lnLike = log (like + (likeI / exp (lnScaler[c]))) + lnScaler[c];
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += lnLike * nSitesOfPat[c];
+                }
+            }       
+        }
+        
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+//#   if 0
+//CLFlt DeleteME[1000];
+//int PrintOld_SSE (TreeNode *p, int division, int chain){
+//
+//    int             c, c1, j, k, nStates;
+//    //MrBFlt            *swr, likeI, pInvar=0.0, lnLike;
+//    CLFlt           *temp_vector;
+//    __m128          *clPtr, **clP;
+//    ModelInfo       *m;
+//
+//    m = &modelSettings[division];
+//    nStates = m->numModelStates;
+//    /* find conditional likelihood pointers */
+//
+//    temp_vector =  DeleteME;
+//
+//    clPtr = (__m128 *) (m->condLikes[m->condLikeIndex[chain][p->index]]);
+//    clP = m->clP_SSE;
+//    for (k=0; k<m->numGammaCats; k++)
+//        {
+//        clP[k] = clPtr;
+//        clPtr += m->numSSEChars * m->numModelStates;
+//        }
+//
+//    for (c=0; c<m->numChars; c++)
+//        {
+//        c1 = c / FLOATS_PER_VEC;
+//        for (k=0; k<m->numGammaCats; k++)
+//            {
+//            for (j=0; j<nStates; j++)
+//                {
+//                *temp_vector++ = *(((CLFlt*)&clP[k][c1*nStates+j])+c % FLOATS_PER_VEC);
+//                }
+//            }
+//        }
+//    temp_vector=DeleteME;
+//
+//    return 1;
+//}
+//#   endif
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Gen_SSE: general n-state model with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_Gen_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{   
+    int             c, j, k, nStates, hasPInvar;
+    MrBFlt          like, *bs;
+    MrBFlt          s01, s10, probOn, probOff, *swr, covBF[40], freq, likeI, pInvar=0.0, lnLike;
+    CLFlt           *lnScaler, *nSitesOfPat, *lnL_SSE, *lnLI_SSE;
+    __m128          *clPtr, **clP, *clInvar=NULL;
+    __m128          m1, mCatLike, mLike, mFreq;
+    ModelInfo       *m;
+
+    /* find model settings and nStates, pInvar, invar cond likes */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    if (m->pInvar == NULL)
+        {
+        hasPInvar = NO;
+        }
+    else
+        {
+        hasPInvar = YES;
+        pInvar =  *(GetParamVals (m->pInvar, chain, state[chain]));
+        clInvar = (__m128 *) (m->invCondLikes);
+        }
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) (m->condLikes[m->condLikeIndex[chain][p->index]]);
+    clP = m->clP_SSE;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * m->numModelStates;
+        }
+    lnL_SSE  = m->lnL_SSE;
+    lnLI_SSE = m->lnLI_SSE;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* if covarion model, adjust base frequencies */
+    if (m->switchRates != NULL)
+        {
+        /* find the stationary frequencies */
+        swr = GetParamVals(m->switchRates, chain, state[chain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        probOff =  1.0 - probOn;
+
+        /* now adjust the base frequencies; on-state stored first in cond likes */
+        for (j=0; j<nStates/2; j++)
+            {
+            covBF[j] = bs[j] * probOn;
+            covBF[j+nStates/2] = bs[j] * probOff;
+            }
+
+        /* finally set bs pointer to adjusted values */
+        bs = covBF;
+        }
+
+    /* find category frequencies */
+    if (hasPInvar == NO)
+        freq =  1.0 /  m->numGammaCats;
+    else
+        freq = (1.0 - pInvar) /  m->numGammaCats;
+
+    mFreq = _mm_set1_ps ((CLFlt)(freq));
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* reset lnL */
+    *lnL = 0.0;
+
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        mLike = _mm_setzero_ps ();
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            mCatLike = _mm_setzero_ps ();
+            for (j=0; j<nStates; j++)
+                {
+                m1 = _mm_mul_ps (clP[k][j], _mm_set1_ps ((CLFlt)bs[j]));
+                mCatLike = _mm_add_ps (mCatLike, m1);
+                }
+            m1 = _mm_mul_ps (mCatLike, mFreq);
+            mLike = _mm_add_ps (mLike, m1);
+            clP[k] += nStates;
+            }
+        _mm_store_ps (lnL_SSE, mLike);
+        lnL_SSE += FLOATS_PER_VEC;
+        }
+
+    /* loop over characters */
+    if (hasPInvar == NO)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            like = m->lnL_SSE[c];
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+                }
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=0; c<m->numSSEChars; c++)
+            {
+            mCatLike = _mm_setzero_ps ();
+            for (j=0; j<nStates; j++)
+                {
+                m1 = _mm_mul_ps (clInvar[j], _mm_set1_ps ((CLFlt)bs[j]));
+                mCatLike = _mm_add_ps (mCatLike, m1);
+                }
+            clInvar += nStates;
+            _mm_store_ps (lnL_SSE, mCatLike);
+            lnLI_SSE += FLOATS_PER_VEC;
+            }
+
+        for (c=0; c<m->numChars; c++)
+            {
+            like  = m->lnL_SSE[c];
+            likeI = m->lnLI_SSE[c];
+            if (lnScaler[c] < -200.0)
+                {
+                /* we are not going to be able to exponentiate the scaling factor */
+                if (likeI > 1E-70)
+                    {
+                    /* forget about like; it is going to be insignificant compared to likeI */
+                    lnLike = log(likeI);
+                    }
+                else
+                    {
+                    /* treat likeI as if 0.0, that is, ignore it completely */
+                    lnLike = log(like) + lnScaler[c];
+                    }
+                }
+            else
+                lnLike = log (like + (likeI / exp (lnScaler[c]))) + lnScaler[c];
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += lnLike * nSitesOfPat[c];
+                }
+            }       
+        }
+        
+    return NO_ERROR;
+    
+}
+#endif
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Gen_GibbsGamma: general n-state models using
+|       Gibbs resampling of discrete gamma rate categories
+|
+-------------------------------------------------------------------*/
+int Likelihood_Gen_GibbsGamma (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, j, nStates, nGammaCats, *rateCat;
+    MrBFlt          s01, s10, probOn, probOff, *swr;
+    MrBFlt          covBF[40], *bs, like;
+    CLFlt           *clP, *lnScaler, *nSitesOfPat, *clInvar=NULL;
+    ModelInfo       *m;
+    
+    /* find model settings, nStates and invar cond likes */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    clInvar = m->invCondLikes;
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* if covarion model, adjust base frequencies */
+    if (m->switchRates != NULL)
+        {
+        /* find the stationary frequencies */
+        swr = GetParamVals(m->switchRates, chain, state[chain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        probOff =  1.0 - probOn;
+
+        /* now adjust the base frequencies; on-state stored first in cond likes */
+        for (j=0; j<nStates/2; j++)
+            {
+            covBF[j] = bs[j] * probOn;
+            covBF[j+nStates/2] = bs[j] * probOff;
+            }
+
+        /* finally set bs pointer to adjusted values */
+        bs = covBF;
+        }
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* find rate category index and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* loop over characters */
+    if (m->pInvar == NULL)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            like = 0.0;
+            for (j=0; j<nStates; j++)
+                {
+                like += (*(clP++)) * bs[j];
+#   ifdef DEBUG_LIKELIHOOD
+                // printf ("char=%d cat=%d j=%d like %E\n",c, k,j,like);
+#   endif
+                }
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+                }
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=0; c<m->numChars; c++)
+            {
+            like = 0.0;
+            if (rateCat[c] < nGammaCats)
+                {
+                for (j=0; j<nStates; j++)
+                    like += (*(clP++)) * bs[j];
+                clInvar += nStates;
+                }
+            else
+                {
+                for (j=0; j<nStates; j++)
+                    like += (*(clInvar++)) * bs[j];
+                clP += nStates;
+                }
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (log(like) + lnScaler[c]) * nSitesOfPat[c];
+                }
+            }       
+        }
+        
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_NUC4: 4by4 nucleotide models with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_NUC4 (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, k, hasPInvar;
+    MrBFlt          freq, likeI, *bs, like, pInvar=0.0;
+    CLFlt           *clPtr, **clP, *lnScaler, *nSitesOfPat, *clInvar=NULL;
+    ModelInfo       *m;
+
+#   if defined (FAST_LOG)
+    int             index;
+    MrBFlt          likeAdjust = 1.0, f;
+#   endif
+
+    /* find model settings and pInvar, invar cond likes */
+    m = &modelSettings[division];
+    if (m->pInvar == NULL)
+        {
+        hasPInvar = NO;
+        }
+    else
+        {
+        hasPInvar = YES;
+        pInvar =  *(GetParamVals (m->pInvar, chain, state[chain]));
+        clInvar = m->invCondLikes;
+        }
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* find category frequencies */
+    if (hasPInvar == NO)
+        freq =  1.0 /  m->numGammaCats;
+    else
+        freq =  (1.0 - pInvar) /  m->numGammaCats;
+
+    /* find tree scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* loop over characters */
+    if (hasPInvar == NO)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            like = 0.0;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                like += (clP[k][A] * bs[A] + clP[k][C] * bs[C] + clP[k][G] * bs[G] + clP[k][T] * bs[T]);
+                clP[k] += 4;
+                }
+            like *= freq;
+            
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+#   if defined (FAST_LOG)
+                f = frexp (like, &index);
+                index = 1-index;
+                (*lnL) += (lnScaler[c] +  logValue[index]) * nSitesOfPat[c];                
+                for (k=0; k<(int)nSitesOfPat[c]; k++)
+                    likeAdjust *= f;
+#   else
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+#   endif
+                }
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=0; c<m->numChars; c++)
+            {
+            like = 0.0;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                like += (clP[k][A] * bs[A] + clP[k][C] * bs[C] + clP[k][G] * bs[G] + clP[k][T] * bs[T]);
+                clP[k] += 4;
+                }
+            like *= freq;
+            likeI = (clInvar[A] * bs[A] + clInvar[C] * bs[C] + clInvar[G] * bs[G] + clInvar[T] * bs[T]) * pInvar;
+            if (lnScaler[c] < -200)
+                {
+                /* we are not going to be able to exponentiate the scaling factor */
+                if (likeI > 1E-70)
+                    {
+                    /* forget about like; it is going to be insignificant compared to likeI */
+                    like = likeI;
+                    }
+                else
+                    {
+                    /* treat likeI as if 0.0, that is, ignore it completely */
+                    }
+                }
+            else
+                like = like + (likeI / exp (lnScaler[c]));
+
+            clInvar += 4;
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+#   if defined (FAST_LOG)
+                f = frexp (like, &index);
+                index = 1-index;
+                (*lnL) += (lnScaler[c] +  logValue[index]) * nSitesOfPat[c];                
+                for (k=0; k<(int)nSitesOfPat[c]; k++)
+                    likeAdjust *= f;
+#   else
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+#   endif
+                }
+            }       
+        }
+        
+#   if defined (FAST_LOG)
+    (*lnL) += log (likeAdjust);
+#   endif
+
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_NUC4_GibbsGamma: 4by4 nucleotide models with rate
+|       variation using Gibbs sampling from gamma rate categories
+|
+-------------------------------------------------------------------*/
+int Likelihood_NUC4_GibbsGamma (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, i, r, nGammaCats, *rateCat;
+    MrBFlt          *bs, like;
+    CLFlt           *clP, *lnScaler, *nSitesOfPat, *clInvar;
+    ModelInfo       *m;
+
+#   if defined (FAST_LOG)
+    int             k, index;
+    MrBFlt          likeAdjust = 1.0, f;
+#   endif
+
+    /* find model settings and invar cond likes */
+    m = &modelSettings[division];
+    clInvar = m->invCondLikes;
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* find tree scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* find rate category index  and number of gamma categories */
+    rateCat = m->tiIndex + chain * m->numChars;
+    nGammaCats = m->numGammaCats;
+
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* loop over characters */
+    if (m->pInvar == NULL)
+        {
+        for (c=i=0; c<m->numChars; c++)
+            {
+            like = (clP[A] * bs[A] + clP[C] * bs[C] + clP[G] * bs[G] + clP[T] * bs[T]);
+            clP += 4;
+            
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+#   if defined (FAST_LOG)
+                f = frexp (like, &index);
+                index = 1-index;
+                (*lnL) += (lnScaler[c] +  logValue[index]) * nSitesOfPat[c];                
+                for (k=0; k<(int)nSitesOfPat[c]; k++)
+                    likeAdjust *= f;
+#   else
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+#   endif
+                }
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=i=0; c<m->numChars; c++)
+            {
+            r = rateCat[c];
+            if (r < nGammaCats)
+                like = (clP[A] * bs[A] + clP[C] * bs[C] + clP[G] * bs[G] + clP[T] * bs[T]);
+            else
+                like = (clInvar[A] * bs[A] + clInvar[C] * bs[C] + clInvar[G] * bs[G] + clInvar[T] * bs[T]);
+            clInvar += 4;
+            clP += 4;
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (log (like) + lnScaler[c]) * nSitesOfPat[c];
+                }
+            }       
+        }
+        
+#   if defined (FAST_LOG)
+    (*lnL) += log (likeAdjust);
+#   endif
+
+    return NO_ERROR;
+}
+
+
+//#if defined (SSE_ENABLED)
+///*------------------------------------------------------------------
+// |
+// | Likelihood_NUC4_GibbsGamma: 4by4 nucleotide models with rate
+// |     variation using Gibbs sampling from gamma rate categories
+// |
+// -------------------------------------------------------------------*/
+//int Likelihood_NUC4_GibbsGamma_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+//{
+//    int             c, i, r, nGammaCats, *rateCat;
+//    MrBFlt          *bs, like;
+//    CLFlt           *lnScaler, *nSitesOfPat, *lnL_SSE, *lnLI_SSE;
+//    __m128          *clP, *clInvar=NULL;
+//    __m128          m1, mA, mC, mG, mT, mFreq, mPInvar, mLike;
+//    ModelInfo       *m;
+//    
+//#if defined (FAST_LOG)
+//    int             k, index;
+//    MrBFlt          likeAdjust = 1.0, f;
+//#endif
+//    
+//    /* find model settings and invar cond likes */
+//    m = &modelSettings[division];
+//    clInvar = (__m128 *)m->invCondLikes;
+//    /* find conditional likelihood pointer */
+//    clP = (__m128 *)m->condLikes[m->condLikeIndex[chain][p->index]];
+//    
+//    lnL_SSE  = m->lnL_SSE;
+//    lnLI_SSE = m->lnLI_SSE;
+//    
+//    /* find base frequencies */
+//    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+//    
+//    /* find tree scaler */
+//    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+//    
+//    /* find nSitesOfPat */
+//    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+//    
+//    /* find rate category index  and number of gamma categories */
+//    rateCat = m->tiIndex + chain * m->numChars;
+//    nGammaCats = m->numGammaCats;
+//    
+//    /* reset lnL */
+//    *lnL = 0.0;
+//    
+//    /* calculate variable likelihood */
+//    for (c=0; c<m->numSSEChars; c++)
+//    {
+//        mLike = _mm_mul_ps (clP[A], mA);
+//        m1    = _mm_mul_ps (clP[C], mC);
+//        mLike = _mm_add_ps (mLike, m1);
+//        m1    = _mm_mul_ps (clP[G], mG);
+//        mLike = _mm_add_ps (mLike, m1);
+//        m1    = _mm_mul_ps (clP[T], mT);
+//        mLike = _mm_add_ps (mLike, m1);
+//        
+//        clP += 4;
+//        _mm_store_ps (lnL_SSE, mLike);
+//        lnL_SSE += FLOATS_PER_VEC;
+//    }
+//    
+//    /* calculate invariable likelihood */
+//    if (hasPInvar == YES)
+//    {
+//        for (c=0; c<m->numSSEChars; c++)
+//        {
+//            mLike = _mm_mul_ps (clInvar[A], mA);
+//            m1    = _mm_mul_ps (clInvar[C], mC);
+//            mLike = _mm_add_ps (mLike, m1);
+//            m1    = _mm_mul_ps (clInvar[G], mG);
+//            mLike = _mm_add_ps (mLike, m1);
+//            m1    = _mm_mul_ps (clInvar[T], mT);
+//            mLike = _mm_add_ps (mLike, m1);
+//            mLike = _mm_mul_ps (mLike, mPInvar);
+//            
+//            _mm_store_ps (lnLI_SSE, mLike);
+//            clInvar += 4;
+//            lnLI_SSE += FLOATS_PER_VEC;
+//        }
+//    }
+//    
+//    
+//    /* loop over characters */
+//    if (m->pInvar == NULL)
+//    {
+//        for (c=i=0; c<m->numChars; c++)
+//        {
+//            like = m->lnL_SSE[c];
+//            /* check against LIKE_EPSILON (values close to zero are problematic) */
+//            if (like < LIKE_EPSILON)
+//            {
+//                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30lf\n", spacer, division, c, like);
+//                (*lnL) = MRBFLT_NEG_MAX;
+//                return ERROR;
+//            }
+//            else
+//            {
+//#if defined (FAST_LOG)
+//                f = frexp (like, &index);
+//                index = 1-index;
+//                (*lnL) += (lnScaler[c] +  logValue[index]) * nSitesOfPat[c];
+//                for (k=0; k<(int)nSitesOfPat[c]; k++)
+//                    likeAdjust *= f;
+//#else
+//                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+//#endif
+//            }
+//        }
+//    }
+//    else
+//    {
+//        /* has invariable category */
+//        for (c=i=0; c<m->numChars; c++)
+//        {
+//            r = rateCat[c];
+//            if (r < nGammaCats)
+//                like = m->lnL_SSE[c];
+//            else
+//                like = m->lnLI_SSE[c];
+//            
+//            /* check against LIKE_EPSILON (values close to zero are problematic) */
+//            if (like < LIKE_EPSILON)
+//            {
+//                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30lf\n", spacer, division, c, like);
+//                (*lnL) = MRBFLT_NEG_MAX;
+//                return ERROR;
+//            }
+//            else
+//            {
+//                (*lnL) += (log (like) + lnScaler[c]) * nSitesOfPat[c];
+//            }
+//        }       
+//    }
+//    
+//#if defined (FAST_LOG)
+//    (*lnL) += log (likeAdjust);
+//#endif
+//    
+//    return NO_ERROR;
+//}
+//#endif
+
+
+#if defined (SSE_ENABLED)
+/*------------------------------------------------------------------
+|
+|   Likelihood_NUC4_SSE: 4by4 nucleotide models with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_NUC4_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, k, hasPInvar;
+    MrBFlt          freq, *bs, pInvar=0.0, like, likeI;
+    CLFlt           *lnScaler, *nSitesOfPat, *lnL_SSE, *lnLI_SSE;
+    __m128          *clPtr, **clP, *clInvar=NULL;
+    __m128          m1, mA, mC, mG, mT, mFreq, mPInvar=_mm_set1_ps(0.0f), mLike;
+    ModelInfo       *m;
+
+#   if defined (FAST_LOG)
+    int             index;
+    MrBFlt          likeAdjust = 1.0, f;
+#   endif
+
+    /* find model settings and pInvar, invar cond likes */
+    m = &modelSettings[division];
+    if (m->pInvar == NULL)
+        {
+        hasPInvar = NO;
+        }
+    else
+        {
+        hasPInvar = YES;
+        pInvar =  *(GetParamVals (m->pInvar, chain, state[chain]));
+        mPInvar = _mm_set1_ps ((CLFlt)(pInvar));
+        clInvar = (__m128 *) (m->invCondLikes);
+        }
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) (m->condLikes[m->condLikeIndex[chain][p->index]]);
+    clP = m->clP_SSE;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * m->numModelStates;
+        }
+    lnL_SSE  = m->lnL_SSE;
+    lnLI_SSE = m->lnLI_SSE;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    mA = _mm_set1_ps ((CLFlt)(bs[A]));
+    mC = _mm_set1_ps ((CLFlt)(bs[C]));
+    mG = _mm_set1_ps ((CLFlt)(bs[G]));
+    mT = _mm_set1_ps ((CLFlt)(bs[T]));
+
+    /* find category frequencies */
+    if (hasPInvar == NO)
+        freq =  1.0 / m->numGammaCats;
+    else
+        freq =  (1.0 - pInvar) / m->numGammaCats;
+    mFreq = _mm_set1_ps ((CLFlt)(freq));
+
+    /* find tree scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* calculate variable likelihood */
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        mLike = _mm_setzero_ps ();
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            m1    = _mm_mul_ps (clP[k][A], mA);
+            mLike = _mm_add_ps (mLike, m1);
+            m1    = _mm_mul_ps (clP[k][C], mC);
+            mLike = _mm_add_ps (mLike, m1);
+            m1    = _mm_mul_ps (clP[k][G], mG);
+            mLike = _mm_add_ps (mLike, m1);
+            m1    = _mm_mul_ps (clP[k][T], mT);
+            mLike = _mm_add_ps (mLike, m1);
+            clP[k] += 4;
+            }
+        mLike = _mm_mul_ps (mLike, mFreq);
+        _mm_store_ps (lnL_SSE, mLike);
+        lnL_SSE += FLOATS_PER_VEC;
+        }
+    
+    /* calculate invariable likelihood */
+    if (hasPInvar == YES)
+        {
+        for (c=0; c<m->numSSEChars; c++)
+            {
+            mLike = _mm_mul_ps (clInvar[A], mA);
+            m1    = _mm_mul_ps (clInvar[C], mC);
+            mLike = _mm_add_ps (mLike, m1);
+            m1    = _mm_mul_ps (clInvar[G], mG);
+            mLike = _mm_add_ps (mLike, m1);
+            m1    = _mm_mul_ps (clInvar[T], mT);
+            mLike = _mm_add_ps (mLike, m1);
+            mLike = _mm_mul_ps (mLike, mPInvar);
+
+            _mm_store_ps (lnLI_SSE, mLike);
+            clInvar += 4;
+            lnLI_SSE += FLOATS_PER_VEC;
+            }
+        }
+
+    /* accumulate results */
+    if (hasPInvar == NO)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            like = m->lnL_SSE[c];
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+#   if defined (FAST_LOG)
+                f = frexp (like, &index);
+                index = 1-index;
+                (*lnL) += (lnScaler[c] +  logValue[index]) * nSitesOfPat[c];                
+                for (k=0; k<(int)nSitesOfPat[c]; k++)
+                    likeAdjust *= f;
+#   else
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+#   endif
+                }
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=0; c<m->numChars; c++)
+            {
+            like  = m->lnL_SSE[c];
+            likeI = m->lnLI_SSE[c];
+            if (lnScaler[c] < -200)
+                {
+                /* we are not going to be able to exponentiate the scaling factor */
+                if (likeI > 1E-70)
+                    {
+                    /* forget about like; it is going to be insignificant compared to likeI */
+                    like = likeI;
+                    }
+                else
+                    {
+                    /* treat likeI as if 0.0, that is, ignore it completely */
+                    }
+                }
+            else
+                like = like + (likeI / exp (lnScaler[c]));
+
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+#   if defined (FAST_LOG)
+                f = frexp (like, &index);
+                index = 1-index;
+                (*lnL) += (lnScaler[c] +  logValue[index]) * nSitesOfPat[c];                
+                for (k=0; k<(int)nSitesOfPat[c]; k++)
+                    likeAdjust *= f;
+#   else
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+#   endif
+                }
+            }
+        }
+
+#   if defined (FAST_LOG)
+    (*lnL) += log (likeAdjust);
+#   endif
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_NY98: Codon model with three selection categories,
+|       after Nielsen and Yang (1998).
+|
+-------------------------------------------------------------------*/
+int Likelihood_NY98 (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, j, k, nStates;
+    MrBFlt          catLike, like, *bs, *omegaCatFreq;
+    CLFlt           **clP,*clPtr, *lnScaler, *nSitesOfPat;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* number of states */
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP;
+    for (k=0; k<m->numOmegaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+    
+    /* find codon frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find category frequencies */
+    omegaCatFreq = GetParamSubVals (m->omega, chain, state[chain]);
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    *lnL = 0.0; /* reset lnL */
+
+    for (c=m->numDummyChars; c<m->numChars; c++)
+        {
+        like = 0.0;
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            catLike = 0.0;
+            for (j=0; j<nStates; j++)
+                catLike += clP[k][j] * bs[j];
+            like += catLike * omegaCatFreq[k];
+            clP[k] += nStates;
+            }
+        /* check against LIKE_EPSILON (values close to zero are problematic) */
+        if (like < LIKE_EPSILON)
+            {
+#   ifdef DEBUG_LIKELIHOOD
+            MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+            (*lnL) = MRBFLT_NEG_MAX;
+            abortMove = YES;
+            return ERROR;
+            }
+        else
+            {
+            (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*------------------------------------------------------------------
+|
+|   Likelihood_NY98_SSE: Codon model with three selection categories,
+|       after Nielsen and Yang (1998).
+|
+-------------------------------------------------------------------*/
+int Likelihood_NY98_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, j, k, nStates;
+    MrBFlt          like, *bs, *omegaCatFreq;
+    CLFlt           *lnScaler, *nSitesOfPat, *lnL_SSE;
+    __m128          *clPtr, **clP;
+    __m128          m1, mCatLike, mLike;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* number of states */
+    nStates = m->numModelStates;
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP_SSE;
+    for (k=0; k<m->numOmegaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * nStates;
+        }
+    
+    /* find codon frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find category frequencies */
+    omegaCatFreq = GetParamSubVals (m->omega, chain, state[chain]);
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    *lnL = 0.0; /* reset lnL */
+
+    lnL_SSE  = m->lnL_SSE;
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        mLike = _mm_setzero_ps ();
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            mCatLike = _mm_setzero_ps ();
+            for (j=0; j<nStates; j++)
+                {
+                m1 = _mm_mul_ps (clP[k][j], _mm_set1_ps ((CLFlt)bs[j]));
+                mCatLike = _mm_add_ps (mCatLike, m1);
+                }
+            m1 = _mm_mul_ps (mCatLike, _mm_set1_ps ((CLFlt)omegaCatFreq[k]));
+            mLike = _mm_add_ps (mLike, m1);
+            clP[k] += nStates;
+            }
+        _mm_store_ps (lnL_SSE, mLike);
+        lnL_SSE += FLOATS_PER_VEC;
+        }
+    for (c=m->numDummyChars; c<m->numChars; c++)
+        {
+        like = m->lnL_SSE[c];
+        /* check against LIKE_EPSILON (values close to zero are problematic) */
+        if (like < LIKE_EPSILON)
+            {
+#   ifdef DEBUG_LIKELIHOOD
+            MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+            (*lnL) = MRBFLT_NEG_MAX;
+            abortMove = YES;
+            return ERROR;
+            }
+        else    
+            {
+            (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+            }
+        }
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Res: restriction site model with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_Res (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, k;
+    MrBFlt          *bs, freq, like, pUnobserved, pObserved;
+    CLFlt           *clPtr, **clP, *lnScaler, *nSitesOfPat;
+    ModelInfo       *m;
+
+    
+    m = &modelSettings[division];
+
+    /* find conditional likelihood pointer */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numChars * m->numModelStates;
+        }
+
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* find category frequencies */
+    freq =  1.0 /  m->numGammaCats;
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    *lnL = 0.0; /* reset lnL */
+
+    pUnobserved = 0.0;
+    for (c=0; c<m->numDummyChars; c++)
+        {
+        like = 0.0;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            like += (clP[k][0]*bs[0] + clP[k][1]*bs[1]) * freq;
+            clP[k] += 2;
+            }
+        pUnobserved += like *  exp(lnScaler[c]);
+        }
+
+    pObserved =  1.0 - pUnobserved;
+    if (pObserved < LIKE_EPSILON)
+        {
+#   ifdef DEBUG_LIKELIHOOD
+        MrBayesPrint ("%s   WARNING: p(Observed) < LIKE_EPSILON - for division %d p(Observed) = %1.30le\n", spacer, division+1, pObserved);
+#   endif
+        (*lnL) = MRBFLT_NEG_MAX;
+        abortMove = YES;
+        return ERROR;
+        }
+
+    for (c=m->numDummyChars; c<m->numChars; c++)
+        {
+        like = 0.0;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            like += (clP[k][0]*bs[0] + clP[k][1]*bs[1]) * freq;
+            clP[k] += 2;
+            }
+        /* check against LIKE_EPSILON (values close to zero are problematic) */
+        if (like < LIKE_EPSILON)
+            {
+#   ifdef DEBUG_LIKELIHOOD
+            MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+            (*lnL) = MRBFLT_NEG_MAX;
+            abortMove = YES;
+            return ERROR;
+            }
+        else    
+            {
+            (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+            }
+        }
+
+    /* correct for absent characters */
+    (*lnL) -=  log(pObserved) * (m->numUncompressedChars);
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*------------------------------------------------------------------
+|
+|   Likelihood_Res_SSE: 4by4 nucleotide models with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_Res_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, k;
+    MrBFlt          freq, *bs, like, pUnobserved, pObserved;
+    CLFlt           *lnScaler, *nSitesOfPat, *lnL_SSE;
+    __m128          *clPtr, **clP;
+    __m128          m1, mA, mB, mFreq, mLike;
+    ModelInfo       *m;
+
+    /* find model settings and pInvar, invar cond likes */
+    m = &modelSettings[division];
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) (m->condLikes[m->condLikeIndex[chain][p->index]]);
+    clP = m->clP_SSE;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * m->numModelStates;
+        }
+    lnL_SSE  = m->lnL_SSE;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    mA = _mm_set1_ps ((CLFlt)(bs[0]));
+    mB = _mm_set1_ps ((CLFlt)(bs[1]));
+
+    freq =  1.0 / m->numGammaCats;
+    mFreq = _mm_set1_ps ((CLFlt)(freq));
+
+    /* find tree scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* calculate variable likelihood */
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        mLike = _mm_setzero_ps ();
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            m1    = _mm_mul_ps (clP[k][0], mA);
+            mLike = _mm_add_ps (mLike, m1);
+            m1    = _mm_mul_ps (clP[k][1], mB);
+            mLike = _mm_add_ps (mLike, m1);
+            clP[k] += 2;
+            }
+        mLike = _mm_mul_ps (mLike, mFreq);
+        _mm_store_ps (lnL_SSE, mLike);
+        lnL_SSE += FLOATS_PER_VEC;
+        }
+
+    pUnobserved = 0.0;
+    for (c=0; c<m->numDummyChars; c++)
+        {
+        like  = m->lnL_SSE[c];
+        pUnobserved += like *  exp(lnScaler[c]);
+        }
+
+    pObserved =  1.0 - pUnobserved;
+    if (pObserved < LIKE_EPSILON)
+        {
+#   ifdef DEBUG_LIKELIHOOD
+        MrBayesPrint ("%s   WARNING: p(Observed) < LIKE_EPSILON - for division %d p(Observed) = %1.30le\n", spacer, division+1, pObserved);
+#   endif
+        (*lnL) = MRBFLT_NEG_MAX;
+        abortMove = YES;
+        return ERROR;
+        }
+
+    for (c=m->numDummyChars; c<m->numChars; c++)
+        {
+        like  = m->lnL_SSE[c];
+        /* check against LIKE_EPSILON (values close to zero are problematic) */
+        if (like < LIKE_EPSILON)
+            {
+#   ifdef DEBUG_LIKELIHOOD
+            MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+            (*lnL) = MRBFLT_NEG_MAX;
+            abortMove = YES;
+            return ERROR;
+            }
+        else    
+            {
+            (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+            }
+        }
+
+    /* correct for absent characters */
+    (*lnL) -=  log(pObserved) * (m->numUncompressedChars);
+
+    return NO_ERROR;
+}
+#endif
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Std: variable states model with or without rate
+|       variation
+|
+-------------------------------------------------------------------*/
+int Likelihood_Std (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             b, c, j, k, nBetaCats, nGammaCats, nStates, numReps;
+    MrBFlt          catLike, catFreq, gammaFreq, like, *bs, *bsBase,
+                    pUnobserved, pObserved;
+    CLFlt           *clPtr, **clP, *lnScaler, *nSitesOfPat;
+    ModelInfo       *m;
+
+    m = &modelSettings[division];
+
+    numReps=0;
+    for (c=0; c<m->numChars; c++)
+        {
+        if (m->nStates[c] == 2)
+            numReps += m->numBetaCats * 2;
+        else
+            numReps += m->nStates[c];
+        }
+    /* find conditional likelihood pointers */
+    clPtr = m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += numReps;
+        }
+    
+    /* find base frequencies */
+    bsBase = GetParamStdStateFreqs (m->stateFreq, chain, state[chain]);
+
+    /* find gamma category number and frequencies */
+    nGammaCats = m->numGammaCats;
+    gammaFreq = 1.0 / nGammaCats;
+
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    *lnL = 0.0; /* reset lnL */
+
+    if (m->numBetaCats == 1)
+        {
+        pUnobserved = 0.0;
+        catFreq = gammaFreq;
+        for (c=j=0; c<m->numDummyChars; c++)
+            {
+            like = 0.0;
+            nStates = m->nStates[c];
+            bs = bsBase + m->bsIndex[c];
+            for (k=0; k<nGammaCats; k++)
+                {
+                catLike = 0.0;
+                for (j=0; j<nStates; j++)
+                    catLike += clP[k][j] * bs[j];
+                like += catLike * catFreq;
+                clP[k] += nStates;
+                }
+            pUnobserved += like *  exp(lnScaler[c]);
+            }
+
+        pObserved =  1.0 - pUnobserved;
+        if (pObserved < LIKE_EPSILON)
+            pObserved = LIKE_EPSILON;
+
+        for (c=m->numDummyChars; c<m->numChars; c++)
+            {
+            like = 0.0;
+            nStates = m->nStates[c];
+            bs = bsBase + m->bsIndex[c];
+
+            for (k=0; k<nGammaCats; k++)
+                {
+                catLike = 0.0;
+                for (j=0; j<nStates; j++)
+                    catLike += clP[k][j] * bs[j];
+                like += catLike * catFreq;
+                clP[k] += nStates;
+                }
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+                }
+            }
+        }
+    else
+        {
+        pUnobserved = 0.0;
+        for (c=j=0; c<m->numDummyChars; c++)
+            {
+            like = 0.0;
+            nStates = m->nStates[c];
+            bs = bsBase + m->bsIndex[c];
+            if (nStates == 2)
+                {
+                nBetaCats = m->numBetaCats;
+                catFreq = gammaFreq / nBetaCats;
+                }
+            else
+                {
+                nBetaCats = 1;
+                catFreq = gammaFreq;
+                }
+            for (b=0; b<nBetaCats; b++)
+                {
+                for (k=0; k<nGammaCats; k++)
+                    {
+                    catLike = 0.0;
+                    for (j=0; j<nStates; j++)
+                        catLike += clP[k][j] * bs[j];
+                    like += catLike * catFreq;
+                    clP[k] += nStates;
+                    }
+                bs += nStates;
+                }
+            pUnobserved += like *  exp(lnScaler[c]);
+            }
+
+        pObserved =  1.0 - pUnobserved;
+        if (pObserved < LIKE_EPSILON)
+            pObserved = LIKE_EPSILON;
+
+        for (c=m->numDummyChars; c<m->numChars; c++)
+            {
+            like = 0.0;
+            nStates = m->nStates[c];
+            bs = bsBase + m->bsIndex[c];
+            if (nStates == 2)
+                {
+                nBetaCats = m->numBetaCats;
+                catFreq = gammaFreq / nBetaCats;
+                }
+            else
+                {
+                nBetaCats = 1;
+                catFreq = gammaFreq;
+                }
+            for (b=0; b<nBetaCats; b++)
+                {
+                for (k=0; k<nGammaCats; k++)
+                    {
+                    catLike = 0.0;
+                    for (j=0; j<nStates; j++)
+                        catLike += clP[k][j] * bs[j];
+                    like += catLike * catFreq;
+                    clP[k] += nStates;
+                    }
+                bs += nStates;
+                }
+            /* check against LIKE_EPSILON (values close to zero are problematic) */
+            if (like < LIKE_EPSILON)
+                {
+#   ifdef DEBUG_LIKELIHOOD
+                MrBayesPrint ("%s   WARNING: In LIKE_EPSILON - for division %d char %d has like = %1.30le\n", spacer, division+1, c+1, like);
+#   endif
+                (*lnL) = MRBFLT_NEG_MAX;
+                abortMove = YES;
+                return ERROR;
+                }
+            else    
+                {
+                (*lnL) += (lnScaler[c] +  log(like)) * nSitesOfPat[c];
+                }
+            }
+        }
+
+    /* correct for absent characters */
+    (*lnL) -=  log(pObserved) * (m->numUncompressedChars);
+
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Pars: likelihood under the Tuffley and Steel (1997)
+|       model for characters with constant number of states. The idea
+|       is described in:
+|
+|       Tuffley, C., and M. Steel. 1997. Links between maximum likelihood
+|          and maximum parsimony under a simple model of site substitution.
+|          Bull. Math. Bio. 59:581-607.
+|
+|       The likelihood under the Tuffley and Steel (1997) model is:
+|       
+|       L = k^[-(T + n)]
+|      
+|       where L is the likelihood
+|             k is the number of character states
+|             T is the parsimony tree length
+|             n is the number of characters 
+|
+|   The parsimony calculator does not use character packing; this is
+|       to enable reweighting of characters 
+|
+|   Note that this is an empirical Bayes approach in that it uses the
+|       maximum likelihood branch length.
+|
+-------------------------------------------------------------------*/
+int Likelihood_Pars (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, i, nStates;
+    BitsLong        done, *pL, *pR, *pP, *pA, *oldpP, x;
+    CLFlt           nParsChars, treeLength;
+    CLFlt           length, *nSitesOfPat, *newNodeLength, oldNodeLength;
+    Tree            *t;
+    ModelInfo       *m;
+
+    /* Find model settings */
+    m = &modelSettings[division];
+
+    /* Get tree */
+    t = GetTree(m->brlens,chain,state[chain]);
+    
+    /* Get parsimony tree length */
+    treeLength = (CLFlt) m->parsTreeLength[2 * chain + state[chain]];
+    
+    /* Get number of states */
+    nStates = m->numStates;
+
+    /* Get number of sites of pat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+
+    /* Mark the nodes that can be stop nodes                 */
+    /* (there must not be any touched side nodes below them) */
+    p = t->root;
+    p->marked = YES;
+    for (i=t->nIntNodes-1; i>=0; i--)
+        {
+        p = t->intDownPass[i];
+        p->marked = NO;
+        if (p->upDateCl == YES && p->anc->marked == YES)
+            {
+            if (p->left->upDateCl == NO || p->right->upDateCl == NO)
+                p->marked = YES;
+            }
+        }
+
+    /* Now make downpass node by node */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+
+        /* continue if no work needs to be done */
+        if (p->upDateCl == NO)
+            continue;
+
+        /* flip space */
+        FlipCondLikeSpace(m, chain, p->index);
+        
+        /* find parsimony sets for the node and its environment */
+        pL    = m->parsSets[m->condLikeIndex[chain][p->left->index ]];
+        pR    = m->parsSets[m->condLikeIndex[chain][p->right->index]];
+        oldpP = m->parsSets[m->condLikeScratchIndex[p->index       ]];
+        pP    = m->parsSets[m->condLikeIndex[chain][p->index       ]];
+
+        /* find old and new node lengths */
+        oldNodeLength =  m->parsNodeLens[m->condLikeScratchIndex[p->index]];
+        newNodeLength = &m->parsNodeLens[m->condLikeIndex[chain][p->index]];
+        
+        if (t->isRooted == NO && p->anc->anc == NULL)
+            {
+            pA = m->parsSets[m->condLikeIndex[chain][p->anc->index]];
+            length = 0.0;
+            for (c=0; c<m->numChars; c++)
+                {
+                x = pL[c] & pR[c];
+                if (x == 0)
+                    {
+                    x = pL[c] | pR[c];
+                    length += nSitesOfPat[c];
+                    }
+                if ((x & pA[c]) == 0)
+                    length += nSitesOfPat[c];
+                pP[c] = x;
+                }
+            treeLength += (length - oldNodeLength);
+            newNodeLength[0] = length;
+            }
+        else
+            {
+            length = 0.0;
+            done = 0;
+            for (c=0; c<m->numChars; c++)
+                {
+                x = pL[c] & pR[c];
+                if (x == 0)
+                    {
+                    x = pL[c] | pR[c];
+                    length += nSitesOfPat[c];
+                    }
+                pP[c] = x;
+                done |= (x^oldpP[c]);
+                }
+            treeLength += (length - oldNodeLength);
+            newNodeLength[0] = length;
+            if (p->marked == YES && done == 0)
+                break;
+            }
+        }
+
+    /* Count number of characters in the partition. It is calculated
+       on the fly because this number is going to differ for
+       different chains if character reweighting is used. */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    nParsChars = 0.0;
+    for (c=0; c<m->numChars; c++)
+        nParsChars += nSitesOfPat[c];
+
+    /* Calculate likelihood from parsimony tree length */
+    *lnL = - ((treeLength + nParsChars) *  log (nStates));
+
+    /* Store current parsimony tree length */
+    m->parsTreeLength[2 * chain + state[chain]] = treeLength;
+
+    return (NO_ERROR);
+}
+
+
+#if 0
+int Likelihood_ParsCodon (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             x, y;
+    TreeNode        *q;
+    
+    /* no warnings */
+    q = p;
+    x = division;
+    y = chain;
+    *lnL = 0.0;
+    x = whichSitePats;
+
+    MrBayesPrint ("%s   Parsimony calculator for codons not yet implemented\n", spacer);
+    
+    return ERROR;
+}
+#   endif
+
+
+/*------------------------------------------------------------------
+|
+|   Likelihood_Pars: likelihood under the Tuffley and Steel (1997)
+|       model for characters with constant number of states. The idea
+|       is described in:
+|
+|       Tuffley, C., and M. Steel. 1997. Links between maximum likelihood
+|          and maximum parsimony under a simple model of site substitution.
+|          Bull. Math. Bio. 59:581-607.
+|
+|       The likelihood under the Tuffley and Steel (1997) model is:
+|       
+|       L = k^[-(T + n)]
+|      
+|       where L is the likelihood
+|             k is the number of character states
+|             T is the parsimony tree length
+|             n is the number of characters 
+|
+|   The parsimony calculator does not use character packing; this is
+|       to enable reweighting of characters 
+|
+|   Note that this is an empirical Bayes approach in that it uses the
+|       maximum likelihood branch length.
+|
+|   This variant of the calculator assumes that the number of states
+|       is variable. It does not take state order into account.
+|
+-------------------------------------------------------------------*/
+int Likelihood_ParsStd (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int             c, i, *nStates;
+    BitsLong        *pL, *pR, *pP, *pA, x;
+    CLFlt           *treeLength;
+    CLFlt           *nSitesOfPat;
+    Tree            *t;
+    ModelInfo       *m;
+
+    /* Find model settings */
+    m = &modelSettings[division];
+
+    /* Get tree */
+    t = GetTree(m->brlens,chain,state[chain]);
+    
+    /* Allocate space for parsimony tree length */
+    treeLength = (CLFlt *) SafeCalloc (m->numChars, sizeof (CLFlt));
+    
+    /* Get number of states */
+    nStates = m->nStates;
+
+    /* Get number of sites of pat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+
+    /* Make downpass node by node; do not skip any nodes */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+
+        /* flip space */
+        FlipCondLikeSpace(m, chain, p->index);
+        
+        /* find parsimony sets for the node and its environment */
+        pL    = m->parsSets[m->condLikeIndex[chain][p->left->index ]];
+        pR    = m->parsSets[m->condLikeIndex[chain][p->right->index]];
+        pP    = m->parsSets[m->condLikeIndex[chain][p->index       ]];
+
+        if (t->isRooted == NO && p->anc->anc == NULL)
+            {
+            pA = m->parsSets[m->condLikeIndex[chain][p->anc->index]];
+            for (c=0; c<m->numChars; c++)
+                {
+                x = pL[c] & pR[c];
+                if (x == 0)
+                    {
+                    x = pL[c] | pR[c];
+                    treeLength[c] += nSitesOfPat[c];
+                    }
+                if ((x & pA[c]) == 0)
+                    treeLength[c] += nSitesOfPat[c];
+                pP[c] = x;
+                }
+            }
+        else
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                x = pL[c] & pR[c];
+                if (x == 0)
+                    {
+                    x = pL[c] | pR[c];
+                    treeLength[c] += nSitesOfPat[c];
+                    }
+                pP[c] = x;
+                }
+            }
+        }
+
+    /* Calculate the likelihood one character at a time */
+    *lnL = 0.0;
+    for (c=0; c<m->numChars; c++)
+        {
+        *lnL -= ((treeLength[c] + nSitesOfPat[c]) * log (nStates[c]));
+        }
+
+    /* Free space for parsimony character states */
+    free (treeLength);
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   LaunchLogLikeForDivision: calculate the log likelihood of the 
+|       new state of the chain for a single division
+|
+-----------------------------------------------------------------*/
+void LaunchLogLikeForDivision(int chain, int d, MrBFlt* lnL)
+{
+    int i;
+    TreeNode        *p;
+    ModelInfo       *m;
+    Tree            *tree;
+#   if defined (TIMING_ANALIZ)
+    clock_t         CPUTimeStart;
+#   endif
+    
+    m = &modelSettings[d];
+    tree = GetTree(m->brlens, chain, state[chain]);
+    
+    if (m->upDateCijk == YES)
+        {
+        if (UpDateCijk(d, chain)== ERROR)
+            {
+            (*lnL) = MRBFLT_NEG_MAX; /* effectively abort the move */
+            return;
+            }
+        m->upDateAll = YES;
+        }
+    
+#   if defined (BEAGLE_ENABLED)
+    if (m->useBeagle == YES)
+        {
+        LaunchBEAGLELogLikeForDivision(chain, d, m, tree, lnL);
+        return;
+        }
+#   endif
+        
+    /* Flip and copy or reset site scalers */
+    FlipSiteScalerSpace(m, chain);
+    if (m->upDateAll == YES)
+        ResetSiteScalers(m, chain);
+    else
+        CopySiteScalers(m, chain);
+    
+    if (m->parsModelId == NO)
+        {
+        for (i=0; i<tree->nIntNodes; i++)
+            {
+            p = tree->intDownPass[i];
+            
+            if (p->left->upDateTi == YES)
+                {
+                /* shift state of ti probs for node */
+                FlipTiProbsSpace (m, chain, p->left->index);
+                m->TiProbs (p->left, d, chain);
+                }
+            
+            if (p->right->upDateTi == YES)
+                {
+                /* shift state of ti probs for node */
+                FlipTiProbsSpace (m, chain, p->right->index);
+                m->TiProbs (p->right, d, chain);
+                }
+            
+            if (tree->isRooted == NO)
+                {
+                if (p->anc->anc == NULL /* && p->upDateTi == YES */)
+                    {
+                    /* shift state of ti probs for node */
+                    FlipTiProbsSpace (m, chain, p->index);
+                    m->TiProbs (p, d, chain);
+                    }
+                }
+            
+            if (p->upDateCl == YES)
+                {
+                if (tree->isRooted == NO)
+                    {
+                    if (p->anc->anc == NULL)
+                        {
+                        TIME(m->CondLikeRoot (p, d, chain),CPUCondLikeRoot);
+                        }
+                    else
+                        {
+                        TIME(m->CondLikeDown (p, d, chain),CPUCondLikeDown);                        
+                        }
+                    }
+                else
+                    {
+                    TIME(m->CondLikeDown (p, d, chain),CPUCondLikeDown);
+                    }
+
+                if (m->scalersSet[chain][p->index] == YES && m->upDateAll == NO)
+                    {
+#   if defined (SSE_ENABLED)
+                    if (m->useSSE == YES)
+                        {
+                        TIME(RemoveNodeScalers_SSE (p, d, chain),CPUScalersRemove);
+                        }
+                    else
+                        {
+                        TIME(RemoveNodeScalers (p, d, chain),CPUScalersRemove);
+                        }
+#   else
+                    TIME(RemoveNodeScalers (p, d, chain),CPUScalersRemove);
+#   endif
+                    }
+                FlipNodeScalerSpace (m, chain, p->index);
+                m->scalersSet[chain][p->index] = NO;
+                
+                if (p->scalerNode == YES)
+                    {
+                    TIME(m->CondLikeScaler (p, d, chain),CPUScalers);
+                    }
+                }
+            }
+        }
+    TIME(m->Likelihood (tree->root->left, d, chain, lnL, (chainId[chain] % chainParams.numChains)),CPULilklihood);
+    return;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   RemoveNodeScalers: Remove node scalers
+|
+-----------------------------------------------------------------*/
+int RemoveNodeScalers (TreeNode *p, int division, int chain)
+{
+    int             c;
+    CLFlt           *scP, *lnScaler;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+    assert (m->scalersSet[chain][p->index] == YES);
+
+    /* find scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* find site scalers */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+
+    /* remove scalers */
+    for (c=0; c<m->numChars; c++)
+        lnScaler[c] -= scP[c];
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/*----------------------------------------------------------------
+|
+|   RemoveNodeScalers_SSE: Remove node scalers, SSE code
+|
+-----------------------------------------------------------------*/
+int RemoveNodeScalers_SSE (TreeNode *p, int division, int chain)
+{
+    int             c;
+    __m128          *scP_SSE, *lnScaler_SSE;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+    assert (m->scalersSet[chain][p->index] == YES);
+
+    /* find scalers */
+    scP_SSE = (__m128*)(m->scalers[m->nodeScalerIndex[chain][p->index]]);
+
+    /* find site scalers */
+    lnScaler_SSE = (__m128*)(m->scalers[m->siteScalerIndex[chain]]);
+
+    /* remove scalers */
+    for (c=0; c<m->numSSEChars; c++)
+        {
+        lnScaler_SSE[c] = _mm_sub_ps(lnScaler_SSE[c], scP_SSE[c]);
+        }
+
+    return NO_ERROR;
+    
+}
+#endif
+
+
+int SetBinaryQMatrix (MrBFlt **a, int whichChain, int division)
+{
+    MrBFlt          scaler, *bs;
+    ModelInfo       *m;
+        
+    /* set up pointers to the appropriate model information */
+    m = &modelSettings[division];
+    assert (m->numModelStates == 2);
+
+    bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+    scaler = 1.0 / (2*bs[0]*bs[1]);
+    a[0][0]= -bs[1]*scaler;
+    a[0][1]=  bs[1]*scaler;
+    a[1][0]=  bs[0]*scaler;
+    a[1][1]= -bs[0]*scaler;
+
+    return (NO_ERROR);
+}
+
+
+int SetNucQMatrix (MrBFlt **a, int n, int whichChain, int division, MrBFlt rateMult, MrBFlt *rA, MrBFlt *rS)
+{
+    register int    i, j, k;
+    int             isTransition=0, nDiff, rtNum=0;
+    MrBFlt          scaler, mult=0.0, probOn, sum, *swr, s01, s10, s[4][4], nonsyn, *rateValues=NULL, *bs, dN, dS;
+    ModelInfo       *m;
+    ModelParams     *mp;
+#   if defined BEAGLE_ENABLED
+    MrBFlt          trans;
+#   endif
+
+    /* set up pointers to the appropriate model information */
+    mp = &modelParams[division];
+    m = &modelSettings[division];
+    assert (m->numModelStates == n);
+
+    /* All of the models that are set up in this function require the frequencies
+       of the nucleotides (or doublets or codons). They will also require either
+       a transition/transversion rate ratio or the GTR rate parameters. The 
+       "rateValues" will either be
+       
+          rateValues[0] = transtion/transversion rate (kappa)
+       
+       for nst=2 models or
+       
+          rateValues[0] = A <-> C rate
+          rateValues[1] = A <-> G rate
+          rateValues[2] = A <-> T rate
+          rateValues[3] = C <-> G rate
+          rateValues[4] = C <-> T rate
+          rateValues[5] = G <-> T rate
+          
+       for nst=6 models. */
+    bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+    if (m->nst == 2)
+        {
+        rateValues = GetParamVals(m->tRatio, whichChain, state[whichChain]);
+#   if defined (BEAGLE_ENABLED)
+        /* transversions assumed to have rate 1.0; */
+        trans = rateValues[0];
+        if (m->numModelStates == 4)   /* code to satisfy Beagle */
+            {
+            rateValues = (MrBFlt *) SafeCalloc (6, sizeof(MrBFlt));
+            rateValues[0] = rateValues[2] = rateValues[3] = rateValues[5] =1.0; /* Setting transversions */
+            rateValues[1] = rateValues[4] = trans; /* Setting transitions */
+            }
+#   endif
+        }
+
+    else if (m->nst == 6 || m->nst == NST_MIXED)
+        rateValues = GetParamVals(m->revMat, whichChain, state[whichChain]);
+#   if defined (BEAGLE_ENABLED)
+    else if (m->nst == 1 && m->numModelStates == 4)   /* code to satisfy Beagle */
+        {
+        rateValues = (MrBFlt *) SafeCalloc (6, sizeof(MrBFlt));
+        for (i=0; i<6; i++)
+            rateValues[i] = 1.0;
+        }
+#   endif
+
+    if (n == 4) 
+        {
+        /* 4 X 4 model:
+        
+           Here, we set the rate matrix for the GTR model (Tavare, 1986). We
+           need not only the 6 rates for this model (rateValues), but also the 
+           base frequencies (bs). */
+            
+        /* set diagonal of Q matrix to 0 */
+        for (i=0; i<4; i++)
+            a[i][i] = 0.0;
+
+        /* initialize Q matrix */
+        scaler = 0.0;
+        for (i=0; i<4; i++)
+            {
+            for (j=i+1; j<4; j++)
+                {
+                if (i == 0 && j == 1)
+                    mult = rateValues[0];
+                else if (i == 0 && j == 2)
+                    mult = rateValues[1];
+                else if (i == 0 && j == 3)
+                    mult = rateValues[2];
+                else if (i == 1 && j == 2)
+                    mult = rateValues[3];
+                else if (i == 1 && j == 3)
+                    mult = rateValues[4];
+                else if (i == 2 && j == 3)
+                    mult = rateValues[5];
+                a[i][i] -= (a[i][j] = bs[j] * mult);
+                a[j][j] -= (a[j][i] = bs[i] * mult);
+                scaler += bs[i] * a[i][j];
+                scaler += bs[j] * a[j][i];
+                }
+            }
+            
+        /* rescale Q matrix */
+        scaler = 1.0 / scaler;
+        for (i=0; i<4; i++)
+            for (j=0; j<4; j++)
+                a[i][j] *= scaler;
+        }
+    else if (n == 8) /* we have a 4 X 4 covarion model */
+        {
+        /* 8 X 8 covarion model:
+        
+           Here, we set the rate matrix for the covarion model (Tuffley and
+           Steel, 1997). We need the rate parameters of the model 
+           (contained in rateValues), the frequencies of the four nucleotides,
+           and the switching rates to completely specify the rate matrix. We
+           first set up the 4 X 4 submatrix that represents changes (the upper
+           left portion of the 8 X 8 matrix). Note that if we have rate
+           variation across sites, that we need to deal with the multiplication
+           in the rate matrix (i.e., we cannot simply deal with rate variation
+           by multiplying the branch length by a rate multiplier as we can
+           with other models). Instead, we multiply the scaled rate matrix
+           by the rate multiplier. */
+
+        /* Get the switching rates. The rate of off->on is s01 and the rate
+           of on->off is s10. The stationary probability of the switch process
+           is prob1 = s01/(s01+s10) and prob0 = s10/(s01+s10). */
+        swr = GetParamVals (m->switchRates, whichChain, state[whichChain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        
+        /* set matrix a to 0 */
+        for (i=0; i<8; i++)
+            for (j=0; j<8; j++)
+                a[i][j] = 0.0;
+
+        /* set up the 4 X 4 matrix representing substitutions (s[][]; upper left) */
+        if (m->nst == 1)
+            {
+            scaler = 0.0;
+            for (i=0; i<4; i++)
+                {
+                for (j=i+1; j<4; j++)
+                    {
+                    s[i][j] = bs[j];
+                    s[j][i] = bs[i];
+                    scaler += bs[i] * s[i][j] * probOn;
+                    scaler += bs[j] * s[j][i] * probOn;
+                    }
+                }
+            }
+        else if (m->nst == 2)
+            {
+            scaler = 0.0;
+            for (i=0; i<4; i++)
+                {
+                for (j=i+1; j<4; j++)
+                    {
+                    if ((i == 0 && j == 2) || (i == 2 && j == 0) || (i == 1 && j == 3) || (i == 3 && j == 1))
+                        mult = rateValues[0];
+                    else
+                        mult = 1.0;
+                    s[i][j] = bs[j] * mult;
+                    s[j][i] = bs[i] * mult;
+                    scaler += bs[i] * s[i][j] * probOn;
+                    scaler += bs[j] * s[j][i] * probOn;
+                    }
+                }
+            }
+        else
+            {
+            scaler = 0.0;
+            for (i=0; i<4; i++)
+                {
+                for (j=i+1; j<4; j++)
+                    {
+                    if (i == 0 && j == 1)
+                        mult = rateValues[0];
+                    else if (i == 0 && j == 2)
+                        mult = rateValues[1];
+                    else if (i == 0 && j == 3)
+                        mult = rateValues[2];
+                    else if (i == 1 && j == 2)
+                        mult = rateValues[3];
+                    else if (i == 1 && j == 3)
+                        mult = rateValues[4];
+                    else if (i == 2 && j == 3)
+                        mult = rateValues[5];
+
+                    s[i][j] = bs[j] * mult;
+                    s[j][i] = bs[i] * mult;
+                    scaler += bs[i] * s[i][j] * probOn;
+                    scaler += bs[j] * s[j][i] * probOn;
+                    }
+                }
+            }
+
+        /* rescale off diagonal elements of s[][] matrix */
+        scaler = 1.0 / scaler;
+        for (i=0; i<4; i++)
+            {
+            for (j=0; j<4; j++)
+                {
+                if (i != j)
+                    s[i][j] *= scaler;
+                }
+            }
+            
+        /* now, scale s[][] by rate factor */
+        for (i=0; i<4; i++)
+            {
+            for (j=0; j<4; j++)
+                {
+                if (i != j)
+                    s[i][j] *= rateMult;
+                }
+            }
+            
+        /* put in diagonal elements of s[][] */
+        for (i=0; i<4; i++)
+            {
+            sum = 0.0;
+            for (j=0; j<4; j++)
+                {
+                if (i != j)
+                    sum += s[i][j];
+                }
+            s[i][i] = -(sum + s10);
+            }
+                
+        /* Now, put s[][] into top left portion of a matrix and fill in the
+           other parts of the matrix with the appropriate switching rates. */
+        for (i=0; i<4; i++)
+            for (j=0; j<4; j++)
+                a[i][j] = s[i][j];
+        for (i=4; i<8; i++)
+            a[i][i] = -s01;
+        a[0][4] = s10;
+        a[1][5] = s10;
+        a[2][6] = s10;
+        a[3][7] = s10;
+        a[4][0] = s01;
+        a[5][1] = s01;
+        a[6][2] = s01;
+        a[7][3] = s01;
+        
+#       if 0
+        for (i=0; i<8; i++)
+            {
+            for (j=0; j<8; j++)
+                printf ("%1.10lf ", a[i][j]);
+            printf ("\n");
+            }
+        for (i=0; i<4; i++)
+            printf ("%lf ", bs[i]);
+        printf ("\n");
+        printf ("s01 = %lf s10 = %lf pi1 = %lf pi0 = %lf\n", s01, s10, probOn, 1-probOn);
+#       endif
+        }
+    else if (n == 16) 
+        {
+        /* 16 X 16 doublet model:
+        
+           We have a doublet model. The states are in the order AA, AC, AG, AT, CA, CC
+           CG, CT, GA, GC, GG, GT, TA, TC, TG, TT. The rate matrix is straight-forward
+           to set up. We simply multiply the rate parameter (e.g., the ti/tv rate
+           ratio) by the doublet frequencies. */
+           
+        /* set diagonal of Q matrix to 0 */
+        for (i=0; i<16; i++)
+            a[i][i] = 0.0;
+
+        if (m->nst == 1) /* F81-like doublet model */
+            {
+            scaler = 0.0;
+            for (i=0; i<16; i++)
+                {
+                for (j=i+1; j<16; j++)
+                    {
+                    if (((doublet[i].first & doublet[j].first) == 0) && ((doublet[i].second & doublet[j].second) == 0))
+                        mult = 0.0;
+                    else
+                        mult = 1.0;                 
+                    a[i][i] -= (a[i][j] = bs[j] * mult);
+                    a[j][j] -= (a[j][i] = bs[i] * mult);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            }
+        else if (m->nst == 2) /* HKY-like doublet model */
+            {
+            scaler = 0.0;
+            for (i=0; i<16; i++)
+                {
+                for (j=i+1; j<16; j++)
+                    {
+                    if (((doublet[i].first & doublet[j].first) == 0) && ((doublet[i].second & doublet[j].second) == 0))
+                        mult = 0.0;
+                    else
+                        {
+                        if ((doublet[i].first & doublet[j].first) == 0)
+                            {
+                            if ((doublet[i].first + doublet[j].first) == 5 || (doublet[i].first + doublet[j].first) == 10)
+                                mult = rateValues[0];
+                            else
+                                mult = 1.0;
+                            }
+                        else
+                            {
+                            if ((doublet[i].second + doublet[j].second) == 5 || (doublet[i].second + doublet[j].second) == 10)
+                                mult = rateValues[0];
+                            else
+                                mult = 1.0;
+                            }
+                        }               
+                    a[i][i] -= (a[i][j] = bs[j] * mult);
+                    a[j][j] -= (a[j][i] = bs[i] * mult);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            }
+        else /* GTR-like doublet model */
+            {
+            scaler = 0.0;
+            for (i=0; i<16; i++)
+                {
+                for (j=i+1; j<16; j++)
+                    {
+                    if (((doublet[i].first & doublet[j].first) == 0) && ((doublet[i].second & doublet[j].second) == 0))
+                        mult = 0.0;
+                    else
+                        {
+                        if ((doublet[i].first & doublet[j].first) == 0)
+                            {
+                            if ((doublet[i].first + doublet[j].first) == 3)
+                                mult = rateValues[0];
+                            else if ((doublet[i].first + doublet[j].first) == 5)
+                                mult = rateValues[1];
+                            else if ((doublet[i].first + doublet[j].first) == 9)
+                                mult = rateValues[2];
+                            else if ((doublet[i].first + doublet[j].first) == 6)
+                                mult = rateValues[3];
+                            else if ((doublet[i].first + doublet[j].first) == 10)
+                                mult = rateValues[4];
+                            else
+                                mult = rateValues[5];
+                            }
+                        else
+                            {
+                            if ((doublet[i].second + doublet[j].second) == 3)
+                                mult = rateValues[0];
+                            else if ((doublet[i].second + doublet[j].second) == 5)
+                                mult = rateValues[1];
+                            else if ((doublet[i].second + doublet[j].second) == 9)
+                                mult = rateValues[2];
+                            else if ((doublet[i].second + doublet[j].second) == 6)
+                                mult = rateValues[3];
+                            else if ((doublet[i].second + doublet[j].second) == 10)
+                                mult = rateValues[4];
+                            else
+                                mult = rateValues[5];
+                            }
+                        }               
+                    a[i][i] -= (a[i][j] = bs[j] * mult);
+                    a[j][j] -= (a[j][i] = bs[i] * mult);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            }
+                    
+            
+        /* rescale Q matrix */
+        scaler = 1.0 / scaler;
+        for (i=0; i<16; i++)
+            for (j=0; j<16; j++)
+                a[i][j] *= scaler;
+        }
+    else
+        {
+        /* 64(ish) X 64(ish) codon model:
+        
+           Here, we set the rate matrix for the codon model (see Goldman and
+           Yang, 1994). Note that we can specifiy any general type of codon
+           model, with these constraints:
+           
+            a[i][j] = 0                      -> if i and j differ at 2 or 3 nucleotides
+            a[i][j] = rateValues[0] * bs[j]  -> if synonymous A <-> C change
+            a[i][j] = rateValues[1] * bs[j]  -> if synonymous A <-> G change
+            a[i][j] = rateValues[2] * bs[j]  -> if synonymous A <-> T change
+            a[i][j] = rateValues[3] * bs[j]  -> if synonymous C <-> G change
+            a[i][j] = rateValues[4] * bs[j]  -> if synonymous C <-> T change
+            a[i][j] = rateValues[5] * bs[j]  -> if synonymous G <-> T change
+            
+            a[i][j] = rateValues[0] * nonsyn * bs[j]  -> if nonsynonymous A <-> C change
+            a[i][j] = rateValues[1] * nonsyn * bs[j]  -> if nonsynonymous A <-> G change
+            a[i][j] = rateValues[2] * nonsyn * bs[j]  -> if nonsynonymous A <-> T change
+            a[i][j] = rateValues[3] * nonsyn * bs[j]  -> if nonsynonymous C <-> G change
+            a[i][j] = rateValues[4] * nonsyn * bs[j]  -> if nonsynonymous C <-> T change
+            a[i][j] = rateValues[5] * nonsyn * bs[j]  -> if nonsynonymous G <-> T change
+            
+          Other models, such as the one used by Nielsen & Yang (1998) can be obtained
+          from this model by restricing transitions and transversions to have the same rate.
+          nonsyn is the nonsynonymous/synonymous rate ratio (often called the
+          dN/dS ratio). If we are in this part of the function, then we rely on it
+          being called with the "rateMult" parameter specifying the dN/dS ratio. Note
+          that the size of the matrix will never be 64 X 64 as we only consider changes
+          among coding triplets (i.e., we exclude the stop codons). */
+          
+        /* get the nonsynonymous/synonymous rate ratio */
+        nonsyn = rateMult; 
+        
+        /* set diagonal of Q matrix to 0 */
+        for (i=0; i<n; i++)
+            a[i][i] = 0.0;
+            
+        /* set dN and dS rates to zero */
+        dN = dS = 0.0;
+
+        if (m->nst == 1) /* F81-like codon model */
+            {
+            scaler = 0.0;
+            for (i=0; i<n; i++)
+                {
+                for (j=i+1; j<n; j++)
+                    {
+                    nDiff = 0;
+                    for (k=0; k<3; k++)
+                        {
+                        if (mp->codonNucs[i][k] != mp->codonNucs[j][k])
+                            nDiff++;
+                        }
+                    if (nDiff > 1)
+                        {
+                        mult = 0.0;
+                        }
+                    else
+                        {
+                        if (mp->codonAAs[i] == mp->codonAAs[j])
+                            mult = 1.0;
+                        else
+                            mult = nonsyn;
+                        }
+                    
+                    a[i][i] -= (a[i][j] = bs[j] * mult);
+                    a[j][j] -= (a[j][i] = bs[i] * mult);
+                    if (mp->codonAAs[i] == mp->codonAAs[j])
+                        dS += (bs[i] * a[i][j] + bs[j] * a[j][i]);
+                    else
+                        dN += (bs[i] * a[i][j] + bs[j] * a[j][i]);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            }
+        else if (m->nst == 2) /* HKY-like codon model */
+            {
+            scaler = 0.0;
+            for (i=0; i<n; i++)
+                {
+                for (j=i+1; j<n; j++)
+                    {
+                    nDiff = 0;
+                    for (k=0; k<3; k++)
+                        {
+                        if (mp->codonNucs[i][k] != mp->codonNucs[j][k])
+                            {
+                            nDiff++;
+                            if ((mp->codonNucs[i][k] == 0 && mp->codonNucs[j][k] == 2) || (mp->codonNucs[i][k] == 2 && mp->codonNucs[j][k] == 0) ||
+                                (mp->codonNucs[i][k] == 1 && mp->codonNucs[j][k] == 3) || (mp->codonNucs[i][k] == 3 && mp->codonNucs[j][k] == 1))
+                                isTransition = YES;
+                            else
+                                isTransition = NO;
+                            }
+                        }
+                    if (nDiff > 1)
+                        {
+                        mult = 0.0;
+                        }
+                    else
+                        {
+                        if (mp->codonAAs[i] == mp->codonAAs[j])
+                            mult = 1.0;
+                        else
+                            mult = nonsyn;
+                        if (isTransition == YES)
+                            mult *= rateValues[0];
+                        }
+                    
+                    a[i][i] -= (a[i][j] = bs[j] * mult);
+                    a[j][j] -= (a[j][i] = bs[i] * mult);
+                    if (mp->codonAAs[i] == mp->codonAAs[j])
+                        dS += (bs[i] * a[i][j] + bs[j] * a[j][i]);
+                    else
+                        dN += (bs[i] * a[i][j] + bs[j] * a[j][i]);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            }
+        else /* GTR-like codon model */
+            {
+            scaler = 0.0;
+            for (i=0; i<n; i++)
+                {
+                for (j=i+1; j<n; j++)
+                    {
+                    nDiff = 0;
+                    for (k=0; k<3; k++)
+                        {
+                        if (mp->codonNucs[i][k] != mp->codonNucs[j][k])
+                            {
+                            nDiff++;
+                            if ((mp->codonNucs[i][k] == 0 && mp->codonNucs[j][k] == 1) || (mp->codonNucs[i][k] == 1 && mp->codonNucs[j][k] == 0))
+                                rtNum = 0;
+                            else if ((mp->codonNucs[i][k] == 0 && mp->codonNucs[j][k] == 2) || (mp->codonNucs[i][k] == 2 && mp->codonNucs[j][k] == 0))
+                                rtNum = 1;
+                            else if ((mp->codonNucs[i][k] == 0 && mp->codonNucs[j][k] == 3) || (mp->codonNucs[i][k] == 3 && mp->codonNucs[j][k] == 0))
+                                rtNum = 2;
+                            else if ((mp->codonNucs[i][k] == 1 && mp->codonNucs[j][k] == 2) || (mp->codonNucs[i][k] == 2 && mp->codonNucs[j][k] == 1))
+                                rtNum = 3;
+                            else if ((mp->codonNucs[i][k] == 1 && mp->codonNucs[j][k] == 3) || (mp->codonNucs[i][k] == 3 && mp->codonNucs[j][k] == 1))
+                                rtNum = 4;
+                            else
+                                rtNum = 5;
+                            }
+                        }
+                    if (nDiff > 1)
+                        {
+                        mult = 0.0;
+                        }
+                    else
+                        {
+                        if (mp->codonAAs[i] == mp->codonAAs[j])
+                            mult = 1.0;
+                        else
+                            mult = nonsyn;
+                        if (rtNum == 0)
+                            mult *= rateValues[0];
+                        else if (rtNum == 1)
+                            mult *= rateValues[1];
+                        else if (rtNum == 2)
+                            mult *= rateValues[2];
+                        else if (rtNum == 3)
+                            mult *= rateValues[3];
+                        else if (rtNum == 4)
+                            mult *= rateValues[4];
+                        else
+                            mult *= rateValues[5];
+                        }
+                    
+                    a[i][i] -= (a[i][j] = bs[j] * mult);
+                    a[j][j] -= (a[j][i] = bs[i] * mult);
+                    if (mp->codonAAs[i] == mp->codonAAs[j])
+                        dS += (bs[i] * a[i][j] + bs[j] * a[j][i]);
+                    else
+                        dN += (bs[i] * a[i][j] + bs[j] * a[j][i]);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            }
+
+        /* rescale Q matrix */
+        if (m->nucModelId == NUCMODEL_CODON && m->numOmegaCats > 1)
+            {
+            /* If we have a positive selection model with multiple categories, then
+               we do not rescale the rate matrix until we have finished generating
+               all of the necessary rate matrices. The rescaling occurrs in 
+               UpDateCijk. */
+            (*rA) = dN;
+            (*rS) = dS;
+            }
+        else
+            {
+            scaler = 1.0 / scaler;
+            for (i=0; i<n; i++)
+                for (j=0; j<n; j++)
+                    a[i][j] *= scaler;
+            (*rA) = (*rS) = 1.0;
+            }           
+        }
+
+#   if 0
+    for (i=0; i<n; i++)
+        {
+        for (j=0; j<n; j++)
+            printf ("%0.5lf ", a[i][j]);
+        printf ("\n");
+        }
+#   endif
+
+#   if defined (BEAGLE_ENABLED)
+    if ((m->nst == 1 || m->nst == 2) && m->numModelStates == 4)
+        free (rateValues);
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int SetProteinQMatrix (MrBFlt **a, int n, int whichChain, int division, MrBFlt rateMult)
+{
+    register int    i, j, k;
+    int             aaModelID;
+    MrBFlt          scaler, probOn, sum, *swr, s01, s10, *bs, *rt;
+    ModelInfo       *m;
+        
+    /* set up pointers to the appropriate model information */
+    m = &modelSettings[division];
+
+    /* get amino acid model ID 
+        AAMODEL_POISSON         0
+        AAMODEL_JONES           1
+        AAMODEL_DAY             2
+        AAMODEL_MTREV           3
+        AAMODEL_MTMAM           4
+        AAMODEL_WAG             5
+        AAMODEL_RTREV           6
+        AAMODEL_CPREV           7
+        AAMODEL_VT              8
+        AAMODEL_BLOSUM          9
+        AAMODEL_LG             10
+        AAMODEL_EQ             11
+        AAMODEL_GTR            12 */
+        
+    if (m->aaModelId >= 0)
+        aaModelID = m->aaModelId;
+    else
+        aaModelID = (int)*GetParamVals(m->aaModel, whichChain, state[whichChain]);
+    
+    /* Make certain that we have either 20 or 40 states. Anything
+       else means we have a real problem. */
+    if (n != 20 && n != 40)
+        {
+        MrBayesPrint ("%s   ERROR: There should be 20 or 40 states for the aa model\n");
+        return (ERROR);
+        }
+
+    if (n == 20)
+        {
+        /* We have a run-of-the-mill amino acid model (i.e., 20 X 20). */
+        if (aaModelID == AAMODEL_POISSON)
+            {
+            scaler = 1.0 / 19.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = scaler;
+                    a[j][i] = scaler;
+                    }
+                }
+            for (i=0; i<20; i++)
+                a[i][i] = -1.0;
+            }
+        else if (aaModelID == AAMODEL_EQ)
+            {
+            bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = 0.0;
+            scaler = 0.0;   
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][i] -= (a[i][j] = bs[j]);
+                    a[j][j] -= (a[j][i] = bs[i]);
+                    scaler += bs[i] * a[i][j];
+                    scaler += bs[j] * a[j][i];
+                    }
+                }
+            scaler = 1.0 / scaler;
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] *= scaler;
+            }
+        else if (aaModelID == AAMODEL_GTR)
+            {
+            bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+            rt = GetParamVals (m->revMat, whichChain, state[whichChain]);
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = 0.0;
+            scaler = 0.0;
+            for (i=k=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][i] -= (a[i][j] = bs[j] * rt[k]);
+                    a[j][j] -= (a[j][i] = bs[i] * rt[k]);
+                    k++;
+                    }
+                }
+            for (i=0; i<20; i++)
+                scaler += -(bs[i] * a[i][i]);
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] /= scaler;
+            }
+        else if (aaModelID == AAMODEL_JONES)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaJones[i][j];
+            }
+        else if (aaModelID == AAMODEL_DAY)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaDayhoff[i][j];
+            }
+        else if (aaModelID == AAMODEL_MTREV)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaMtrev24[i][j];
+            }
+        else if (aaModelID == AAMODEL_MTMAM)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaMtmam[i][j];
+            }
+        else if (aaModelID == AAMODEL_RTREV)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aartREV[i][j];
+            }
+        else if (aaModelID == AAMODEL_WAG)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaWAG[i][j];
+            }
+        else if (aaModelID == AAMODEL_CPREV)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aacpREV[i][j];
+            }
+        else if (aaModelID == AAMODEL_VT)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaVt[i][j];
+            }
+        else if (aaModelID == AAMODEL_BLOSUM)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaBlosum[i][j];
+            }
+        else if (aaModelID == AAMODEL_LG)
+            {
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = aaLG[i][j];
+            }
+        else
+            {
+            MrBayesPrint ("%s   ERROR: Don't understand which amino acid model is needed\n");
+            return (ERROR);
+            }
+#       if 0
+        for (i=0; i<20; i++)
+            {
+            for (j=0; j<20; j++)
+                printf ("%1.3lf ", a[i][j]);
+            printf ("\n");
+            }
+#       endif
+        }
+    else
+        {
+        /* 40 X 40 covarion model:
+        
+           We have a covarion model, and must set up the other quadrants. Note that if
+           we are at this point in the code, that we have already set up the upper left
+           portion of the 40 X 40 rate matrix. Note that if we have rate
+           variation across sites, that we need to deal with the multiplication
+           in the rate matrix (i.e., we cannot simply deal with rate variation
+           by multiplying the branch length by a rate multiplier as we can
+           with other models). Instead, we multiply the scaled rate matrix
+           by the rate multiplier. */
+
+        /* Get the switching rates. The rate of off->on is s01 and the rate
+           of on->off is s10. The stationary probability of the switch process
+           is prob1 = s01/(s01+s10) and prob0 = s10/(s01+s10). */
+        swr = GetParamVals (m->switchRates, whichChain, state[whichChain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        
+        /* set matrix a[][] to 0 */
+        for (i=0; i<40; i++)
+            for (j=0; j<40; j++)
+                a[i][j] = 0.0;  
+                
+        /* fill in upper-left sub matrix (where substitutions occur */
+        if (aaModelID == AAMODEL_POISSON)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = 0.05;
+                    a[j][i] = 0.05;
+                    scaler += 0.05 * a[i][j] * probOn;
+                    scaler += 0.05 * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_EQ)
+            {
+            bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = bs[j];
+                    a[j][i] = bs[i];
+                    scaler += bs[i] * a[i][j] * probOn;
+                    scaler += bs[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_GTR)
+            {
+            bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+            rt = GetParamVals (m->revMat, whichChain, state[whichChain]);
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] = 0.0;
+            scaler = 0.0;
+            for (i=k=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][i] -= (a[i][j] = bs[j] * rt[k]);
+                    a[j][j] -= (a[j][i] = bs[i] * rt[k]);
+                    k++;
+                    }
+                }
+            for (i=0; i<20; i++)
+                scaler += -(bs[i] * a[i][i]);
+            for (i=0; i<20; i++)
+                for (j=0; j<20; j++)
+                    a[i][j] /= scaler;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = bs[j];
+                    a[j][i] = bs[i];
+                    scaler += bs[i] * a[i][j] * probOn;
+                    scaler += bs[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_JONES)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaJones[i][j];
+                    a[j][i] = aaJones[j][i];
+                    scaler += jonesPi[i] * a[i][j] * probOn;
+                    scaler += jonesPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_DAY)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaDayhoff[i][j];
+                    a[j][i] = aaDayhoff[j][i];
+                    scaler += dayhoffPi[i] * a[i][j] * probOn;
+                    scaler += dayhoffPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_MTREV)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaMtrev24[i][j];
+                    a[j][i] = aaMtrev24[j][i];
+                    scaler += mtrev24Pi[i] * a[i][j] * probOn;
+                    scaler += mtrev24Pi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_MTMAM)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaMtmam[i][j];
+                    a[j][i] = aaMtmam[j][i];
+                    scaler += mtmamPi[i] * a[i][j] * probOn;
+                    scaler += mtmamPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_RTREV)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aartREV[i][j];
+                    a[j][i] = aartREV[j][i];
+                    scaler += rtrevPi[i] * a[i][j] * probOn;
+                    scaler += rtrevPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_WAG)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaWAG[i][j];
+                    a[j][i] = aaWAG[j][i];
+                    scaler += wagPi[i] * a[i][j] * probOn;
+                    scaler += wagPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_CPREV)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aacpREV[i][j];
+                    a[j][i] = aacpREV[j][i];
+                    scaler += cprevPi[i] * a[i][j] * probOn;
+                    scaler += cprevPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_VT)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaVt[i][j];
+                    a[j][i] = aaVt[j][i];
+                    scaler += vtPi[i] * a[i][j] * probOn;
+                    scaler += vtPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_BLOSUM)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaBlosum[i][j];
+                    a[j][i] = aaBlosum[j][i];
+                    scaler += blosPi[i] * a[i][j] * probOn;
+                    scaler += blosPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else if (aaModelID == AAMODEL_LG)
+            {
+            scaler = 0.0;
+            for (i=0; i<20; i++)
+                {
+                for (j=i+1; j<20; j++)
+                    {
+                    a[i][j] = aaLG[i][j];
+                    a[j][i] = aaLG[j][i];
+                    scaler += lgPi[i] * a[i][j] * probOn;
+                    scaler += lgPi[j] * a[j][i] * probOn;
+                    }
+                }
+            }
+        else
+            {
+            MrBayesPrint ("%s   ERROR: Don't understand which amino acid model is needed\n");
+            return (ERROR);
+            }
+
+        /* rescale off diagonal elements of Q matrix */
+        scaler = 1.0 / scaler;
+        for (i=0; i<20; i++)
+            {
+            for (j=0; j<20; j++)
+                {
+                if (i != j)
+                    a[i][j] *= scaler;
+                }
+            }
+            
+        /* now, scale by rate factor */
+        for (i=0; i<20; i++)
+            {
+            for (j=0; j<20; j++)
+                {
+                if (i != j)
+                    a[i][j] *= rateMult;
+                }
+            }
+            
+        /* put in diagonal elements */
+        for (i=0; i<20; i++)
+            {
+            sum = 0.0;
+            for (j=0; j<20; j++)
+                {
+                if (i != j)
+                    sum += a[i][j];
+                a[i][i] = -(sum + s10);
+                }
+            }
+                
+        /* fill in the other three submatrices */
+        for (i=20; i<40; i++)
+            a[i][i] = -s01;
+        for (i=0; i<20; i++)
+            {
+            a[i][20+i] = s10;
+            a[20+i][i] = s01;
+            }
+                       
+        }
+
+    return (NO_ERROR);
+}
+
+
+int SetStdQMatrix (MrBFlt **a, int nStates, MrBFlt *bs, int cType)
+{
+    register int    i, j;
+    MrBFlt          scaler;
+
+    /* This function sets up ordered or unordered models for standard characters
+       with unequal stationary state frequencies. It requires the stationary
+       frequencies of the states (passed when calling the function). It also
+       needs to know the number of states and the type (ordered or unordered) 
+       of the character. */
+
+    /* set Q matrix to 0 */
+    for (i=0; i<nStates; i++)
+        for (j=0; j<nStates; j++)
+            a[i][j] = 0.0;
+
+    /* initialize Q matrix */
+    scaler = 0.0;
+    if (cType == UNORD)
+        {
+        /* unordered characters */
+        for (i=0; i<nStates; i++)
+            {
+            for (j=0; j<nStates; j++)
+                {
+                if (i != j)
+                    {
+                    a[i][i] -= (a[i][j] = bs[j]);
+                    scaler += bs[i] * a[i][j];
+                    }
+                }
+            }
+        }
+    else
+        {
+        /* ordered characters */
+        for (i=0; i<nStates; i++)
+            {
+            for (j=0; j<nStates; j++)
+                {
+                if (abs(i - j) == 1)
+                    {
+                    a[i][i] -= (a[i][j] = bs[j]);
+                    scaler += bs[i] * a[i][j];
+                    }
+                }
+            }
+        }
+        
+    /* rescale Q matrix */
+    for (i=0; i<nStates; i++)
+        for (j=0; j<nStates; j++)
+            a[i][j] /= scaler;
+
+#   if defined DEBUG_SETSTDQMATRIX
+    for (i=0; i<nStates; i++)
+        {
+        for (j=0; j<nStates; j++)
+            printf ("%0.5lf ", a[i][j]);
+        printf ("\n");
+        }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int TiProbs_Fels (TreeNode *p, int division, int chain)
+{
+    int         i, j, k, index;
+    MrBFlt      t, u, x, z, beta, bigPi_j[4], pij, bigPij,
+                *catRate, baseRate, theRate, *pis, length;
+    CLFlt       *tiP;
+    ModelInfo   *m;
+
+    m = &modelSettings[division];
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+
+    /* get base frequencies */
+    pis = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* get rate multipliers (for gamma & partition specific rates) */
+    theRate = 1.0;
+    baseRate = GetRate (division, chain);
+    /* compensate for invariable sites if appropriate */
+    if (m->pInvar != NULL)
+        baseRate /= (1.0 - (*GetParamVals(m->pInvar, chain, state[chain])));
+    /* get category rates */
+    if (m->shape == NULL)
+        catRate = &theRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+    /* rescale beta */
+    beta =  (0.5 / ((pis[0] + pis[2])*(pis[1] + pis[3]) + ((pis[0]*pis[2]) + (pis[1]*pis[3]))));
+
+    bigPi_j[0] =  (pis[0] + pis[2]);
+    bigPi_j[1] =  (pis[1] + pis[3]);
+    bigPi_j[2] =  (pis[0] + pis[2]);
+    bigPi_j[3] =  (pis[1] + pis[3]);
+
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* numerical errors will ensue if we allow very large or very small branch lengths,
+       which might occur in relaxed clock models */
+
+    /* fill in values */
+    for (k=index=0; k<m->numGammaCats; k++)
+        {
+        t =  length * baseRate * catRate[k];
+
+        if (t < TIME_MIN)
+            {
+            /* Fill in identity matrix */
+            for (i=0; i<4; i++)
+                {
+                for (j=0; j<4; j++)
+                    {
+                    if (i == j)
+                        tiP[index++] = 1.0;
+                    else
+                        tiP[index++] = 0.0;
+                    }
+                }
+            }
+        else if (t > TIME_MAX)
+            {
+            /* Fill in stationary matrix */
+            for (i=0; i<4; i++)
+                for (j=0; j<4; j++)
+                    tiP[index++] = (CLFlt) pis[j];
+            }
+        else
+            {
+            /* calculate probabilities */
+            for (i=0; i<4; i++)
+                {
+                for (j=0; j<4; j++)
+                    {
+                    bigPij = bigPi_j[j];
+                    pij =  pis[j];
+                    u =  1.0/bigPij -  1.0;
+                    x =  exp(-beta * t);
+                    z = (bigPij - pij) / bigPij;
+                    
+                    if (i == j)
+                        tiP[index++] = (CLFlt) (pij + pij * u * x + z * x);
+                    else
+                        tiP[index++] = (CLFlt) (pij + pij * u * x - (pij/bigPij) * x);
+                    }
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   TiProbs_Gen: Calculates transition probabilities for general
+|       models with or without rate variation. This function does
+|       not work with:
+|      
+|       1. codon models with omega variation or
+|       2. covarion models with rate variation
+|
+|   In either of these cases, TiProbs_GenCov is used
+|
+-----------------------------------------------------------------*/
+int TiProbs_Gen (TreeNode *p, int division, int chain)
+{
+    register int    i, j, k, n, s, index;
+    MrBFlt          t, *catRate, baseRate, *eigenValues, *cijk, *bs,
+                    EigValexp[64], sum, *ptr, theRate, correctionFactor,
+                    length;
+    CLFlt           *tiP;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+    n = m->numModelStates;
+    
+    /* find the correction factor to make branch lengths
+       in terms of expected number of substitutions per character */
+    correctionFactor = 1.0;
+    if (m->dataType == DNA || m->dataType == RNA)
+        {
+        if (m->nucModelId == NUCMODEL_DOUBLET)
+            correctionFactor = 2.0;
+        else if (m->nucModelId == NUCMODEL_CODON)
+            correctionFactor = 3.0;
+        }
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+    
+    /* get rate multipliers (for gamma & partition specific rates) */
+    theRate = 1.0;
+    baseRate = GetRate (division, chain);
+    
+    /* compensate for invariable sites if appropriate */
+    if (m->pInvar != NULL)
+        baseRate /= (1.0 - (*GetParamVals(m->pInvar, chain, state[chain])));
+        
+    /* get category rates */
+    if (m->shape == NULL)
+        catRate = &theRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+        
+    /* get eigenvalues and cijk pointers */
+    eigenValues = m->cijks[m->cijkIndex[chain]];
+    cijk        = eigenValues + (2 * n);
+
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* fill in values */
+    for (k=index=0; k<m->numGammaCats; k++)
+        {
+        t =  length * baseRate * catRate[k] * correctionFactor;
+
+        if (t < TIME_MIN)
+            {
+            /* Fill in identity matrix */
+            for (i=0; i<n; i++)
+                {
+                for (j=0; j<n; j++)
+                    {
+                    if (i == j)
+                        tiP[index++] = 1.0;
+                    else
+                        tiP[index++] = 0.0;
+                    }
+                }
+            }
+        else if (t > TIME_MAX)
+            {
+            /* Get base freq */
+            bs = GetParamSubVals(m->stateFreq, chain, state[chain]);
+            /* Fill in stationary matrix */
+            for (i=0; i<n; i++)
+                for (j=0; j<n; j++)
+                    tiP[index++] = (CLFlt) bs[j];
+            }
+        else
+            {
+            /* We actually need to do some work... */
+            for (s=0; s<n; s++)
+                EigValexp[s] =  exp(eigenValues[s] * t);
+
+            ptr = cijk;
+            for (i=0; i<n; i++)
+                {
+                for (j=0; j<n; j++)
+                    {
+                    sum = 0.0;
+                    for (s=0; s<n; s++)
+                        sum += (*ptr++) * EigValexp[s];
+                    tiP[index++] = (CLFlt) ((sum < 0.0) ? 0.0 : sum);
+                    }
+                }
+            }
+        }
+
+#   if 0
+    printf ("v = %lf (%d)\n", t, p->index);
+    for (i=index=0; i<n; i++)
+        {
+        for (j=0; j<n; j++)
+            printf ("%1.4lf ", tiP[index++]);
+        printf ("\n");
+        }
+    printf ("\n");
+#   endif
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   TiProbs_GenCov: Calculates transition probabilities for codon
+|       models with omega variation or covarion models with
+|       rate variation.
+|
+-----------------------------------------------------------------*/
+int TiProbs_GenCov (TreeNode *p, int division, int chain)
+{
+    register int    i, j, k, n, s, index;
+    int             sizeOfSingleCijk;
+    MrBFlt          t, *eigenValues, *cijk, EigValexp[64], sum, *ptr, correctionFactor,
+                    length, *bs;
+    CLFlt           *tiP;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+    n = m->numModelStates;
+    
+    /* find the correction factor to make branch lengths
+       in terms of expected number of substitutions per character */
+    correctionFactor = 1.0;
+    if (m->dataType == DNA || m->dataType == RNA)
+        {
+        if (m->nucModelId == NUCMODEL_DOUBLET)
+            correctionFactor = 2.0;
+        else if (m->nucModelId == NUCMODEL_CODON)
+            correctionFactor = 3.0;
+        }
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+            
+    /* get eigenvalues and cijk pointers */
+    eigenValues = m->cijks[m->cijkIndex[chain]];
+    cijk        = eigenValues + (2 * n);
+    
+    /* get offset size (we need to move the pointers to the appropriate
+       cijk information for these models) */
+    sizeOfSingleCijk = m->cijkLength / m->nCijkParts;
+
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* numerical errors will ensue if we allow very large or very small branch lengths,
+       which might occur in relaxed clock models */
+
+    /* fill in values */
+    for (k=index=0; k<m->nCijkParts; k++)
+        {
+        t =  length * correctionFactor;
+            
+        if (t < TIME_MIN)
+            {
+            /* Fill in identity matrix */
+            for (i=0; i<n; i++)
+                {
+                for (j=0; j<n; j++)
+                    {
+                    if (i == j)
+                        tiP[index++] = 1.0;
+                    else
+                        tiP[index++] = 0.0;
+                    }
+                }
+            }
+        else if (t > TIME_MAX)
+            {
+            /* Get base freq */
+            bs = GetParamSubVals(m->stateFreq, chain, state[chain]);
+            /* Fill in stationary matrix */
+            for (i=0; i<n; i++)
+                for (j=0; j<n; j++)
+                    tiP[index++] = (CLFlt) bs[j];
+            }
+        else
+            {
+            /* We actually need to do some work... */
+            for (s=0; s<n; s++)
+                EigValexp[s] =  exp(eigenValues[s] * t);
+
+            ptr = cijk;
+            for (i=0; i<n; i++)
+                {
+                for (j=0; j<n; j++)
+                    {
+                    sum = 0.0;
+                    for (s=0; s<n; s++)
+                        sum += (*ptr++) * EigValexp[s];
+                    tiP[index++] = (CLFlt) ((sum < 0.0) ? 0.0 : sum);
+                    }
+                }
+                
+            /* increment pointers by m->cijkLength */
+            if (k+1 < m->nCijkParts)
+                {
+                /* shift pointers */
+                eigenValues += sizeOfSingleCijk;
+                cijk        += sizeOfSingleCijk;
+                }
+            }
+        }
+        
+#   if 0
+    for (i=index=0; i<n; i++)
+        {
+        for (j=0; j<n; j++)
+            printf ("%1.4lf ", tiP[index++]);
+        printf ("\n");
+        }
+#   endif
+
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   TiProbs_Hky: update transition probabilities for 4by4
+|       nucleotide model with nst == 2 (K80/HKY85)
+|       with or without rate variation
+|
+------------------------------------------------------------------*/
+int TiProbs_Hky (TreeNode *p, int division, int chain)
+{
+    int         i, j, k, index;
+    MrBFlt      t, kap, u, w, x, y, z, beta, bigPi_j[4], pij, bigPij, *pis,
+                *catRate, baseRate, theRate, length;
+    CLFlt       *tiP;
+    ModelInfo   *m;
+    
+    m = &modelSettings[division];
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+
+    /* get kappa */
+    kap =  *GetParamVals (m->tRatio, chain, state[chain]);
+    
+    /* get base frequencies */
+    pis = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* get rate multipliers (for gamma & partition specific rates) */
+    theRate = 1.0;
+    baseRate = GetRate (division, chain);
+    /* compensate for invariable sites if appropriate */
+    if (m->pInvar != NULL)
+        baseRate /= (1.0 - (*GetParamVals(m->pInvar, chain, state[chain])));
+    /* get category rates */
+    if (m->shape == NULL)
+        catRate = &theRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+    /* rescale beta */
+    beta =  0.5 / ((pis[0] + pis[2])*(pis[1] + pis[3]) + kap*((pis[0]*pis[2]) + (pis[1]*pis[3])));
+
+    bigPi_j[0] = pis[0] + pis[2];
+    bigPi_j[1] = pis[1] + pis[3];
+    bigPi_j[2] = pis[0] + pis[2];
+    bigPi_j[3] = pis[1] + pis[3];
+
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* numerical errors will ensue if we allow very large or very small branch lengths,
+       which might occur in relaxed clock models */
+
+    /* fill in values */
+    for (k=index=0; k<m->numGammaCats; k++)
+        {
+        t =  length * baseRate * catRate[k];
+
+        if (t < TIME_MIN)
+            {
+            /* Fill in identity matrix */
+            for (i=0; i<4; i++)
+                {
+                for (j=0; j<4; j++)
+                    {
+                    if (i == j)
+                        tiP[index++] = 1.0;
+                    else
+                        tiP[index++] = 0.0;
+                    }
+                }
+            }
+        else if (t > TIME_MAX)
+            {
+            /* Fill in stationary matrix */
+            for (i=0; i<4; i++)
+                for (j=0; j<4; j++)
+                    tiP[index++] = (CLFlt) pis[j];
+            }
+        else
+            {
+            /* calculate probabilities */
+            for (i=0; i<4; i++)
+                {
+                for (j=0; j<4; j++)
+                    {
+                    bigPij = bigPi_j[j];
+                    pij = pis[j];
+                    u =  1.0/bigPij -  1.0;
+                    w = -beta * (1.0 + bigPij * (kap -  1.0));
+                    x =  exp(-beta * t);
+                    y =  exp(w * t);
+                    z = (bigPij - pij) / bigPij;
+                    
+                    if (i == j)
+                        tiP[index++] = (CLFlt) (pij + pij * u * x + z * y);
+                    else if ((i == 0 && j == 2) || (i == 2 && j == 0) || (i == 1 && j == 3) || (i == 3 && j == 1))
+                        tiP[index++] = (CLFlt) (pij + pij * u * x - (pij/bigPij) * y);
+                    else
+                        tiP[index++] = (CLFlt) (pij * (1.0 - x));
+                    }
+                }
+            }
+        }
+        
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   TiProbs_JukesCantor: update transition probabilities for 4by4
+|       nucleotide model with nst == 1 (Jukes-Cantor)
+|       with or without rate variation
+|
+------------------------------------------------------------------*/
+int TiProbs_JukesCantor (TreeNode *p, int division, int chain)
+{
+    /* calculate Jukes Cantor transition probabilities */
+    
+    int         i, j, k, index;
+    MrBFlt      t, *catRate, baseRate, length;
+    CLFlt       pNoChange, pChange, *tiP;
+    ModelInfo   *m;
+    
+    m = &modelSettings[division];
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+
+    baseRate =  1.0;
+    if (m->shape == NULL)
+        catRate = &baseRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* numerical errors will ensue if we allow very large or very small branch lengths,
+       which might occur in relaxed clock models */
+
+    /* fill in values */
+    for (k=index=0; k<m->numGammaCats; k++)
+        {
+        t = length*catRate[k];
+            
+        if (t < TIME_MIN)
+            {
+            /* Fill in identity matrix */
+            for (i=0; i<4; i++)
+                {
+                for (j=0; j<4; j++)
+                    {
+                    if (i == j)
+                        tiP[index++] = 1.0;
+                    else
+                        tiP[index++] = 0.0;
+                    }
+                }
+            }
+        else if (t > TIME_MAX)
+            {
+            /* Fill in stationary matrix */
+            for (i=0; i<4; i++)
+                for (j=0; j<4; j++)
+                    tiP[index++] = 0.25;
+            }
+        else
+            {
+            /* calculate probabilities */
+            pChange   = (CLFlt) (0.25 - 0.25 * exp(-(4.0/3.0)*t));
+            pNoChange = (CLFlt) (0.25 + 0.75 * exp(-(4.0/3.0)*t));
+            for (i=0; i<4; i++)
+                {
+                for (j=0; j<4; j++)
+                    {
+                    if (i == j)
+                        tiP[index++] = pNoChange;
+                    else
+                        tiP[index++] = pChange;
+                    }
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   TiProbs_Res: update transition probabilities for binary
+|       restriction site model with or without rate variation
+|
+------------------------------------------------------------------*/
+int TiProbs_Res (TreeNode *p, int division, int chain)
+{
+    int         k, index;
+    MrBFlt      baseRate, eV, mu, theRate, v,
+                *bs, *catRate, length;
+    CLFlt       *tiP;
+    ModelInfo   *m;
+    
+    /* find model settings for the division */
+    m = &modelSettings[division];
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+
+    /* find rates */
+    baseRate = GetRate (division, chain);
+    theRate = 1.0;
+    if (m->shape == NULL)
+        catRate = &theRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+    /* find base frequencies */
+    bs = GetParamSubVals(m->stateFreq, chain, state[chain]);
+
+    /* calculate scaling factor */
+    mu =  1.0 / (2.0 * bs[0] * bs[1]);
+    
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* numerical errors will ensue if we allow very large or very small branch lengths,
+       which might occur in relaxed clock models */
+
+    /* fill in values */
+    for (k=index=0; k<m->numGammaCats; k++)
+        {       
+        v =  length * baseRate * catRate[k];
+            
+        if (v < TIME_MIN)
+            {
+            /* Fill in identity matrix */
+            tiP[index++] = (CLFlt) (bs[0] + bs[1]);
+            tiP[index++] = (CLFlt) (bs[1] - bs[1]);
+            tiP[index++] = (CLFlt) (bs[0] - bs[0]);
+            tiP[index++] = (CLFlt) (bs[1] + bs[0]);
+            }
+        else if (v > TIME_MAX)
+            {
+            /* Fill in stationary matrix */
+            tiP[index++] = (CLFlt) bs[0];
+            tiP[index++] = (CLFlt) bs[1];
+            tiP[index++] = (CLFlt) bs[0];
+            tiP[index++] = (CLFlt) bs[1];
+            }
+        else
+            {
+            /* calculate probabilities */
+            eV =  exp(-mu * v);
+            tiP[index++] = (CLFlt) (bs[0] + bs[1] * eV);
+            tiP[index++] = (CLFlt) (bs[1] - bs[1] * eV);
+            tiP[index++] = (CLFlt) (bs[0] - bs[0] * eV);
+            tiP[index++] = (CLFlt) (bs[1] + bs[0] * eV);
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   TiProbs_Std: update transition probabilities for
+|       variable states model with or without rate variation
+|
+------------------------------------------------------------------*/
+int TiProbs_Std (TreeNode *p, int division, int chain)
+{
+    int         b, c, i, j, k, n, s, nStates, index=0, index2;
+    MrBFlt      v, eV1, eV2, eV3, eV4, eV5, *catRate,
+                baseRate, theRate, pi, f1, f2, f3, f4, f5, f6, f7, root,
+                *eigenValues, *cijk, sum, *bs, mu, length;
+    CLFlt       pNoChange, pChange, *tiP;
+    ModelInfo   *m;
+#   if defined (DEBUG_TIPROBS_STD)
+    int         index3;
+#   endif
+
+    m = &modelSettings[division];
+
+    /* find transition probabilities */
+    tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+    
+    /* get rate multiplier */
+    theRate = 1.0;
+    baseRate = GetRate (division, chain);
+
+    /* get category rates */
+    if (m->shape == NULL)
+        catRate = &theRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+#   if defined (DEBUG_TIPROBS_STD)
+    /* find base frequencies */
+    bs = GetParamStdStateFreqs (m->stateFreq, chain, state[chain]);
+#   endif
+
+    /* find length */
+    if (m->cppEvents != NULL)
+        {
+        length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+        }
+    else if (m->tk02BranchRates != NULL)
+        {
+        length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->igrBranchRates != NULL)
+        {
+        length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+        }
+    else if (m->mixedBrchRates != NULL)
+        {
+        length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+        }
+    else
+        length = p->length;
+
+    /* numerical errors will ensue if we allow very large or very small branch lengths, which might
+       occur in relaxed clock models; an elegant solution would be to substitute the stationary
+       probs and initial probs but for now we truncate lengths at small or large values TODO */
+    if (length > BRLENS_MAX)
+        length = BRLENS_MAX;
+    else if (length < BRLENS_MIN)
+        length = BRLENS_MIN;
+
+    /* fill in values; this has to be done differently if state freqs are not equal */
+    if (m->stateFreq->paramId == SYMPI_EQUAL)
+        {
+        /* equal state frequencies */
+        /* fill in values for unordered characters */
+        index = 0;
+#   if defined (DEBUG_TIPROBS_STD)
+        index3 = 0;
+#   endif
+        for (nStates=2; nStates<=10; nStates++)
+            {
+            if (m->isTiNeeded[nStates-2] == NO)
+                continue;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                /* calculate probabilities */
+                v =  length*catRate[k]*baseRate;
+                eV1 =  exp(-(nStates / (nStates -  1.0)) * v);
+                pChange   = (CLFlt) ((1.0 / nStates) - ((1.0 / nStates) * eV1));
+                pNoChange = (CLFlt) ((1.0 / nStates) + ((nStates - 1.0) / nStates) * eV1);
+                if (pChange<0.0)
+                    pChange = (CLFlt) 0.0;
+                for (i=0; i<nStates; i++)
+                    {
+                    for (j=0; j<nStates; j++)
+                        {
+                        if (i == j)
+                            tiP[index++] = pNoChange;
+                        else
+                            tiP[index++] = pChange;
+                        }
+                    }
+#   if defined (DEBUG_TIPROBS_STD)
+                PrintTiProbs (tiP+index-(nStates*nStates), bs+index3, nStates);
+#   endif
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+            index3 += nStates;
+#   endif
+            }
+
+        /* fill in values for 3-state ordered character */
+        if (m->isTiNeeded[9] == YES)
+            {
+            nStates = 3;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                /* calculate probabilities */
+                v =  length * catRate[k] * baseRate;
+                eV1 =  exp (-(3.0 / 4.0) * v);
+                eV2 =  exp (-(9.0 / 4.0) * v);
+                
+                /* pij(0,0) */
+                tiP[index] = (CLFlt) ((1.0 / 3.0) + (eV1 / 2.0) + (eV2 / 6.0));
+                /* pij(0,1) = pij(1,0) */
+                tiP[index+1] = tiP[index+3] = (CLFlt) ((1.0 / 3.0) - (eV2 / 3.0));
+                /* pij(0,2) */
+                tiP[index+2] = (CLFlt) ((1.0 / 3.0) - (eV1 / 2.0) + (eV2 / 6.0));
+                /* pij(1,1) */
+                tiP[index+4] = (CLFlt) ((1.0 / 3.0) + (2.0 * eV2 / 3.0));
+                
+                /* fill in mirror part of matrix */
+                index += 5;
+                index2 = index - 2;
+                for (i=0; i<4; i++)
+                    tiP[index++] = tiP[index2--];
+
+                /* make sure no value is negative */
+                for (i=index-(nStates*nStates); i<index; i++) {
+                    if (tiP[i] < 0.0)
+                        tiP[i] = (CLFlt) 0.0;
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+                PrintTiProbs (tiP+index-(nStates*nStates), bs+index3, nStates);
+#   endif
+                }
+
+#   if defined (DEBUG_TIPROBS_STD)
+            index3 += nStates;
+#   endif
+            }
+
+        /* 4-state ordered character */
+        if (m->isTiNeeded[10] == YES)
+            {
+            nStates = 4;
+            pi = 1.0 / 4.0;
+            root =  sqrt (2.0);
+            f1 = root +  1.0;
+            f2 = root -  1.0;
+
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                /* calculate probabilities */
+                v =  length * catRate[k] * baseRate;
+                eV1 =  1.0 / (exp ((4.0 * v) / 3.0));
+                eV2 =  exp ((2.0 * (root - 2.0) * v) / 3.0) / root;
+                eV3 =  1.0 / (root *  exp ((2.0 * (root + 2.0) * v) / 3.0));
+                
+                /* pij(0,0) */
+                tiP[index] = (CLFlt) (pi * (1.0 + eV1 + (f1*eV2) + (f2*eV3)));
+                /* pij(0,1) = pij(1,0) */
+                tiP[index+1] = tiP[index+4] = (CLFlt) (pi * (1.0 - eV1 + eV2 - eV3));
+                /* pij(0,2) = tiP(1,3) */
+                tiP[index+2] = tiP[index+7] = (CLFlt) (pi * (1.0 - eV1 - eV2 + eV3));
+                /* pij(0,3) */
+                tiP[index+3] = (CLFlt) (pi * (1.0 + eV1 - (f1*eV2) - (f2*eV3)));
+                /* pij(1,1) */
+                tiP[index+5] = (CLFlt) (pi * (1.0 + eV1 + (f2*eV2) + (f1*eV3)));
+                /* pij(1,2) */
+                tiP[index+6] = (CLFlt) (pi * (1.0 + eV1 - (f2*eV2) - (f1*eV3)));
+
+                /* fill in mirror part of matrix */
+                index += 8;
+                index2 = index - 1;
+                for (i=0; i<8; i++)
+                    tiP[index++] = tiP[index2--];
+        
+                /* make sure no value is negative */
+                for (i=index-(nStates*nStates); i<index; i++) {
+                    if (tiP[i] < 0.0)
+                        tiP[i] = (CLFlt) 0.0;
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+                PrintTiProbs (tiP+index-(nStates*nStates), bs+index3, nStates);
+#   endif
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+            index3 += nStates;
+#   endif
+            }
+
+        /* 5-state ordered character */
+        if (m->isTiNeeded[11] == YES)
+            {
+            nStates = 5;
+            pi = 1.0 / 5.0;
+            root =  sqrt (5.0);
+
+            f5 = root /  4.0;
+            f1 =  0.75 + f5;;
+            f2 =  1.25 + f5;
+            f3 =  1.25 - f5;
+            f4 =  0.75 - f5;
+            f5 = f5 *  2.0;
+            f6 = f5 +  0.5;
+            f7 = f5 -  0.5;
+
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                /* calculate probabilities */
+                v =  length * catRate[k] * baseRate;
+                v *=  5.0 /  16.0;
+
+                eV1 =  exp ((root -  3.0) * v);
+                eV2 =  exp (-(root +  3.0) * v);
+                eV3 =  exp ((root -  5.0) * v);
+                eV4 =  exp (-(root +  5.0) * v);
+
+                /* pij(0,0) */
+                tiP[index] = (CLFlt) (pi* (1.0 + (f1*eV3) + (f2*eV1) + (f3*eV2) + (f4*eV4)));
+                /* pij(0,1) = pij(1,0) */
+                tiP[index+1] = tiP[index+5] =
+                    (CLFlt) (pi*(1.0 - (eV3/2.0) + (f5*eV1) - (f5*eV2) - (eV4/2.0)));
+                /* pij(0,2) = pij(2,0) */
+                tiP[index+2] = tiP[index+10] = (CLFlt) (pi*(1.0 - (f6*eV3) + (f7*eV4)));
+                /* pij(0,3) = pij(1,4) */
+                tiP[index+3] = tiP[index+9] =
+                    (CLFlt) (pi*(1.0 - (eV3/2.0) - (f5*eV1) + (f5*eV2) - (eV4/2.0)));
+                /* pij(0,4) */
+                tiP[index+4] = (CLFlt) (pi*(1.0 + (f1*eV3) - (f2*eV1) - (f3*eV2) + (f4*eV4)));
+                /* pij(1,1) */
+                tiP[index+6] = (CLFlt) (pi*(1.0 + (f4*eV3) + (f3*eV1) + (f2*eV2) + (f1*eV4)));
+                /* pij(1,2) = pij(2,1) */
+                tiP[index+7] = tiP[index+11] = (CLFlt) (pi*(1.0 + (f7*eV3) - (f6*eV4)));
+                /* pij(1,3) */
+                tiP[index+8] = (CLFlt) (pi*(1.0 + (f4*eV3) - (f3*eV1) - (f2*eV2) + (f1*eV4)));
+                /* pij(2,2) */
+                tiP[index+12] = (CLFlt) (pi*(1.0 + (2.0*eV3) + (2.0*eV4)));
+
+                /* fill in mirror part of matrix */
+                index += 13;
+                index2 = index - 2;
+                for (i=0; i<12; i++)
+                    tiP[index++] = tiP[index2--];
+
+                /* make sure no value is negative */
+                for (i=index-(nStates*nStates); i<index; i++) {
+                    if (tiP[i] < 0.0)
+                        tiP[i] = (CLFlt) 0.0;
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+                PrintTiProbs (tiP+index-(nStates*nStates), bs+index3, nStates);
+#   endif
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+            index3 += nStates;
+#   endif
+            }
+
+        /* 6-state ordered character */
+        if (m->isTiNeeded[12] == YES)
+            {
+            nStates = 6;
+            pi =  1.0 /  6.0;
+            root =  sqrt (3.0);
+
+            f4 = (3.0 / (2.0 * root));
+            f1 =  1.0 + f4;
+            f2 =  1.0 - f4;
+            f3 =  0.5 + f4;
+            f4 =  0.5 - f4;
+
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                /* calculate probabilities */
+                v =  length * catRate[k] * baseRate;
+                v /=  5.0;
+
+                eV1 =  exp (-9 * v);
+                eV2 =  exp (-6 * v);
+                eV3 =  exp (-3 * v);
+                eV4 =  exp (3.0 * (root - 2.0) * v);
+                eV5 =  exp (-3.0 * (root + 2.0) * v);
+
+                /* pij(0,0) */
+                tiP[index] = (CLFlt) (pi* (1.0 + (0.5*eV1) + eV2 + (1.5*eV3) + (f1*eV4) + (f2*eV5)));
+                /* pij(0,1) = pij(1,0) */
+                tiP[index+1] = tiP[index+6] = (CLFlt) (pi*(1.0 - eV1 - eV2 + (f3*eV4) + (f4*eV5)));
+                /* pij(0,2) = pij(2,0) */
+                tiP[index+2] = tiP[index+12] = 
+                    (CLFlt) (pi*(1.0 + (0.5*eV1) - eV2 - (1.5*eV3) + (0.5*eV4) + (0.5*eV5)));
+                /* pij(0,3) = pij(2,5) */
+                tiP[index+3] = tiP[index+17] = 
+                    (CLFlt) (pi*(1.0 + (0.5*eV1) + eV2 - (1.5*eV3) - (0.5*eV4) - (0.5*eV5)));
+                /* pij(0,4) = pij(1,5) */
+                tiP[index+4] = tiP[index+11] = (CLFlt) (pi*(1.0 - eV1 + eV2 - (f3*eV4) - (f4*eV5)));
+                /* pij(0,5) */
+                tiP[index+5] = (CLFlt) (pi*(1.0 + (0.5*eV1) - eV2 + (1.5*eV3) - (f1*eV4) - (f2*eV5)));
+                /* pij(1,1) */
+                tiP[index+7] = (CLFlt) (pi*(1.0 + (2.0*eV1) + eV2 + eV4 + eV5));
+                /* pij(1,2) = pij(2,1) */
+                tiP[index+8] = tiP[index+13] = (CLFlt) (pi*(1.0 - eV1 + eV2 - (f4*eV4) - (f3*eV5)));
+                /* pij(1,3) = pij(2,4) */
+                tiP[index+9] = tiP[index+16] = (CLFlt) (pi*(1.0 - eV1 - eV2 + (f4*eV4) + (f3*eV5)));
+                /* pij(1,4) */
+                tiP[index+10] = (CLFlt) (pi*(1.0 + (2.0*eV1) - eV2 - eV4 - eV5));
+                /* pij(2,2) */
+                tiP[index+14] = (CLFlt) (pi*(1.0 + (0.5*eV1) + eV2 + (1.5*eV3) + (f2*eV4) + (f1*eV5)));
+                /* pij(2,3) */
+                tiP[index+15] = (CLFlt) (pi*(1.0 + (0.5*eV1) - eV2 + (1.5*eV3) - (f2*eV4) - (f1*eV5)));
+
+                /* fill in mirror part of matrix */
+                index += 18;
+                index2 = index - 1;
+                for (i=0; i<18; i++)
+                    tiP[index++] = tiP[index2--];
+
+                /* make sure no value is negative */
+                for (i=index-(nStates*nStates); i<index; i++) {
+                    if (tiP[i] < 0.0)
+                        tiP[i] = (CLFlt) 0.0;
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+                PrintTiProbs (tiP+index-(nStates*nStates), bs+index3, nStates);
+#   endif
+                }
+#   if defined (DEBUG_TIPROBS_STD)
+            index3 += nStates;
+#   endif
+            }
+        }
+    else
+        {
+        /* unequal state frequencies */
+        index = 0;
+
+        /* first fill in for binary characters using beta categories if needed */
+        if (m->isTiNeeded[0] == YES)
+            {
+            /* find base frequencies */
+            bs = GetParamStdStateFreqs (m->stateFreq, chain, state[chain]);
+
+            /* cycle through beta and gamma cats */
+            for (b=0; b<m->numBetaCats; b++)
+                {
+                mu =  1.0 / (2.0 * bs[0] * bs[1]);
+                for (k=0; k<m->numGammaCats; k++)
+                    {
+                    /* calculate probabilities */
+                    v =  length*catRate[k]*baseRate;
+                    eV1 =  exp(- mu * v);
+                    tiP[index++] = (CLFlt) (bs[0] + (bs[1] * eV1));
+                    tiP[index++] = (CLFlt) (bs[1] - (bs[1] * eV1));
+                    tiP[index++] = (CLFlt) (bs[0] - (bs[0] * eV1));
+                    tiP[index++] = (CLFlt) (bs[1] + (bs[0] * eV1));
+                    }
+                /* update stationary state frequency pointer */
+                bs += 2;
+                }
+            }
+
+        /* now use general algorithm for the other cases */
+        if (m->cijkLength > 0)
+            {
+            /* first update cijk if necessary */
+            if (m->cijkLength > 0 && m->upDateCijk == YES)
+                {
+                if (UpDateCijk (division, chain) == ERROR)
+                    return (ERROR);
+                }
+
+            /* then get first set of eigenvalues */
+            eigenValues = m->cijks[m->cijkIndex[chain]];
+
+            /* and cycle through the relevant characters */
+            for (c=0; c<m->stateFreq->nSympi; c++)
+                {
+                n = m->stateFreq->sympinStates[c];
+
+                /* fill in values */
+                for (k=0; k<m->numGammaCats; k++)
+                    {
+                    v =  length * baseRate * catRate[k];
+                    cijk = eigenValues + (2 * n);
+
+                    for (i=0; i<n; i++)
+                        {
+                        for (j=0; j<n; j++)
+                            {
+                            sum = 0.0;
+                            for (s=0; s<n; s++)
+                                sum += (*cijk++) * exp(eigenValues[s] * v);
+                            tiP[index++] = (CLFlt) ((sum <  0.0) ?  0.0 : sum);
+                            }
+                        }
+                    }
+
+                /* update eigenValues pointer */
+                eigenValues += (n * n * n) + (2 * n);
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+int UpDateCijk (int whichPart, int whichChain)
+{
+    int         c, i, j, k, n, n3, isComplex, sizeOfSingleCijk, cType, numQAllocated;
+    MrBFlt      **q[100], **eigvecs, **inverseEigvecs;
+    MrBFlt      *eigenValues, *eigvalsImag, *cijk;
+    MrBFlt      *bs, *bsBase, *rateOmegaValues=NULL, rA=0.0, rS=0.0, posScaler, *omegaCatFreq=NULL;
+    complex     **Ceigvecs, **CinverseEigvecs;
+    ModelInfo   *m;
+    Param       *p;
+#   if defined (BEAGLE_ENABLED)
+    int         u;
+    double      *beagleEigvecs=NULL, *beagleInverseEigvecs=NULL;
+#   endif
+
+    /* get a pointer to the model settings for this partition */
+    m = &modelSettings[whichPart];
+    assert (m->upDateCijk == YES);
+    
+    /* we should only go through here if we have cijk information available for the partition */
+    if (m->cijkLength > 0) 
+        {
+        /* flip cijk space */
+        FlipCijkSpace(m, whichChain);
+        
+        /* figure out information on either omega values or rate values, if necessary */
+        if (m->dataType == DNA || m->dataType == RNA)
+            {
+            if (m->nucModelId == NUCMODEL_CODON)                                                    /* we have a NY98 model     */
+                {
+                rateOmegaValues = GetParamVals(m->omega, whichChain, state[whichChain]);
+                if (m->numOmegaCats > 1)
+                    omegaCatFreq = GetParamSubVals (m->omega, whichChain, state[whichChain]);
+                }
+            else if (m->nCijkParts > 1 && m->nucModelId == NUCMODEL_4BY4 && m->numModelStates == 8) /* we have a covarion model */
+                rateOmegaValues = GetParamSubVals (m->shape, whichChain, state[whichChain]);        /* with rate variation      */
+            }
+        else if (m->dataType == PROTEIN)
+            {
+            if (m->nCijkParts > 1)                                                                  /* we have a covarion model */
+                rateOmegaValues = GetParamSubVals (m->shape, whichChain, state[whichChain]);        /* with rate variation      */
+            }
+#   if defined (BEAGLE_ENABLED)
+        else if (m->dataType == RESTRICTION){}
+#   endif
+        else if (m->dataType != STANDARD)
+            {
+            MrBayesPrint ("%s   ERROR: Should not be updating cijks!\n", spacer);
+            return (ERROR);
+            }
+        
+        if (m->dataType == STANDARD)
+            {
+            /* set pointers and other stuff needed */
+            numQAllocated = 1;
+            p = m->stateFreq;
+            eigenValues = m->cijks[m->cijkIndex[whichChain]];
+            q[0] = AllocateSquareDoubleMatrix (10);
+            eigvecs = AllocateSquareDoubleMatrix (10);
+            inverseEigvecs = AllocateSquareDoubleMatrix (10);
+            Ceigvecs = AllocateSquareComplexMatrix (10);
+            CinverseEigvecs = AllocateSquareComplexMatrix (10);
+            bsBase = GetParamStdStateFreqs (m->stateFreq, whichChain, state[whichChain]);
+            
+            /* cycle over characters needing cijks */
+            for (c=0; c<p->nSympi; c++)
+                {
+                n = p->sympinStates[c];
+                bs = bsBase + p->sympiBsIndex[c];
+                cType = p->sympiCType[c];
+                n3 = n * n * n;
+                eigvalsImag = eigenValues + n;
+                cijk = eigenValues + (2 * n);
+                if (SetStdQMatrix (q[0], n, bs, cType) == ERROR)
+                    return (ERROR);
+                isComplex = GetEigens (n, q[0], eigenValues, eigvalsImag, eigvecs, inverseEigvecs, Ceigvecs, CinverseEigvecs);
+                if (isComplex == NO)
+                    {
+                    CalcCijk (n, cijk, eigvecs, inverseEigvecs);
+                    }
+                else
+                    {
+                    if (isComplex == YES)
+                        MrBayesPrint ("%s   ERROR: Complex eigenvalues found!\n", spacer);
+                    else
+                        MrBayesPrint ("%s   ERROR: Computing eigenvalues problem!\n", spacer);
+                    goto errorExit;
+                    }
+                eigenValues += (n3 + (2 * n));
+                }
+            }
+        else
+            {
+            /* all other data types */
+            numQAllocated = m->nCijkParts;
+            sizeOfSingleCijk = m->cijkLength / m->nCijkParts;
+            n = m->numModelStates;
+            n3 = n * n * n;
+#   if defined (BEAGLE_ENABLED)
+            if (m->useBeagle == YES)
+                eigenValues = m->cijks[m->cijkIndex[whichChain]/m->nCijkParts];
+            else
+                eigenValues = m->cijks[m->cijkIndex[whichChain]];
+#   else
+            eigenValues = m->cijks[m->cijkIndex[whichChain]];
+#   endif
+            eigvalsImag = eigenValues + n;
+            cijk        = eigenValues + (2 * n);
+            for (k=0; k<numQAllocated; k++)
+                q[k] = AllocateSquareDoubleMatrix (n);
+            eigvecs = AllocateSquareDoubleMatrix (n);
+            inverseEigvecs = AllocateSquareDoubleMatrix (n);
+            Ceigvecs = AllocateSquareComplexMatrix (n);
+            CinverseEigvecs = AllocateSquareComplexMatrix (n);
+            bs = GetParamSubVals (m->stateFreq, whichChain, state[whichChain]);
+            
+            if (m->nCijkParts == 1)
+                {
+                if (m->dataType == DNA || m->dataType == RNA)
+                    {
+                    if (m->nucModelId == NUCMODEL_CODON)
+                        {
+                        if (SetNucQMatrix (q[0], n, whichChain, whichPart, rateOmegaValues[0], &rA, &rS) == ERROR)
+                            goto errorExit;
+                        }
+                    else
+                        {
+                        if (SetNucQMatrix (q[0], n, whichChain, whichPart, 1.0, &rA, &rS) == ERROR)
+                            goto errorExit;
+                        }
+                    }
+#   if defined (BEAGLE_ENABLED)
+                else if (m->dataType == RESTRICTION)
+                    {
+                    SetBinaryQMatrix (q[0], whichChain, whichPart);
+                    }
+#   endif
+                else
+                    {
+                    if (SetProteinQMatrix (q[0], n, whichChain, whichPart, 1.0) == ERROR)
+                        goto errorExit;
+                    }
+                isComplex = GetEigens (n, q[0], eigenValues, eigvalsImag, eigvecs, inverseEigvecs, Ceigvecs, CinverseEigvecs);
+#   if defined (BEAGLE_ENABLED)
+                if (isComplex == YES)
+                    {
+                    if (isComplex == YES)
+                        MrBayesPrint ("%s   ERROR: Complex eigenvalues found!\n", spacer);
+                    else
+                        MrBayesPrint ("%s   ERROR: Computing eigenvalues problem!\n", spacer);
+                    goto errorExit;
+                    }
+                if (m->useBeagle == YES)
+                    {
+                    /* TODO: only allocate this space once at initialization */
+                    beagleEigvecs = (double*) SafeCalloc (2*n*n, sizeof(double));
+                    beagleInverseEigvecs = beagleEigvecs + n*n;
+                    for (i=k=0; i<n; i++)
+                        {
+                        // eigenValues[i] = 0.1;
+                        for (j=0; j<n; j++)
+                            {
+                            beagleEigvecs[k] = eigvecs[i][j];
+                            beagleInverseEigvecs[k] = inverseEigvecs[i][j];
+                            k++;
+                            }
+                        }
+                    beagleSetEigenDecomposition(m->beagleInstance,
+                                                m->cijkIndex[whichChain],
+                                                beagleEigvecs,
+                                                beagleInverseEigvecs,
+                                                eigenValues);
+                    free(beagleEigvecs);
+                    }
+                else
+                    {
+                    CalcCijk (n, cijk, eigvecs, inverseEigvecs);
+                    }
+#   else
+                if (isComplex == NO)
+                    {
+                    CalcCijk (n, cijk, eigvecs, inverseEigvecs);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   ERROR: Complex eigenvalues found!\n", spacer);
+                    goto errorExit;
+                    }
+#   endif
+                }
+            else
+                {
+                /* Here, we calculate the rate matrices (Q) for various nucleotide and amino acid
+                   data models. Usually, when the rate matrix is set in SetNucQMatrix, it is scaled
+                   such that the average substitution rate is one. However, there is a complication
+                   for positive selection models using codon rate matrices. First, we have more than
+                   one matrix; in fact, we have as many rate matrices as there are omega values. Second,
+                   the mean substitution rate still has to be one. And third, we want the synonymous
+                   rate to be the same across the rate matrices. For positive selection models, the Q
+                   matrix comes out of SetNucQMatrix unscaled. Once we have all m->nCijkParts rate 
+                   matrices, we then scale again, this time to ensure that the mean substitution rate is one. */
+
+                /* First, calculate rate matrices for each category: */
+                posScaler = 0.0;
+                for (k=0; k<m->nCijkParts; k++)
+                    {
+                    if (m->dataType == DNA || m->dataType == RNA)
+                        {
+                        if (SetNucQMatrix (q[k], n, whichChain, whichPart, rateOmegaValues[k], &rA, &rS) == ERROR)
+                            goto errorExit;
+                        }
+                    else
+                        {
+                        if (SetProteinQMatrix (q[k], n, whichChain, whichPart, rateOmegaValues[k]) == ERROR)
+                            goto errorExit;
+                        }
+                    if (m->nucModelId == NUCMODEL_CODON && m->numOmegaCats > 1)
+                        posScaler += omegaCatFreq[k] * (rS + rA);
+                    }
+                    
+                /* Then rescale the rate matrices, if this is a positive selection model: */
+                if (m->nucModelId == NUCMODEL_CODON && m->numOmegaCats > 1)
+                    {
+                    posScaler = 1.0 / posScaler;
+                    for (k=0; k<m->nCijkParts; k++)
+                        {
+                        for (i=0; i<n; i++)
+                            for (j=0; j<n; j++)
+                                q[k][i][j] *= posScaler;
+                        }
+                    }
+
+                /* Finally, calculate eigenvalues, etc.: */
+#   if defined (BEAGLE_ENABLED)
+                if (m->useBeagle == YES)
+                    {
+                    /* TODO: only allocate this space once at initialization */
+                    beagleEigvecs = (double*) SafeCalloc (2*n*n, sizeof(double));
+                    beagleInverseEigvecs = beagleEigvecs + n*n;
+                    }
+#   endif
+                for (k=0; k<m->nCijkParts; k++)
+                    {
+                    isComplex = GetEigens (n, q[k], eigenValues, eigvalsImag, eigvecs, inverseEigvecs, Ceigvecs, CinverseEigvecs);
+#   if defined (BEAGLE_ENABLED)
+                    if (isComplex == YES)
+                        {
+                        if (isComplex == YES)
+                            MrBayesPrint ("%s   ERROR: Complex eigenvalues found!\n", spacer);
+                        else
+                            MrBayesPrint ("%s   ERROR: Computing eigenvalues problem!\n", spacer);
+                        goto errorExit;
+                        }
+                    if (m->useBeagle == YES)
+                        {
+                        for (i=u=0; i<n; i++)
+                            {
+                            for (j=0; j<n; j++)
+                                {
+                                beagleEigvecs[u] = eigvecs[i][j];
+                                beagleInverseEigvecs[u] = inverseEigvecs[i][j];
+                                u++;
+                                }
+                            }
+
+                        beagleSetEigenDecomposition(m->beagleInstance,
+                                                    m->cijkIndex[whichChain] + k,
+                                                    beagleEigvecs,
+                                                    beagleInverseEigvecs,
+                                                    eigenValues);
+                        }
+                    else
+                        {
+                        CalcCijk (n, cijk, eigvecs, inverseEigvecs);
+                        }
+#   else
+                    if (isComplex == NO)
+                        {
+                        CalcCijk (n, cijk, eigvecs, inverseEigvecs);
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   ERROR: Complex eigenvalues found!\n", spacer);
+                        goto errorExit;
+                        }
+#   endif
+                    /* shift pointers */
+                    eigenValues += sizeOfSingleCijk;
+                    eigvalsImag += sizeOfSingleCijk;
+                    cijk        += sizeOfSingleCijk;
+                    }
+#   if defined (BEAGLE_ENABLED)
+                free(beagleEigvecs);
+#   endif
+                }
+            }
+            
+        for (k=0; k<numQAllocated; k++)
+            FreeSquareDoubleMatrix (q[k]);
+        FreeSquareDoubleMatrix (eigvecs);
+        FreeSquareDoubleMatrix (inverseEigvecs);
+        FreeSquareComplexMatrix (Ceigvecs);
+        FreeSquareComplexMatrix (CinverseEigvecs);
+        }
+        
+    return (NO_ERROR);
+
+    errorExit:      
+        for (k=0; k<numQAllocated; k++)
+            FreeSquareDoubleMatrix (q[k]);
+        FreeSquareDoubleMatrix (eigvecs);
+        FreeSquareDoubleMatrix (inverseEigvecs);
+        FreeSquareComplexMatrix (Ceigvecs);
+        FreeSquareComplexMatrix (CinverseEigvecs);
+
+        return ERROR;
+}
+
diff --git a/src/likelihood.h b/src/likelihood.h
new file mode 100644 (file)
index 0000000..fe0dcdf
--- /dev/null
@@ -0,0 +1,134 @@
+#ifndef __LIKELIHOOD_H__
+#define __LIKELIHOOD_H__
+
+//#define TIMING_ANALIZ
+#if defined (TIMING_ANALIZ)
+    static clock_t         CPUCondLikeDown;
+    static clock_t         CPUScalers;
+    static clock_t         CPUScalersRemove;
+    static clock_t         CPUCondLikeRoot;
+    static clock_t         CPULilklihood;
+
+    #define TIME(X1,CPUtime)\
+        {CPUTimeStart = clock();\
+        X1;\
+        CPUtime += (clock()-CPUTimeStart);}
+#else
+    #define TIME(X1,CPUtime)\
+        X1;
+#endif
+
+#define A                           0
+#define C                           1
+#define G                           2
+#define T                           3
+#define AA                          0
+#define AC                          1
+#define AG                          2
+#define AT                          3
+#define CA                          4
+#define CC                          5
+#define CG                          6
+#define CT                          7
+#define GA                          8
+#define GC                          9
+#define GG                          10
+#define GT                          11
+#define TA                          12
+#define TC                          13
+#define TG                          14
+#define TT                          15
+
+CLFlt     *preLikeL;                  /* precalculated cond likes for left descendant */
+CLFlt     *preLikeR;                  /* precalculated cond likes for right descendant*/
+CLFlt     *preLikeA;                  /* precalculated cond likes for ancestor        */
+
+int       CondLikeDown_Bin (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeDown_Bin_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeDown_Gen (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeDown_Gen_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeDown_Gen_GibbsGamma (TreeNode *p, int division, int chain);
+int       CondLikeDown_NUC4 (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeDown_NUC4_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeDown_NUC4_GibbsGamma (TreeNode *p, int division, int chain);
+int       CondLikeDown_NY98 (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeDown_NY98_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeDown_Std (TreeNode *p, int division, int chain);
+int       CondLikeRoot_Bin (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeRoot_Bin_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeRoot_Gen (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeRoot_Gen_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeRoot_Gen_GibbsGamma (TreeNode *p, int division, int chain);
+int       CondLikeRoot_NUC4 (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeRoot_NUC4_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeRoot_NUC4_GibbsGamma (TreeNode *p, int division, int chain);
+int       CondLikeRoot_NY98 (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeRoot_NY98_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeRoot_Std (TreeNode *p, int division, int chain);
+int       CondLikeScaler_Gen (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeScaler_Gen_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeScaler_Gen_GibbsGamma (TreeNode *p, int division, int chain);
+int       CondLikeScaler_NUC4 (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeScaler_NUC4_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeScaler_NUC4_GibbsGamma (TreeNode *p, int division, int chain);
+int       CondLikeScaler_NY98 (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       CondLikeScaler_NY98_SSE (TreeNode *p, int division, int chain);
+#endif
+int       CondLikeScaler_Std (TreeNode *p, int division, int chain);
+int       CondLikeUp_Bin (TreeNode *p, int division, int chain);
+int       CondLikeUp_Gen (TreeNode *p, int division, int chain);
+int       CondLikeUp_NUC4 (TreeNode *p, int division, int chain);
+int       CondLikeUp_Std (TreeNode *p, int division, int chain);
+void      LaunchLogLikeForDivision (int chain, int d, MrBFlt* lnL);
+int       Likelihood_Adgamma (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int       Likelihood_Gen (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#if defined (SSE_ENABLED)
+int       Likelihood_Gen_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#endif
+int       Likelihood_Gen_GibbsGamma (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int       Likelihood_NUC4 (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#if defined (SSE_ENABLED)
+int       Likelihood_NUC4_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#endif
+int       Likelihood_NUC4_GibbsGamma (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int       Likelihood_NY98 (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#if defined (SSE_ENABLED)
+int       Likelihood_NY98_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#endif
+int       Likelihood_Pars (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int       Likelihood_ParsStd (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int       Likelihood_Res (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#if defined (SSE_ENABLED)
+int       Likelihood_Res_SSE (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+#endif
+int       Likelihood_Std (TreeNode *p, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int       TiProbs_Fels (TreeNode *p, int division, int chain);
+int       TiProbs_Gen (TreeNode *p, int division, int chain);
+int       TiProbs_GenCov (TreeNode *p, int division, int chain);
+int       TiProbs_Hky (TreeNode *p, int division, int chain);
+int       TiProbs_JukesCantor (TreeNode *p, int division, int chain);
+int       TiProbs_Std (TreeNode *p, int division, int chain);
+int       TiProbs_Res (TreeNode *p, int division, int chain);
+
+#endif  /* __LIKELIHOOD_H__ */
diff --git a/src/mbbeagle.c b/src/mbbeagle.c
new file mode 100644 (file)
index 0000000..591ec93
--- /dev/null
@@ -0,0 +1,1258 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  This file originally contributed by:
+ *
+ *  Marc A. Suchard
+ *  Department of Biomathematics
+ *  University of California, Los Angeles
+ *  Los Angeles, CA 90095
+ *  msuchard@ucla.edu
+ *
+ *  With important contributions by
+ *
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "mbbeagle.h"
+#include "mcmc.h"
+#include "model.h"
+#include "utils.h"
+
+const char* const svnRevisionMbbeagleC = "$Rev: 1008 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+
+/* Functions and variables defined in mcmc.c that are not exported in mcmc.h */
+void    LaunchLogLikeForDivision(int chain, int d, MrBFlt* lnL);
+
+void    FlipCondLikeSpace (ModelInfo *m, int chain, int nodeIndex);
+void    FlipNodeScalerSpace (ModelInfo *m, int chain, int nodeIndex);
+void    FlipSiteScalerSpace (ModelInfo *m, int chain);
+void    FlipTiProbsSpace (ModelInfo *m, int chain, int nodeIndex);
+void    ResetSiteScalers (ModelInfo *m, int chain);
+void    CopySiteScalers (ModelInfo *m, int chain);
+
+int     TreeCondLikes_Beagle_No_Rescale (Tree *t, int division, int chain);
+int     TreeCondLikes_Beagle_Rescale_All (Tree *t, int division, int chain);
+
+extern int *chainId;
+extern int numLocalChains;
+
+
+#if defined (BEAGLE_ENABLED)
+/*------------------------------------------------------------------------
+|
+|   InitBeagleInstance: create and initialize a beagle instance
+|
+-------------------------------------------------------------------------*/
+int InitBeagleInstance (ModelInfo *m, int division)
+{
+    int                     i, j, k, c, s, *inStates, numPartAmbigTips;
+    double                  *inPartials;
+    BitsLong                *charBits;
+    BeagleInstanceDetails   details;
+    long preferedFlags, requiredFlags;
+    int resource;
+    
+    if (m->useBeagle == NO)
+        return ERROR;
+    
+    /* at least one eigen buffer needed */
+    if (m->nCijkParts == 0)
+        m->nCijkParts = 1;
+
+    /* allocate memory used by beagle */
+    m->logLikelihoods          = (MrBFlt *) SafeCalloc ((numLocalChains)*m->numChars, sizeof(MrBFlt));
+    m->inRates                 = (MrBFlt *) SafeCalloc (m->numGammaCats, sizeof(MrBFlt));
+    m->branchLengths           = (MrBFlt *) SafeCalloc (2*numLocalTaxa, sizeof(MrBFlt));
+    m->tiProbIndices           = (int *) SafeCalloc (2*numLocalTaxa, sizeof(int));
+    m->inWeights               = (MrBFlt *) SafeCalloc (m->numGammaCats*m->nCijkParts, sizeof(MrBFlt));
+    m->bufferIndices           = (int *) SafeCalloc (m->nCijkParts, sizeof(int));
+    m->eigenIndices            = (int *) SafeCalloc (m->nCijkParts, sizeof(int));
+    m->childBufferIndices      = (int *) SafeCalloc (m->nCijkParts, sizeof(int));
+    m->childTiProbIndices      = (int *) SafeCalloc (m->nCijkParts, sizeof(int));
+    m->cumulativeScaleIndices  = (int *) SafeCalloc (m->nCijkParts, sizeof(int));
+
+    numPartAmbigTips = 0;
+    if (m->numStates != m->numModelStates)
+        numPartAmbigTips = numLocalTaxa;
+    else
+        {
+        for (i=0; i<numLocalTaxa; i++)
+            {
+            if (m->isPartAmbig[i] == YES)
+                numPartAmbigTips++;
+            }
+        }
+
+    if (beagleResourceNumber >= 0 && beagleResourceNumber != 99)
+        {
+        resource = beagleResourceNumber;
+        beagleResourceCount = 1;
+        }
+    else if (beagleResourceCount != 0) 
+        {
+        resource = beagleResource[beagleInstanceCount % beagleResourceCount];
+        }
+    preferedFlags = beagleFlags;
+    
+    requiredFlags = 0L;
+    
+    if (beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS)
+        requiredFlags |= BEAGLE_FLAG_SCALERS_LOG; //BEAGLE_FLAG_SCALERS_RAW;
+
+    /* TODO: allocate fewer buffers when nCijkParts > 1 */
+    /* create beagle instance */
+    m->beagleInstance = beagleCreateInstance(numLocalTaxa,
+                                             m->numCondLikes * m->nCijkParts,
+                                             numLocalTaxa - numPartAmbigTips,
+                                             m->numModelStates,
+                                             m->numChars,
+                                            (numLocalChains + 1) * m->nCijkParts,
+                                             m->numTiProbs*m->nCijkParts,
+                                             m->numGammaCats,
+                                             m->numScalers * m->nCijkParts,
+                                             (beagleResourceCount == 0 ? NULL : &resource),
+                                             (beagleResourceCount == 0 ? 0 : 1),                                             
+                                             preferedFlags,
+                                             requiredFlags,
+                                             &details);
+
+    if (m->beagleInstance < 0)
+        {
+        MrBayesPrint ("%s   Failed to start BEAGLE instance\n", spacer);
+        return (ERROR);
+        }
+    else
+        {
+        MrBayesPrint ("\n%s   Using BEAGLE resource %i for division %d:", spacer, details.resourceNumber, division+1);
+#   if defined (THREADS_ENABLED)
+        MrBayesPrint (" (%s)\n", (tryToUseThreads ? "threaded" : "non-threaded"));
+#   else
+        MrBayesPrint (" (non-threaded)\n");
+#   endif
+        MrBayesPrint ("%s      Rsrc Name : %s\n", spacer, details.resourceName);
+        MrBayesPrint ("%s      Impl Name : %s\n", spacer, details.implName);
+        MrBayesPrint ("%s      Flags:", spacer);
+        BeaglePrintFlags(details.flags);
+        MrBayesPrint ("\n");
+        beagleInstanceCount++;          
+        }
+
+    /* initialize tip data */
+    inStates = (int *) SafeMalloc (m->numChars * sizeof(int));
+    if (!inStates)
+        return ERROR;
+    inPartials = (double *) SafeMalloc (m->numChars * m->numModelStates * sizeof(double));
+    if (!inPartials)
+        return ERROR;
+    for (i=0; i<numLocalTaxa; i++)
+        {
+        if (m->isPartAmbig[i] == NO)
+            {
+            charBits = m->parsSets[i];
+            for (c=0; c<m->numChars; c++)
+                {
+                for (s=j=0; s<m->numModelStates; s++)
+                    {
+                    if (IsBitSet(s, charBits))
+                        {
+                        inStates[c] = s;
+                        j++;
+                        }
+                    }
+                if (j == m->numModelStates)
+                    inStates[c] = j;
+                else
+                    assert (j==1);
+                charBits += m->nParsIntsPerSite;
+                }
+            beagleSetTipStates(m->beagleInstance, i, inStates);
+            }
+        else /* if (m->isPartAmbig == YES) */
+            {
+            k = 0;
+            charBits = m->parsSets[i];
+            for (c=0; c<m->numChars; c++)
+                {
+                for (s=0; s<m->numModelStates; s++)
+                    {
+                    if (IsBitSet(s%m->numStates, charBits))
+                        inPartials[k++] = 1.0;
+                    else
+                        inPartials[k++] = 0.0;
+                    }
+                charBits += m->nParsIntsPerSite;
+                }
+            beagleSetTipPartials(m->beagleInstance, i, inPartials);
+            }
+        }
+    free (inStates);
+    free (inPartials);
+
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   LaunchBEAGLELogLikeForDivision: calculate the log likelihood  
+|       of the new state of the chain for a single division
+|
+-----------------------------------------------------------------*/
+void LaunchBEAGLELogLikeForDivision(int chain, int d, ModelInfo* m, Tree* tree, MrBFlt* lnL)
+{
+    int i, rescaleFreqNew;
+    int *isScalerNode;
+    TreeNode *p;
+    
+    if (beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS) 
+        {
+    
+#   if defined (DEBUG_MB_BEAGLE_FLOW)
+        MrBayesPrint ("ALWAYS RESCALING\n");
+#   endif
+        /* Flip and copy or reset site scalers */
+        FlipSiteScalerSpace(m, chain);
+        if (m->upDateAll == YES) {
+            for (i=0; i<m->nCijkParts; i++) {           
+                beagleResetScaleFactors(m->beagleInstance, m->siteScalerIndex[chain] + i);
+                }
+            }
+        else
+            CopySiteScalers(m, chain);
+
+        TreeTiProbs_Beagle(tree, d, chain);
+        TreeCondLikes_Beagle(tree, d, chain);
+        TreeLikelihood_Beagle(tree, d, chain, lnL, (chainId[chain] % chainParams.numChains));
+        } 
+    else 
+        { /* MB_BEAGLE_SCALE_DYNAMIC */
+    
+        /* This flag is only valid within this block */
+        m->rescaleBeagleAll = NO;        
+        TreeTiProbs_Beagle(tree, d, chain);
+        if (m->succesCount[chain] > 1000)
+            {
+            m->succesCount[chain] = 10;
+            m->rescaleFreq[chain]++; /* increase rescaleFreq independent of whether we accept or reject new state */
+            m->rescaleFreqOld = rescaleFreqNew = m->rescaleFreq[chain];
+            for (i=0; i<tree->nIntNodes; i++)
+                {
+                p = tree->intDownPass[i];
+                if (p->upDateCl == YES) {
+                     /* flip to the new workspace since TreeCondLikes_Beagle_Rescale_All() does not do it for
+                        (p->upDateCl == YES) since it assumes that TreeCondLikes_Beagle_No_Rescale() did it */
+                    FlipCondLikeSpace (m, chain, p->index);
+                   }
+                }
+            goto rescale_all;
+            }
+
+        if (beagleScalingFrequency != 0 && 
+            m->beagleComputeCount[chain] % (beagleScalingFrequency) == 0)
+            {
+            m->rescaleFreqOld = rescaleFreqNew = m->rescaleFreq[chain];
+            for (i=0; i<tree->nIntNodes; i++)
+                {
+                p = tree->intDownPass[i];
+                if (p->upDateCl == YES) {
+                     /* flip to the new workspace since TreeCondLikes_Beagle_Rescale_All() does not do it for
+                        (p->upDateCl == YES) since it assumes that TreeCondLikes_Beagle_No_Rescale() did it */
+                    FlipCondLikeSpace (m, chain, p->index);
+                   }
+                }
+            goto rescale_all;
+            }
+
+        TreeCondLikes_Beagle_No_Rescale(tree, d, chain);
+
+        /* Check if likelihood is valid */      
+        if (TreeLikelihood_Beagle(tree, d, chain, lnL, (chainId[chain] % chainParams.numChains)) == BEAGLE_ERROR_FLOATING_POINT) 
+            {
+            m->rescaleFreqOld = rescaleFreqNew = m->rescaleFreq[chain];
+            if (rescaleFreqNew > 1 && m->succesCount[chain] < 40)
+                {
+                if (m->succesCount[chain] < 10)
+                    {
+                    if (m->succesCount[chain] < 4)
+                        {
+                        rescaleFreqNew -= rescaleFreqNew >> 3; /* <== we cut up to 12,5% of rescaleFreq */
+                        if (m->succesCount[chain] < 2)
+                            {
+                            rescaleFreqNew -= rescaleFreqNew >> 3;
+                            /* to avoid situation when we may stack at high rescaleFreq when new states do not get accepted because of low liklihood but there proposed frequency is high we reduce rescaleFreq even if we reject the last move*/
+                            /* basically the higher probability of proposing of low liklihood state which needs smaller rescaleFreq would lead to higher probability of hitting this code which should reduce rescaleFreqOld thus reduce further probability of hitting this code */
+                            /* at some point this negative feedback mechanism should get in balance with the mechanism of periodically increasing rescaleFreq when long sequence of successes is achieved*/
+                            m->rescaleFreqOld -= m->rescaleFreqOld >> 3;
+                            }
+                        m->rescaleFreqOld -= m->rescaleFreqOld >> 3;
+                        m->rescaleFreqOld--;
+                        m->rescaleFreqOld = (m->rescaleFreqOld ? m->rescaleFreqOld:1);
+                        m->recalculateScalers = YES; 
+                        recalcScalers = YES;
+                        }
+                    }
+                rescaleFreqNew--;
+                rescaleFreqNew = (rescaleFreqNew ? rescaleFreqNew : 1);
+                }
+            m->succesCount[chain] = 0;
+    rescale_all:
+#   if defined (DEBUG_MB_BEAGLE_FLOW)
+            MrBayesPrint ("NUMERICAL RESCALING\n");
+#   endif
+
+            m->rescaleBeagleAll = YES;
+            FlipSiteScalerSpace(m, chain);
+            isScalerNode = m->isScalerNode[chain];
+    while_loop:
+            ResetScalersPartition (isScalerNode, tree, rescaleFreqNew);
+            for (i=0; i<m->nCijkParts; i++) 
+                {           
+                beagleResetScaleFactors(m->beagleInstance, m->siteScalerIndex[chain] + i);
+                }
+            
+            TreeCondLikes_Beagle_Rescale_All (tree, d, chain);
+            if (TreeLikelihood_Beagle(tree, d, chain, lnL, (chainId[chain] % chainParams.numChains)) == BEAGLE_ERROR_FLOATING_POINT)
+                {
+                if (rescaleFreqNew > 1)
+                    {
+                    /* Swap back scalers which were swapped in TreeCondLikes_Beagle_Rescale_All() */
+                    for (i=0; i<tree->nIntNodes; i++)
+                        {
+                        p = tree->intDownPass[i];
+                        if (isScalerNode[p->index] == YES)
+                            FlipNodeScalerSpace (m, chain, p->index);
+                        }
+                    rescaleFreqNew -= rescaleFreqNew >> 3; /* <== we cut up to 12,5% of rescaleFreq */
+                    rescaleFreqNew--;                      /* we cut extra 1 of rescaleFreq */
+                    goto while_loop;
+                    }
+                }
+            m->rescaleFreq[chain] = rescaleFreqNew;
+            }
+        }
+    
+    /* Count number of evaluations */
+    m->beagleComputeCount[chain]++;
+}
+
+
+void recalculateScalers(int chain)
+{
+    int         i, d, rescaleFreqNew;
+    int         *isScalerNode;
+    ModelInfo*  m;
+    Tree        *tree;
+
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        if (m->recalculateScalers == YES)
+            {
+            m->recalculateScalers = NO;
+            tree = GetTree(m->brlens, chain, state[chain]);
+
+            rescaleFreqNew = m->rescaleFreq[chain];
+            isScalerNode = m->isScalerNode[chain];
+
+            ResetScalersPartition (isScalerNode, tree, rescaleFreqNew);
+            for (i=0; i<m->nCijkParts; i++) {           
+                beagleResetScaleFactors(m->beagleInstance, m->siteScalerIndex[chain] + i);
+            }
+            /* here it does not matter if we flip CL space or not */
+            TreeCondLikes_Beagle_Rescale_All (tree, d, chain);
+            }
+        }
+}
+
+
+void BeagleAddGPUDevicesToList(int **newResourceList, int *beagleResourceCount)
+{
+    BeagleResourceList* beagleResources;
+    int i, gpuCount;
+    
+    beagleResources = beagleGetResourceList();
+    if (*newResourceList == NULL) {
+        *newResourceList = (int*) SafeCalloc(sizeof(int), beagleResources->length);
+    }
+    gpuCount = 0;
+    for (i = 0; i < beagleResources->length; i++) {
+        if (beagleResources->list[i].supportFlags & BEAGLE_FLAG_PROCESSOR_GPU) {
+            (*newResourceList)[gpuCount] = i;
+            gpuCount++;
+        }
+    }
+    *beagleResourceCount = gpuCount;            
+}
+
+
+void BeagleRemoveGPUDevicesFromList(int **beagleResource, int *beagleResourceCount)
+{
+    *beagleResourceCount = 0;
+}
+
+
+/*-----
+|
+| BeaglePrintResources: outputs the available BEAGLE resources
+|
+----------*/
+void BeaglePrintResources()
+{
+    int i;
+    BeagleResourceList* beagleResources;
+    
+    beagleResources = beagleGetResourceList();
+    MrBayesPrint ("%s   Available resources reported by beagle library:\n", spacer);
+    for (i=0; i<beagleResources->length; i++) 
+        {
+        MrBayesPrint ("\tResource %i:\n", i);       
+        MrBayesPrint ("\tName: %s\n", beagleResources->list[i].name);
+        if (i > 0) 
+            {
+            MrBayesPrint ("\tDesc: %s\n", beagleResources->list[i].description);
+            }
+        MrBayesPrint ("\tFlags:");
+        BeaglePrintFlags(beagleResources->list[i].supportFlags);
+        MrBayesPrint ("\n\n");
+        }
+    MrBayesPrint ("%s   BEAGLE vesion: %s\n", spacer, beagleGetVersion());
+}
+
+
+int BeagleCheckFlagCompatability(long inFlags)
+{
+    if (inFlags & BEAGLE_FLAG_PROCESSOR_GPU) {
+        if (inFlags & BEAGLE_FLAG_VECTOR_SSE) {
+            MrBayesPrint ("%s   Simultaneous use of GPU and SSE not available.\n", spacer);
+            return NO;
+        }
+        if (inFlags & BEAGLE_FLAG_THREADING_OPENMP) {
+            MrBayesPrint ("%s   Simultaneous use of GPU and OpenMP not available.\n", spacer);
+            return NO;
+        }
+    }
+
+    return YES;
+}
+
+
+/*-------------------
+|
+|  BeaglePrintFlags: outputs beagle instance details
+|
+______________________*/
+void BeaglePrintFlags(long inFlags) 
+{
+    int     i, k;
+    char *names[] = { "PROCESSOR_CPU",
+                      "PROCESSOR_GPU",
+                      "PROCESSOR_FPGA",
+                      "PROCESSOR_CELL",
+                      "PRECISION_DOUBLE",
+                      "PRECISION_SINGLE",
+                      "COMPUTATION_ASYNCH",
+                      "COMPUTATION_SYNCH",
+                      "EIGEN_REAL",
+                      "EIGEN_COMPLEX",
+                      "SCALING_MANUAL",
+                      "SCALING_AUTO",
+                      "SCALING_ALWAYS",
+                      "SCALING_DYNAMIC",
+                      "SCALERS_RAW",
+                      "SCALERS_LOG",
+                      "VECTOR_NONE",
+                      "VECTOR_SSE",
+                      "THREADING_NONE",
+                      "THREADING_OPENMP"
+                    };
+    long flags[] = { BEAGLE_FLAG_PROCESSOR_CPU,
+                     BEAGLE_FLAG_PROCESSOR_GPU,
+                     BEAGLE_FLAG_PROCESSOR_FPGA,
+                     BEAGLE_FLAG_PROCESSOR_CELL,
+                     BEAGLE_FLAG_PRECISION_DOUBLE,
+                     BEAGLE_FLAG_PRECISION_SINGLE,
+                     BEAGLE_FLAG_COMPUTATION_ASYNCH,
+                     BEAGLE_FLAG_COMPUTATION_SYNCH,
+                     BEAGLE_FLAG_EIGEN_REAL,
+                     BEAGLE_FLAG_EIGEN_COMPLEX,
+                     BEAGLE_FLAG_SCALING_MANUAL,
+                     BEAGLE_FLAG_SCALING_AUTO,
+                     BEAGLE_FLAG_SCALING_ALWAYS,
+                     BEAGLE_FLAG_SCALING_DYNAMIC,
+                     BEAGLE_FLAG_SCALERS_RAW,
+                     BEAGLE_FLAG_SCALERS_LOG,
+                     BEAGLE_FLAG_VECTOR_NONE,
+                     BEAGLE_FLAG_VECTOR_SSE,
+                     BEAGLE_FLAG_THREADING_NONE,
+                     BEAGLE_FLAG_THREADING_OPENMP
+                    };
+
+    for (i=k=0; i<20; i++)
+        {
+        if (inFlags & flags[i])
+            {
+            if (k%4 == 0 && k > 0)
+                MrBayesPrint ("\n%s            ", spacer);
+            MrBayesPrint (" %s", names[i]);
+            k++;
+            }
+        }
+}
+
+
+#if defined(THREADS_ENABLED)
+void *LaunchThreadLogLikeForDivision(void *arguments)
+{
+    int d, chain;
+    MrBFlt *lnL;
+    LaunchStruct* launchStruct;
+    
+    launchStruct = (LaunchStruct*) arguments;
+    chain = launchStruct->chain;
+    d = launchStruct->division;
+    lnL = launchStruct->lnL;
+    LaunchLogLikeForDivision(chain, d, lnL);    
+    return 0;
+}
+
+
+MrBFlt LaunchLogLikeForAllDivisionsInParallel(int chain)
+{
+    int d;
+    int threadError;
+    pthread_t* threads;
+    LaunchStruct* launchValues;
+    int* wait;
+    ModelInfo* m;
+    MrBFlt chainLnLike;
+    
+    chainLnLike = 0.0;
+
+    /* TODO Initialize only once */
+    threads = (pthread_t*) SafeMalloc(sizeof(pthread_t) * numCurrentDivisions);
+    launchValues = (LaunchStruct*) SafeMalloc(sizeof(LaunchStruct) * numCurrentDivisions);
+    wait = (int*) SafeMalloc(sizeof(int) * numCurrentDivisions);
+    
+    /* Cycle through divisions and recalculate tis and cond likes as necessary. */
+    /* Code below does not try to avoid recalculating ti probs for divisions    */
+    /* that could share ti probs with other divisions.                          */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        
+#   if defined (BEST_MPI_ENABLED)
+        if (isDivisionActive[d] == NO)
+            continue;
+#   endif
+        m = &modelSettings[d];
+        
+        if (m->upDateCl == YES) 
+            {                   
+            launchValues[d].chain = chain;
+            launchValues[d].division = d;
+            launchValues[d].lnL = &(m->lnLike[2*chain + state[chain]]);
+            /* Fork */
+            threadError = pthread_create(&threads[d], NULL, 
+                                         LaunchThreadLogLikeForDivision, 
+                                         (void*) &launchValues[d]);
+            assert (0 == threadError);
+            wait[d] = 1;                    
+            }           
+        else 
+            {
+            wait[d] = 0;
+            }
+        }
+    
+    for (d = 0; d < numCurrentDivisions; d++)
+        {
+        /* Join */
+        if (wait[d]) 
+            {
+            threadError = pthread_join(threads[d], NULL);
+            assert (0 == threadError);
+            }               
+        m = &modelSettings[d];
+        chainLnLike += m->lnLike[2*chain + state[chain]];
+        }
+            
+    /* TODO Free these once */
+    free(threads);
+    free(launchValues);
+    free(wait);
+    
+    return chainLnLike;
+}
+#endif
+
+
+int ScheduleLogLikeForAllDivisions()
+{
+    int d;
+    int divisionsToLaunch = 0;
+    ModelInfo       *m;
+    
+    if (numCurrentDivisions < 2) {
+        return 0;
+        }
+    
+    for (d=0; d<numCurrentDivisions; d++) {
+        m = &modelSettings[d];
+        if (m->upDateCl == YES) {
+            divisionsToLaunch++;
+            }
+        }
+    
+    return (divisionsToLaunch > 1);
+}
+
+
+/*----------------------------------------------------------------
+ |
+ |  TreeCondLikes_Beagle: This routine updates all conditional
+ |       (partial) likelihoods of a beagle instance while doing no rescaling.
+ |      That potentialy can make final liklihood bad then calculation with rescaling needs to be done.
+ |
+ -----------------------------------------------------------------*/
+int TreeCondLikes_Beagle_No_Rescale (Tree *t, int division, int chain)
+{
+    int                 i, j, cumulativeScaleIndex;
+    BeagleOperation     operations;
+    TreeNode            *p;
+    ModelInfo           *m;
+    unsigned            chil1Step, chil2Step;
+    int                 *isScalerNode;
+    
+    m = &modelSettings[division];
+    isScalerNode = m->isScalerNode[chain];
+    
+    for (i=0; i<t->nIntNodes; i++)
+    {
+        p = t->intDownPass[i];
+        
+        /* check if conditional likelihoods need updating */
+        if (p->upDateCl == YES)
+        {
+            /* flip to the new workspace */
+            FlipCondLikeSpace (m, chain, p->index);
+            
+            /* update conditional likelihoods */
+            operations.destinationPartials    = m->condLikeIndex[chain][p->index       ];
+            operations.child1Partials         = m->condLikeIndex[chain][p->left->index ];
+            operations.child1TransitionMatrix = m->tiProbsIndex [chain][p->left->index ];
+            operations.child2Partials         = m->condLikeIndex[chain][p->right->index];
+            operations.child2TransitionMatrix = m->tiProbsIndex [chain][p->right->index];
+            
+            /* All partials for tips are the same across omega categories, thus we are doing the following two if statments.*/
+            if (p->left->left== NULL)
+                chil1Step=0;
+            else
+                chil1Step=1;
+            
+            if (p->right->left== NULL)
+                chil2Step=0;
+            else
+                chil2Step=1;
+            
+            operations.destinationScaleWrite = BEAGLE_OP_NONE;
+            cumulativeScaleIndex  = BEAGLE_OP_NONE;
+            if (isScalerNode[p->index] == YES)
+                {
+                operations.destinationScaleRead  = m->nodeScalerIndex[chain][p->index];
+                }
+            else
+                {
+                operations.destinationScaleRead  = BEAGLE_OP_NONE;
+                }
+            
+            for (j=0; j<m->nCijkParts; j++)
+            {
+                beagleUpdatePartials(m->beagleInstance,
+                                     &operations,
+                                     1,
+                                     cumulativeScaleIndex);
+                
+                operations.destinationPartials++;
+                operations.child1Partials+=chil1Step;
+                operations.child1TransitionMatrix++;
+                operations.child2Partials+=chil2Step;
+                operations.child2TransitionMatrix++;
+                
+                if (isScalerNode[p->index] == YES)
+                    operations.destinationScaleRead++;
+            }
+        }
+    }
+    
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+ |
+ |  TreeCondLikes_Beagle: This routine updates all conditional
+ |       (partial) likelihoods of a beagle instance while rescaling at every node.
+ |        Note: all nodes get recalculated, not only tached by move.
+ |
+ -----------------------------------------------------------------*/
+int TreeCondLikes_Beagle_Rescale_All (Tree *t, int division, int chain)
+{
+    int                 i, j, cumulativeScaleIndex;
+    BeagleOperation     operations;
+    TreeNode            *p;
+    ModelInfo           *m;
+    unsigned            chil1Step, chil2Step;
+    int                 *isScalerNode;
+    
+    m = &modelSettings[division];
+    isScalerNode = m->isScalerNode[chain];
+    
+    for (i=0; i<t->nIntNodes; i++)
+    {
+        p = t->intDownPass[i];
+        
+        if (p->upDateCl == NO) {
+            //p->upDateCl = YES;
+            /* flip to the new workspace */
+            FlipCondLikeSpace (m, chain, p->index);
+        }
+        
+        /* update conditional likelihoods */
+        operations.destinationPartials    = m->condLikeIndex[chain][p->index       ];
+        operations.child1Partials         = m->condLikeIndex[chain][p->left->index ];
+        operations.child1TransitionMatrix = m->tiProbsIndex [chain][p->left->index ];
+        operations.child2Partials         = m->condLikeIndex[chain][p->right->index];
+        operations.child2TransitionMatrix = m->tiProbsIndex [chain][p->right->index];
+        
+        /* All partials for tips are the same across omega catigoris, thus we are doing the following two if statments.*/
+        if (p->left->left== NULL)
+            chil1Step=0;
+        else
+            chil1Step=1;
+        
+        if (p->right->left== NULL)
+            chil2Step=0;
+        else
+            chil2Step=1;
+
+        operations.destinationScaleRead = BEAGLE_OP_NONE;
+        if (isScalerNode[p->index] == YES)
+            {
+            FlipNodeScalerSpace (m, chain, p->index);
+            operations.destinationScaleWrite = m->nodeScalerIndex[chain][p->index];
+            cumulativeScaleIndex  = m->siteScalerIndex[chain];
+            }
+        else
+            {
+            operations.destinationScaleWrite = BEAGLE_OP_NONE;
+            cumulativeScaleIndex  = BEAGLE_OP_NONE;
+            }
+        
+        
+        
+        for (j=0; j<m->nCijkParts; j++)
+        {
+            beagleUpdatePartials(m->beagleInstance,
+                                 &operations,
+                                 1,
+                                 cumulativeScaleIndex);
+            
+            operations.destinationPartials++;
+            operations.child1Partials+=chil1Step;
+            operations.child1TransitionMatrix++;
+            operations.child2Partials+=chil2Step;
+            operations.child2TransitionMatrix++;
+            
+            if (isScalerNode[p->index] == YES) {
+                operations.destinationScaleWrite++;
+                cumulativeScaleIndex++;
+                }
+
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   TreeCondLikes_Beagle: This routine updates all conditional
+|       (partial) likelihoods of a beagle instance.
+|
+-----------------------------------------------------------------*/
+int TreeCondLikes_Beagle (Tree *t, int division, int chain)
+{
+    int                 i, j, destinationScaleRead, cumulativeScaleIndex;
+    BeagleOperation     operations;
+    TreeNode            *p;
+    ModelInfo           *m;
+    unsigned            chil1Step, chil2Step;
+    
+    m = &modelSettings[division];
+    
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        
+        /* check if conditional likelihoods need updating */
+        if (p->upDateCl == YES)
+            {
+            /* remove old scalers */
+            if (m->scalersSet[chain][p->index] == YES && m->upDateAll == NO)
+                {
+                destinationScaleRead = m->nodeScalerIndex[chain][p->index];
+                cumulativeScaleIndex = m->siteScalerIndex[chain];
+                for (j=0; j<m->nCijkParts; j++)
+                    {
+                    beagleRemoveScaleFactors(m->beagleInstance,
+                                             &destinationScaleRead,
+                                             1,
+                                             cumulativeScaleIndex);
+                    destinationScaleRead++;
+                    cumulativeScaleIndex++;
+                    }
+                }
+
+            /* flip to the new workspace */
+            FlipCondLikeSpace (m, chain, p->index);
+            FlipNodeScalerSpace (m, chain, p->index);
+            m->scalersSet[chain][p->index] = NO;
+            
+            /* update conditional likelihoods */
+            operations.destinationPartials    = m->condLikeIndex[chain][p->index       ];
+            operations.child1Partials         = m->condLikeIndex[chain][p->left->index ];
+            operations.child1TransitionMatrix = m->tiProbsIndex [chain][p->left->index ];
+            operations.child2Partials         = m->condLikeIndex[chain][p->right->index];
+            operations.child2TransitionMatrix = m->tiProbsIndex [chain][p->right->index];
+
+            /* All partials for tips are the same across omega catigoris, thus we are doing the following two if statments.*/
+            if (p->left->left== NULL && p->left->right== NULL)
+                chil1Step=0;
+            else
+                chil1Step=1;
+
+            if (p->right->left== NULL && p->right->right== NULL)
+                chil2Step=0;
+            else
+                chil2Step=1;
+
+            if (p->scalerNode == YES)
+                {
+                m->scalersSet[chain][p->index] = YES;
+                operations.destinationScaleWrite = m->nodeScalerIndex[chain][p->index];
+                cumulativeScaleIndex  = m->siteScalerIndex[chain];
+                }
+            else
+                {
+                operations.destinationScaleWrite = BEAGLE_OP_NONE;
+                cumulativeScaleIndex  = BEAGLE_OP_NONE;
+                }
+            operations.destinationScaleRead = BEAGLE_OP_NONE;
+
+            for (j=0; j<m->nCijkParts; j++)
+                {
+                beagleUpdatePartials(m->beagleInstance,
+                                     &operations,
+                                     1,
+                                     cumulativeScaleIndex);
+
+                operations.destinationPartials++;
+                operations.child1Partials+=chil1Step;
+                operations.child1TransitionMatrix++;
+                operations.child2Partials+=chil2Step;
+                operations.child2TransitionMatrix++;
+                if (p->scalerNode == YES)
+                    {
+                    operations.destinationScaleWrite++;
+                    cumulativeScaleIndex++;
+                    }
+                }
+
+            }
+        } /* end of for */
+
+    return NO_ERROR;
+}
+
+
+/**---------------------------------------------------------------------------
+|
+|   TreeLikelihood_Beagle: Accumulate the log likelihoods calculated by Beagle
+|      at the root.
+|
+---------------------------------------- -------------------------------------*/
+int TreeLikelihood_Beagle (Tree *t, int division, int chain, MrBFlt *lnL, int whichSitePats)
+{
+    int         i, j, c = 0, nStates, hasPInvar, beagleReturn;
+    MrBFlt      *swr, s01, s10, probOn, probOff, covBF[40], pInvar=0.0, *bs, freq, likeI, lnLikeI, diff, *omegaCatFreq;
+    CLFlt       *clInvar=NULL, *nSitesOfPat;
+    double      *nSitesOfPat_Beagle;
+    TreeNode    *p;
+    ModelInfo   *m;
+    double      pUnobserved;
+
+#   if defined (MB_PRINT_DYNAMIC_RESCALE_FAIL_STAT)
+    static unsigned countBeagleDynamicFail=0;
+    static unsigned countALL=0;
+#   endif
+
+    /* find root node */
+    p = t->root->left;
+
+    /* find model settings and nStates, pInvar, invar cond likes */
+    m = &modelSettings[division];
+    
+    nStates = m->numModelStates;
+    if (m->pInvar == NULL)
+        {
+        hasPInvar = NO;
+        }
+    else
+        {
+        hasPInvar = YES;
+        pInvar =  *(GetParamVals (m->pInvar, chain, state[chain]));
+        clInvar = m->invCondLikes;
+        }
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* if covarion model, adjust base frequencies */
+    if (m->switchRates != NULL)
+        {
+        /* find the stationary frequencies */
+        swr = GetParamVals(m->switchRates, chain, state[chain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        probOff =  1.0 - probOn;
+
+        /* now adjust the base frequencies; on-state stored first in cond likes */
+        for (j=0; j<nStates/2; j++)
+            {
+            covBF[j] = bs[j] * probOn;
+            covBF[j+nStates/2] = bs[j] * probOff;
+            }
+
+        /* finally set bs pointer to adjusted values */
+        bs = covBF;
+        }
+
+    /* TODO Really only need to check if state frequencies have changed */
+    if (m->upDateCijk == YES)
+        {
+        /* set base frequencies in BEAGLE instance */
+        for (i=0; i<m->nCijkParts; i++)
+            beagleSetStateFrequencies(m->beagleInstance,
+                                      m->cijkIndex[chain] + i,
+                                      bs);
+        }
+
+    /* find category frequencies */
+    if (hasPInvar == NO)
+        freq = 1.0 / m->numGammaCats;
+    else
+        freq = (1.0 - pInvar) / m->numGammaCats;
+
+    /* TODO: cat weights only need to be set when they change */
+    /* set category frequencies in beagle instance */
+    if (m->numOmegaCats > 1)
+        {
+        omegaCatFreq = GetParamSubVals(m->omega, chain, state[chain]);
+        for (i=0; i<m->nCijkParts; i++)
+            {
+            for (j=0; j<m->numGammaCats; j++)
+                m->inWeights[j] = freq * omegaCatFreq[i];
+            beagleSetCategoryWeights(m->beagleInstance,
+                                     m->cijkIndex[chain] + i,
+                                     m->inWeights);
+            }
+        }
+    else if (hasPInvar == YES)
+        {
+        for (i=0; i<m->numGammaCats; i++)
+            m->inWeights[i] = freq;
+        beagleSetCategoryWeights(m->beagleInstance,
+                                 m->cijkIndex[chain],
+                                 m->inWeights);
+        }
+
+    /* find nSitesOfPat */
+    nSitesOfPat = numSitesOfPat + (whichSitePats*numCompressedChars) + m->compCharStart;
+    
+    /* TODO: pattern weights only need to be set when they change */
+    /* set pattern weights in beagle instance if using dynamic reweighting */
+    if (chainParams.weightScheme[0] + chainParams.weightScheme[1] > ETA)
+        {
+        nSitesOfPat_Beagle = (double *) SafeMalloc (m->numChars * sizeof(double));
+        for (c=0; c<m->numChars; c++)
+            nSitesOfPat_Beagle[c] = numSitesOfPat[m->compCharStart + c];
+        beagleSetPatternWeights(m->beagleInstance,
+                                nSitesOfPat_Beagle);
+        SafeFree ((void **)(&nSitesOfPat_Beagle));
+        }
+
+    /* find root log likelihoods and scalers */
+    for (i=0; i<m->nCijkParts; i++)
+        {
+        m->bufferIndices[i] = m->condLikeIndex[chain][p->index] + i;
+        m->eigenIndices[i]  = m->cijkIndex[chain] + i;
+        m->cumulativeScaleIndices[i] = m->siteScalerIndex[chain] + i;
+        if (t->isRooted == NO)
+            {
+            m->childBufferIndices[i]     = m->condLikeIndex  [chain][p->anc->index];
+            m->childTiProbIndices[i]     = m->tiProbsIndex   [chain][p->index] + i;
+            }
+        }
+
+    /* reset lnL */
+    *lnL = 0.0;
+
+    /* get root log likelihoods */
+    if (t->isRooted == YES)
+        {        
+        beagleReturn = beagleCalculateRootLogLikelihoods(m->beagleInstance,
+                                          m->bufferIndices,
+                                          m->eigenIndices,
+                                          m->eigenIndices,
+                                          m->cumulativeScaleIndices,
+                                          m->nCijkParts,
+                                          lnL);
+
+        }
+    else
+        {
+        beagleReturn = beagleCalculateEdgeLogLikelihoods(m->beagleInstance,
+                                          m->bufferIndices,
+                                          m->childBufferIndices,
+                                          m->childTiProbIndices,
+                                          NULL,
+                                          NULL,
+                                          m->eigenIndices,
+                                          m->eigenIndices,
+                                          m->cumulativeScaleIndices,
+                                          m->nCijkParts,
+                                          lnL,
+                                          NULL,
+                                          NULL);       
+        }
+#   if defined (MB_PRINT_DYNAMIC_RESCALE_FAIL_STAT)
+    countALL++;
+#   endif
+    if (beagleReturn == BEAGLE_ERROR_FLOATING_POINT)
+        {
+#   if defined (MB_PRINT_DYNAMIC_RESCALE_FAIL_STAT)
+        countBeagleDynamicFail++;
+        MrBayesPrint ("DEBUG INFO (not an error) countBeagleDynamicFail:%d countALL:%d\n", countBeagleDynamicFail, countALL);
+#   endif
+        return beagleReturn;
+        }
+    assert (beagleReturn == BEAGLE_SUCCESS);
+    m->succesCount[chain]++;
+    
+    /* accumulate logs across sites */
+    if (hasPInvar == NO)
+        {
+        if (m->dataType == RESTRICTION)
+            {
+            beagleGetSiteLogLikelihoods(m->beagleInstance, m->logLikelihoods);
+            (*lnL) = 0.0;
+            pUnobserved = 0.0;
+            for (c=0; c<m->numDummyChars; c++)
+                {
+                pUnobserved +=  exp((double)m->logLikelihoods[c]);
+                }
+            /* correct for absent characters */
+            (*lnL) -= log (1-pUnobserved) * (m->numUncompressedChars);
+            for (; c<m->numChars; c++)
+                {
+                (*lnL) += m->logLikelihoods[c] * nSitesOfPat[c];
+                }
+            }
+        /* already done, just check for numerical errors */
+        assert ((*lnL) == (*lnL));
+        }
+    else
+        {
+        /* has invariable category */
+        beagleGetSiteLogLikelihoods(m->beagleInstance,
+                                    m->logLikelihoods);
+        (*lnL) = 0.0;
+        for (c=0; c<m->numChars; c++)
+            {
+            likeI = 0.0;
+            for (j=0; j<nStates; j++)
+                likeI += (*(clInvar++)) * bs[j];
+            if (likeI != 0.0)
+                {
+                lnLikeI = log(likeI * pInvar);
+                diff = lnLikeI - m->logLikelihoods[c];
+                }
+            else
+                diff = -1000.0;
+            if (diff < -200.0)
+                (*lnL) += m->logLikelihoods[c] * nSitesOfPat[c];
+            else if (diff > 200.0)
+                (*lnL) += lnLikeI * nSitesOfPat[c];
+            else
+                {
+                (*lnL) += (m->logLikelihoods[c] + log(1.0 + exp(diff))) * nSitesOfPat[c];
+                }
+
+            /* check for numerical errors */
+            assert ((*lnL) == (*lnL));
+            }       
+        }
+        
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   TreeTiProbs_Beagle: This routine updates all transition
+|       probability matrices of a beagle instance.
+|
+-----------------------------------------------------------------*/
+int TreeTiProbs_Beagle (Tree *t, int division, int chain)
+{
+    int         i, j, k, count;
+    MrBFlt      correctionFactor, theRate, baseRate, *catRate, length;
+    TreeNode    *p;
+    ModelInfo   *m;
+    
+    /* get model settings */
+    m = &modelSettings[division];
+    
+    /* find the correction factor to make branch lengths
+       in terms of expected number of substitutions per character */
+    correctionFactor = 1.0;
+    if (m->dataType == DNA || m->dataType == RNA)
+        {
+        if (m->nucModelId == NUCMODEL_DOUBLET)
+            correctionFactor = 2.0;
+        else if (m->nucModelId == NUCMODEL_CODON)
+            correctionFactor = 3.0;
+        }
+
+    /* get rate multipliers (for gamma & partition specific rates) */
+    theRate = 1.0;
+    baseRate = GetRate (division, chain);
+    
+    /* compensate for invariable sites if appropriate */
+    if (m->pInvar != NULL)
+        baseRate /= (1.0 - (*GetParamVals(m->pInvar, chain, state[chain])));
+        
+    /* get category rates for gamma */
+    if (m->shape == NULL)
+        catRate = &theRate;
+    else
+        catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+    /* get effective category rates */
+    for (k=0; k<m->numGammaCats; k++)
+        m->inRates[k] = baseRate * catRate[k] * correctionFactor;
+
+    /* TODO: only need to set category rates when they change */
+    /* set category rates */
+    beagleSetCategoryRates(m->beagleInstance, m->inRates);
+    
+    /* get ti prob indices and branch lengths to update */
+    for (i=count=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        
+        /* check if transition probs need updating */
+        if (p->upDateTi == YES)
+            {
+            /* flip transition probability */
+            FlipTiProbsSpace (m, chain, p->index);
+            
+            /* find length */
+            if (m->cppEvents != NULL)
+                {
+                length = GetParamSubVals (m->cppEvents, chain, state[chain])[p->index];
+                }
+            else if (m->tk02BranchRates != NULL)
+                {
+                length = GetParamSubVals (m->tk02BranchRates, chain, state[chain])[p->index];
+                }
+            else if (m->igrBranchRates != NULL)
+                {
+                length = GetParamSubVals (m->igrBranchRates, chain, state[chain])[p->index];
+                }
+            else if (m->mixedBrchRates != NULL)
+                {
+                length = GetParamSubVals (m->mixedBrchRates, chain, state[chain])[p->index];
+                }
+            else
+                length = p->length;
+
+            /* numerical errors might ensue if we allow very large or very small branch lengths, which might
+               occur in relaxed clock models; an elegant solution would be to substitute the stationary
+               probs and initial probs but for now we truncate lengths at small or large values */
+            if (length > BRLENS_MAX)
+                length = BRLENS_MAX;
+            else if (length < BRLENS_MIN)
+                length = BRLENS_MIN;
+
+            m->branchLengths[count] = length;
+            
+            /* find index */
+            m->tiProbIndices[count] = m->tiProbsIndex[chain][p->index];
+            count++;
+            }
+        }
+
+    /* TODO: only need to update branches that have changed */
+    /* calculate transition probabilities */
+    if (count > 0) {
+        for (i=0; i<m->nCijkParts; i++)
+            {
+            beagleUpdateTransitionMatrices(m->beagleInstance,
+                                           m->cijkIndex[chain] + i,
+                                           m->tiProbIndices,
+                                           NULL,
+                                           NULL,
+                                           m->branchLengths,
+                                           count);
+            for (j=0; j<count; j++)
+                m->tiProbIndices[j]++;
+            }
+        }
+
+    /* return success */
+    return NO_ERROR;
+}
+
+#endif // BEAGLE_ENABLED
+
+
+void BeagleNotLinked()
+{
+    MrBayesPrint ("%s   BEAGLE library is not linked to this executable.\n", spacer);
+}
+
+
+void BeagleThreadsNotLinked()
+{
+    MrBayesPrint ("%s   Pthreads library is not linked to this executable.\n", spacer);
+}
+
diff --git a/src/mbbeagle.h b/src/mbbeagle.h
new file mode 100644 (file)
index 0000000..91e542f
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __MBBEAGLE_H__
+#define __MBBEAGLE_H__
+
+void   BeaglePrintResources (void);
+void   BeaglePrintFlags (long inFlags);
+void   BeagleNotLinked (void);
+void   BeagleThreadsNotLinked (void);
+int    BeagleCheckFlagCompatability (long inFlags);
+void   BeagleAddGPUDevicesToList (int **beagleResource, int *beagleResourceCount);
+void   BeagleRemoveGPUDevicesFromList (int **beagleResource, int *beagleResourceCount);
+int    ScheduleLogLikeForAllDivisions (void);
+
+void   LaunchBEAGLELogLikeForDivision (int chain, int d, ModelInfo* m, Tree* tree, MrBFlt* lnL);
+void  *LaunchThreadLogLikeForDivision (void *arguments);
+MrBFlt LaunchLogLikeForAllDivisionsInParallel (int chain);
+void   recalculateScalers (int chain);
+
+int    InitBeagleInstance (ModelInfo *m, int division);
+
+int    TreeCondLikes_Beagle (Tree *t, int division, int chain);
+int    TreeLikelihood_Beagle (Tree *t, int division, int chain, MrBFlt *lnL, int whichSitePats);
+int    TreeTiProbs_Beagle (Tree *t, int division, int chain);
+
+#endif  /* __MBBEAGLE_H__ */
diff --git a/src/mcmc.c b/src/mcmc.c
new file mode 100644 (file)
index 0000000..4912f17
--- /dev/null
@@ -0,0 +1,19069 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "best.h"
+#include "command.h"
+#include "likelihood.h"
+#include "mbbeagle.h"
+#include "mcmc.h"
+#include "model.h"
+#include "proposal.h"
+#include "sumpt.h"
+#include "utils.h"
+#if defined(__MWERKS__)
+#include "SIOUX.h"
+#endif
+#include <signal.h>
+
+const char* const svnRevisionMcmcC = "$Rev: 1072 $";   /* Revision keyword which is expanded/updated by svn on each commit/update */
+
+#if defined (WIN_VERSION) && !defined (__GNUC__)
+#define VISUAL
+#else
+typedef void (*sighandler_t) (int);
+#endif
+
+#define RESCALE_FREQ                1           /* node cond like rescaling frequency */
+#define SCALER_REFRESH_FREQ         1           /* generations between refreshing scaler nodes */
+#define GIBBS_SAMPLE_FREQ           100         /* generations between gibbs sampling of gamma cats */
+#define MAX_SMALL_JUMP              10          /* threshold for precalculating trans probs of adgamma model */
+#define BIG_JUMP                    100         /* threshold for using stationary approximation */
+#define MAX_RUNS                    120         /* maximum number of independent runs */
+#define PFILE                       0
+#define TFILE                       1
+#define CALFILE                     2
+#define MCMCFILE                    3
+#define MAXTUNINGPARAM              10000       /* limit to ensure convergence for autotuning */
+#define SAMPLE_ALL_SS                           /* if defined makes ss sample every generation instead of every sample frequency */
+#define BEAGLE_RESCALE_FREQ         160
+#define BEAGLE_RESCALE_FREQ_DOUBLE  10          /* The factor by which BEAGLE_RESCALE_FREQ get multiplied if double presition is used */
+#define TARGETLENDELTA              100
+
+/* debugging compiler statements */
+#undef  DEBUG_SETUPTERMSTATE
+#undef  DEBUG_RUNCHAIN
+#undef  DEBUG_NOSHORTCUTS
+#undef  DEBUG_NOSCALING
+#undef  DEBUG_TIPROBS_STD
+#undef  DEBUG_RUN_WITHOUT_DATA
+#undef  DEBUG_CONSTRAINTS
+#undef  DEBUG_LNLIKELIHOOD  /* slow if defined!! */
+#undef  DEBUG_LIKELIHOOD
+#undef  DEBUG_FBDPR       // #undef  FBDPR_CondOnN
+#undef  SHOW_MOVE
+
+#if defined (MPI_ENABLED)
+#define ERROR_TEST2(failString,X1,X2) \
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);\
+    if (sumErrors > 0)\
+        {\
+        MrBayesPrint ("%s   "failString"\n", spacer);\
+        X1;X2;\
+        }
+#else
+#define ERROR_TEST2(failString,X1,X2) \
+    if (nErrors > 0)\
+        {\
+        MrBayesPrint ("%s   "failString"\n", spacer);\
+        X1;X2;\
+        }
+#endif
+
+/* local (to this file) data types */
+typedef struct pfnode
+    {
+    struct pfnode   *left;
+    struct pfnode   *right;
+    int             *count;
+    BitsLong        *partition;
+    } PFNODE;
+
+/* local prototypes */
+int       AddTreeSamples (int from, int to, int saveToList);
+PFNODE   *AddPartition (PFNODE *r, BitsLong *p, int runId);
+int       AddTreeToPartitionCounters (Tree *tree, int treeId, int runId);
+int       AttemptSwap (int swapA, int swapB, RandLong *seed);
+void      BuildExhaustiveSearchTree (Tree *t, int chain, int nTaxInTree, TreeInfo *tInfo);
+int       BuildStepwiseTree (Tree *t, int chain, RandLong *seed);
+int       CalcLikeAdgamma (int d, Param *param, int chain, MrBFlt *lnL);
+void      CalcPartFreqStats (PFNODE *p, STATS *stat);
+void      CalcTopoConvDiagn (int numSamples);
+#ifdef    VISUAL
+BOOL      WINAPI CatchInterrupt (DWORD signum);
+#else  
+void      CatchInterrupt (int signum);
+#endif  
+int       CheckTemperature (void);
+void      CloseMBPrintFiles (void);
+PFNODE   *CompactTree (PFNODE *p);
+int       ConfirmAbortRun(void);
+void      CopyParams (int chain);
+void      CopyPFNodeDown (PFNODE *p);
+void      CopySiteScalers (ModelInfo *m, int chain);
+void      CopyTrees (int chain);
+int       ExtendChainQuery (void);
+int       FillNumSitesOfPat (void);
+TreeNode *FindBestNode (Tree *t, TreeNode *p, TreeNode *addNode, CLFlt *minLength, int chain);
+void      FlipCijkSpace (ModelInfo *m, int chain);
+void      FlipCondLikeSpace (ModelInfo *m, int chain, int nodeIndex);
+void      FlipNodeScalerSpace (ModelInfo *m, int chain, int nodeIndex);
+void      FlipSiteScalerSpace (ModelInfo *m, int chain);
+void      FlipTiProbsSpace (ModelInfo *m, int chain, int nodeIndex);
+void      FreeChainMemory (void);
+MrBFlt    GetFitchPartials (ModelInfo *m, int chain, int source1, int source2, int destination);
+void      GetStamp (void);
+void      GetSwappers (int *swapA, int *swapB, int curGen);
+void      GetTempDownPassSeq (TreeNode *p, int *i, TreeNode **dp);
+MrBFlt    GibbsSampleGamma (int chain, int division, RandLong *seed);
+int       InitAdGamma(void);
+int       InitChainCondLikes (void);
+int       InitClockBrlens (Tree *t);
+int       InitEigenSystemInfo (ModelInfo *m);
+int       InitInvCondLikes (void);
+int       InitParsSets (void);
+int       InitPrintParams (void);
+int       IsPFNodeEmpty (PFNODE *p);
+PFNODE   *LargestNonemptyPFNode (PFNODE *p, int *i, int j);
+MrBFlt    LogLike (int chain);
+MrBFlt    LogPrior (int chain);
+int       LnBirthDeathPriorPrRandom    (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF);
+int       LnBirthDeathPriorPrDiversity (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF);
+int       LnBirthDeathPriorPrCluster   (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF);
+int       LnFossilizedBDPriorFossilTip (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF, MrBFlt fR);
+int       LnFossilizedBDPriorRandom    (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt *sR, MrBFlt *eR, MrBFlt sF, MrBFlt *fR);
+int       LnFossilizedBDPriorDiversity (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt *sR, MrBFlt *eR, MrBFlt sF, MrBFlt *fR);
+MrBFlt    LnP0 (MrBFlt t, MrBFlt l, MrBFlt m);
+MrBFlt    LnP0Subsample (MrBFlt t, MrBFlt l, MrBFlt m, MrBFlt f);
+MrBFlt    LnP1 (MrBFlt t, MrBFlt l, MrBFlt m);
+MrBFlt    LnP1Subsample (MrBFlt t, MrBFlt l, MrBFlt m, MrBFlt f);
+MrBFlt    LnP0_fossil (MrBFlt t, MrBFlt lambda, MrBFlt mu, MrBFlt psi, MrBFlt c1, MrBFlt c2);
+MrBFlt    LnP1_fossil (MrBFlt t, MrBFlt rho, MrBFlt c1, MrBFlt c2);
+MrBFlt    LnQi_fossil (MrBFlt t, MrBFlt *t_f, int sl, MrBFlt *c1, MrBFlt *c2);
+MrBFlt    LnPi_fossil (MrBFlt t, MrBFlt *t_f, int sl, MrBFlt *c1, MrBFlt *c2, MrBFlt *lambda, MrBFlt *mu, MrBFlt *psi);
+int       NewtonRaphsonBrlen (Tree *t, TreeNode *p, int chain);
+void      NodeToNodeDistances (Tree *t, TreeNode *fromNode);
+int       PickProposal (RandLong *seed, int chainIndex);
+int       NumCppEvents (Param *p, int chain);
+int       PosSelProbs (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       PosSelProbs_SSE (TreeNode *p, int division, int chain);
+#endif
+int       PreparePrintFiles (void);
+int       PrintAncStates_Bin (TreeNode *p, int division, int chain);
+int       PrintAncStates_Gen (TreeNode *p, int division, int chain);
+int       PrintAncStates_NUC4 (TreeNode *p, int division, int chain);
+int       PrintAncStates_Std (TreeNode *p, int division, int chain);
+int       PrintCalTree (int curGen, Tree *tree);
+int       PrintCheckPoint (int gen);
+int       PrintMCMCDiagnosticsToFile (int curGen);
+#if defined (MPI_ENABLED)
+int       PrintMPISlaves (FILE *fp);
+#endif
+void      PrintParamValues (Param *p, int chain, char *s);
+int       PrintParsMatrix (void);
+int       PrintSiteRates_Gen (TreeNode *p, int division, int chain);
+int       PrintSiteRates_Std (TreeNode *p, int division, int chain);
+int       PrintStates (int curGen, int coldId);
+int       PrintStatesToFiles (int n);
+int       PrintSwapInfo (void);
+int       PrintTermState (void);
+void      PrintTiProbs (CLFlt *tP, MrBFlt *bs, int nStates);
+int       PrintTopConvInfo (void);
+void      PrintToScreen (int curGen, int startGen, time_t endingT, time_t startingT);
+int       PrintTree (int curGen, Param *treeParam, int chain, int showBrlens, MrBFlt clockRate);
+MrBFlt    PropAncFossil (Param *param, int chain);
+#if defined (MPI_ENABLED)
+int       ReassembleMoveInfo (void);
+int       ReassembleParamVals (int *curId);
+int       ReassembleSwapInfo (void);
+int       ReassembleTuningParams (void);
+void      RedistributeMoveInfo (void);
+int       RedistributeParamVals (void);
+int       RedistributeTuningParams (void);
+#endif
+int       RemovePartition (PFNODE *r, BitsLong *p, int runId);
+int       RemoveTreeFromPartitionCounters (Tree *tree, int treeId, int runId);
+int       RemoveTreeSamples (int from, int to);
+int       ReopenMBPrintFiles (void);
+void      ResetChainIds (void);
+void      ResetFlips(int chain);
+int       ResetScalers (void);
+void      ResetSiteScalers (ModelInfo *m, int chain);
+int       ReusePreviousResults(int *numSamples, int);
+int       RunChain (RandLong *seed);
+int       SafeSprintf (char **target, int *targetLen, char *fmt, ...);
+void      SetChainIds (void);
+void      SetFileNames (void);
+int       SetLikeFunctions (void);
+int       SetLocalChainsAndDataSplits (void);
+int       SetModelInfo (void);
+int       SetMoves (void);
+int       SetBinaryQMatrix (MrBFlt **a, int whichChain, int division);
+int       SetNucQMatrix (MrBFlt **a, int n, int whichChain, int division, MrBFlt rateMult, MrBFlt *rA, MrBFlt *rS);
+int       SetProteinQMatrix (MrBFlt **a, int n, int whichChain, int division, MrBFlt rateMult);
+int       SetStdQMatrix (MrBFlt **a, int nStates, MrBFlt *bs, int cType);
+int       SetUpPartitionCounters (void);
+int       SetUpTermState (void);
+int       SetUsedMoves (void);
+int       ShowMoveSummary (void);
+void      ShowValuesForChain (int chn);
+int       SiteOmegas (TreeNode *p, int division, int chain);
+#if defined (SSE_ENABLED)
+int       SiteOmegas_SSE (TreeNode *p, int division, int chain);
+#endif
+PFNODE   *SmallestNonemptyPFNode (PFNODE *p, int *i, int j);
+PFNODE   *Talloc (void);
+void      Tfree (PFNODE *r);
+MrBFlt    Temperature (int x);
+void      TouchAllCijks (int chain);
+void      TouchAllPartitions (void);
+void      TouchAllTrees (int chain);
+void      TouchEverything (int chain);
+
+/* globals */
+int             *bsIndex;                    /* compressed std stat freq index               */
+Chain           chainParams;                 /* parameters of Markov chain                   */
+int             *compCharPos;                /* char position in compressed matrix           */
+int             *compColPos;                 /* column position in compressed matrix         */
+BitsLong        *compMatrix;                 /* compressed character matrix                  */
+int             compMatrixRowSize;           /* row size of compressed matrix                */
+char            inputFileName[100];          /* input (NEXUS) file name                      */
+MoveType        moveTypes[NUM_MOVE_TYPES];   /* holds information on the move types          */
+int             numCompressedChars;          /* number of compressed characters              */
+int             numMoveTypes;                /* the number of move types                     */
+CLFlt           *numSitesOfPat;              /* no. sites of each pattern                    */
+int             *origChar;                   /* index from compressed char to original char  */
+char            stamp[11];                   /* holds a unique identifier for each analysis  */
+MrBFlt          *stdStateFreqs;              /* std char state frequencies                   */
+int             *stdType;                    /* compressed std char type: ord, unord, irrev  */
+int             *tiIndex;                    /* compressed std char ti index                 */
+
+#if defined (BEAGLE_ENABLED)
+int             recalcScalers;               /* shoud we recalculate scalers for current state YES/NO */
+#endif
+
+/* local (to this file) variables */
+int             numLocalChains;              /* number of Markov chains                      */
+int             *chainId = NULL;             /* information on the id (0 ...) of the chain   */
+MrBFlt          *curLnL = NULL;              /* stores log likelihood                        */
+MrBFlt          *curLnPr = NULL;             /* stores log prior probability                 */
+int             stepRelativeBurninSS;        /* Should we use relative burn in within each step or not    */
+MrBFlt          powerSS;                     /* power (betta) in power posterior destribution used in SS  */
+MrBFlt          *marginalLnLSS = NULL;       /* marginal liklihood obtained using stepppingstone sampling */
+MrBFlt          *stepAcumulatorSS = NULL;    /* accumulates liklihoods for current step in SS             */
+MrBFlt          *stepScalerSS = NULL;        /* scaler of stepAcumulatorSS in log scale in SS             */
+MrBFlt          *splitfreqSS = NULL;         /* array holding split frequencis for each step in SS        */
+int             *sympiIndex;                 /* sympi state freq index for multistate chars  */
+int             stdStateFreqsRowSize;        /* row size for std state frequencies           */
+int             *weight;                     /* weight of each compressed char               */
+int             *chainTempId;                /* info ton temp, change to float holding temp? */
+int             state[MAX_CHAINS];           /* state of chain                               */
+int             augmentData;                 /* are data being augmented for any division?   */
+int             *nAccepted;                  /* counter of accepted moves                    */
+int             *termState = NULL;           /* stores character states of tips              */
+int             *isPartAmbig = NULL;         /* records whether tips are partially ambiguous */
+BitsLong        **parsPtrSpace = NULL;       /* space holding pointers to parsimony sets     */
+BitsLong        ***parsPtr = NULL;           /* pointers to pars state sets for chain & node */
+CLFlt           *parsNodeLengthSpace = NULL; /* space for parsimony node lengths             */
+CLFlt           **parsNodeLen = NULL;        /* pointers to pars node lengths for chains     */
+char            *printString;                /* string for printing to a file                */
+size_t          printStringSize;             /* length of printString                        */
+MCMCMove        **usedMoves;                 /* vector of pointers to used moves             */
+int             numUsedMoves;                /* the number of moves used by chain            */
+Param           **printParam;                /* vector of pointers to normal params to print */
+int             numPrintParams;              /* the number of normal params to print         */
+Param           **printTreeParam;            /* vector of pointers to tree params to print   */
+Param           **topologyParam;             /* vector of pointers to topology params        */
+int             numPrintTreeParams;          /* the number of tree params to print           */
+int             codon[6][64];                /* holds info on amino acids coded in code      */
+int             chainHasAdgamma;             /* indicates if chain has adgamma HMMs          */
+int             inferPosSel;                 /* indicates if positive selection is inferred  */
+MrBFlt          *posSelProbs;                /* probs. for positive selection                */
+int             hasMarkovTi[MAX_SMALL_JUMP]; /* vector marking size of observed HMM jumps    */
+int             *siteJump;                   /* vector of sitejumps for adgamma model        */
+MrBFlt          **rateProbs;                 /* pointers to rate probs used by adgamma model */
+MrBFlt          *rateProbSpace;              /* space for rate probs used by adgamma model   */
+int             rateProbRowSize;             /* size of rate probs for one chain one state   */
+MrBFlt          **markovTi[MAX_SMALL_JUMP];  /* trans prob matrices used in calc of adgamma  */
+MrBFlt          **markovTiN;                 /* trans prob matrices used in calc of adgamma  */
+int             whichReweightNum;            /* used for setting reweighting of char pats    */
+int             ***swapInfo;                 /* keeps track of attempts & successes of swaps */
+int             tempIndex;                   /* keeps track of which user temp is specified  */
+int             abortMove;                   /* flag determining whether to abort move       */
+PFNODE          **partFreqTreeRoot;          /* root of tree(s) holding partition freqs      */
+int             nLongsNeeded;                /* number of longs needed for partitions        */
+BitsLong        **partition;                 /* matrix holding partitions                    */
+MrBFlt          *maxLnL0 = NULL;             /* maximum likelihood                           */
+FILE            *fpMcmc = NULL;              /* pointer to .mcmc file                        */
+FILE            **fpParm = NULL;             /* pointer to .p file(s)                        */
+FILE            ***fpTree = NULL;            /* pointer to .t file(s)                        */
+FILE            *fpSS = NULL;                /* pointer to .ss file                          */
+static int      requestAbortRun;             /* flag for aborting mcmc analysis              */
+int             *topologyPrintIndex;         /* print file index of each topology            */
+int             *printTreeTopologyIndex;     /* topology index of each tree print file       */
+int             numPreviousGen;              /* number of generations in run to append to    */
+
+#if defined (MPI_ENABLED)
+int             lowestLocalRunId;            /* lowest local run Id                          */
+int             highestLocalRunId;           /* highest local run Id                         */
+#endif
+
+#if defined (PRINT_DUMP)
+FILE            **fpDump = NULL;             /* pointer to .dump file(s)                     */
+#endif
+
+/* AddPartition: Add a partition to the tree keeping track of partition frequencies */
+PFNODE *AddPartition (PFNODE *r, BitsLong *p, int runId)
+{
+    int     i, comp;
+    
+    if (r == NULL)
+        {
+        /* new partition */
+        r = Talloc ();                  /* create a new node */
+        if (r == NULL)
+            return NULL;
+        for (i=0; i<nLongsNeeded; i++)
+            r->partition[i] = p[i];
+        for (i=0; i<chainParams.numRuns; i++)
+            r->count[i] = 0;
+        r->count[runId] = 1;
+        r->left = r->right = NULL;
+        }
+    else
+        {
+        for (i=0; i<nLongsNeeded; i++)
+            {
+            if (r->partition[i] != p[i])
+                break;
+            }
+        
+        if (i == nLongsNeeded)
+            comp = 0;
+        else if (r->partition[i] < p[i])
+            comp = -1;
+        else
+            comp = 1;
+        
+        if (comp == 0)          /* repeated partition */
+            r->count[runId]++;
+        else if (comp < 0)      /* greater than -> into left subtree */
+            {
+            if ((r->left = AddPartition (r->left, p, runId)) == NULL)
+                {
+                Tfree (r);
+                return NULL;
+                }
+            }
+        else
+            {
+            /* smaller than -> into right subtree */
+            if ((r->right = AddPartition (r->right, p, runId)) == NULL)
+                {
+                Tfree (r);
+                return NULL;
+                }
+            }
+        }
+
+    return r;
+}
+
+
+int AddToPrintString (char *tempStr)
+{
+    size_t  len1, len2;
+    
+    len1 = strlen(printString);
+    len2 = strlen(tempStr);
+    if (len1 + len2 + 5 > printStringSize)
+        {
+        printStringSize += len1 + len2 - printStringSize + 200;
+        printString = (char*)SafeRealloc((void*)printString, printStringSize * sizeof(char));
+        if (!printString)
+            {
+            MrBayesPrint ("%s   Problem reallocating printString (%d)\n", spacer, printStringSize * sizeof(char));
+            goto errorExit;
+            }
+        }
+    strcat(printString, tempStr);   
+    // printf ("printString(%d) -> \"%s\"\n", printStringSize, printString);
+    return (NO_ERROR);
+    
+    errorExit:
+        return (ERROR);
+}
+
+
+/* AddTreeSamples: Add tree samples from .t files to partition counters. if saveToList == YES then also save trees in tree list */
+int AddTreeSamples (int from, int to, int saveToList)
+{
+    int     i, j, k, longestLine;
+    BitsLong    lastBlock;
+    char    *word, *s, *lineBuf;
+    FILE    *fp;
+    Tree    *t;
+    char    *tempStr;
+    int     tempStrSize = TEMPSTRSIZE;
+
+    if (from > to)
+        return (NO_ERROR);
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    for (i=0; i<numTopologies; i++)
+        {
+        t = chainParams.dtree;
+
+        for (j=0; j<chainParams.numRuns; j++)
+            {
+            if (numPrintTreeParams == 1)
+                {
+                if (chainParams.numRuns == 1)
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.t", chainParams.chainFileName);
+                else
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.run%d.t", chainParams.chainFileName, j+1);
+                }
+            else
+                {
+                if (chainParams.numRuns == 1)
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.tree%d.t", chainParams.chainFileName, i+1);
+                else
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.tree%d.run%d.t", chainParams.chainFileName, i+1, j+1);
+                }
+
+            if ((fp = OpenBinaryFileR (tempStr)) == NULL) 
+                {
+                MrBayesPrint ("%s   Problem openning file %s.\n", spacer, tempStr);
+                free (tempStr);
+                return (ERROR);
+                }
+
+            longestLine = LongestLine (fp);
+            SafeFclose (&fp);
+
+            if ((fp = OpenTextFileR (tempStr)) == NULL) 
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+
+            lineBuf = (char *) SafeCalloc (longestLine + 10, sizeof (char));
+            if (!lineBuf)
+                {
+                SafeFclose (&fp);
+                free (tempStr);
+                return (ERROR);
+                }
+
+            lastBlock = LastBlock (fp, lineBuf, longestLine);
+            fseek (fp, lastBlock, SEEK_SET);
+
+            for (k=1; k<=to; k++)
+                {
+                do {
+                    if (fgets (lineBuf, longestLine, fp) == NULL) 
+                        {
+                        SafeFclose (&fp);
+                        free (lineBuf);
+                        free (tempStr);
+                        return ERROR;
+                        }
+                    word = strtok (lineBuf, " ");
+                    } while (strcmp (word, "tree") != 0);
+                if (k>=from)
+                    {
+                    s = strtok (NULL, ";");
+                    while (*s != '(')
+                        s++;
+                    StripComments(s);
+                    if (ResetTopology (t, s) == ERROR)
+                        {
+                        SafeFclose (&fp);
+                        free (lineBuf);
+                        free (tempStr);
+                        return ERROR;
+                        }
+                    if (AddTreeToPartitionCounters (t, i, j) == ERROR)
+                        {
+                        SafeFclose (&fp);
+                        free (lineBuf);
+                        free (tempStr);
+                        return ERROR;
+                        }
+                    if (saveToList == YES)
+                        if (AddToTreeList(&chainParams.treeList[numTopologies*j+i],t) == ERROR)
+                            return (ERROR);
+                    }
+                }
+            SafeFclose (&fp);
+            free (lineBuf);
+            } /* next run */
+        } /* next tree */
+    free (tempStr);
+    return (NO_ERROR);
+}
+
+
+/* AddTreeToPartitionCounters: Break a tree into partitions and add those to counters */
+int AddTreeToPartitionCounters (Tree *tree, int treeId, int runId)
+{
+    int         i, j, nTaxa;
+    TreeNode    *p;
+
+    if (tree->isRooted == YES)
+        nTaxa = tree->nNodes - tree->nIntNodes - 1;
+    else
+        nTaxa = tree->nNodes - tree->nIntNodes;
+
+    for (i=0; i<nTaxa; i++)
+        {
+        ClearBits(partition[i], nLongsNeeded);
+        SetBit(i, partition[i]);
+        }
+
+    for (i=0; i<tree->nIntNodes-1; i++)
+        {
+        p = tree->intDownPass[i];
+        assert (p->index >= tree->nNodes - tree->nIntNodes - (tree->isRooted == YES ? 1 : 0));
+        for (j=0; j<nLongsNeeded; j++)
+            {
+            partition[p->index][j] = partition[p->left->index][j] | partition[p->right->index][j];
+            }
+
+        if ((partFreqTreeRoot[treeId] = AddPartition (partFreqTreeRoot[treeId], partition[p->index], runId)) == NULL)
+            {
+            MrBayesPrint ("%s   Could not allocate space for new partition in AddTreeToPartitionCounters\n", spacer);
+            return ERROR;
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+int AttemptSwap (int swapA, int swapB, RandLong *seed)
+{
+    int             d, tempX, reweightingChars, isSwapSuccessful, chI, chJ, runId;
+    MrBFlt          tempA, tempB, lnLikeA, lnLikeB, lnPriorA, lnPriorB, lnR, r,
+                    lnLikeStateAonDataB=0.0, lnLikeStateBonDataA=0.0, lnL;
+    ModelInfo       *m;
+    Tree            *tree;
+#   if defined (MPI_ENABLED)
+    int             numChainsForProc, tempIdA=0, tempIdB=0, proc, procIdForA=0, procIdForB=0, tempIdMy=0, procIdPartner=0,
+                    whichElementA=0, whichElementB=0, lower, upper, areWeA, doISwap, ierror,
+                    myId, partnerId, i, run;
+    MrBFlt          swapRan;
+    MPI_Status      status[2];
+    MPI_Request     request[2];
+#   endif
+
+#   if defined (MPI_ENABLED)
+
+    /* get the number of chains handled by this proc */
+    /* the number will be corrected further down for unbalanced scenarios */
+    numChainsForProc = (int) (chainParams.numChains * chainParams.numRuns / num_procs);
+
+#   endif
+
+    /* are we using character reweighting? */
+    reweightingChars = NO;
+    if ((chainParams.weightScheme[0] + chainParams.weightScheme[1]) > 0.00001)
+        reweightingChars = YES;
+            
+#   if defined (MPI_ENABLED)
+
+    /* figure out processors involved in swap */
+    lower = upper = 0;
+    for (proc=0; proc<num_procs; proc++)
+        {
+        /* assign or increment chain id */
+        if (proc < (chainParams.numChains * chainParams.numRuns) % num_procs)
+            upper += numChainsForProc+1;
+        else
+            upper += numChainsForProc;
+
+        /* if swapA lies between lower and upper
+            * chain id's we know that this is the proc
+            * swapA is in */
+        if (swapA >= lower && swapA < upper)
+            {
+            procIdForA = proc;
+            whichElementA = swapA - lower;
+            }
+        if (swapB >= lower && swapB < upper)
+            {
+            procIdForB = proc;
+            whichElementB = swapB - lower;
+            }
+        lower = upper;
+        }
+
+    /* NOTE: at this point, procIdForA and procIdForB *
+        * store the proc id's of swapping procs. Also,   *
+        * whichElementA and whichElementB store the      *
+        * chainId[] index of swapping procs              */
+
+    /* figure out if I am involved in the swap */
+    doISwap = areWeA = NO;
+    if (proc_id == procIdForA)
+        {
+        doISwap = YES;
+        areWeA = YES;
+        }
+    else if (proc_id == procIdForB)
+        {
+        doISwap = YES;
+        }
+
+    /* chain's that do not swap, continue to the next iteration */  
+    if (doISwap == YES)
+        {
+        
+        /* no need to communicate accross processors if swapping chains are in the same proc */
+        if (procIdForA == procIdForB)
+            {
+            if (reweightingChars == YES)
+                {
+                /* use character reweighting */
+                lnLikeStateAonDataB = 0.0;
+                for (d=0; d<numCurrentDivisions; d++)
+                    {
+                    m = &modelSettings[d];
+                    tree = GetTree(m->brlens, whichElementA, state[whichElementA]);
+                    lnL = 0.0;
+                    m->Likelihood (tree->root->left, d, whichElementA, &lnL, chainId[whichElementB] % chainParams.numChains);
+                    lnLikeStateAonDataB += lnL;
+                    }
+                lnLikeStateBonDataA = 0.0;
+                for (d=0; d<numCurrentDivisions; d++)
+                    {
+                    m = &modelSettings[d];
+                    tree = GetTree(m->brlens, whichElementB, state[whichElementB]);
+                    lnL = 0.0;
+                    m->Likelihood (tree->root->left, d, whichElementB, &lnL, chainId[whichElementA] % chainParams.numChains);
+                    lnLikeStateBonDataA += lnL;
+                    }
+                }
+
+            /*curLnPr[whichElementA] = LogPrior(whichElementA);
+            curLnPr[whichElementB] = LogPrior(whichElementB);*/
+
+            /* then do the serial thing - simply swap chain id's */
+            tempA = Temperature (chainId[whichElementA]);
+            tempB = Temperature (chainId[whichElementB]);
+            lnLikeA = curLnL[whichElementA];
+            lnLikeB = curLnL[whichElementB];
+            if (chainParams.isSS == YES)
+                {
+                lnLikeA *= powerSS;
+                lnLikeB *= powerSS;
+                }
+            lnPriorA = curLnPr[whichElementA];
+            lnPriorB = curLnPr[whichElementB];
+            if (reweightingChars == YES)
+                {
+                if (chainParams.isSS == YES)
+                    lnR = (tempB * (lnLikeStateAonDataB*powerSS + lnPriorA) + tempA * (lnLikeStateBonDataA*powerSS + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                else
+                    lnR = (tempB * (lnLikeStateAonDataB + lnPriorA) + tempA * (lnLikeStateBonDataA + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                }
+            else
+                lnR = (tempB * (lnLikeA + lnPriorA) + tempA * (lnLikeB + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+            if (lnR <  -100.0)
+                r =  0.0;
+            else if (lnR > 0.0)
+                r =  1.0;
+            else
+                r =  exp(lnR);
+
+            isSwapSuccessful = NO;
+            if (RandomNumber(seed) < r)
+                {
+                /* swap chain id's (heats) */
+                tempX = chainId[whichElementA];
+                chainId[whichElementA] = chainId[whichElementB];
+                chainId[whichElementB] = tempX;
+                if (reweightingChars == YES)
+                    {
+                    curLnL[whichElementA] = lnLikeStateAonDataB;
+                    curLnL[whichElementB] = lnLikeStateBonDataA;
+                    }
+                isSwapSuccessful = YES;
+                }
+                
+            chI = chainId[whichElementA];
+            chJ = chainId[whichElementB];
+            if (chainId[whichElementB] < chainId[whichElementA])
+                {
+                chI = chainId[whichElementB];
+                chJ = chainId[whichElementA];
+                }
+            runId = chI / chainParams.numChains;
+            chI = chI % chainParams.numChains;
+            chJ = chJ % chainParams.numChains;
+            swapInfo[runId][chJ][chI]++;
+            if (isSwapSuccessful == YES)
+                swapInfo[runId][chI][chJ]++;
+            }
+        /* we need to communicate across processors */
+        else
+            {
+            if (reweightingChars == YES)
+                {
+                /* If we are reweighting characters, then we need to do an additional communication to
+                    figure out the chainId's of the partner. We need to have this information so we can
+                    properly calculate likelihoods with switched observations. */
+                if (areWeA == YES)
+                    {
+                    lnLikeStateAonDataB = 0.0;
+                    myId = chainId[whichElementA];
+                    ierror = MPI_Isend (&myId, 1, MPI_INT, procIdForB, 0, MPI_COMM_WORLD, &request[0]);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Irecv (&partnerId, 1, MPI_INT, procIdForB, 0, MPI_COMM_WORLD, &request[1]);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (2, request, status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    for (d=0; d<numCurrentDivisions; d++)
+                        {
+                        m = &modelSettings[d];
+                        tree = GetTree(m->brlens, whichElementA, state[whichElementA]);
+                        lnL = 0.0;
+                        m->Likelihood (tree->root->left, d, whichElementA, &lnL, partnerId);
+                        lnLikeStateAonDataB = lnL;
+                        }
+                    }
+                else
+                    {
+                    lnLikeStateBonDataA = 0.0;
+                    myId = chainId[whichElementB];
+                    ierror = MPI_Isend (&myId, 1, MPI_INT, procIdForA, 0, MPI_COMM_WORLD, &request[0]);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Irecv (&partnerId, 1, MPI_INT, procIdForA, 0, MPI_COMM_WORLD, &request[1]);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (2, request, status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    for (d=0; d<numCurrentDivisions; d++)
+                        {
+                        m = &modelSettings[d];
+                        tree = GetTree(m->brlens, whichElementB, state[whichElementB]);
+                        lnL = 0.0;
+                        m->Likelihood (tree->root->left, d, whichElementB, &lnL, partnerId);
+                        lnLikeStateBonDataA = lnL;
+                        }
+                    }
+                }
+
+            if (areWeA == YES)
+                {
+                /*curLnPr[whichElementA] = LogPrior(whichElementA);*/
+
+                /* we are processor A */
+                tempIdA = chainId[whichElementA];
+                lnLikeA = curLnL[whichElementA];
+                lnPriorA = curLnPr[whichElementA];
+                swapRan = RandomNumber(seed);
+
+                myStateInfo[0] = lnLikeA;
+                myStateInfo[1] = lnPriorA;
+                myStateInfo[2] = tempIdA;
+                myStateInfo[3] = swapRan;
+                myStateInfo[4] = 0.0;
+                if (reweightingChars == YES)
+                    {
+                    myStateInfo[2] = lnLikeStateAonDataB;
+                    tempIdB = partnerId;
+                    }
+                    
+                ierror = MPI_Isend (&myStateInfo, 5, MPI_DOUBLE, procIdForB, 0, MPI_COMM_WORLD, &request[0]);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Irecv (&partnerStateInfo, 5, MPI_DOUBLE, procIdForB, 0, MPI_COMM_WORLD, &request[1]);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (2, request, status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+
+                lnLikeA = curLnL[whichElementA];
+                lnLikeB = partnerStateInfo[0];
+                if (chainParams.isSS == YES)
+                    {
+                    lnLikeA *= powerSS;
+                    lnLikeB *= powerSS;
+                    }
+                lnPriorA = curLnPr[whichElementA];
+                lnPriorB = partnerStateInfo[1];
+                if (reweightingChars == YES)
+                    lnLikeStateBonDataA = partnerStateInfo[2];
+                else
+                    tempIdB = partnerStateInfo[2];
+                
+                tempA = Temperature (tempIdA);
+                tempB = Temperature (tempIdB);
+
+                if (reweightingChars == YES)
+                    {
+                    if (chainParams.isSS == YES)
+                        lnR = (tempB * (lnLikeStateAonDataB*powerSS + lnPriorA) + tempA * (lnLikeStateBonDataA*powerSS + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                    else
+                        lnR = (tempB * (lnLikeStateAonDataB + lnPriorA) + tempA * (lnLikeStateBonDataA + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                    }
+                else
+                    lnR = (tempB * (lnLikeA + lnPriorA) + tempA * (lnLikeB + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                if (lnR < -100.0)
+                    r = 0.0;
+                else if (lnR > 0.0)
+                    r = 1.0;
+                else
+                    r = exp(lnR);
+
+                /* process A's random number is used to make the swap decision */
+                isSwapSuccessful = NO;
+                if (swapRan < r)
+                    {
+                    /* swap chain id's (heats) */
+                    isSwapSuccessful = YES;
+                    tempIdMy = chainId[whichElementA];
+                    procIdPartner = procIdForB;
+
+                    if (reweightingChars == YES)
+                        chainId[whichElementA] = tempIdB;
+                    else
+                        chainId[whichElementA] = (int)(partnerStateInfo[2]);
+                    if (reweightingChars == YES)
+                        {
+                        curLnL[whichElementA] = lnLikeStateAonDataB;
+                        }
+                    }
+                    
+                /* only processor A keeps track of the swap success/failure */
+                chI = tempIdA;
+                chJ = tempIdB;
+                if (tempIdB < tempIdA)
+                    {
+                    chI = tempIdB;
+                    chJ = tempIdA;
+                    }
+                runId = chI / chainParams.numChains;
+                chI = chI % chainParams.numChains;
+                chJ = chJ % chainParams.numChains;
+                swapInfo[runId][chJ][chI]++;
+                if (isSwapSuccessful == YES)
+                    {
+                    swapInfo[runId][chI][chJ]++;
+                    /* exchange the move info */
+                    for (i=0; i<numUsedMoves; i++)
+                        {
+                        myStateInfo[0] = usedMoves[i]->nAccepted[tempIdA];
+                        myStateInfo[1] = usedMoves[i]->nTried[tempIdA];
+                        myStateInfo[2] = usedMoves[i]->nBatches[tempIdA];
+                        myStateInfo[3] = usedMoves[i]->nTotAccepted[tempIdA];
+                        myStateInfo[4] = usedMoves[i]->nTotTried[tempIdA];
+                        myStateInfo[5] = usedMoves[i]->lastAcceptanceRate[tempIdA];
+                        if (usedMoves[i]->moveType->numTuningParams > 0)
+                            myStateInfo[6] = usedMoves[i]->tuningParam[tempIdA][0];
+                        else
+                            myStateInfo[6] = 0.0;
+
+                        ierror = MPI_Isend (&myStateInfo, 7, MPI_DOUBLE, procIdForB, 0, MPI_COMM_WORLD, &request[0]);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            return (ERROR);
+                            }
+                        ierror = MPI_Irecv (&partnerStateInfo, 7, MPI_DOUBLE, procIdForB, 0, MPI_COMM_WORLD, &request[1]);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            return (ERROR);
+                            }
+                        ierror = MPI_Waitall (2, request, status);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            return (ERROR);
+                            }
+
+                        usedMoves[i]->nAccepted[tempIdB]          = (int)partnerStateInfo[0];
+                        usedMoves[i]->nTried[tempIdB]             = (int)partnerStateInfo[1];
+                        usedMoves[i]->nBatches[tempIdB]           = (int)partnerStateInfo[2];
+                        usedMoves[i]->nTotAccepted[tempIdB]       = (int)partnerStateInfo[3];
+                        usedMoves[i]->nTotTried[tempIdB]          = (int)partnerStateInfo[4];
+                        usedMoves[i]->lastAcceptanceRate[tempIdB] = partnerStateInfo[5];
+                        if (usedMoves[i]->moveType->numTuningParams > 0)
+                            usedMoves[i]->tuningParam[tempIdB][0]     = partnerStateInfo[6];
+
+                        usedMoves[i]->nAccepted[tempIdA]          = 0;
+                        usedMoves[i]->nTried[tempIdA]             = 0;
+                        usedMoves[i]->nBatches[tempIdA]           = 0;
+                        usedMoves[i]->lastAcceptanceRate[tempIdA] = 0.0;
+                        usedMoves[i]->nTotAccepted[tempIdA]       = 0;
+                        usedMoves[i]->nTotTried[tempIdA]          = 0;
+                        if (usedMoves[i]->moveType->numTuningParams > 0)
+                            usedMoves[i]->tuningParam[tempIdA][0]     = 0.0;
+                
+                        }
+                    }
+                }
+            else
+                {
+                /*curLnPr[whichElementB] = LogPrior(whichElementB);*/
+
+                /* we are processor B */
+                tempIdB  = chainId[whichElementB];
+                lnLikeB  = curLnL[whichElementB];
+                lnPriorB = curLnPr[whichElementB];
+                swapRan  = -1.0;
+
+                myStateInfo[0] = lnLikeB;
+                myStateInfo[1] = lnPriorB;
+                myStateInfo[2] = tempIdB;
+                myStateInfo[3] = swapRan;
+                myStateInfo[4] = 0.0;
+                if (reweightingChars == YES)
+                    {
+                    myStateInfo[2] = lnLikeStateBonDataA;
+                    tempIdA = partnerId;
+                    }
+
+                ierror = MPI_Isend (&myStateInfo, 5, MPI_DOUBLE, procIdForA, 0, MPI_COMM_WORLD, &request[0]);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Irecv (&partnerStateInfo, 5, MPI_DOUBLE, procIdForA, 0, MPI_COMM_WORLD, &request[1]);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (2, request, status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+
+                lnLikeB = curLnL[whichElementB];
+                lnLikeA = partnerStateInfo[0];
+                lnPriorB = curLnPr[whichElementB];
+                lnPriorA = partnerStateInfo[1];
+                if (reweightingChars == YES)
+                    lnLikeStateAonDataB = partnerStateInfo[2];
+                else
+                    tempIdA = partnerStateInfo[2];
+
+                tempB = Temperature (tempIdB);
+                tempA = Temperature (tempIdA);
+
+                if (chainParams.isSS == YES)
+                    {
+                    lnLikeA *= powerSS;
+                    lnLikeB *= powerSS;
+                    }
+
+                if (reweightingChars == YES)
+                    {
+                    if (chainParams.isSS == YES)
+                        lnR = (tempB * (lnLikeStateAonDataB*powerSS + lnPriorA) + tempA * (lnLikeStateBonDataA*powerSS + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                    else
+                        lnR = (tempB * (lnLikeStateAonDataB + lnPriorA) + tempA * (lnLikeStateBonDataA + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                    }
+                else
+                    lnR = (tempB * (lnLikeA + lnPriorA) + tempA * (lnLikeB + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+                if (lnR < -100.0)
+                    r = 0.0;
+                else if (lnR > 0.0)
+                    r = 1.0;
+                else
+                    r = exp(lnR);
+
+                /* we use process A's random number to make the swap decision */
+                isSwapSuccessful = NO;
+                if (partnerStateInfo[3] < r)
+                    {
+                    isSwapSuccessful = YES;
+                    tempIdMy = chainId[whichElementB];
+                    procIdPartner = procIdForA;
+
+                    if (reweightingChars == YES)
+                        chainId[whichElementB] = tempIdA;
+                    else
+                        chainId[whichElementB] = (int)(partnerStateInfo[2]);
+                    if (reweightingChars == YES)
+                        {
+                        curLnL[whichElementB] = lnLikeStateBonDataA;
+                        }
+                    /* swap the move info */
+                    for (i=0; i<numUsedMoves; i++)
+                        {
+                        myStateInfo[0] = usedMoves[i]->nAccepted[tempIdB];
+                        myStateInfo[1] = usedMoves[i]->nTried[tempIdB];
+                        myStateInfo[2] = usedMoves[i]->nBatches[tempIdB];
+                        myStateInfo[3] = usedMoves[i]->nTotAccepted[tempIdB];
+                        myStateInfo[4] = usedMoves[i]->nTotTried[tempIdB];
+                        myStateInfo[5] = usedMoves[i]->lastAcceptanceRate[tempIdB];
+                        if (usedMoves[i]->moveType->numTuningParams > 0)
+                            myStateInfo[6] = usedMoves[i]->tuningParam[tempIdB][0];
+                        else
+                            myStateInfo[6] = 0.0;
+
+                        ierror = MPI_Isend (&myStateInfo, 7, MPI_DOUBLE, procIdForA, 0, MPI_COMM_WORLD, &request[0]);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            return (ERROR);
+                            }
+                        ierror = MPI_Irecv (&partnerStateInfo, 7, MPI_DOUBLE, procIdForA, 0, MPI_COMM_WORLD, &request[1]);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            return (ERROR);
+                            }
+                        ierror = MPI_Waitall (2, request, status);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            return (ERROR);
+                            }
+
+                        usedMoves[i]->nAccepted[tempIdA]          = (int)partnerStateInfo[0];
+                        usedMoves[i]->nTried[tempIdA]             = (int)partnerStateInfo[1];
+                        usedMoves[i]->nBatches[tempIdA]           = (int)partnerStateInfo[2];
+                        usedMoves[i]->nTotAccepted[tempIdA]       = (int)partnerStateInfo[3];
+                        usedMoves[i]->nTotTried[tempIdA]          = (int)partnerStateInfo[4];
+                        usedMoves[i]->lastAcceptanceRate[tempIdA] = partnerStateInfo[5];
+                        if (usedMoves[i]->moveType->numTuningParams > 0)
+                            usedMoves[i]->tuningParam[tempIdA][0]     = partnerStateInfo[6];
+
+                        usedMoves[i]->nAccepted[tempIdB]          = 0;
+                        usedMoves[i]->nTried[tempIdB]             = 0;
+                        usedMoves[i]->nBatches[tempIdB]           = 0;
+                        usedMoves[i]->nTotAccepted[tempIdB]       = 0;
+                        usedMoves[i]->nTotTried[tempIdB]          = 0;
+                        usedMoves[i]->lastAcceptanceRate[tempIdB] = 0.0;
+                        if (usedMoves[i]->moveType->numTuningParams > 0)
+                            usedMoves[i]->tuningParam[tempIdB][0]     = 0.0;
+                        }
+                    }
+                }
+
+            /*We exchange only if swap successful and (my id is cold or patner id is cold)*/
+            if (chainParams.isSS == YES && isSwapSuccessful == YES && (tempIdMy % chainParams.numChains == 0 || (areWeA == YES && chainId[whichElementA] % chainParams.numChains == 0) || (areWeA == NO && chainId[whichElementB] % chainParams.numChains == 0)))
+                {
+                    run = tempIdMy/chainParams.numChains;
+
+                    myStateInfo[0] = tempIdMy;
+                    myStateInfo[1] = marginalLnLSS   [ run ];
+                    myStateInfo[2] = stepAcumulatorSS[ run ];
+                    myStateInfo[3] = stepScalerSS    [ run ];
+
+                    ierror = MPI_Isend (&myStateInfo, 4, MPI_DOUBLE, procIdPartner, 0, MPI_COMM_WORLD, &request[0]);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+
+                    ierror = MPI_Irecv (&partnerStateInfo, 4, MPI_DOUBLE, procIdPartner, 0, MPI_COMM_WORLD, &request[1]);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (2, request, status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+
+                    /*we swap chains from the same run*/
+                    assert (run == (int)partnerStateInfo[0]/chainParams.numChains);
+
+                    /*If my chain is the cold chain then send current SS values of corresponding run*/
+                    if (tempIdMy % chainParams.numChains == 0)
+                        {
+                        assert ((int)partnerStateInfo[0] % chainParams.numChains != 0);
+                        assert (partnerStateInfo[1] == 0.0);
+                        marginalLnLSS   [ run ] = (MrBFlt) 0.0;
+                        stepAcumulatorSS[ run ] = (MrBFlt) 0.0;
+                        stepScalerSS    [ run ] = (MrBFlt) 0.0;
+                        }
+                    else if ((int)partnerStateInfo[0] % chainParams.numChains == 0)
+                        {
+                        marginalLnLSS   [ run ] = (MrBFlt) partnerStateInfo[1];
+                        stepAcumulatorSS[ run ] = (MrBFlt) partnerStateInfo[2];
+                        stepScalerSS    [ run ] = (MrBFlt) partnerStateInfo[3];
+                        }
+                }
+
+            }
+        }
+#   else
+    if (reweightingChars == YES)
+        {
+        /* use character reweighting */
+        lnLikeStateAonDataB = 0.0;
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            tree = GetTree(m->brlens, swapA, state[swapA]);
+            lnL = 0.0;
+            m->Likelihood (tree->root->left, d, swapA, &lnL, chainId[swapB] % chainParams.numChains);
+            lnLikeStateAonDataB += lnL;
+            }
+        lnLikeStateBonDataA = 0.0;
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            tree = GetTree(m->brlens, swapB, state[swapB]);
+            lnL = 0.0;
+            m->Likelihood (tree->root->left, d, swapB, &lnL, chainId[swapA] % chainParams.numChains);
+            lnLikeStateBonDataA += lnL;
+            }
+        }
+
+    assert (fabs((curLnPr[swapA]-LogPrior(swapA))/curLnPr[swapA]) < 0.0001);
+    assert (fabs((curLnPr[swapB]-LogPrior(swapB))/curLnPr[swapB]) < 0.0001);
+
+    tempA = Temperature (chainId[swapA]);
+    tempB = Temperature (chainId[swapB]);
+    lnLikeA = curLnL[swapA];
+    lnLikeB = curLnL[swapB];
+    lnPriorA = curLnPr[swapA];
+    lnPriorB = curLnPr[swapB];
+
+    if (chainParams.isSS == YES)
+        {
+        lnLikeA *= powerSS;
+        lnLikeB *= powerSS;
+        }
+
+    if (reweightingChars == YES)
+        {
+        if (chainParams.isSS == YES)
+            lnR = (tempB * (lnLikeStateAonDataB*powerSS + lnPriorA) + tempA * (lnLikeStateBonDataA*powerSS + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+        else
+            lnR = (tempB * (lnLikeStateAonDataB + lnPriorA) + tempA * (lnLikeStateBonDataA + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+        }
+    else
+        lnR = (tempB * (lnLikeA + lnPriorA) + tempA * (lnLikeB + lnPriorB)) - (tempA * (lnLikeA + lnPriorA) + tempB * (lnLikeB + lnPriorB));
+    if (lnR < -100.0)
+        r = 0.0;
+    else if (lnR > 0.0)
+        r =  1.0;
+    else
+        r =  exp (lnR);
+
+    isSwapSuccessful = NO;
+    if (RandomNumber(seed) < r)
+        {
+        tempX = chainId[swapA];
+        chainId[swapA] = chainId[swapB];
+        chainId[swapB] = tempX;
+
+        if (reweightingChars == YES)
+            {
+            curLnL[swapA] = lnLikeStateAonDataB;
+            curLnL[swapB] = lnLikeStateBonDataA;
+            }
+        isSwapSuccessful = YES;
+        }
+        
+    chI = chainId[swapA];
+    chJ = chainId[swapB];
+    if (chainId[swapB] < chainId[swapA])
+        {
+        chI = chainId[swapB];
+        chJ = chainId[swapA];
+        }
+    runId = chI / chainParams.numChains;
+    chI = chI % chainParams.numChains;
+    chJ = chJ % chainParams.numChains;
+    swapInfo[runId][chJ][chI]++;
+    if (isSwapSuccessful == YES)
+        swapInfo[runId][chI][chJ]++;
+#   endif
+    
+    return (NO_ERROR);
+}
+
+
+/* Autotune Dirichlet move */
+void AutotuneDirichlet (MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *alphaPi, MrBFlt minTuning, MrBFlt maxTuning)
+{
+    MrBFlt delta, logTuning, newTuning;
+
+    delta = 1.0 / sqrt(batch);
+    delta = 0.01 < delta ? 0.01 : delta;
+
+    logTuning = log(*alphaPi);
+
+    if (acceptanceRate > targetRate)
+        logTuning -= delta;
+    else
+        logTuning += delta;
+
+    newTuning = exp(logTuning);
+    if (newTuning > minTuning && newTuning < maxTuning)
+        *alphaPi = newTuning;
+}
+
+
+/* Autotune multiplier move */
+void AutotuneMultiplier (MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *lambda, MrBFlt minTuning, MrBFlt maxTuning)
+{
+    MrBFlt delta, logTuning, newTuning;
+
+    delta = 1.0 / sqrt(batch);
+    delta = 0.01 < delta ? 0.01 : delta;
+
+    logTuning = log(*lambda);
+
+    if (acceptanceRate > targetRate)
+        logTuning += delta;
+    else
+        logTuning -= delta;
+
+    newTuning = exp(logTuning);
+    if (newTuning > minTuning && newTuning < maxTuning)
+        *lambda = newTuning;
+}
+
+
+/* Autotune sliding window move */
+void AutotuneSlider (MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *width, MrBFlt minTuning, MrBFlt maxTuning)
+{
+    MrBFlt delta, logTuning, newTuning;
+
+    delta = 1.0 / sqrt(batch);
+    delta = 0.01 < delta ? 0.01 : delta;
+
+    logTuning = log(*width);
+
+    if (acceptanceRate > targetRate)
+        logTuning += delta;
+    else
+        logTuning -= delta;
+
+    newTuning = exp(logTuning);
+    if (newTuning > minTuning && newTuning < maxTuning)
+        *width = newTuning;
+}
+
+
+void BuildExhaustiveSearchTree (Tree *t, int chain, int nTaxInTree, TreeInfo *tInfo)
+{
+    int         i;
+    TreeNode    *p, *q, *r;
+        
+    if (nTaxInTree == t->nIntNodes + 1) {
+        
+        /* Get downpass */
+        GetDownPass (t);
+
+        /* Calculate cost of this tree and add to counter */
+        tInfo->curScore = GetParsimonyLength (t, chain);
+        if (tInfo->curScore < tInfo->minScore)
+            {
+            tInfo->totalScore *= pow ((tInfo->warp/3.0) / (1.0 - tInfo->warp), tInfo->minScore - tInfo->curScore);
+            tInfo->totalScore += 1.0;
+            tInfo->minScore = tInfo->curScore;
+            }
+        else
+            tInfo->totalScore += pow (tInfo->warp/3.0, tInfo->curScore - tInfo->minScore) * pow (1.0-tInfo->warp, tInfo->minScore - tInfo->curScore);
+    }
+
+    else {
+
+        /* find node to connect */
+        q=tInfo->leaf[nTaxInTree];
+
+        /* add using this ancestral node */
+        p=tInfo->vertex[nTaxInTree-1];
+        q->anc=p;
+        p->right=q;
+
+        for (i=0;i<2*nTaxInTree-1;i++) {
+            /* find node to connect to */
+            if (i>=nTaxInTree)
+                r=tInfo->vertex[i-nTaxInTree];
+            else
+                r=tInfo->leaf[i];
+
+            /* add to this node */
+            p->left=r;
+            if (r->anc==NULL)
+                p->anc=NULL;
+            else {
+                p->anc=r->anc;
+                if (r->anc->left==r)
+                    r->anc->left=p;
+                else
+                    r->anc->right=p;
+            }
+            r->anc=p;
+
+            /* next level */
+            BuildExhaustiveSearchTree (t, chain, nTaxInTree+1, tInfo);
+
+            if (tInfo->stopScore > 0.0 && tInfo->totalScore >= tInfo->stopScore)
+                return;
+
+            /* restore tree before trying next possibility */
+            r->anc=p->anc;
+            if (r->anc!=NULL) {
+                if (r->anc->left==p)
+                    r->anc->left=r;
+                else
+                    r->anc->right=r;
+            }
+        }
+    }
+}
+
+
+/*------------------------------------------------------------------
+|
+|   BuildParsTrees: Fill in trees using random add seq with parsimony
+|
+------------------------------------------------------------------*/
+int BuildParsTrees (RandLong *seed, int fromChain, int toChain)
+{
+    int         k, chn;
+    Param       *p, *q;
+    Tree        *tree;
+
+    /* Build starting trees for state 0 */
+    for (chn=fromChain; chn<toChain; chn++)
+        {
+        for (k=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->paramType == P_TOPOLOGY)
+                {
+                assert (p->nSubParams == 1);
+                q = p->subParams[0];
+                tree = GetTree (q, chn, 0);
+                /* fixed topology */
+                if (p->paramId == TOPOLOGY_RCL_FIXED ||
+                    p->paramId == TOPOLOGY_RCCL_FIXED ||
+                    p->paramId == TOPOLOGY_CL_FIXED ||
+                    p->paramId == TOPOLOGY_CCL_FIXED ||
+                    p->paramId == TOPOLOGY_NCL_FIXED ||
+                    p->paramId == TOPOLOGY_PARSIMONY_FIXED)
+                    {
+                    MrBayesPrint ("%s   Tree %s is fixed so a parsimony-based starting tree is not built\n", spacer, p->name);
+                    return (NO_ERROR);
+                    }
+                /* constrained topology */
+                else if (tree->nConstraints > 0)
+                    {
+                    MrBayesPrint ("%s   Tree %s is constrained and parsimony-based starting trees are not implemented for constrained trees (yet)\n", spacer, p->name);
+                    return (NO_ERROR);
+                    }
+                /* random topology */
+                else
+                    {
+                    if (BuildStepwiseTree (tree, chn, &globalSeed) == ERROR)
+                        return (ERROR);
+                    }
+                if (InitializeTreeCalibrations (tree) == ERROR)
+                    return (ERROR);
+                FillTopologySubParams(p, chn, 0, seed);
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* build (starting) topology stepwise */
+int BuildStepwiseTree (Tree *t, int chain, RandLong *seed) {
+
+    int         i, j, nTips;
+    TreeNode    *p, *q, *r;
+    CLFlt        length;
+
+    // Allocate parsimony matrix if not done already
+
+    /* get the tips */
+    for (i=j=0; i<t->nNodes; i++) {
+        p =  t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL)
+            t->allDownPass[j++] = p;
+        else if (p->right == NULL && p->anc == NULL && t->isRooted == NO)
+            t->allDownPass[j++] = p;
+    }
+    nTips = j;
+
+    /* order the tips randomly, use last as root */
+    for (i=0; i<nTips-1; i++) {
+        j = (int) (RandomNumber(seed)*(nTips-1-i));
+        j += i;
+        p = t->allDownPass[i];
+        t->allDownPass[i] = t->allDownPass[j];
+        t->allDownPass[j] = p;
+    }
+
+    /* build first tree */
+    j = 0;
+    q = t->allDownPass[0];
+    r = t->allDownPass[1];
+    p = t->intDownPass[j++];
+    q->anc   = p;
+    r->anc   = p;
+    p->left  = q;
+    p->right = r;
+    q = t->allDownPass[nTips-1];
+    q->anc   = NULL;
+    q->right = NULL;
+    q->left = p;
+    p->anc = q;
+    t->root = q;
+
+    /* add nodes one at a time */
+    for (i=2; i<nTips-1; i++) {
+        r = t->allDownPass[i];
+        p = t->intDownPass[j++];
+        GetParsDP(t, t->root->left, chain);
+        GetParsFP(t, t->root->left, chain);
+        q = FindBestNode(t, t->root->left, r, &length, chain);
+        p->left = q;
+        p->right = r;
+        p->anc = q->anc;
+        if (q->anc->left == q)
+            q->anc->left = p;
+        else
+            q->anc->right = p;
+        q->anc = p;
+        r->anc = p;
+    }
+
+    /* take care of the root */
+    if (t->isRooted == YES) {
+        r = t->root;
+        q = t->allDownPass[t->nNodes-1];
+        p = t->intDownPass[j];
+        q->anc = q->right = NULL;
+        q->left = p;
+        p->anc = q;
+        p->left = r->left;
+        p->right = r;
+        p->left->anc = p;
+        r->left = r->right = NULL;
+        r->anc = p;
+        t->root = q;
+    }
+    GetDownPass (t);
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------
+|
+|   CalcLikeAdgamma: calc likelihood for one adgamma correlation HMM
+|
+-------------------------------------------------------------------*/
+int CalcLikeAdgamma (int d, Param *param, int chain, MrBFlt *lnL)
+{
+    int             c, i, j, nRates, posit, lastCharId;
+    MrBFlt          logScaler, max, prob, *F,
+                    *oldF, *tempF, fSpace[2][MAX_GAMMA_CATS];
+    MrBFlt          *rP;
+    CLFlt           freq, *lnScaler;
+    ModelInfo       *m;
+    ModelParams     *mp;
+    BitsLong        *inHMM;
+    
+    /* find nRates for first division in HMM */
+    m = &modelSettings[d];
+    mp = &modelParams[d];
+    nRates = m->numGammaCats;
+
+    /* calculate rate category frequencies */
+    freq = (CLFlt) ((CLFlt) 1.0 / nRates);
+
+    /* find Markov trans probs */
+    F = GetParamSubVals (param,chain, state[chain]);
+    for (i=posit=0; i<nRates; i++)
+        for (j=0; j<nRates; j++)
+            markovTi[0][i][j] = F[posit++];
+    
+    /* precalculate Markov trans probs up to largest small jump */
+    /* but only if needed                                       */
+    for (i=1; i<MAX_SMALL_JUMP; i++)
+        {
+        if (hasMarkovTi[i] == YES)
+            {
+            if (hasMarkovTi[i-1] == YES || i == 1)
+                MultiplyMatrices(nRates, markovTi[i-1], markovTi[0], markovTi[i]);
+            else
+                MultiplyMatrixNTimes(nRates, markovTi[0], i+1, markovTi[i]);
+            }
+        }
+        
+    /* find site scaler for this chain and state */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find rate probs for this chain and state */
+    rP = rateProbs[chain] + state[chain] * rateProbRowSize;
+
+    /* set bit vector indicating divisions in this HMM */
+    inHMM = (BitsLong *) SafeCalloc (((param->nRelParts/nBitsInALong) + 1), sizeof(BitsLong));
+    for (i=0; i<param->nRelParts; i++)
+        {
+        if (modelSettings[param->relParts[i]].shape ==
+            modelSettings[d].shape)
+            {
+            SetBit(param->relParts[i], inHMM);
+            }
+        }
+    
+    /* Perform the so-called forward algorithm of HMMs  */  
+    /* set up the space for f(c,i) */
+    F = fSpace[0];
+    oldF = fSpace[1];
+
+    for (c=0; c<numChar; c++)
+        {
+        if (IsBitSet(partitionId[c][partitionNum] - 1, inHMM) == YES)
+            break;
+        }
+
+    /* fill in fi(0) */
+    max = 0.0;
+    m = &modelSettings[partitionId[c][partitionNum] - 1];
+    posit = m->rateProbStart + (compCharPos[c] - m->compCharStart) * m->numGammaCats;
+
+    for (i=0; i<nRates; i++)
+        {
+        F[i] = rP[posit++];
+        if (F[i] > max)
+            max = F[i];
+        }
+
+    for (i=0; i<nRates; i++)
+        F[i] /= max;
+
+    /* set logscaler to the value from the first character */
+    logScaler = lnScaler[compCharPos[c]] +  log(max);
+
+    /* now step along the sequence to the end */
+    lastCharId = charInfo[c].charId;
+    for (c++; c<numChar; c++)
+        {
+        /* skip if excluded */
+        if (charInfo[c].isExcluded == YES)
+            continue;
+
+        /* skip if part of same codon in translated protein model */
+        if ((mp->dataType == DNA || mp->dataType == RNA) && m->dataType == PROTEIN && charInfo[c].charId == lastCharId)
+            continue;
+        else
+            lastCharId = charInfo[c].charId;
+        
+        /* skip if not in HMM */
+        if (IsBitSet(partitionId[c][partitionNum] - 1, inHMM) == NO)
+            continue;
+        
+        /* switch F and oldF, since the previous F is now old */
+        tempF = F;
+        F = oldF;
+        oldF = tempF;
+
+        /* find the position of the rate probs */
+        m = &modelSettings[partitionId[c][partitionNum] - 1];
+        posit = m->rateProbStart + (compCharPos[c] - m->compCharStart) * m->numGammaCats;
+                
+        /* calculate the HMM forward probs fi(x) at site x in HMM */
+        if (siteJump[c] <= MAX_SMALL_JUMP)
+            {
+            max = 0.0;
+            for (i=0; i<nRates; i++)
+                {
+                prob = 0.0;
+                for (j=0; j<nRates; j++)
+                    prob += markovTi[siteJump[c]-1][i][j] * oldF[j];
+                F[i] = rP[posit++] * prob;
+                if (F[i] > max)
+                    max = F[i];
+                }
+            }
+        else if (siteJump[c] < BIG_JUMP)    /* intermediate jump, calculate trans probs */
+            {
+            MultiplyMatrixNTimes(nRates, markovTi[0], siteJump[c], markovTiN);
+            max = 0.0;
+            for (i=0; i<nRates; i++)
+                {
+                prob = 0.0;
+                for (j=0; j<nRates; j++)
+                    prob += markovTiN[i][j] * oldF[j];
+                F[i] = rP[posit++] * prob;
+                if (F[i] > max)
+                    max = F[i];
+                }
+            }
+        else    /* big jump, use stationary freqs */
+            {
+            max = 0.0;
+            for (i=0; i<nRates; i++)
+                {
+                prob = 0.0;
+                for (j=0; j<nRates; j++)
+                    prob += (oldF[j] / freq);
+                F[i] = rP[posit++] * prob;
+                if (F[i] > max)
+                    max = F[i];
+                }
+            }
+
+        /* rescale and adjust total scaler with HMM scaler and site scaler */
+        for (i=0; i<nRates; i++)
+            F[i] /= max;
+
+        logScaler += lnScaler[compCharPos[c]] +  log(max);
+
+        }
+    
+    /* now pull the rate probs together at the end, F contains the vals needed */
+    prob =  0.0;
+    for (i=0; i<nRates; i++)
+        prob += (freq * F[i]);
+
+    (*lnL) = logScaler +  log(prob);
+
+    free (inHMM);
+
+    return (NO_ERROR);
+}
+
+
+/* CalcPartFreqStats: Calculate standard deviation of partition frequencies */
+void CalcPartFreqStats (PFNODE *p, STATS *stat)
+{
+    int     i, j, n, min;
+    MrBFlt  f, sum, sumsq, stdev;
+
+    n = chainParams.numRuns;
+    min = (int)(chainParams.minPartFreq * stat->numSamples);
+    if ((MrBFlt)min != chainParams.minPartFreq * stat->numSamples)
+        min++;
+
+    /* recursively compute partition frequencies for all subpartitions */
+    if (p->left != NULL) 
+        CalcPartFreqStats (p->left, stat);
+    if (p->right != NULL)
+        CalcPartFreqStats (p->right, stat);
+
+    for (i=0; i<n; i++)
+        {
+        if (p->count[i] >= min)
+            break;
+        }
+
+    if (i == n)
+        return;
+
+    sum = 0.0;
+    sumsq = 0.0;
+    for (i=0; i<n; i++)
+        {
+        f = (MrBFlt) (p->count[i]) / (MrBFlt) (stat->numSamples);
+        sum += f;
+        sumsq += f * f;
+        }
+    
+    f = (sumsq - sum * sum / n) / (n - 1);
+    if (f < 0.0)
+        stdev = 0.0;
+    else
+        stdev = sqrt (f);
+    
+    stat->sum += stdev;
+    if (stdev > stat->max)
+        stat->max = stdev;
+
+    stat->numPartitions++;
+
+    if (chainParams.allComps == YES)
+        {
+        for (i=0; i<n; i++)
+            {
+            for (j=i+1; j<n; j++)
+                {
+                if (p->count[i] < min && p->count[j] < min)
+                    continue;
+
+                sum = 0.0;
+                sumsq = 0.0;
+
+                f = (MrBFlt) (p->count[i]) / (MrBFlt) (stat->numSamples);
+                sum += f;
+                sumsq += f * f;
+                
+                f = (MrBFlt) (p->count[j]) / (MrBFlt) (stat->numSamples);
+                sum += f;
+                sumsq += f * f;
+
+                f = (sumsq - sum * sum / 2.0);
+                if (f < 0.0)
+                    stdev = 0.0;
+                else
+                    stdev = sqrt (f);
+                
+                if (chainParams.diagnStat == AVGSTDDEV)
+                    stat->pair[i][j] += stdev;
+                else if (stdev > stat->pair[i][j])
+                    stat->pair[i][j] = stdev;
+                stat->pair[j][i]++;
+                }
+            }
+        }
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CalcTopoConvDiagn: Calculate average and max standard deviation
+|                 in clade credibility (partition frequency) values
+|
+----------------------------------------------------------------*/
+void CalcTopoConvDiagn (int numSamples)
+{
+    int     i, j, n;
+    STATS   *stat;
+    
+    for (n=0; n<numTopologies; n++)
+        {
+        stat = &chainParams.stat[n];
+        stat->numSamples = numSamples;
+        stat->numPartitions = 0.0;
+        stat->sum = 0.0;
+        stat->max = 0.0;
+
+        if (chainParams.allComps == YES)
+            {
+            for (i=0; i<chainParams.numRuns; i++)
+                for (j=0; j<chainParams.numRuns; j++)
+                    stat->pair[i][j] = 0.0;
+            }
+    
+        CalcPartFreqStats (partFreqTreeRoot[n], stat);
+        
+        stat->avgStdDev = stat->sum / stat->numPartitions;
+        }
+}
+
+
+/* used in DoCompRefTree */
+void PartFreq (PFNODE *p, STATS *stat, int *ntrees)
+{
+    int     i, n = chainParams.numRuns;
+    MrBFlt  f, sum, sumsq, stdev;
+    
+    /* recursively compute partition frequencies for all subpartitions */
+    if (p->left != NULL)
+        PartFreq (p->left, stat, ntrees);
+    if (p->right != NULL)
+        PartFreq (p->right, stat, ntrees);
+    
+    sum = sumsq = 0.0;
+    for (i=0; i<chainParams.numRuns; i++)
+        {
+        f = (MrBFlt)(p->count[i]) / (MrBFlt)ntrees[i];
+        sum += f;
+        sumsq += f * f;
+        }
+    
+    f = (sumsq - sum * sum / n) / (n - 1);
+    if (f < 0.0)
+        stdev = 0.0;
+    else
+        stdev = sqrt (f);
+    
+    stat->sum += stdev;
+    if (stat->max < stdev)
+        stat->max = stdev;
+    
+    stat->numPartitions++;
+}
+void CalcTopoConvDiagn2 (int *nTrees)
+{
+    int     n;
+    STATS   *stat;
+    
+    for (n=0; n<numTopologies; n++)
+        {
+        stat = &chainParams.stat[n];
+        stat->numPartitions = 0.0;
+        stat->sum = stat->max = 0.0;
+    
+        PartFreq (partFreqTreeRoot[n], stat, nTrees);
+        
+        stat->avgStdDev = stat->sum / stat->numPartitions;
+        }
+}
+
+
+int CheckTemperature (void)
+{
+    if (chainParams.userDefinedTemps == YES)
+            {
+          if (AreDoublesEqual(chainParams.userTemps[0], 1.0, ETA)==NO)
+            {
+            MrBayesPrint ("%s   The first user-defined temperature must be 1.0.\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+void CloseMBPrintFiles (void)
+{
+    int     i, n;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return;
+#   endif
+
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        SafeFclose (&fpParm[n]);
+#if defined (PRINT_DUMP)
+        SafeFclose (&fpDump[n]);
+#endif
+
+        for (i=0; i<numTrees; i++)
+            {
+            if (fpTree[n][i])
+                {
+                fprintf (fpTree[n][i], "end;\n");
+                SafeFclose (&fpTree[n][i]);
+                }
+            }
+        }
+
+    if (chainParams.mcmcDiagn == YES)
+        SafeFclose (&fpMcmc);
+
+    if (chainParams.isSS == YES)
+        SafeFclose (&fpSS);
+}
+
+
+/* CompactTree: prune partition tree */
+PFNODE *CompactTree (PFNODE *p)
+{
+    int         i, j;
+    PFNODE      *q, *r;
+
+    if (p == NULL)
+        return NULL;
+    
+    i = j = 0;
+    if (IsPFNodeEmpty(p) == YES)
+        {
+        /* steal info from terminal on the way up */
+        q = SmallestNonemptyPFNode (p->left, &i, 0);
+        r = LargestNonemptyPFNode (p->right, &j, 0);
+
+        if (q != NULL || r != NULL)
+            {
+            if (i < j)
+                q = r;
+        
+            for (i=0; i<chainParams.numRuns; i++)
+                {
+                p->count[i] = q->count[i];
+                q->count[i] = 0;
+                }
+            for (i=0; i<nLongsNeeded; i++)
+                p->partition[i] = q->partition[i];
+            }
+        }
+
+    p->left = CompactTree (p->left);
+    p->right = CompactTree (p->right);
+
+    /* delete on the way down if empty */
+    if (IsPFNodeEmpty(p) == YES)
+        {
+        Tfree (p);
+        return NULL;
+        }
+    else
+        return p;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   CopyParams: copy parameters of touched divisions
+|
+-----------------------------------------------------------------*/
+void CopyParams (int chain)
+{
+    int         i, j, k, fromState, toState, *fromInt, *toInt;
+    MrBFlt      *from, *to;
+    ModelInfo   *m;
+    Param       *p;
+
+    /* copy all params                                               */
+    /* now done for all vars, can also be done for only touched vars */
+    /* but then m->upDateCl must be kept separate for each chain!    */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+
+        from = GetParamVals (p, chain, state[chain]);
+        to = GetParamVals (p, chain, (state[chain] ^ 1));
+
+        for (j=0; j<p->nValues; j++)
+            to[j] = from[j];
+
+        from = GetParamSubVals (p, chain, state[chain]);
+        to = GetParamSubVals (p, chain, (state[chain] ^ 1));
+
+        for (j=0; j<p->nSubValues; j++)
+            to[j] = from[j];
+
+        fromInt = GetParamIntVals (p, chain, state[chain]);
+        toInt = GetParamIntVals (p, chain, (state[chain] ^ 1));
+
+        for (j=0; j<p->nIntValues; j++)
+            toInt[j] = fromInt[j];
+
+        if (p->nStdStateFreqs > 0)
+            {
+            from = GetParamStdStateFreqs (p, chain, state[chain]);
+            to = GetParamStdStateFreqs (p, chain, state[chain] ^ 1);
+            for (j=0; j<p->nStdStateFreqs; j++)
+                to[j] = from[j];
+            }
+
+        if (p->paramType == P_CPPEVENTS)
+            {
+            fromState = 2*chain + state[chain];
+            toState   = 2*chain + (state[chain] ^ 1);
+            for (j=0; j<2*numLocalTaxa-2; j++)
+                {
+                if (p->nEvents[toState][j] != p->nEvents[fromState][j])
+                    {
+                    if (p->nEvents[fromState][j] == 0)
+                        {
+                        free (p->position[toState][j]);
+                        p->position[toState][j] = NULL;
+                        free (p->rateMult[toState][j]);
+                        p->rateMult[toState][j] = NULL;
+                        }
+                    else if (p->nEvents[toState][j] == 0)
+                        {
+                        p->position[toState][j] = (MrBFlt *) SafeCalloc (p->nEvents[fromState][j], sizeof (MrBFlt));
+                        p->rateMult[toState][j] = (MrBFlt *) SafeCalloc (p->nEvents[fromState][j], sizeof (MrBFlt));
+                        }
+                    else
+                        {
+                        p->position[toState][j] = (MrBFlt *) SafeRealloc ((void *)p->position[toState][j], p->nEvents[fromState][j] * sizeof (MrBFlt));
+                        p->rateMult[toState][j] = (MrBFlt *) SafeRealloc ((void *)p->rateMult[toState][j], p->nEvents[fromState][j] * sizeof (MrBFlt));
+                        }
+                    p->nEvents[toState][j] = p->nEvents[fromState][j];
+                    }
+                if (p->nEvents[fromState][j] > 0)
+                    {
+                    for (k=0; k<p->nEvents[fromState][j]; k++)
+                        {
+                        p->position[toState][j][k] = p->position[fromState][j][k];
+                        p->rateMult[toState][j][k] = p->rateMult[fromState][j][k];
+                        }
+                    }
+                }
+            }
+        }
+
+    /* copy division params (model settings) for chain */
+    /* reset division update flags                     */
+    fromState = 2 * chain + state[chain];
+    toState   = 2 * chain + (state[chain] ^ 1);
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = &modelSettings[i];
+        m->lnLike[toState] = m->lnLike[fromState];
+        if (m->parsModelId == YES)
+            m->parsTreeLength[toState] = m->parsTreeLength[fromState];
+        m->upDateCl = NO;
+        m->upDateCijk = NO;
+        m->upDateAll = NO;
+        }
+        
+    return;
+}
+
+
+/* CopySiteScalers: Copy site scalers from scratch space into current space */
+void CopySiteScalers (ModelInfo *m, int chain)
+{
+    CLFlt       *from, *to;
+#   if defined (BEAGLE_ENABLED)
+    int         i, j;
+#   endif
+
+#   if defined (BEAGLE_ENABLED)
+    if (m->useBeagle == YES)
+        {
+        j = m->siteScalerScratchIndex;
+        for (i=0; i<m->nCijkParts; i++)
+            {
+            beagleResetScaleFactors (m->beagleInstance,
+                                     m->siteScalerIndex[chain] + i);
+            beagleAccumulateScaleFactors (m->beagleInstance,
+                                          &j,
+                                          1,
+                                          m->siteScalerIndex[chain] + i);
+            j++;
+            }
+        return;
+        }
+#   endif
+    from = m->scalers[m->siteScalerScratchIndex];
+    to   = m->scalers[m->siteScalerIndex[chain]];
+    memcpy ((void*) to, (void*) from, (size_t)(m->numChars) * sizeof(CLFlt));
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   CopyTrees: copies touched trees for chain
+|       resets division and node update flags in the process
+|       Note: partition information of nodes are not copied if
+|       either source or destination tree does not have bitsets allocated
+|
+-----------------------------------------------------------------*/
+void CopyTrees (int chain)
+{
+    int         i, j, n, nTaxa, nLongsNeeded;
+    TreeNode    *p, *q;
+    Tree        *from, *to;
+
+    /* reset division update flags */
+    for (i=0; i<numCurrentDivisions; i++)
+        modelSettings[i].upDateCl = NO;
+
+    for (n=0; n<numTrees; n++)
+        {
+        from = GetTreeFromIndex (n, chain, state[chain]);       
+        to = GetTreeFromIndex (n, chain, (state[chain] ^ 1));
+        if (from->bitsets != NULL && to->bitsets != NULL)
+            {
+            if (from->isRooted == NO)
+                nTaxa = from->nNodes - from->nIntNodes;
+            else
+                nTaxa = from->nNodes - from->nIntNodes - 1;
+            nLongsNeeded = (int)((nTaxa - 1) / nBitsInALong) + 1;
+            }
+        else
+            nLongsNeeded = 0;
+
+        /* copy nodes */
+        for (j=0; j<from->nNodes; j++)
+            {
+            /* copy pointers */
+            p  = from->nodes + j;
+            q  = to->nodes + j;
+
+            if (p->anc != NULL)
+                q->anc = to->nodes + p->anc->memoryIndex;
+            else
+                q->anc = NULL;
+
+            if (p->left != NULL)    
+                q->left = to->nodes + p->left->memoryIndex;
+            else
+                q->left = NULL;
+
+            if (p->right != NULL)   
+                q->right = to->nodes + p->right->memoryIndex;
+            else
+                q->right = NULL;
+
+            CopyTreeNodes (q, p, nLongsNeeded);
+            q->upDateCl = q->upDateTi = NO;     /* reset update flags */
+            }
+        
+        for (i=0; i<from->nIntNodes; i++)
+            {
+            to->intDownPass[i] = to->nodes + from->intDownPass[i]->memoryIndex;
+            }
+        for (i=0; i<from->nNodes; i++)
+            {
+            to->allDownPass[i] = to->nodes + from->allDownPass[i]->memoryIndex;
+            }
+
+        to->root = to->nodes + from->root->memoryIndex;
+
+        /* rest of tree info is constant and need not be copied */
+        }
+    
+    return;
+}
+
+
+#ifdef VISUAL
+BOOL WINAPI CatchInterrupt (DWORD signum)
+{
+    /* set up signal handler to do the same */
+    MrBayesPrint ("\n   Ctrl-C detected\n");
+    requestAbortRun = YES;
+    return TRUE;
+}
+#else
+void CatchInterrupt (int signum)
+{
+    /* set up signal handler to do the same */
+    signal (signum, CatchInterrupt);
+    requestAbortRun = YES;
+    MrBayesPrint ("\n   Ctrl-C detected\n");
+}
+#endif
+
+
+/*----------------------------------------------------------------
+|
+|   DebugNodeScalers: Calculate node scalers sum
+|
+-----------------------------------------------------------------*/
+CLFlt DebugNodeScalers (TreeNode *p, int division, int chain)
+{
+    int             c;
+    CLFlt           *scP;
+    CLFlt           sum=0.0;
+    ModelInfo       *m;
+    
+    m = &modelSettings[division];
+
+    /* find scalers */
+    scP = m->scalers[m->nodeScalerIndex[chain][p->index]];
+
+    /* remove scalers */
+    for (c=0; c<m->numChars; c++)
+        sum += scP[c];
+
+    return sum;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   DebugTreeScalers: Calculate DebugNodeScalers for each node and printit
+|
+-----------------------------------------------------------------*/
+void DebugTreeScalers(int chain, int d)
+{
+    int i;
+    TreeNode        *p;
+    ModelInfo       *m;
+    Tree            *tree;
+    
+    m = &modelSettings[d];
+    tree = GetTree(m->brlens, chain, state[chain]);
+    
+    if (m->parsModelId == NO)
+        {
+        for (i=0; i<tree->nIntNodes; i++)
+            {
+            p = tree->intDownPass[i];
+            
+            if (p->scalerNode == YES)
+                {
+                printf ("Node:%d Sum scalers:%f\n",p->index,DebugNodeScalers(p, d, chain));
+                }
+            }
+        }
+}
+
+
+int DoMcmc (void)
+{
+    RandLong    seed;
+    int         rc, i, j, run;
+    char        c;
+    FILE        *tempFile;
+    char        temp[20];
+    char        *strBuf,*tmpcp;
+    double      tmp;
+
+#   if defined (BEST_MPI_ENABLED)
+    Tree        *tree;
+#   endif
+
+#   if !defined (VISUAL) && !defined (MPI_ENABLED)
+    sighandler_t sigint_oldhandler, sigterm_oldhandler;
+#   endif
+
+    numPreviousGen = 0;     /* Make sure this is reset */
+
+    /* Check to see that we have a data matrix. Otherwise, the MCMC is rather
+       pointless. */
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        goto errorExit;
+        }
+
+    if (setUpAnalysisSuccess == NO)
+        {
+        MrBayesPrint ("%s   The analysis could not be started because there was an error during its setup.\n", spacer);
+        MrBayesPrint ("%s   Refer to error messages printed during model set up to adress the problem.\n", spacer);
+        goto errorExit;
+        }
+
+    /* set file names */
+    sumtParams.numRuns  = chainParams.numRuns;
+    sumpParams.numRuns  = chainParams.numRuns;
+    sumssParams.numRuns = chainParams.numRuns;
+    
+    if (fileNameChanged == YES)
+        {
+        SetFileNames();
+        fileNameChanged = NO;
+        }
+
+    MrBayesPrint ("%s   Running Markov chain\n", spacer);
+    
+    /* Check the chain temperature parameters */
+    if (CheckTemperature () == ERROR)
+        goto errorExit;
+    
+    /* Set the chain random number seeds here. We have two seeds. One
+       (called swapSeed) is only used to determine which two chains 
+       will swap states in the next trial. The other (called seed) is
+       the seed for our work-horse pseudorandom number generator. Note
+       that if we are doing MPI, we want the swap seed to be the same
+       for every processor. This is taken care of when we initialize
+       things in the program. If we are doing MPI, we also want to make
+       certain that seed is different for every processor. */
+#   if defined (MPI_ENABLED)
+    seed = globalSeed + (proc_id + 1);
+    if (seed < 0)
+        seed = -seed;
+#   else
+    seed = globalSeed;
+#   endif
+
+    /* Get a unique identifier (stamp) for this run. This is used as
+       an identifier for each mcmc analysis. It uses runIDSeed to initialize 
+       the stamp. All of the processors should have the same seed, so 
+       this should be safe. */
+    GetStamp ();
+    
+    MrBayesPrint ("%s   Seed = %d\n", spacer, seed);
+    MrBayesPrint ("%s   Swapseed = %d\n", spacer, swapSeed);
+
+    /* Show the model to make sure the user sees it before running the analysis */
+    if (ShowModel() == ERROR)
+        goto errorExit;
+    MrBayesPrint ("\n");
+
+    /* Warn the user or stop analysis in case the model is strange */
+    if (CheckModel() == ERROR)
+        goto errorExit;
+                
+    /* Determine the number of local chains and data splits */
+    if (SetLocalChainsAndDataSplits() == ERROR)
+        goto errorExit;
+
+    /* Set up the moves to be used */
+    if (SetUsedMoves () == ERROR)
+        goto errorExit;
+
+    /* Check to see that we have at least one move. Otherwise, the MCMC is rather
+       pointless. */
+    if (numUsedMoves == 0)
+        {
+        MrBayesPrint ("%s   No move is currently switched on.\n", spacer);
+        MrBayesPrint ("%s   There must be at least one move to run an MCMC analysis.\n", spacer);
+        MrBayesPrint ("%s   Switch on moves using the 'propset' command.\n", spacer);
+        goto errorExit;
+        }
+
+    /* Show summary table of moves that will be used */ 
+    if (ShowMoveSummary () == ERROR)
+        goto errorExit;
+
+    /* Set the likelihood function pointers. */
+    if (SetLikeFunctions () == ERROR)
+        goto errorExit;
+
+    /* Set up number of characters of each character pattern. */
+    if (FillNumSitesOfPat () == ERROR)
+        goto errorExit;
+
+    /* Initialize parsimony sets. */
+    if (InitParsSets() == ERROR)
+        goto errorExit;
+
+    /* Set up a terminal state index matrix for local compression. */
+    if (SetUpTermState() == ERROR)
+        goto errorExit;
+
+    /* Initialize conditional likelihoods and transition probabilities for chain (the working space). */
+    if (InitChainCondLikes () == ERROR)
+        goto errorExit;
+
+    /* Initialize adgamma conditional likelihoods */
+    if (InitAdGamma () == ERROR)
+        goto errorExit;
+    
+    /* Initialize invariable conditional likelihoods. */
+    if (InitInvCondLikes() == ERROR)
+        goto errorExit;
+
+    /* Allocate BEST chain variables */
+    if (numTopologies > 1 && !strcmp(modelParams[0].topologyPr,"Speciestree"))
+        AllocateBestChainVariables();
+
+    /* allocate SS memory for the chains if needed */
+    if (chainParams.isSS == YES)
+        {
+        if (memAllocs[ALLOC_SS] == YES)
+            {
+            MrBayesPrint ("%s   SS is already allocated\n", spacer);
+            goto errorExit;
+            }
+        else if ((marginalLnLSS = (MrBFlt *) SafeCalloc (chainParams.numRuns, sizeof(MrBFlt))) == NULL)
+            {
+            MrBayesPrint ("%s   Problem allocating marginalLnLSS\n", spacer);
+            goto errorExit;
+            }
+        else if ((stepScalerSS = (MrBFlt *) SafeCalloc (chainParams.numRuns, sizeof(MrBFlt))) == NULL)
+            {
+            MrBayesPrint ("%s   Problem allocating stepScalerSS\n", spacer);
+            free (marginalLnLSS);
+            goto errorExit;
+            }
+        else if ((stepAcumulatorSS = (MrBFlt *) SafeCalloc (chainParams.numRuns, sizeof(MrBFlt))) == NULL)
+            {
+            MrBayesPrint ("%s   Problem allocating stepAcumulatorSS\n", spacer);
+            free (stepScalerSS);
+            free (marginalLnLSS);
+            goto errorExit;
+            }
+        else if ((splitfreqSS = (MrBFlt *) SafeCalloc (chainParams.numStepsSS*numTopologies, sizeof(MrBFlt))) == NULL)
+            {
+            MrBayesPrint ("%s   Problem allocating splitfreqSS\n", spacer);
+            free (stepScalerSS);
+            free (marginalLnLSS);
+            free (stepAcumulatorSS);
+            goto errorExit;
+            }
+        else
+            memAllocs[ALLOC_SS] = YES;
+        }
+
+    /* Either append to previous run or deal with starting values */
+    if (chainParams.append == YES)
+        {
+        /* Continue old run */
+       
+        /* Get starting values from checkpoint file */
+        MrBayesPrint ("%s   Getting values from previous run\n", spacer);
+        strcpy(inputFileName, chainParams.chainFileName);
+        strcat(inputFileName, ".ckp");
+        if (OpenTextFileR(inputFileName) == NULL)
+            {
+            MrBayesPrint ("%s   Could not find the checkpoint file '%s'.\n", spacer, inputFileName);
+            MrBayesPrint ("%s   Make sure it is in the working directory.\n", spacer);
+            goto errorExit;
+            }
+
+        if (DoExecute () == ERROR)
+            goto errorExit;
+
+        /* Get number of generations to start from and SS information if needed */
+        temp[0] = '\0';
+        numPreviousGen = 0;
+#   if defined (MPI_ENABLED)
+        if (proc_id == 0) {
+#   endif
+        tempFile = OpenBinaryFileR (inputFileName);
+        do { c = fgetc(tempFile);
+            } while (c!=':' && c!=EOF);
+        if (c!=EOF)
+            {
+            do { c = fgetc(tempFile);
+                } while (c!=':' && c!=EOF);
+            }
+        if (c!=EOF)
+            {
+            do { c = fgetc(tempFile);
+                } while (!isdigit(c) && c!=EOF);
+            }
+        if (c!=EOF)
+            {
+            i=0;
+            while (c >= '0' && c <= '9' && i < 18)
+                {
+                temp[i++] = c;
+                c = fgetc(tempFile);
+                }
+            temp[i] = '\0';
+            numPreviousGen = atoi(temp);
+            }
+        if (chainParams.isSS==YES && c!=EOF)
+            {
+            do { c = fgetc(tempFile);
+                } while (c!=':' && c!=EOF);
+            strBuf = (char *) SafeCalloc (chainParams.numRuns*20,sizeof(char));
+            if (fgets(strBuf,chainParams.numRuns*20,tempFile)==NULL)
+                {
+                MrBayesPrint ("%s   Error: Reading SsAcumulators from .ckp file fails.\n", spacer);
+                free(strBuf);
+                goto errorExit;
+                }
+
+            tmpcp=strtok(strBuf," "); 
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                if (tmpcp == NULL)
+                    {
+                    MrBayesPrint ("%s   Error: Not enough values in SsAcumulators comment of .ckp file.   \n", spacer);
+                    free(strBuf);
+                    goto errorExit;
+                    }
+                    
+                tmp=atof(tmpcp);
+                stepScalerSS[run]=tmp-10;
+                stepAcumulatorSS[run]=exp(10);
+                tmpcp=strtok(NULL," ]");
+                }
+                      
+            free(strBuf);
+            }
+#   if defined (MPI_ENABLED)
+        }
+        MPI_Bcast (&numPreviousGen, 1, MPI_INT, 0, MPI_COMM_WORLD);
+#   endif
+        if (numPreviousGen == 0)
+            {
+            MrBayesPrint ("%s   Could not find the number of generations in previous run.\n", spacer);
+            goto errorExit;
+            }
+        else if (numPreviousGen >= chainParams.numGen)
+            {
+            MrBayesPrint ("%s   The specified number of generations (%d) was already finished in\n", spacer, chainParams.numGen);
+            MrBayesPrint ("%s   the previous run you are trying to append to.\n", spacer);
+            goto errorExit;
+            }
+        else
+            MrBayesPrint ("%s   Using samples up to generation %d from previous analysis.\n", spacer, numPreviousGen);
+        }
+    else
+        {
+        /* New run */
+        
+        /* deal with starting param values */
+        if (!strcmp(chainParams.startParams,"Reset"))
+            {
+            MrBayesPrint ("%s   Resetting starting values for substitution model parameters\n", spacer);
+            FillNormalParams (&seed, 0, numLocalChains);
+            }
+
+        /* deal with starting treeparam values */
+        if (!strcmp(chainParams.startTree,"Random"))
+            {
+            MrBayesPrint ("%s   Resetting starting trees and tree parameters\n", spacer);
+            FillTreeParams (&seed, 0, numLocalChains);
+            }
+        else if (!strcmp(chainParams.startTree,"Parsimony"))
+            {
+            MrBayesPrint ("%s   Rebuilding starting trees using random addition sequences and parsimony\n", spacer);
+            BuildParsTrees (&seed, 0, numLocalChains);
+            }
+
+        /* Perturb start trees if requested */
+        if (chainParams.numStartPerts > 0)
+            {
+            MrBayesPrint ("%s   Randomly perturbing starting trees\n", spacer);
+            for (i=0; i<numTrees; i++)
+                {
+                for (j=0; j<numGlobalChains; j++)
+                    RandPerturb (GetTreeFromIndex(i, j, 0), chainParams.numStartPerts, &seed);
+                }
+            }
+        }
+
+    /* Set clockRate if we have calibration */
+    for (j=0; j<numGlobalChains; j++)
+        {
+        if (UpdateClockRate(0.0, j) == ERROR) 
+            goto errorExit;
+        }
+    /*
+    for (i=0; i<numParams; i++)
+        {
+        for (j=0; j<numGlobalChains; j++)
+            assert (IsTreeConsistent(&params[i], j, 0) == YES);
+        }  */
+
+    /* Initialize vectors of print parameters */
+    if (InitPrintParams () == ERROR)
+        goto errorExit;
+    
+    /*! setup a signal handler to catch interrupts, ignore failure */
+#   ifdef VISUAL
+    SetConsoleCtrlHandler (CatchInterrupt, TRUE);
+#   else
+#       if !defined (MPI_ENABLED)
+    /* we do not want to mess with the signal handling in MPI version */
+    sigint_oldhandler  = signal(SIGINT, CatchInterrupt);
+    sigterm_oldhandler = signal(SIGTERM, CatchInterrupt);
+#       endif
+#   endif
+    requestAbortRun = NO;
+
+    /* Run the Markov chain. */
+    rc = RunChain (&seed);
+    if (rc == ERROR)
+        {
+#   ifdef VISUAL
+        SetConsoleCtrlHandler (CatchInterrupt, FALSE);
+#   else
+#       if !defined (MPI_ENABLED)
+        signal(SIGINT, sigint_oldhandler);
+        signal(SIGTERM, sigterm_oldhandler);
+#       endif
+#   endif
+        goto errorExit;
+        }
+    else if (rc == ABORT)
+        {
+        ResetChainIds();
+        FreeChainMemory();
+#   ifdef VISUAL
+        SetConsoleCtrlHandler (CatchInterrupt, FALSE);
+#   else
+#       if !defined (MPI_ENABLED)
+        signal(SIGINT, sigint_oldhandler);
+        signal(SIGTERM, sigterm_oldhandler);
+#       endif
+#   endif
+        return ABORT;
+        }
+        
+    /*! restore the default signal handler */
+#   ifdef VISUAL
+    SetConsoleCtrlHandler (CatchInterrupt, FALSE);
+#   else
+#       if !defined (MPI_ENABLED)
+    signal(SIGINT, sigint_oldhandler);
+    signal(SIGTERM, sigterm_oldhandler);
+#       endif
+#   endif
+
+    /* Reset the global seed at end of chain. We don't want successive
+       chains to all start with the same random number seed. */
+    globalSeed = seed;
+
+    /* Free up all memory allocated for the chain. */
+    FreeChainMemory ();
+    
+    return (NO_ERROR);
+    
+    errorExit:
+        FreeChainMemory ();
+        return (ERROR);
+}
+
+
+int DoMcmcp (void)
+{
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        return (ERROR);
+        }
+
+    sumtParams.numRuns = chainParams.numRuns;
+    sumpParams.numRuns = chainParams.numRuns;
+    
+    if (fileNameChanged == YES)
+        {
+        SetFileNames();
+        fileNameChanged = NO;
+        }
+
+    MrBayesPrint ("%s   Successfully set chain parameters\n", spacer);
+
+    return (NO_ERROR);
+}
+
+
+int DoSsParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        tempStr[5];
+    static int  negBurninss;
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Burninss"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                negBurninss = NO;
+                expecting = Expecting(NUMBER) | Expecting(DASH);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                negBurninss = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (negBurninss == NO)
+                    chainParams.burninSS = tempI;
+                else
+                    chainParams.burninSS = -tempI;
+                MrBayesPrint ("%s   Setting burnin for stepping-stone sampling to %d\n", spacer, chainParams.burninSS);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }         
+            }
+        else if (!strcmp(parmName, "Nsteps"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.numStepsSS = tempI;
+                MrBayesPrint ("%s   Setting number of steps in stepping-stone sampling to %d\n", spacer, chainParams.numStepsSS);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }                
+            }
+        else if (!strcmp(parmName, "FromPrior"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.startFromPriorSS = YES;
+                    else
+                        chainParams.startFromPriorSS = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for FromPrior parameter\n", spacer);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Setting FromPrior=%s\n", spacer, (chainParams.startFromPriorSS==YES)?"Yes":"No");
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }                
+            }
+        else if (!strcmp(parmName, "Alpha"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                chainParams.alphaSS = tempD;
+                MrBayesPrint ("%s   Setting alpha in stepping-stone sampling to %lf\n", spacer, chainParams.alphaSS);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }                
+            }
+        else
+            {
+            return (ERROR);
+            }
+        }
+    return (NO_ERROR);
+}
+
+
+int DoMcmcParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        *tempStr;
+    int         tempStrSize = TEMPSTRSIZE;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+    *tempStr='\0';
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A character matrix must be defined first\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Seed (globalSeed) ***************************************************************/
+        if (!strcmp(parmName, "Seed"))
+            {
+                MrBayesPrint ("%s   Error: Setting \"Seed\" in mcmc command is depricated. Use \"set\" command instead.\n", spacer);
+                MrBayesPrint ("%s   For more information type \"help set\";\n", spacer);
+                free (tempStr);
+                return (ERROR);
+            /*
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                globalSeed = tempI;
+                MrBayesPrint ("%s   Setting seed to %ld\n", spacer, globalSeed);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+                */
+            }
+        /* set Swapseed (global variable swapSeed) ***************************************************************/
+        else if (!strcmp(parmName, "Swapseed"))
+            {
+                MrBayesPrint ("%s   Error: Setting \"Swapseed\" in mcmc command is depricated. Use \"set\" command instead.\n", spacer);
+                MrBayesPrint ("%s   For more information type \"help set\";\n", spacer);
+                free (tempStr);
+                return (ERROR);
+                /*
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                swapSeed = tempI;
+                MrBayesPrint ("%s   Setting swapseed to %ld\n", spacer, swapSeed);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+                */
+            }
+        /* set run ID */
+        /* this setting is provided for GRID use only, so that identical runs can be generated */
+        else if (!strcmp(parmName, "Runidseed"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                runIDSeed = tempI;
+                MrBayesPrint ("%s   Setting run ID [stamp] seed to %ld [for GRID use]\n", spacer, runIDSeed);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Ngen (numGen) ******************************************************************/
+        else if (!strcmp(parmName, "Ngen"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Too few generations\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.numGen = tempI;
+                MrBayesPrint ("%s   Setting number of generations to %d\n", spacer, chainParams.numGen);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Samplefreq (sampleFreq) ********************************************************/
+        else if (!strcmp(parmName, "Samplefreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Sampling chain too infrequently\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                chainParams.sampleFreq = tempI;
+                MrBayesPrint ("%s   Setting sample frequency to %d\n", spacer, chainParams.sampleFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Printfreq (printFreq) **********************************************************/
+        else if (!strcmp(parmName, "Printfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Printing to screen too infrequently\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.printFreq = tempI;
+                MrBayesPrint ("%s   Setting print frequency to %d\n", spacer, chainParams.printFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Printmax (printMax) **********************************************************/
+        else if (!strcmp(parmName, "Printmax"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   You need to print at least one chain\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.printMax = tempI;
+                MrBayesPrint ("%s   Setting maximum number of chains to print to screen to %d\n", spacer, chainParams.printMax);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Printall (printAll) ********************************************************/
+        else if (!strcmp(parmName, "Printall"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.printAll = YES;
+                    else
+                        chainParams.printAll = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Printall\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.allChains == YES)
+                    MrBayesPrint ("%s   Printing all chains to screen\n", spacer);
+                else
+                    MrBayesPrint ("%s   Printing only cold chains to screen\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Swapfreq (swapFreq) ************************************************************/
+        else if (!strcmp(parmName, "Swapfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Swapping states too infrequently\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.swapFreq = tempI;
+                MrBayesPrint ("%s   Setting swap frequency to %d\n", spacer, chainParams.swapFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Nswaps (numSwaps) ************************************************************/
+        else if (!strcmp(parmName, "Nswaps"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   There must be at least one swap per swapping cycle\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                chainParams.numSwaps = tempI;
+                MrBayesPrint ("%s   Setting number of swaps per swapping cycle to %d\n", spacer, chainParams.numSwaps);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Allchains (allChains) ********************************************************/
+        else if (!strcmp(parmName, "Allchains"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.allChains = YES;
+                    else
+                        chainParams.allChains = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Allchains\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.allChains == YES)
+                    MrBayesPrint ("%s   Calculating MCMC diagnostics for all chains\n", spacer);
+                else
+                    MrBayesPrint ("%s   Calculating MCMC diagnostics only for cold chain(s)\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Allcomps (allComps) ************************************************************/
+        else if (!strcmp(parmName, "Allcomps"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.allComps = YES;
+                    else
+                        chainParams.allComps = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Allcomps\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.allComps == YES)
+                    MrBayesPrint ("%s   Calculating MCMC diagnostics for all pairwise run comparisons\n", spacer);
+                else
+                    MrBayesPrint ("%s   Only calculating overall MCMC diagnostics\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Mcmcdiagn (mcmcDiagn) ********************************************************/
+        else if (!strcmp(parmName, "Mcmcdiagn"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.mcmcDiagn = YES;
+                    else
+                        chainParams.mcmcDiagn = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for mcmc diagnostics\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.mcmcDiagn == YES)
+                    MrBayesPrint ("%s   Setting calculation of MCMC diagnostics ('Mcmcdiagn') to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting calculation of MCMC diagnostics ('Mcmcdiagn') to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Diagnfreq (diagnFreq) ************************************************************/
+        else if (!strcmp(parmName, "Diagnfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Diagnosing MCMC behavior too infrequently\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.diagnFreq = tempI;
+                MrBayesPrint ("%s   Setting diagnosing frequency to %d\n", spacer, chainParams.diagnFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Savetrees (saveTrees) ********************************************************/
+        else if (!strcmp(parmName, "Savetrees"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.saveTrees = YES;
+                    else
+                        chainParams.saveTrees = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Savetrees\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.saveTrees == YES)
+                    MrBayesPrint ("%s   Saving trees for MCMC diagnostics in memory (if needed)\n", spacer);
+                else
+                    MrBayesPrint ("%s   Not saving trees for MCMC diagnostics in memory\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Diagnstat (diagnStat) ********************************************************/
+        else if (!strcmp(parmName, "Diagnstat"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Avgstddev"))
+                        chainParams.diagnStat = AVGSTDDEV;
+                    else /* if (!strcmp(tempStr, "Maxstddev")) */
+                        chainParams.diagnStat = MAXSTDDEV;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Savetrees\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.diagnStat == AVGSTDDEV)
+                    MrBayesPrint ("%s   Setting diagnostics statistic to Avgstddev\n", spacer);
+                else /* if (chainParams.diagnStat == MAXSTDDEV) */
+                    MrBayesPrint ("%s   Setting diagnostics statistic to Maxstddev\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Checkpoint (checkPoint) ********************************************************/
+        else if (!strcmp(parmName, "Checkpoint"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.checkPoint = YES;
+                    else
+                        chainParams.checkPoint = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for 'Checkpoint' (check-pointing)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.checkPoint == YES)
+                    MrBayesPrint ("%s   Setting check-pointing ('Checkpoint') to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting check-pointing ('Checkpoint') to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Checkfreq (checkFreq) ************************************************************/
+        else if (!strcmp(parmName, "Checkfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 100)
+                    {
+                    MrBayesPrint ("%s   Check-pointing frequency must be at least 100\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.checkFreq = tempI;
+                MrBayesPrint ("%s   Setting check-pointing frequency to %d\n", spacer, chainParams.checkFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Minpartfreq (minPartFreq) ************************************************************/
+        else if (!strcmp(parmName, "Minpartfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Minimum partition frequency too low (< 0.01)\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                if (tempD > 0.8)
+                    {
+                    MrBayesPrint ("%s   Minimum partition frequency too high (> 0.8)\n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                chainParams.minPartFreq = tempD;
+                MrBayesPrint ("%s   Setting minimum partition frequency to %.2f\n", spacer, chainParams.minPartFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Nruns (numRuns) ****************************************************************/
+        else if (!strcmp(parmName, "Nruns"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Too few runs (minimum of 1 run)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (tempI > MAX_RUNS)
+                    {
+                    MrBayesPrint ("%s   Too many runs (maximum of %d runs)\n", spacer, MAX_RUNS);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (ChangeNumRuns (chainParams.numRuns, tempI) == ERROR)
+                    return (ERROR);
+                chainParams.numRuns = tempI;
+                fileNameChanged = YES;
+                MrBayesPrint ("%s   Setting number of runs to %d\n", spacer, chainParams.numRuns);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Nchains (numChains) ************************************************************/
+        else if (!strcmp(parmName, "Nchains"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Too few chains (minimum of 1 chain)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (tempI > MAX_CHAINS)
+                    {
+                    MrBayesPrint ("%s   Too many chains (maximum of %d chains)\n", spacer, MAX_CHAINS);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (ChangeNumChains (chainParams.numChains, tempI) == ERROR)
+                    return (ERROR);
+                chainParams.numChains = tempI;
+                MrBayesPrint ("%s   Setting number of chains to %d\n", spacer, chainParams.numChains);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Temp (chainTemp) ***************************************************************/
+        else if (!strcmp(parmName, "Temp"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                tempIndex = 0;
+                expecting = Expecting(NUMBER) | Expecting(LEFTPAR);
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                chainParams.userDefinedTemps = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                MrBayesPrint ("%s   Setting user-defined temperatures\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                if (chainParams.userDefinedTemps == NO)
+                    {
+                    sscanf (tkn, "%lf", &tempD);
+                    chainParams.chainTemp = tempD;
+                    MrBayesPrint ("%s   Setting heating parameter to %lf\n", spacer, chainParams.chainTemp);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                else
+                    {
+                    if (tempIndex >= MAX_CHAINS)
+                        {
+                        MrBayesPrint ("%s   Too many user-defined temperatures (%d maximum)\n", spacer, MAX_CHAINS);
+                        free(tempStr);
+                        return (ERROR);
+                        }
+                    sscanf (tkn, "%lf", &tempD);
+                    chainParams.userTemps[tempIndex++] = tempD;
+                    expecting = Expecting(COMMA) | Expecting(RIGHTPAR);
+                    }
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Reweight (weightScheme) ********************************************************/
+        else if (!strcmp(parmName, "Reweight"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(LEFTPAR);
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting = Expecting(NUMBER);
+                whichReweightNum = 0;
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                if (whichReweightNum < 0 || whichReweightNum > 2)
+                    {
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                sscanf (tkn, "%lf", &tempD);
+                chainParams.weightScheme[whichReweightNum] = tempD;
+                if (whichReweightNum < 2)
+                    {
+                    if (tempD < 0.0 || tempD > 100.0)
+                        {
+                        MrBayesPrint ("%s   The reweighting parameter must be between 0 and 100\n", spacer);
+                        chainParams.weightScheme[0] = chainParams.weightScheme[1] = 0.0;
+                        chainParams.weightScheme[2] = 1.0;
+                        free(tempStr);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    if (tempD <= 0.0 || tempD > 1.0)
+                        {
+                        MrBayesPrint ("%s   The reweighting increment must be between 0 and 1\n", spacer);
+                        chainParams.weightScheme[0] = chainParams.weightScheme[1] = 0.0;
+                        chainParams.weightScheme[2] = 1.0;
+                        free(tempStr);
+                        return (ERROR);
+                        }
+                    }
+                if (whichReweightNum == 0)
+                    {
+                    expecting = Expecting(COMMA);
+                    }
+                else if (whichReweightNum == 1)
+                    {
+                    if (chainParams.weightScheme[0] + chainParams.weightScheme[1] > 100.0)
+                        {
+                        MrBayesPrint ("%s   The sum of the reweighting parameters cannot exceed 100 %%\n", spacer);
+                        chainParams.weightScheme[0] = chainParams.weightScheme[1] = 0.0;
+                        chainParams.weightScheme[2] = 1.0;
+                        free(tempStr);
+                        return (ERROR);
+                        }
+                    expecting = Expecting(COMMA) | Expecting(RIGHTPAR);
+                    }
+                else
+                    {
+                    expecting = Expecting(RIGHTPAR);
+                    }
+                whichReweightNum++;
+                }
+            else if ((expecting & Expecting(COMMA)) == Expecting(COMMA))
+                expecting = Expecting(NUMBER);
+            else if ((expecting & Expecting(RIGHTPAR)) == Expecting(RIGHTPAR))
+                {
+                if (chainParams.weightScheme[0] >= 100.0)
+                    {
+                    MrBayesPrint ("%s   Cannot decrease weight of all characters\n", spacer);
+                    chainParams.weightScheme[0] = chainParams.weightScheme[1] = 0.0;
+                    chainParams.weightScheme[2] = 1.0;
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Setting reweighting parameter to (%1.2lf v, %1.2lf ^) increment = %1.2lf\n", 
+                    spacer, chainParams.weightScheme[0], chainParams.weightScheme[1], chainParams.weightScheme[2]);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Filename (chainFileName) *******************************************************/
+        else if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                sscanf (tkn, "%s", tempStr);
+                if (strlen(tempStr)>99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of chain file name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tempStr);
+                    MrBayesPrint ("%s   has %d characters.\n", spacer,strlen(tempStr));
+                    return (ERROR);
+                    }
+                strcpy (chainParams.chainFileName, tempStr);
+                fileNameChanged = YES;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Relburnin (relativeBurnin) ********************************************************/
+        else if (!strcmp(parmName, "Relburnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.relativeBurnin = YES;
+                    else
+                        chainParams.relativeBurnin = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Relburnin\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using relative burnin (a fraction of samples discarded).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Using absolute burnin (a fixed number of samples discarded).\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Burnin (chainBurnIn) ***********************************************************/
+        else if (!strcmp(parmName, "Burnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.chainBurnIn = tempI;
+                MrBayesPrint ("%s   Setting chain burn-in to %d\n", spacer, chainParams.chainBurnIn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Burninfrac (burninFraction) ************************************************************/
+        else if (!strcmp(parmName, "Burninfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too low (< 0.01)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too high (> 0.50)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.burninFraction = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Stoprule (stopRule) ********************************************************/
+        else if (!strcmp(parmName, "Stoprule"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.stopRule = YES;
+                    else
+                        chainParams.stopRule = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Stoprule\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.stopRule == YES)
+                    MrBayesPrint ("%s   Using stopping rule.\n", spacer);
+                else
+                    MrBayesPrint ("%s   Not using stopping rule.\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Stopval (stopVal) ************************************************************/
+        else if (!strcmp(parmName, "Stopval"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.000001)
+                    {
+                    MrBayesPrint ("%s   Stop value too low (< 0.000001)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (tempD > 0.20)
+                    {
+                    MrBayesPrint ("%s   Stop value too high (> 0.20)\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.stopVal = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Starttree (startTree) **************************************************/
+        else if (!strcmp(parmName, "Starttree"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr,"User"))
+                        {
+                        MrBayesPrint ("%s   The 'user' setting of 'Starttree' is deprecated. Set starting trees using 'Startvals' instead.\n", spacer);
+                        free (tempStr);
+                        return (ERROR);
+                        }
+                    else
+                        strcpy(chainParams.startTree, tempStr);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid 'Starttree' argument '%s'. This is a bug -- please report.\n", spacer, tempStr);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Setting 'Starttree' to \"%s\"\n", spacer, chainParams.startTree);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Startingtrees (deprecated) **************************************************/
+        else if (!strcmp(parmName, "Startingtrees"))
+            {
+            free (tempStr);
+            MrBayesPrint ("%s   Parameter 'Startingtrees' is deprecated. Use the 'Starttree' parameter or the 'Startvals' command instead.\n", spacer);
+            return (ERROR);
+            }
+        /* set Nperts (numStartPerts) *********************************************************/
+        else if (!strcmp(parmName, "Nperts"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.numStartPerts = tempI;
+                MrBayesPrint ("%s   Setting number of perturbations to start tree to %d\n", spacer, chainParams.numStartPerts);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Startparams (startParams) **************************************************/
+        else if (!strcmp(parmName, "Startparams"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    strcpy(chainParams.startParams, tempStr);
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid 'Startparams' argument\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                MrBayesPrint ("%s   Setting 'Startparams' to \"%s\"\n", spacer, chainParams.startParams);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Savebrlens (saveBrlens) ********************************************************/
+        else if (!strcmp(parmName, "Savebrlens"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        ; /* This is the only option in version 3.2 */
+                    else
+                        MrBayesPrint ("%s   WARNING: Ignoring savebrlens setting; since version 3.2, branch lengths are always saved\n", spacer);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for savebrlens\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            }
+        /* set Redirect (redirect) ********************************************************/
+        else if (!strcmp(parmName, "Redirect"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.redirect = YES;
+                    else
+                        chainParams.redirect = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for redirecting output\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.redirect == YES)
+                    MrBayesPrint ("%s   Setting program to redirect output\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting program not to redirect output\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Data (runWithData) ************************************************************/
+        else if (!strcmp(parmName, "Data"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.runWithData = YES;
+                    else
+                        chainParams.runWithData = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Data\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.runWithData == NO)
+                    MrBayesPrint ("%s   Running without data (WARNING: use this only for checking priors!)\n", spacer);
+                else
+                    MrBayesPrint ("%s   Running with data (standard analysis)\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Ordertaxa (chainParams.orderTaxa) *********************************************/
+        else if (!strcmp(parmName, "Ordertaxa"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.orderTaxa = YES;
+                    else
+                        chainParams.orderTaxa = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for ordertaxa\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.orderTaxa == YES)
+                    MrBayesPrint ("%s   Setting ordertaxa to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting ordertaxa to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Append (chainParams.append) *********************************************/
+        else if (!strcmp(parmName, "Append"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.append = YES;
+                    else
+                        chainParams.append = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for append\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.append == YES)
+                    MrBayesPrint ("%s   Setting append to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting append to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Autotune (chainParams.autotune) *********************************************/
+        else if (!strcmp(parmName, "Autotune"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.autotune = YES;
+                    else
+                        chainParams.autotune = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Autotune\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.autotune == YES)
+                    MrBayesPrint ("%s   Setting Autotune to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting Autotune to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Tunefreq (tuneFreq) ************************************************************/
+        else if (!strcmp(parmName, "Tunefreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 10)
+                    {
+                    MrBayesPrint ("%s   Autotuning frequency must be at least 10\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                chainParams.tuneFreq = tempI;
+                MrBayesPrint ("%s   Setting autotuning frequency to %d\n", spacer, chainParams.tuneFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Swapadjacent (swapAdjacentOnly) **************************************************/
+        else if (!strcmp(parmName, "Swapadjacent"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.swapAdjacentOnly = YES;
+                    else
+                        chainParams.swapAdjacentOnly = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Swapadjacent\n", spacer);
+                    free(tempStr);
+                    return (ERROR);
+                    }
+                if (chainParams.swapAdjacentOnly == YES)
+                    MrBayesPrint ("%s   Setting program to attempt swaps only between chains of adjacent temperatures\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting program to attempt all possible swaps between chains\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                free(tempStr);
+                return (ERROR);
+                }
+            }
+        else
+            {
+            free(tempStr);
+            return (ERROR);
+            }
+        }
+    free(tempStr);
+    return (NO_ERROR);
+}
+
+
+int DoSs (void)
+{
+    int ret, oldBurnin;
+
+    if (chainParams.numGen/chainParams.sampleFreq <= chainParams.burninSS)
+        {/*Do not change print out to generations vs samples because of danger of overflow*/
+        MrBayesPrint ("%s      ERROR: Burnin %d samples is too large compared with requested total %d samples (%d generations).\n", spacer ,chainParams.burninSS, chainParams.numGen/chainParams.sampleFreq, chainParams.numGen);
+        return ERROR;
+        }
+
+    oldBurnin = chainParams.burninSS;;
+    stepRelativeBurninSS = chainParams.relativeBurnin;
+
+    chainParams.relativeBurnin = YES;
+    if (chainParams.burninSS < 0)
+        chainParams.burninSS =  chainParams.numGen / ((chainParams.numStepsSS-chainParams.burninSS)*chainParams.sampleFreq);
+    chainParams.isSS = YES;
+
+    ret=DoMcmc();
+
+    chainParams.isSS = NO;
+    chainParams.burninSS = oldBurnin;
+    chainParams.relativeBurnin = stepRelativeBurninSS;
+
+    return ret;
+}
+
+
+int DoSsp (void)
+{
+    return NO_ERROR;
+}
+
+
+int ExhaustiveParsimonySearch (Tree *t, int chain, TreeInfo *tInfo)
+{
+    int         i, j, k;
+    TreeNode    *p;
+    
+    for (i=j=k=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL || p->right == NULL)
+            tInfo->leaf[j++] = p;
+        else
+            tInfo->vertex[k++] = p;
+        }
+
+    tInfo->leaf[0]->anc = tInfo->leaf[1]->anc = tInfo->vertex[0];
+    tInfo->vertex[0]->left = tInfo->leaf[0];
+    tInfo->vertex[0]->right = tInfo->leaf[1];
+    tInfo->leaf[t->nIntNodes+1]->left = tInfo->vertex[0];
+    tInfo->vertex[0]->anc = tInfo->leaf[t->nIntNodes+1];
+
+    BuildExhaustiveSearchTree (t, chain, 2, tInfo);
+
+    return (NO_ERROR);
+}
+
+
+int ExtendChainQuery ()
+{
+    int             extendChain, additionalCycles;
+    char            s[100];
+    
+#   if defined (MPI_ENABLED)
+    if (proc_id == 0)
+        {
+        MrBayesPrint ("\n");
+        extendChain = WantTo ("Continue with analysis");
+        }
+    MPI_Bcast (&extendChain, 1, MPI_INT, 0, MPI_COMM_WORLD);
+    if (extendChain == YES)
+        {
+        if (proc_id == 0)
+            {
+            additionalCycles = 0;
+            do
+                {
+                if (additionalCycles < 0)
+                    MrBayesPrint ("%s      Number must be greater than or equal to 0: ", spacer);
+                else
+                    MrBayesPrint ("%s      Additional number of generations: ", spacer);
+
+                if (fgets (s, 100, stdin) == NULL)
+                    {
+                    printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+                    }
+                sscanf (s, "%d", &additionalCycles);
+
+                } while (additionalCycles < 0);
+            MrBayesPrint ("\n");
+            }
+        MPI_Bcast (&additionalCycles, 1, MPI_INT, 0, MPI_COMM_WORLD);
+            
+        return (additionalCycles);
+        }
+    else
+        return (0);
+#   else
+    MrBayesPrint ("\n");
+    extendChain = WantTo ("Continue with analysis");
+    
+    if (extendChain == YES)
+        {
+        additionalCycles = 0;
+        do
+            {
+            if (additionalCycles < 0)
+                MrBayesPrint ("%s      Number must be greater than or equal to 0: ", spacer);
+            else
+                MrBayesPrint ("%s      Additional number of generations: ", spacer);
+
+            if (fgets (s, 20, stdin) == NULL)
+                {
+                printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+                }
+            sscanf (s, "%d", &additionalCycles);
+
+            } while (additionalCycles < 0);
+        MrBayesPrint ("\n");
+        return (additionalCycles);
+        }
+    else
+        return (0);
+#   endif
+
+}
+
+
+int FillNumSitesOfPat (void)
+{
+    int         i, j, n, *increased, *decreased, nToDecrease, nToIncrease, whichToChange;
+    MrBFlt      ran, sum;
+    CLFlt       wtIncrement;
+    
+    wtIncrement = (CLFlt) chainParams.weightScheme[2];
+    increased = decreased = NULL;
+    
+    /* reallocate numSitesOfPat */
+    if (memAllocs[ALLOC_NUMSITESOFPAT] == NO)
+        {
+        MrBayesPrint ("%s   numSitesOfPat is not allocated\n", spacer);
+        goto errorExit;
+        }
+    memAllocs[ALLOC_NUMSITESOFPAT] = NO;
+    numSitesOfPat = (CLFlt *) SafeRealloc((void *) numSitesOfPat, numCompressedChars * chainParams.numChains * sizeof(MrBFlt));
+    if (!numSitesOfPat)
+        {
+        MrBayesPrint ("%s   Problem reallocating numSitesOfPat (%d)\n", spacer, numCompressedChars * chainParams.numChains * sizeof(MrBFlt));
+        goto errorExit;
+        }
+    memAllocs[ALLOC_NUMSITESOFPAT] = YES;
+
+    /* copy first numCompressedChars into the remaining bits */
+    if (chainParams.numChains > 1)
+        {
+        for (i=0; i<numCompressedChars; i++)
+            {
+            for (j=1; j<chainParams.numChains; j++)
+                {
+                numSitesOfPat[j * numCompressedChars + i] = numSitesOfPat[i];
+                }
+            }
+        }   
+        
+    /* reweight characters for each chain */
+    if (chainParams.numChains > 1)
+        {
+        if (chainParams.weightScheme[0] + chainParams.weightScheme[1] > 0.0001)
+            MrBayesPrint ("%s   Reweighting of characters for chains 1 to %d\n", spacer, chainParams.numChains);
+
+        /* check that we don't have an HMM */
+        if (chainHasAdgamma == YES && chainParams.weightScheme[0] + chainParams.weightScheme[1] > 0.0001)
+            {
+            MrBayesPrint ("%s   Reweighting of characters is not allowed with an autocorrelated gamma model\n", spacer);
+            goto errorExit;
+            }
+        
+        /* how many characters */
+        n = 0;
+        for (i=0; i<numCompressedChars; i++)
+            n += (int)numSitesOfPat[0 * numCompressedChars + i];
+        nToDecrease = (int)(n * chainParams.weightScheme[0] / 100.0);
+        nToIncrease = (int)(n * chainParams.weightScheme[1] / 100.0);
+        if (chainParams.weightScheme[0] + chainParams.weightScheme[1] > 0.0001)
+            {
+            MrBayesPrint ("%s      Decreasing weight of %d characters\n", spacer, nToDecrease);
+            MrBayesPrint ("%s      Increasing weight of %d characters\n", spacer, nToIncrease);
+            }
+        
+        /* allocate memory */
+        increased = (int *)SafeMalloc(2 * (size_t)numCompressedChars * sizeof(int));
+        if (!increased)
+            {
+            MrBayesPrint ("%s   Problem reallocating increased (%d)\n", spacer, numCompressedChars * chainParams.numChains * sizeof(int));
+            goto errorExit;
+            }
+        decreased = increased + numCompressedChars;
+
+        /* reweight characters for each chain */
+        for (j=1; j<chainParams.numChains; j++)
+            {
+            for (i=0; i<numCompressedChars; i++)
+                increased[i] = decreased[i] = 0;
+
+            /* decrease weight of characters */
+            for (i=0; i<nToDecrease; i++)
+                {
+                do
+                    {
+                    ran = RandomNumber(&swapSeed);
+                    sum = 0.0;
+                    for (whichToChange=0; whichToChange<numCompressedChars; whichToChange++)
+                        {
+                        sum += numSitesOfPat[0 * numCompressedChars + whichToChange] / n;
+                        if (ran < sum)
+                            break;
+                        }
+                    if (whichToChange < 0 || whichToChange >= numCompressedChars)
+                        continue;
+                    } while (decreased[whichToChange] >= numSitesOfPat[0 * numCompressedChars + whichToChange]);
+                decreased[whichToChange]++;
+                numSitesOfPat[j * numCompressedChars + whichToChange] -= wtIncrement;
+                if (numSitesOfPat[j * numCompressedChars + whichToChange] < 0)
+                    {
+                    MrBayesPrint ("%s   Problem reweighting characters\n", spacer);
+                    goto errorExit;
+                    }
+                }
+
+            /* increase weight of characters */
+            for (i=0; i<nToDecrease; i++)
+                {
+                do
+                    {
+                    ran = RandomNumber(&swapSeed);
+                    sum = 0.0;
+                    for (whichToChange=0; whichToChange<numCompressedChars; whichToChange++)
+                        {
+                        sum += numSitesOfPat[0 * numCompressedChars + whichToChange] / n;
+                        if (ran < sum)
+                            break;
+                        }
+                    if (whichToChange < 0 || whichToChange >= numCompressedChars)
+                        continue;
+                    } while ((increased[whichToChange] + decreased[whichToChange]) >= numSitesOfPat[0 * numCompressedChars + whichToChange]);
+                increased[whichToChange]++;
+                numSitesOfPat[j * numCompressedChars + whichToChange] += wtIncrement;
+                if (numSitesOfPat[j * numCompressedChars + whichToChange] < 0)
+                    {
+                    MrBayesPrint ("%s   Problem reweighting characters\n", spacer);
+                    goto errorExit;
+                    }
+                }
+
+            }
+            
+        /* free allocated memory */
+        free (increased);
+        }
+        
+#   if 0
+    /* print site patterns for each chain */
+    for (i=0; i<numCompressedChars; i++)
+        {
+        MrBayesPrint ("%4d -- ", i);
+        for (j=0; j<chainParams.numChains; j++)
+            {
+            MrBayesPrint ("%4.1lf ", numSitesOfPat[j * numCompressedChars + i]);
+            }
+        MrBayesPrint ("\n");
+        }
+#   endif
+
+    return (NO_ERROR);
+    
+    errorExit:
+        if (increased)
+            free (increased);
+        return (ERROR);
+}
+
+
+/* FindBestNode: Recursive function for finding best attachment point */
+TreeNode *FindBestNode (Tree *t, TreeNode *p, TreeNode *addNode, CLFlt *minLength, int chain) {
+
+    int         c, n, division;
+    TreeNode    *q=NULL, *r=NULL;
+    BitsLong    *pA, *pP, *pX;
+    CLFlt       *nSitesOfPat, fpLength, length;
+    ModelInfo   *m;
+
+    /* Calculate length, looping over divisions */
+    fpLength = 0;
+    for (n=0; n<t->nRelParts; n++)
+        {
+        division = t->relParts[n];
+
+        /* Find model settings */
+        m = &modelSettings[division];
+
+        /* Find number of site patterns */
+        nSitesOfPat = numSitesOfPat + ((1 % chainParams.numChains) * numCompressedChars) + m->compCharStart;
+
+        /* Find final-pass parsimony sets for the node and its ancestor */
+        pP    = m->parsSets[p->index      ];
+        pA    = m->parsSets[p->anc->index ];
+        pX    = m->parsSets[addNode->index];
+
+        for (c=0; c<m->numChars; c++)
+            {
+            if (((pP[c] | pA[c])&pX[c]) == 0)
+                fpLength += nSitesOfPat[c];
+            }
+        }
+
+    /* If tip, this is the best node and its length is the min length */
+    if (p->left == NULL)
+        {
+        *minLength = fpLength;
+        return p;
+        }
+
+    /* Find best node and min length above this node */
+    if (p->left != NULL) {
+        q = FindBestNode(t, p->left,  addNode, minLength, chain);
+        r = FindBestNode(t, p->right, addNode, &length,   chain);
+        if (length < *minLength) {
+            *minLength = length;
+            q = r;
+        }
+    }
+
+    /* Return best node and min length */
+    if (*minLength < fpLength)
+        return q;
+    else /* This node is the best */
+        {
+        *minLength = fpLength;
+        return p;
+        }
+}
+
+
+/* FlipCijkSpace: Flip space for cijks with scratch area */
+void FlipCijkSpace (ModelInfo* m, int chain)
+{
+    int         temp;
+
+    temp                = m->cijkIndex[chain];
+    m->cijkIndex[chain] = m->cijkScratchIndex;
+    m->cijkScratchIndex = temp;
+}
+
+
+/* FlipCondLikeSpace: Flip space for conditional likelihoods with scratch area */
+void FlipCondLikeSpace (ModelInfo* m, int chain, int nodeIndex)
+{
+    int         temp;
+
+    temp                               = m->condLikeIndex[chain][nodeIndex];
+    m->condLikeIndex[chain][nodeIndex] = m->condLikeScratchIndex[nodeIndex];
+    m->condLikeScratchIndex[nodeIndex] = temp;
+}
+
+
+/* FlipNodeScalerSpace: Flip space for node scalers and scaler flag with scratch area */
+void FlipNodeScalerSpace (ModelInfo* m, int chain, int nodeIndex)
+{
+    int         temp;
+
+    temp                                 = m->nodeScalerIndex[chain][nodeIndex];
+    m->nodeScalerIndex[chain][nodeIndex] = m->nodeScalerScratchIndex[nodeIndex];
+    m->nodeScalerScratchIndex[nodeIndex] = temp;
+
+    temp                                 = m->scalersSet[chain][nodeIndex];
+    m->scalersSet[chain][nodeIndex]      = m->scalersSetScratch[nodeIndex];
+    m->scalersSetScratch[nodeIndex]      = temp;
+}
+
+
+/* FlipSiteScalerSpace: Flip space for ln site scalers */
+void FlipSiteScalerSpace (ModelInfo *m, int chain)
+{
+    int  temp;
+
+#   if defined (BEAGLE_ENABLED)
+    int *tempp;
+#   endif
+
+    temp = m->siteScalerIndex[chain];
+    m->siteScalerIndex[chain] = m->siteScalerScratchIndex;
+    m->siteScalerScratchIndex = temp;
+
+#   if defined (BEAGLE_ENABLED)
+    if (m->useBeagle == YES)
+        {
+        tempp = m->isScalerNode[chain];
+        m->isScalerNode[chain] = m->isScalerNodeScratch ;
+        m->isScalerNodeScratch = tempp;
+        }
+#   endif
+}
+
+
+/* FlipTiProbsSpace: Flip space for ti probs with scratch area */
+void FlipTiProbsSpace (ModelInfo* m, int chain, int nodeIndex)
+{
+    int         temp;
+
+    temp                              = m->tiProbsIndex[chain][nodeIndex];
+    m->tiProbsIndex[chain][nodeIndex] = m->tiProbsScratchIndex[nodeIndex];
+    m->tiProbsScratchIndex[nodeIndex] = temp;
+}
+
+
+void FreeChainMemory (void)
+{
+    int         i, j, k, nRateCats;
+    ModelInfo   *m;
+
+    /* free model variables for Gibbs gamma */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        if (modelSettings[i].gibbsGamma == YES)
+            {
+            if (modelSettings[i].pInvar != NULL)
+                nRateCats = modelSettings[i].numGammaCats + 1;
+            else
+                nRateCats = modelSettings[i].numGammaCats;
+            for (j=0; j<numLocalChains; j++)
+                {
+                for (k=0; k<nRateCats; k++)
+                    {
+                    free(modelSettings[i].catLnScaler[j][k]);
+                    free(modelSettings[i].catLike[j][k]);
+                    }
+                free (modelSettings[i].catLnScaler[j]);
+                free (modelSettings[i].catLike[j]);
+                }
+            free (modelSettings[i].tiIndex);
+            free (modelSettings[i].catLike);
+            free (modelSettings[i].catLnScaler);
+            }
+        }
+
+    /* free parsimony sets and node lens */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = &modelSettings[i];
+        if (m->parsSets)
+            {
+            for (j=0; j<m->numParsSets; j++)
+                free (m->parsSets[j]);
+            free (m->parsSets);
+            m->parsSets = NULL;
+            }
+        if (m->parsNodeLens)
+            {
+            free(m->parsNodeLens);
+            m->parsNodeLens = NULL;
+            }
+        }
+
+    /* free model variables for conditional likelihoods */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = &modelSettings[i];
+        if (m->condLikes)
+            {
+            for (j=0; j<m->numCondLikes; j++)
+                {
+#   if defined (SSE_ENABLED)
+                if (m->useSSE == YES)
+                    AlignedSafeFree ((void **)(&m->condLikes[j]));
+                else
+                    free (m->condLikes[j]);
+#   else
+                free (m->condLikes[j]);
+#   endif
+                }
+            free (m->condLikes);
+            m->condLikes = NULL;
+            }
+
+        if (m->scalers)
+            {
+            for (j=0; j<m->numScalers; j++)
+#   if defined (SSE_ENABLED)
+            if (m->useSSE == YES)
+                AlignedSafeFree ((void **)(&m->scalers[j]));
+            else
+                free (m->scalers[j]);
+#   else
+                free (m->scalers[j]);
+
+#   endif
+            free (m->scalers);
+            m->scalers = NULL;
+            }
+
+        if (m->clP)
+            {
+            free (m->clP);
+            m->clP = NULL;
+            }
+#   if defined (SSE_ENABLED)
+        if (m->useSSE == YES)
+            {
+            if (m->clP_SSE)
+                {
+                free (m->clP_SSE);
+                m->clP_SSE = NULL;
+                }
+            if (m->lnL_SSE)
+                AlignedSafeFree ((void **)(&m->lnL_SSE));
+            if (m->lnLI_SSE)
+                AlignedSafeFree ((void **)(&m->lnLI_SSE));
+            }
+#   endif
+
+        if (m->tiProbs)
+            {
+            for (j=0; j<m->numTiProbs; j++)
+                free (m->tiProbs[j]);
+            free (m->tiProbs);
+            m->tiProbs = NULL;
+            }
+                
+        if (m->cijks)
+            {
+            for (j=0; j<numLocalChains+1; j++)
+                free (m->cijks[j]);
+            free (m->cijks);
+            m->cijks = NULL;
+            }
+
+        if (m->condLikeIndex)
+            {
+            for (j=0; j<numLocalChains; j++)
+                free (m->condLikeIndex[j]);
+            free (m->condLikeIndex);
+            m->condLikeIndex = NULL;
+            }
+
+        if (m->condLikeScratchIndex)
+            {
+            free (m->condLikeScratchIndex);
+            m->condLikeScratchIndex=NULL;
+            }
+
+        if (m->tiProbsIndex)
+            {
+            for (j=0; j<numLocalChains; j++)
+                free (m->tiProbsIndex[j]);
+            free (m->tiProbsIndex);
+            m->tiProbsIndex = NULL;
+            }
+        if (m->tiProbsScratchIndex)
+            {
+            free (m->tiProbsScratchIndex);
+            m->tiProbsScratchIndex = NULL;
+            }
+        if (m->nodeScalerIndex)
+            {
+            for (j=0; j<numLocalChains; j++)
+                free (m->nodeScalerIndex[j]);
+            free (m->nodeScalerIndex);
+            m->nodeScalerIndex = NULL;
+            }
+        if (m->nodeScalerScratchIndex)
+            {
+            free (m->nodeScalerScratchIndex);
+            m->nodeScalerScratchIndex = NULL;
+            }
+        if (m->scalersSet)
+            {
+            for (j=0; j<numLocalChains; j++)
+                free (m->scalersSet[j]);
+            free (m->scalersSet);
+            m->scalersSet = NULL;
+            }
+        if (m->scalersSetScratch)
+            {
+            free (m->scalersSetScratch);
+            m->scalersSetScratch = NULL;
+            }
+        if (m->siteScalerIndex)
+            {
+            free (m->siteScalerIndex);
+            m->siteScalerIndex = NULL;
+            }
+        if (m->cijkIndex)
+            {
+            free (m->cijkIndex);
+            m->cijkIndex = NULL;
+            }
+        if (m->ancStateCondLikes)
+            {
+            free (m->ancStateCondLikes);
+            m->ancStateCondLikes = NULL;
+            }
+
+#   if defined (BEAGLE_ENABLED)
+        if (m->useBeagle == NO)
+            continue;
+
+        beagleFinalizeInstance(m->beagleInstance);
+        SafeFree((void **)(&m->logLikelihoods));
+        SafeFree((void **)(&m->inRates));
+        SafeFree((void **)(&m->branchLengths));
+        SafeFree((void **)(&m->tiProbIndices));
+        SafeFree((void **)(&m->inWeights));
+        SafeFree((void **)(&m->bufferIndices));
+        SafeFree((void **)(&m->eigenIndices));
+        SafeFree((void **)(&m->childBufferIndices));
+        SafeFree((void **)(&m->childTiProbIndices));
+        SafeFree((void **)(&m->cumulativeScaleIndices));
+
+        m->isScalerNodeScratch += numLocalTaxa;
+        SafeFree((void **)&(m->isScalerNodeScratch)); 
+        for (j=0; j<numLocalChains; j++)
+            {
+            m->isScalerNode[j] += numLocalTaxa;
+            SafeFree((void **)&(m->isScalerNode[j]));
+            }
+        SafeFree((void **)(&m->isScalerNode));
+
+        SafeFree((void **)(&m->beagleComputeCount));
+        SafeFree((void **)(&m->succesCount));
+        SafeFree((void **)(&m->rescaleFreq));
+
+#   endif
+        }
+
+    if (memAllocs[ALLOC_CURLNL] == YES) /*alloc in RunChain()*/
+        {
+        free (maxLnL0); 
+        free (curLnL);
+        memAllocs[ALLOC_CURLNL] = NO;
+        }
+    if (memAllocs[ALLOC_SS] == YES) /*alloc in mcmc()*/
+        {
+        free (marginalLnLSS);
+        free (stepScalerSS);
+        free (stepAcumulatorSS);
+        free (splitfreqSS);
+        memAllocs[ALLOC_SS] = NO;
+        }
+    if (memAllocs[ALLOC_CURLNPR] == YES) /*alloc in RunChain()*/
+        {
+        free (curLnPr); 
+        memAllocs[ALLOC_CURLNPR] = NO;
+        }
+    if (memAllocs[ALLOC_CHAINID] == YES) /*alloc in RunChain()*/
+        {
+        free (chainId); 
+        memAllocs[ALLOC_CHAINID] = NO;
+        }
+    if (memAllocs[ALLOC_USEDMOVES] == YES) /*alloc in setUsedMoves()*/
+        {
+        free (usedMoves);
+        memAllocs[ALLOC_USEDMOVES] = NO;
+        }
+    if (memAllocs[ALLOC_TERMSTATE] == YES) /*alloc in SetUpTermState()*/
+        {
+        free (termState);
+        termState = NULL;  
+        memAllocs[ALLOC_TERMSTATE] = NO;
+        }
+    if (memAllocs[ALLOC_ISPARTAMBIG] == YES) /*alloc in SetUpTermState()*/
+        {
+        free (isPartAmbig);
+        isPartAmbig = NULL;
+        memAllocs[ALLOC_ISPARTAMBIG] = NO;
+        }
+    if (memAllocs[ALLOC_PRELIKES] == YES) /*alloc in InitCondLike()*/
+        {
+        free (preLikeL);
+        preLikeL = NULL;
+        memAllocs[ALLOC_PRELIKES] = NO;
+        }
+    if (memAllocs[ALLOC_RATEPROBS] == YES) /*alloc in InitAdGamma() */
+        {
+        free (rateProbSpace);
+        free (rateProbs);
+        rateProbs = NULL;
+        memAllocs[ALLOC_RATEPROBS] = NO;
+        }
+    if (memAllocs[ALLOC_SITEJUMP] == YES) /*alloc in InitAdGamma() */
+        {
+        free (siteJump);
+        siteJump = NULL;
+        memAllocs[ALLOC_SITEJUMP] = NO;
+        }
+    if (memAllocs[ALLOC_MARKOVTIS] == YES)  /*alloc in InitAdGamma() */
+        {
+        for (i=0; i<MAX_SMALL_JUMP; i++)
+            if (markovTi[i] != NULL)
+                FreeSquareDoubleMatrix(markovTi[i]);
+        FreeSquareDoubleMatrix(markovTiN);
+        memAllocs[ALLOC_MARKOVTIS] = NO;
+        }
+    if (memAllocs[ALLOC_SWAPINFO] == YES) /*alloc in RunChain()*/
+        {
+        for (i=0; i<chainParams.numRuns; i++)
+            FreeSquareIntegerMatrix(swapInfo[i]);
+        free (swapInfo);
+        memAllocs[ALLOC_SWAPINFO] = NO;
+        }
+    if (memAllocs[ALLOC_POSSELPROBS] == YES) /*alloc in PrintStates() <- RunChain()*/
+        {
+        free (posSelProbs);
+        memAllocs[ALLOC_POSSELPROBS] = NO;
+        }
+    if (memAllocs[ALLOC_PFCOUNTERS] == YES) /*alloc in SetUpParitionCounters() <- RunChain()*/
+        {
+        free (partition[0]);
+        free (partition);
+        for (i=0; i<numTopologies; i++)
+            Tfree (partFreqTreeRoot[i]);
+        free (partFreqTreeRoot);
+        memAllocs[ALLOC_PFCOUNTERS] = NO;
+        }
+    if (memAllocs[ALLOC_FILEPOINTERS] == YES) /* alloc in (PreparePrintFiles(), ReusePreviousResults()) <- RunChain() */
+        {
+        CloseMBPrintFiles ();
+        if (fpTree != NULL)
+            {
+            free (fpTree[0]);
+            free (fpTree);
+            }
+        if (fpParm != NULL)
+            free (fpParm);
+        fpParm = NULL;
+        fpTree = NULL;
+        fpMcmc = NULL;
+        fpSS = NULL;
+        memAllocs[ALLOC_FILEPOINTERS] = NO;
+        }
+    if (memAllocs[ALLOC_STATS] == YES) /* alloc in RunChain() */
+        {
+        if (chainParams.allComps == YES)
+            {
+            for (i=0; i<numTopologies; i++)
+                FreeSquareDoubleMatrix (chainParams.stat[i].pair);
+            }
+        free (chainParams.stat);
+        memAllocs[ALLOC_STATS] = NO;
+        }
+    if (memAllocs[ALLOC_DIAGNTREE] == YES)
+        {
+        FreeTree (chainParams.dtree);
+        memAllocs[ALLOC_DIAGNTREE] = NO;
+        }
+    if (memAllocs[ALLOC_PRINTPARAM] == YES)
+        {
+        free (printParam);
+        free (topologyPrintIndex);
+        memAllocs[ALLOC_PRINTPARAM] = NO;
+        }
+    if (memAllocs[ALLOC_TFILEPOS] == YES)
+        {
+        free (chainParams.tFilePos);
+        chainParams.tFilePos = NULL;
+        memAllocs[ALLOC_TFILEPOS] = NO;
+        }
+    if (memAllocs[ALLOC_TREELIST] == YES)
+        {
+        for (i=0; i<chainParams.numRuns * numTopologies; i++)
+            EraseTreeList (&chainParams.treeList[i]);
+        free (chainParams.treeList);
+        chainParams.treeList = NULL;
+        memAllocs[ALLOC_TREELIST] = NO;
+        }
+    if (memAllocs[ALLOC_BEST] == YES)
+        {
+        FreeBestChainVariables();
+        memAllocs[ALLOC_BEST] = NO;
+        }
+}
+
+
+MrBFlt GetFitchPartials (ModelInfo *m, int chain, int source1, int source2, int destination)
+{
+    int         c, i;
+    BitsLong    x[2], *pS1, *pS2, *pD;
+    MrBFlt      length = 0.0;
+    CLFlt       *nSitesOfPat;
+    
+    assert (m->nParsIntsPerSite <= 2 && m->nParsIntsPerSite > 0);
+    assert (source1 >= 0 && source1 < m->numParsSets);
+    assert (source2 >= 0 && source2 < m->numParsSets);
+    assert (destination >= 0 && destination < m->numParsSets);
+
+    /* find parsimony sets for the nodes */
+    pS1 = m->parsSets[source1    ];
+    pS2 = m->parsSets[source2    ];
+    pD  = m->parsSets[destination];
+        
+    /* Find number of site patterns */
+    nSitesOfPat = numSitesOfPat + ((1 % chainParams.numChains) * numCompressedChars) + m->compCharStart;//chainId[chain]
+
+    if (m->nParsIntsPerSite == 1)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            x[0] = pS1[c] & pS2[c];
+            if (x[0] == 0)
+                {
+                length += nSitesOfPat[c];
+                x[0] = pS1[c] | pS2[c];
+                }
+            pD[c] = x[0];
+            }
+        }
+    else /* if (m->nParsIntsPerSite == 2) */
+        {
+        assert (m->nParsIntsPerSite == 2);
+        for (c=i=0; c<m->numChars; c++)
+            {
+            x[0] = pS1[i]   & pS2[i];
+            x[1] = pS1[i+1] & pS2[i+1];
+            if ((x[0] | x[1]) == 0)
+                {
+                length += nSitesOfPat[c];
+                x[0] = pS1[i]   | pS2[i];
+                x[1] = pS1[i+1] | pS2[i+1];
+                }
+            pD[i++] = x[0];
+            pD[i++] = x[1];
+            }
+        }
+
+    return length;
+    MrBayesPrint ("%d", chain); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+MrBFlt GetParsDP (Tree *t, TreeNode *p, int chain)
+{
+    int             n, division;
+    MrBFlt          length;
+    ModelInfo       *m;
+
+    length = 0.0;
+    if (p->left != NULL)
+        {
+        length += GetParsDP (t, p->left, chain);
+        length += GetParsDP (t, p->right, chain);
+
+        for (n=0; n<t->nRelParts; n++)
+            {
+            division = t->relParts[n];
+            
+            /* Find model settings */
+            m = &modelSettings[division];
+
+            /* Get Fitch partials and length */
+            length += GetFitchPartials(m,
+                                       chain,
+                                       p->left->index,
+                                       p->right->index,
+                                       p->index);
+            }
+        }
+
+    return length;
+}
+
+
+void GetParsFP (Tree *t, TreeNode *p, int chain)
+{
+    int             i, c, n, division;
+    BitsLong        *pL, *pR, *pP, *pA, x[2];
+    ModelInfo       *m;
+
+    if (p->left != NULL)
+        {
+        for (n=0; n<t->nRelParts; n++)
+            {
+            division = t->relParts[n];
+            
+            /* Find model settings */
+            m = &modelSettings[division];
+            assert (m->nParsIntsPerSite == 1 || m->nParsIntsPerSite == 2);
+
+            /* find parsimony sets for the node and its environment */
+            pL   = m->parsSets[p->left->index ];
+            pR   = m->parsSets[p->right->index];
+            pP   = m->parsSets[p->index       ];
+            pA   = m->parsSets[p->anc->index  ];
+            
+            if (m->nParsIntsPerSite == 1)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    x[0] = pP[c] & pA[c];
+
+                    if (x[0] != pA[c])
+                        {   /* means that we allow change of state from p to a */
+                        if ((pL[c] & pR[c]) != 0)
+                            x[0] = ((pL[c] | pR[c]) & pA[c]) | pP[c] ;
+                            /* We still allow only one change from both children of p through p to a.
+                               So state from a that belong to one of the children of p can be added to pP[c],
+                               if p assume the state then the only change would be on the other child. */
+                        else
+                            x[0] = pP[c] | pA[c];
+                            /* Here we allow two change from both children of p through p to a.
+                               Adding pA[c] to pP[c] means that if p assume state exclusive in a then even if
+                               both children will be in different state from p we still get optimal parsimony */
+                        }
+                    pP[c] = x[0];
+                    }
+                }
+            else /* if (m->nParsIntsPerSite == 2) */
+                {
+                for (c=i=0; c<m->numChars; c++)
+                    {
+                    x[0] = pP[i]   & pA[i];
+                    x[1] = pP[i+1] & pA[i+1];
+                    if (x[0] != pA[i] || x[1] != pA[i+1])
+                        {
+                        x[0] = pL[i] & pR[i];
+                        x[1] = pL[i+1] & pR[i+1];
+                        if ((x[0] | x[1]) != 0)
+                            {
+                            x[0] = ((pL[i] | pR[i]) & pA[i]) | pP[i] ;
+                            x[1] = ((pL[i+1] | pR[i+1]) & pA[i+1]) | pP[i+1] ;
+                            }
+                        else
+                            {
+                            x[0] = pP[i] | pA[i];
+                            x[1] = pP[i+1] | pA[i+1];
+                            }
+                        }
+                    pP[i++] = x[0];
+                    pP[i++] = x[1];
+                    }
+                }
+            }
+        GetParsFP (t, p->left, chain);
+        GetParsFP (t, p->right, chain);
+        }
+}
+
+
+int GetParsimonyBrlens (Tree *t, int chain, MrBFlt *brlens)
+{
+    int             c, i, j, n, division;
+    BitsLong        *pP, *pA;
+    CLFlt           *nSitesOfPat;
+    TreeNode        *p;
+    ModelInfo       *m;
+
+    /* Reset all brlens */
+    for (i=0; i<t->nNodes-1; i++)
+        brlens[i] = 0.0;
+    
+    /* Get final parsimony state sets */
+    GetParsDP(t, t->root->left, chain);
+    GetParsFP(t, t->root, chain);
+    
+    /* Get all branch lengths, looping over divisions */
+    for (n=0; n<t->nRelParts; n++)      
+        {
+        division = t->relParts[n];
+
+        /* Find model settings */
+        m = &modelSettings[division];
+
+        /* Find number of site patterns */
+        nSitesOfPat = numSitesOfPat + ((chainId[chain] % chainParams.numChains) * numCompressedChars) + m->compCharStart;
+
+        /* Record branch lengths in downpass */
+        for (i=0; i<t->nNodes-1; i++)
+            {
+            p = t->allDownPass[i];
+
+            /* Find final-pass parsimony sets for the node and its ancestor */
+            pP    = m->parsSets[p->index     ];
+            pA    = m->parsSets[p->anc->index];
+            
+            if (m->nParsIntsPerSite == 1)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    if ((pP[c] & pA[c]) == 0)
+                        brlens[i] += nSitesOfPat[c];
+                    }
+                }
+            else
+                {
+                for (c=j=0; c<m->numChars; c++, j+=2)
+                    {
+                    if ((pP[j] & pA[j]) == 0 && (pP[j+1] & pA[j+1]) == 0)
+                        brlens[i] += nSitesOfPat[c];
+                    }
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+MrBFlt GetParsimonyLength (Tree *t, int chain)
+{
+    int             c, i, n, division;
+    BitsLong        *pP, *pA;
+    CLFlt           *nSitesOfPat;
+    MrBFlt          length;
+    TreeNode        *p;
+    ModelInfo       *m;
+
+    /* Get length down to internal root */
+    length = GetParsDP(t, t->root->left, chain);
+
+    /* return if rooted */
+    if (t->isRooted == NO)
+        return length;
+
+    /* add in the last terminal if not rooted */
+    for (n=0; n<t->nRelParts; n++)      
+        {
+        division = t->relParts[n];
+
+        /* Find model settings */
+        m = &modelSettings[division];
+
+        /* Find number of site patterns */
+        nSitesOfPat = numSitesOfPat + ((chainId[chain] % chainParams.numChains) * numCompressedChars) + m->compCharStart;
+
+        /* Deal with last branch */
+        p = t->intDownPass[t->nIntNodes-1];
+
+        /* find downpass parsimony sets for the node and its environment */
+        pP    = m->parsSets[p->index     ];
+        pA    = m->parsSets[p->anc->index];
+        
+        if (m->nParsIntsPerSite == 1)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                if ((pP[c] & pA[c]) == 0)
+                    {
+                    length += nSitesOfPat[c];
+                    }
+                }
+            }
+        else /* if (m->nParsIntsPerSite == 2) */
+            {
+            for (c=i=0; c<m->numChars; c++, i+=2)
+                {
+                if ((pP[i] & pA[i]) == 0 && (pP[i+1] & pA[i+1]) == 0)
+                    {
+                    length += nSitesOfPat[c];
+                    }
+                }
+            }
+        }
+
+    return length;
+}
+
+
+void GetParsimonySubtreeRootstate (Tree *t, TreeNode *root, int chain)
+{
+    int             c, i, n, division;
+    BitsLong        *pD, *pP, *pA, x[2];
+    TreeNode        *p;
+    ModelInfo       *m;
+
+    /* Loop over divisions */
+    for (n=0; n<t->nRelParts; n++)
+        {
+        division = t->relParts[n];
+            
+        /* Find model settings */
+        m = &modelSettings[division];
+        assert (m->nParsIntsPerSite == 1 || m->nParsIntsPerSite == 2);
+
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            p->marked = NO;
+            }
+
+        p = root;
+        while (p->anc != NULL)
+            {
+            p->marked = YES;
+            p = p->anc;
+            }
+
+        /* Make uppass node by node */
+        for (i=t->nIntNodes-1; i>=0; i--)
+            {
+            p = t->intDownPass[i];
+
+            /* continue if no work needs to be done */
+            if (p->marked == NO)
+                continue;
+
+            /* find downpass and uppass parsimony sets for the node and its environment */
+            pP     = m->parsSets[p->index       ];
+            if (p->left->marked == YES)
+                pD = m->parsSets[p->right->index];
+            else
+                pD = m->parsSets[p->left->index ];
+            pA     = m->parsSets[p->anc->index  ];
+            
+            if (m->nParsIntsPerSite == 1)
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    x[0] = pD[c] & pA[c];
+                    if (x[0] == 0)
+                        {
+                        x[0] = (pD[c] | pA[c]);
+                        }
+                    pP[c] = x[0];
+                    }
+                }
+            else if (m->nParsIntsPerSite == 2)
+                {
+                for (c=i=0; c<m->numChars; c++, i+=2)
+                    {
+                    x[0] = pD[i  ] & pA[i  ];
+                    x[1] = pD[i+1] & pA[i+1];
+                    if (x[0] + x[1] == 0)
+                        {
+                        x[0] = (pD[i  ] | pA[i  ]);
+                        x[1] = (pD[i+1] | pA[i+1]);
+                        }
+                    pP[i  ] = x[0];
+                    pP[i+1] = x[1];
+                    }
+                }
+            if (p == root)
+                break;
+            }
+        }
+
+    return;
+    MrBayesPrint ("%d", chain); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/* GetRate: retrieve the base rate for the division and chain in current state */
+MrBFlt GetRate (int division, int chain)
+{
+    Param   *p;
+    MrBFlt  *values, rate;
+    int     i;
+
+    rate = 0.0;
+
+    p = modelSettings[division].rateMult;
+    values = GetParamVals (p, chain, state[chain]);
+    if (p->nValues == 1)
+        rate = values[0];
+    else
+        {
+        for (i=0; i<p->nRelParts; i++)
+            {
+            if (p->relParts[i] == division)
+                {
+                rate = values[i];
+                break;
+                }
+            }
+        }
+
+    p = modelSettings[division].geneTreeRateMult;
+    if (p != NULL)
+        {
+        values = GetParamVals (p, chain, state[chain]);
+        for (i=0; i<p->nRelParts; i++)
+            {
+            if (p->relParts[i] == division)
+                {
+                rate *= values[i];
+                break;
+                }
+            }
+        }
+    
+    return rate;
+}
+
+
+void GetStamp (void)
+{
+    int     i;
+
+    for (i=0; i<10; i++)
+        stamp[i] = '0' + (int)(RandomNumber(&runIDSeed) * 10);
+    stamp[10] = '\0';
+
+    MrBayesPrint ("%s   MCMC stamp = %s\n", spacer, stamp);
+}
+
+
+void GetSwappers (int *swapA, int *swapB, int run)
+{
+    int         i;
+    
+    /* this works for both the serial and parallel versions because the swapSeed is identical for all
+        processors, ensuring they all get the same sequence of chainIds to swap */
+#   if defined (MPI_ENABLED)
+
+    /* For now, we wonly allow random swaps in the MPI version. Other schemes require
+       tagging of messages, or a dedicated server node doing message processing.      */
+    (*swapA) = (int) (RandomNumber(&swapSeed) * chainParams.numChains);
+    (*swapB) = (int) (RandomNumber(&swapSeed) * (chainParams.numChains - 1));
+    if ((*swapB) == (*swapA))
+        (*swapB) = chainParams.numChains - 1;
+
+#   else
+
+    if (chainParams.swapAdjacentOnly == NO)
+        {
+        (*swapA) = (int) (RandomNumber(&swapSeed) * chainParams.numChains);
+        (*swapB) = (int) (RandomNumber(&swapSeed) * (chainParams.numChains - 1));
+        if ((*swapB) == (*swapA))
+            (*swapB) = chainParams.numChains - 1;
+        }
+    else
+        {
+        (*swapA) = (int) (RandomNumber(&swapSeed) * (chainParams.numChains - 1));
+        (*swapB) = (*swapA) + 1;
+        }
+#   endif
+
+    i = run * chainParams.numChains;
+    (*swapA) += i;
+    (*swapB) += i;
+
+    return;
+}
+
+
+void GetTempDownPassSeq (TreeNode *p, int *i, TreeNode **dp)
+{
+    if (p != NULL)
+        {
+        GetTempDownPassSeq (p->left,  i, dp);
+        GetTempDownPassSeq (p->right, i, dp);
+        dp[(*i)++] = p;
+        }
+}
+
+
+MrBFlt GibbsSampleGamma (int chain, int division, RandLong *seed)
+{
+    int             c, i, k, *rateCat, nStates, nRateCats, nGammaCats, id;
+    CLFlt           **catLike, **catLnScaler, *lnScaler, maxLnScaler,
+                    *clRoot, f, bs[64], *clInvar, pInvar, freq;
+    MrBFlt          ran, lnL, *bsVals, deltaLnL, temp;
+    ModelInfo       *m;
+    Tree            *t;
+    TreeNode        *p;
+
+    m = &modelSettings[division];
+
+    /* find base frequencies */
+    bsVals = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    nStates = m->numModelStates;
+    for (i=0; i<nStates; i++)
+        bs[i] = (CLFlt) bsVals[i];
+
+    /* find tree scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find category like array and associated sccaler */
+    catLike = m->catLike[chain];
+    catLnScaler = m->catLnScaler[chain];
+    
+    /* find rate category index */
+    rateCat = m->tiIndex + chain*m->numChars;
+    
+    /* find number of rate cats and gamma cats */
+    nRateCats = nGammaCats = m->numGammaCats;
+    if (m->pInvar != NULL)
+        nRateCats++;
+
+    /* find tree */
+    t = GetTree (m->brlens, chain, state[chain]);
+
+    /* find invar cond likes (if we have invariable rate category) */
+    clInvar = m->invCondLikes;
+
+    /* get pInvar */
+    if (m->pInvar == NULL)
+        pInvar = 0.0;
+    else
+        pInvar = (CLFlt) *GetParamVals (m->pInvar, chain, state[chain]);
+    freq = ((CLFlt)1.0 - pInvar) / nGammaCats;
+
+    /* get chain temperature */
+    temp = Temperature (chainId[chain]);
+    id = chainId[chain] % chainParams.numChains;
+
+    /* calculate rate probs */
+    for (k=0; k<nGammaCats; k++)
+        {
+        FlipSiteScalerSpace(m, chain);
+        ResetSiteScalers(m, chain);
+        for (c=0; c<m->numChars; c++)
+            rateCat[c] = k;
+        for (i=0; i<t->nIntNodes; i++)
+            {
+            p = t->intDownPass[i];
+            if (t->isRooted == NO && p->anc->anc == NULL)
+                m->CondLikeRoot (p, division, chain);
+            else
+                m->CondLikeDown (p, division, chain);
+            if (p->scalerNode == YES)
+                m->CondLikeScaler (p, division, chain);
+            }
+        /* find root conditional likes */
+        p = t->root->left;
+        clRoot = m->condLikes[m->condLikeIndex[chain][p->index]];
+        for (c=0; c<m->numChars; c++)
+            {
+            catLike[k][c] = 0.0;
+            for (i=0; i<nStates; i++)
+                catLike[k][c] += bs[i]*clRoot[i];
+            catLike[k][c] *= freq;
+            catLnScaler[k][c] = lnScaler[c];
+            clRoot += nStates;
+            }
+        FlipSiteScalerSpace(m, chain);
+        }
+
+    /* fill in the invar cond likes if needed */
+    if (m->pInvar != NULL)
+        {
+        k = nGammaCats;
+        for (c=0; c<m->numChars; c++)
+            {
+            catLike[k][c] = 0.0;
+            for (i=0; i<nStates; i++)
+                catLike[k][c] += bs[i]*clInvar[i];
+            catLike[k][c] *= pInvar;
+            clInvar += nStates;
+            catLnScaler[k][c] = 0.0;
+            }
+        }
+
+    /* Now Gibbs sample the rate categories */
+    for (c=0; c<m->numChars; c++)
+        {
+        /* find max scaler */
+        maxLnScaler = catLnScaler[0][c];
+        for (k=1; k<nRateCats; k++)
+            {
+            if (catLnScaler[k][c] > maxLnScaler && catLike[k][c] > 0.0)
+                maxLnScaler = catLnScaler[k][c];
+            }
+        /* scale values */
+        for (k=0; k<nRateCats; k++)
+            {
+            f = catLnScaler[k][c] - maxLnScaler;
+            if (f < -100.0)
+                catLike[k][c] = 0.0;
+            else
+                {
+                catLike[k][c] *= (CLFlt) exp (f);
+                /* take the temperature into account */
+                if (id != 0)
+                    catLike[k][c] = (CLFlt) pow(catLike[k][c], temp);
+                }
+            }
+        /* get cumulative sum */
+        for (k=1; k<nRateCats; k++)
+            catLike[k][c] += catLike[k-1][c];
+        /* randomly sample a category; multiply by total to avoid scaling probs */
+        ran = RandomNumber(seed) * catLike[nRateCats-1][c];
+        for (k=0; k<nRateCats; k++)
+            {
+            if (ran < catLike[k][c])
+                break;
+            }
+        rateCat[c] = k;
+        }
+
+    /* recalculate everything */
+    FlipSiteScalerSpace(m, chain);
+    ResetSiteScalers(m, chain);
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        if (t->isRooted == NO && p->anc->anc == NULL)
+            m->CondLikeRoot (p, division, chain);
+        else
+            m->CondLikeDown (p, division, chain);
+        if (p->scalerNode == YES)
+            m->CondLikeScaler (p, division, chain);
+        }
+    lnL = 0.0;
+    m->Likelihood (t->root->left, division, chain, &lnL, (chainId[chain] % chainParams.numChains));
+    
+    deltaLnL = lnL - m->lnLike[2*chain + state[chain]];
+    m->lnLike[2*chain + state[chain]] =  lnL;
+
+    return (deltaLnL);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitAdGamma: initialize variables for adgamma model.
+|
+-------------------------------------------------------------------------*/
+int InitAdGamma (void)
+{
+    int         d, c, i, j, k, maxRates, *corrModel;
+    ModelInfo   *m;
+    
+    /* take care of adgamma model */
+    if (chainHasAdgamma == NO)
+        return (NO_ERROR);
+    
+    MrBayesPrint ("%s   Initializing autocorrelated discrete gamma model\n", spacer);
+    
+    /* allocate corr space */
+    corrModel = (int *) SafeCalloc (numCurrentDivisions, sizeof(int));
+    if (!corrModel)
+        return ERROR;
+    
+    /* allocate siteJump */
+    if (memAllocs[ALLOC_SITEJUMP] == YES)
+        {
+        MrBayesPrint ("%s   siteJump not free in InitAdGamma\n", spacer);
+        free (corrModel);
+        return ERROR;
+        }
+    siteJump = (int *) SafeCalloc (numChar, sizeof(int));
+    if (siteJump)
+        memAllocs[ALLOC_SITEJUMP] = YES;
+    else
+        {
+        MrBayesPrint ("%s   Problem allocating siteJump in InitAdGamma (%d ints)\n", spacer, numChar);
+        free (corrModel);
+        return ERROR;
+        }
+    
+    /* reset vector indicating the matrices needed */
+    for (i=0; i<MAX_SMALL_JUMP; i++)
+        hasMarkovTi[i] = NO;
+    
+    /* fill in siteJump */
+    for (i=0; i<numCurrentDivisions; i++)
+        corrModel[i] = 0;
+
+    k = 1;  /* index to corr model, 0 means no corr model */
+    maxRates = 0;   /* max no. rates */
+    for (d=0; d<numCurrentDivisions; d++)
+        modelSettings[d].mark = NO;
+
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        
+        if (m->correlation == NULL || m->mark == YES)
+            continue;
+        
+        m->mark = YES;
+        for (i=0; i<m->correlation->nRelParts; i++)
+            {
+            if (modelSettings[m->correlation->relParts[i]].shape == 
+                modelSettings[d].shape)
+                {
+                modelSettings[m->correlation->relParts[i]].mark = YES;
+                corrModel[m->correlation->relParts[i]] = k;
+                }
+            }
+        k++;
+
+        if (m->numGammaCats > maxRates)
+            maxRates = m->numGammaCats;
+
+        }
+
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES)
+            continue;
+        
+        if ((k=corrModel[partitionId[c][partitionNum] - 1]) == 0)
+            continue;
+
+        /* How far back is last char in this HMM? */
+        for (j=c-1; j>=0; j--)
+            {
+            if (corrModel[partitionId[j][partitionNum] - 1] == k)
+                break;
+            }
+
+        if (j<0)
+            siteJump[c] = 0;
+        else if (charInfo[j].bigBreakAfter == YES)
+            siteJump[c] = BIG_JUMP;
+        else
+            {
+            siteJump[c] = c - j;
+            hasMarkovTi[c-j-1] = YES;
+            }
+        }
+
+    /* check if any HMM is empty */
+    k=0;
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        if (corrModel[i] > k)
+            k = corrModel[i];
+        }
+    for (i=1; i<=k; i++)
+        {
+        for (c=j=0; c<numChar; c++)
+            {
+            if (charInfo[c].isExcluded == NO && corrModel[partitionId[c][partitionNum] - 1] == i)
+                j = c;
+            }
+        if (j == 0)
+            {
+            MrBayesPrint ("%s   ERROR: HMM model %d is empty.\n",spacer,i);
+            free (corrModel);
+            return (ERROR);
+            }
+        }
+
+    /* allocate MarkovTis (space needed for calculations) */
+    if (memAllocs[ALLOC_MARKOVTIS] == YES)
+        {
+        MrBayesPrint ("%s   markovTis not free in InitAdGamma\n", spacer);
+        free (corrModel);
+        return ERROR;
+        }
+
+    for (i=0; i<MAX_SMALL_JUMP; i++)
+        {
+        if (hasMarkovTi[i] == YES || i == 0)    /* base matrix always needed */
+            {
+            markovTi[i] = AllocateSquareDoubleMatrix(maxRates);
+            if (markovTi[i] == NULL)
+                break;
+            }
+        else
+            markovTi[i] = NULL;
+        }
+
+    markovTiN = AllocateSquareDoubleMatrix(maxRates);
+    if (i >= MAX_SMALL_JUMP && markovTiN)
+        memAllocs[ALLOC_MARKOVTIS] = YES;
+    else
+        {
+        MrBayesPrint ("%s   Problem allocating MarkovTis in InitAdGamma (%d MrBFlt)\n", spacer, 2 * MAX_GAMMA_CATS * MAX_GAMMA_CATS);
+        for (i=0; i<MAX_SMALL_JUMP; i++)
+            if (markovTi[i] != NULL) 
+                FreeSquareDoubleMatrix (markovTi[i]);
+        if (markovTiN != NULL) 
+            FreeSquareDoubleMatrix(markovTiN);
+        free (corrModel);
+        return ERROR;
+        }
+
+    /* allocate space for rateProbs needed by adgamma model */
+
+    /* calculate size needed */
+    i = 0;
+    for (j=0; j<numCurrentDivisions; j++)
+        {
+        m = &modelSettings[j];
+        if (m->correlation != NULL)
+            {
+            m->rateProbStart = i;
+            i += m->numGammaCats * m->numChars;
+            }
+        }
+    rateProbRowSize = i;
+
+    /* allocate space */
+    if (memAllocs[ALLOC_RATEPROBS] == YES)
+        {
+        MrBayesPrint ("%s   Space for rate probs not free in InitAdGamma\n", spacer);
+        free (corrModel);
+        return ERROR;
+        }
+    rateProbSpace = (MrBFlt *) SafeMalloc (2 * numLocalChains * rateProbRowSize * sizeof(MrBFlt));
+    rateProbs = (MrBFlt **) SafeMalloc (numLocalChains * sizeof(MrBFlt *));
+    if (!rateProbSpace || !rateProbs)
+        {
+        MrBayesPrint ("%s   Problem allocating rate probs\n", spacer);
+        if (rateProbSpace) 
+            free (rateProbSpace);
+        if (rateProbs) 
+            free (rateProbs);
+        free (corrModel);
+        return ERROR;
+        }
+    else
+        memAllocs[ALLOC_RATEPROBS] = YES;
+
+    /* set chain rateProbs pointers */
+    for (i=j=0; i<numLocalChains; i++)
+        {
+        rateProbs[i] = rateProbSpace + j;
+        j += 2 * rateProbRowSize;
+        }
+
+    free (corrModel);
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitAugmentedModels: allocate and initialize space for augmented
+|      models
+|
+-------------------------------------------------------------------------*/
+int InitAugmentedModels (void)
+{
+    int         d, i, j, useAugmentedModels, nRateCats;
+    ModelInfo   *m;
+
+    useAugmentedModels = NO;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        if (modelSettings[d].gibbsGamma == YES)
+                useAugmentedModels = YES;
+        }
+    
+    if (useAugmentedModels == NO)
+        return (NO_ERROR);
+    
+    MrBayesPrint ("%s   Initializing variables for model augmentation\n", spacer);
+    
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        if (m->gibbsGamma == NO)
+                continue;
+        m->tiIndex = (int *) SafeMalloc (numLocalChains * m->numChars * sizeof (int));
+        if (!m->tiIndex)
+            return ERROR;
+        m->catLike = (CLFlt ***) SafeMalloc (numLocalChains * sizeof (CLFlt **));
+        if (!m->catLike)
+            return ERROR;
+        m->catLnScaler = (CLFlt ***) SafeMalloc (numLocalChains * sizeof (CLFlt **));
+        if (!m->catLnScaler)
+            return ERROR;
+        if (m->pInvar == NULL)
+            nRateCats = m->numGammaCats;
+        else
+            nRateCats = m->numGammaCats + 1;
+        for (i=0; i<numLocalChains; i++)
+            {
+            m->catLike[i] = (CLFlt **) SafeCalloc (nRateCats, sizeof (CLFlt *));
+            if (!m->catLike[i])
+                return ERROR;
+            m->catLnScaler[i] = (CLFlt **) SafeCalloc (nRateCats, sizeof (CLFlt *));
+            if (!m->catLnScaler[i])
+                return ERROR;
+            for (j=0; j<nRateCats; j++)
+                {
+                m->catLike[i][j] = (CLFlt *) SafeCalloc (m->numChars, sizeof (CLFlt));
+                if (!m->catLike[i][j])
+                    return ERROR;
+                m->catLnScaler[i][j] = (CLFlt *) SafeCalloc (m->numChars, sizeof (CLFlt));
+                if (!m->catLnScaler[i][j])
+                    return ERROR;
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitChainCondLikes: (1) calculate size of cond like arrays, tiprob arrays
+|       and scaler arrays; (2) allocate space for cond like, tiprob and
+|       scaler arrays; (3) allocate and set node indices pointing to
+|       cond like and scaler arrays; (4) initialize tip cond likes;
+|       (5) allocate space for precalculated cond likes; (6) allocate
+|       space for adgamma probs, if used.
+|
+-------------------------------------------------------------------------*/
+int InitChainCondLikes (void)
+{
+    int         c, d, i, j, k, s, t, numReps, condLikesUsed, nIntNodes, nNodes, useBeagle,
+                clIndex, tiIndex, scalerIndex, indexStep;
+    BitsLong    *charBits;
+    CLFlt       *cL;
+    ModelInfo   *m;
+#   if defined (SSE_ENABLED)
+    int         j1;
+#   endif
+#   if defined (BEAGLE_ENABLED)
+    double      *nSitesOfPat;
+    MrBFlt      freq;
+#   endif
+
+    /* Figure out how large cond like array is needed, and how many cond like, scaler and tiprob arrays are needed.
+       Also check for possible use of Beagle */
+    condLikesUsed = NO;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+
+        MrBayesPrint ("%s   Division %d has %d unique site patterns\n", spacer, d+1, m->numChars);
+
+        /* initialize model settings for chain cond likes */
+        m->condLikeLength = 0;
+        m->numCondLikes = 0;
+
+        if (m->parsModelId == YES)
+            continue;
+
+        condLikesUsed = YES;
+
+        /* figure out length of cond like array */
+        if (m->dataType == STANDARD)
+            {
+#   if defined (BEAGLE_ENABLED)
+            m->useBeagle = NO;
+#   endif
+            for (c=0; c<m->numChars; c++)
+                {
+                numReps = m->numGammaCats;
+                if (m->nStates[c] == 2)
+                    numReps *= m->numBetaCats;
+                m->condLikeLength += m->nStates[c] * numReps;
+                }
+            }
+        else
+            {
+            if (m->gibbsGamma == YES)
+                m->condLikeLength = m->numChars * m->numModelStates;
+            else
+                m->condLikeLength = m->numChars * m->numGammaCats * m->numOmegaCats * m->numModelStates;
+#   if defined (BEAGLE_ENABLED)
+            /* tentatively decide on whether to use Beagle */
+            if (tryToUseBEAGLE == YES)
+                {
+                if (m->printAncStates == YES || m->printSiteRates == YES || m->printPosSel ==YES || m->printSiteOmegas==YES)
+                    {
+                    MrBayesPrint ("%s   Non-beagle version of conditional likelihood calculator will be used for division %d due to\n", spacer, d+1);
+                    MrBayesPrint ("%s   request of reporting 'ancestral states', 'site rates', 'pos selection' or 'site omegas'.\n", spacer);
+                    }                
+                else if (m->gibbsGamma == NO)
+                    m->useBeagle = YES;
+                }
+#   endif
+            }
+        
+        /* find size of tree */
+        nIntNodes = GetTree(m->brlens, 0, 0)->nIntNodes;
+        nNodes = GetTree(m->brlens, 0, 0)->nNodes;
+
+        /* figure out number of cond like arrays */
+        m->numCondLikes = (numLocalChains + 1) * (nIntNodes);
+        m->numCondLikes += numLocalTaxa;
+        /*
+#   if !defined (DEBUG_NOSHORTCUTS)
+        for (i=0; i<numLocalTaxa; i++)
+            {
+            if (m->isPartAmbig[i] == NO && m->dataType != STANDARD)
+                m->numCondLikes--;
+            }
+#   endif
+        */
+
+        /* figure out number of node and site scalers */
+        m->numScalers = (numLocalChains + 1) * (nIntNodes + 1);   /* add 1 for site scalers */
+
+        /* figure out length of ti prob array and number of ti prob arrays */
+        m->tiProbLength = 0;
+        if (m->dataType == STANDARD)
+            {
+            m->numTiCats = 0;   /* We do not have repeated similar transition probability matrices */
+            if (m->stateFreq->paramId == SYMPI_EQUAL)
+                {
+                for (k=0; k<9; k++)
+                    {
+                    if (m->isTiNeeded[k] == YES)
+                        m->tiProbLength += (k + 2) * (k + 2) * m->numGammaCats;
+                    }
+                for (k=9; k<13; k++)
+                    {
+                    if (m->isTiNeeded[k] == YES)
+                        m->tiProbLength += (k - 6) * (k - 6) * m->numGammaCats;
+                    }
+                for (k=13; k<18; k++)
+                    {
+                    if (m->isTiNeeded[k] == YES)
+                         m->tiProbLength += (k - 11) * (k - 11) * m->numGammaCats;
+                    }
+                }
+            else
+                {
+                /* deal with unequal state frequencies */
+                if (m->isTiNeeded[0] == YES)
+                    m->tiProbLength += 4 * m->numGammaCats * m->numBetaCats;
+                for (c=0; c<m->numChars; c++)
+                    {
+                    if (m->nStates[c] > 2 && (m->cType[c] == UNORD || m->cType[c] == ORD))
+                        {
+                        m->tiProbLength += (m->nStates[c] * m->nStates[c]) * m->numGammaCats;
+                        }
+                    }
+                }
+            }
+        else
+            {
+            m->numTiCats    = m->numGammaCats * m->numBetaCats * m->numOmegaCats;   /* A single partition has either gamma, beta or omega categories */
+            m->tiProbLength = m->numModelStates * m->numModelStates * m->numTiCats;
+            }
+        m->numTiProbs = (numLocalChains + 1) * nNodes;
+        
+        /* set info about eigen systems */
+        if (InitEigenSystemInfo (m) == ERROR)
+            return (ERROR);
+        }
+
+    /* check if conditional likelihoods are needed */
+    if (condLikesUsed == YES)
+        MrBayesPrint ("%s   Initializing conditional likelihoods\n", spacer);
+    else
+        return NO_ERROR;
+
+    /* allocate space and fill in info for tips */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+       
+        /* allocate space for conditional likelihoods */
+        useBeagle = NO;
+#   if defined (BEAGLE_ENABLED)
+        if (m->useBeagle == YES)
+            {
+            if (InitBeagleInstance(m, d) != ERROR)
+                useBeagle = YES;
+            else
+                m->useBeagle = NO;
+            }
+#   endif
+        //m->useSSE = NO;
+#   if defined (SSE_ENABLED)
+        /*if (useBeagle == NO && m->dataType != STANDARD)
+            m->useSSE = YES;*/
+        if (useBeagle == YES)
+            m->useSSE = NO;
+
+#   endif
+        if (useBeagle == NO && m->useSSE == NO)
+            MrBayesPrint ("%s   Using standard non-SSE likelihood calculator for division %d (%s-precision)\n", spacer, d+1, (sizeof(CLFlt) == 4 ? "single" : "double"));
+        else if (useBeagle == NO && m->useSSE == YES)
+            MrBayesPrint ("%s   Using standard SSE likelihood calculator for division %d (single-precision)\n", spacer, d+1);
+
+        if (useBeagle == NO)
+            {
+            /* allocate cond like space */
+            m->condLikes = (CLFlt**) SafeMalloc(m->numCondLikes * sizeof(CLFlt*));
+            if (!m->condLikes)
+                return (ERROR);
+            for (i=0; i<m->numCondLikes; i++)
+                {
+#   if defined (SSE_ENABLED)
+                if (m->useSSE == YES)
+                    {
+                    /* calculate number SSE chars */
+                    m->numSSEChars = ((m->numChars - 1) / FLOATS_PER_VEC) + 1;
+
+                    /* allocate space with padding (m->condLikeLength is without padding) */
+                    if (m->gibbsGamma == YES)
+                        numReps = 1;
+                    else
+                        numReps = m->numGammaCats * m->numOmegaCats;
+                    k = m->numSSEChars * FLOATS_PER_VEC * m->numModelStates * numReps;
+                    
+                    m->condLikes[i] = (CLFlt*) AlignedMalloc (k * sizeof(CLFlt), 16);
+                    if (!m->condLikes[i])
+                        return (ERROR);
+
+                    /* start by filling all with 0.0f; pad when filling in tips */
+                    for (j=0; j<k; j++)
+                        m->condLikes[i][j] = 0.0f;
+                    }
+                else
+                    {
+                    m->condLikes[i] = (CLFlt*) SafeMalloc(m->condLikeLength * sizeof(CLFlt));
+                    if (!m->condLikes[i])
+                        return (ERROR);
+                    }
+#   else
+                m->condLikes[i] = (CLFlt*) SafeMalloc(m->condLikeLength * sizeof(CLFlt));
+                if (!m->condLikes[i])
+                    return (ERROR);
+#   endif
+                }
+
+            /* allocate scaler space and pointers for scaling */
+            m->scalers = (CLFlt**) SafeMalloc(m->numScalers * sizeof(CLFlt*));
+            if (!m->scalers)
+                return (ERROR);
+            for (i=0; i<m->numScalers; i++)
+                {
+#   if defined (SSE_ENABLED)
+                if (m->useSSE == YES)
+                    {
+                    /* allocate space with padding */
+                    m->scalers[i] = (CLFlt*) AlignedMalloc (m->numSSEChars * FLOATS_PER_VEC * sizeof(CLFlt), 16);
+                    if (!m->scalers[i])
+                        return (ERROR);
+                    for (j=0; j<m->numSSEChars*FLOATS_PER_VEC; j++)
+                        m->scalers[i][j] = 0.0f;
+                    }
+                else
+                    {
+                    m->scalers[i] = (CLFlt*) SafeMalloc (m->numChars * sizeof(CLFlt));
+                    if (!m->scalers[i])
+                        return (ERROR);
+                    }
+#   else
+                m->scalers[i] = (CLFlt*) SafeMalloc (m->numChars * sizeof(CLFlt));
+                if (!m->scalers[i])
+                    return (ERROR);
+#   endif
+                }
+
+            /* allocate stuff for facilitating scaling and accumulation of cond likes */
+            if (m->dataType == STANDARD)
+                {
+                m->clP = (CLFlt **) SafeMalloc(m->numGammaCats * sizeof(CLFlt *));
+                if (!m->clP)
+                    return (ERROR);
+                }
+            else
+                {
+                m->clP = (CLFlt **) SafeMalloc(m->numTiCats * sizeof(CLFlt *));
+                if (!m->clP)
+                    return (ERROR);
+#   if defined (SSE_ENABLED)
+                if (m->useSSE == YES)
+                    {
+                    m->clP_SSE = (__m128 **) SafeMalloc(m->numTiCats * sizeof(__m128 *));
+                    if (!m->clP_SSE)
+                        return (ERROR);
+                    m->lnL_SSE  = AlignedMalloc (m->numSSEChars * FLOATS_PER_VEC * sizeof(CLFlt*), 16);
+                    m->lnLI_SSE = AlignedMalloc (m->numSSEChars * FLOATS_PER_VEC * sizeof(CLFlt*), 16);
+                    if (!m->lnL_SSE || !m->lnLI_SSE)
+                        return (ERROR);
+                    }
+#   endif
+                }
+
+            /* allocate tiprob space */
+            m->tiProbs = (CLFlt**) SafeMalloc(m->numTiProbs * sizeof(CLFlt*));
+            if (!m->tiProbs)
+                return (ERROR);
+            for (i=0; i<m->numTiProbs; i++)
+                {
+                m->tiProbs[i] = (CLFlt*) SafeMalloc(m->tiProbLength * sizeof(CLFlt));
+                if (!m->tiProbs[i])
+                    return (ERROR);
+                }
+            }
+
+        /* allocate eigen system space (needed also for Beagle version */
+        if (m->nCijkParts > 0)
+            {
+            m->cijks = (MrBFlt**) SafeMalloc((numLocalChains + 1) * sizeof(MrBFlt*));
+            if (!m->cijks)
+                return ERROR;
+            for (i=0; i<numLocalChains+1; i++)
+                {
+                m->cijks[i] = (MrBFlt*) SafeMalloc(m->cijkLength * sizeof(MrBFlt));
+                if (!m->cijks[i])
+                    return (ERROR);
+                }
+            }
+
+        /* get size of tree */
+        nIntNodes = GetTree(m->brlens,0,0)->nIntNodes;
+        nNodes = GetTree(m->brlens,0,0)->nNodes;
+
+            
+        /* allocate and set indices from tree nodes to cond like arrays */
+        m->condLikeIndex = (int **) SafeMalloc (numLocalChains * sizeof(int *));
+        if (!m->condLikeIndex)
+            return (ERROR);
+        for (i=0; i<numLocalChains; i++)
+            {
+            m->condLikeIndex[i] = (int *) SafeMalloc (nNodes * sizeof(int));
+            if (!m->condLikeIndex[i])
+                return (ERROR);
+            }
+        for (i=0; i<numLocalChains; i++)
+            for (j=0; j<nNodes; j++)
+                m->condLikeIndex[i][j] = -1;
+
+        /* set up indices for terminal nodes */
+        clIndex = 0;
+        if (useBeagle == YES)
+            indexStep = m->nCijkParts;
+        else
+            indexStep = 1;
+        for (i=0; i<numLocalTaxa; i++)
+            {
+#   if !defined (DEBUG_NOSHORTCUTS)
+            /* TODO: Untill CondLikeRoot_XXX are fixed (case 4 when one of the children is non-ambig) we allocate space for non-ambig tips. if fixed also uncoment down the function */
+            /* if (useBeagle == NO && useSSE == NO && m->isPartAmbig[i] == NO && m->dataType != STANDARD)
+                continue;
+            */
+#   endif
+            for (j=0; j<numLocalChains; j++)
+                m->condLikeIndex[j][i] = clIndex;
+            clIndex += 1; /* even for multiple omega cat we need only one set of conditional likelihoods  for terminals for all chains.*/
+            }
+
+        /* reserve private space for parsimony-based moves if parsimony model is used */
+        if (m->parsModelId == YES && m->parsimonyBasedMove == YES)
+            clIndex += nIntNodes;
+
+        /* set up indices for internal nodes */
+        for (j=0; j<numLocalChains; j++)
+            {
+            for (i=0; i<nIntNodes; i++)
+                {
+                m->condLikeIndex[j][i+numLocalTaxa] = clIndex;
+                clIndex += indexStep;
+                }
+            }
+
+        /* allocate and set up scratch cond like indices */
+        m->condLikeScratchIndex = (int *) SafeMalloc (nNodes * sizeof(int));
+        if (!m->condLikeScratchIndex)
+            return (ERROR);
+        for (i=0; i<nNodes; i++)
+            m->condLikeScratchIndex[i] = -1;
+        for (i=0; i<nIntNodes; i++)
+            {
+            m->condLikeScratchIndex[i+numLocalTaxa] = clIndex;
+            clIndex += indexStep;
+            }
+
+        /* allocate and set indices from tree edges to ti prob arrays */
+        m->tiProbsIndex = (int **) SafeMalloc (numLocalChains * sizeof(int *));
+        if (!m->tiProbsIndex)
+            return (ERROR);
+        for (i=0; i<numLocalChains; i++)
+            {
+            m->tiProbsIndex[i] = (int *) SafeMalloc (nNodes * sizeof(int));
+            if (!m->tiProbsIndex[i])
+                return (ERROR);
+            }
+
+        /* set up indices for nodes */
+        tiIndex = 0;
+        for (i=0; i<numLocalChains; i++)
+            {
+            for (j=0; j<nNodes; j++)
+                {
+                m->tiProbsIndex[i][j] = tiIndex;
+                tiIndex += indexStep;
+                }
+            }
+
+        /* allocate and set up scratch transition prob indices */
+        m->tiProbsScratchIndex = (int *) SafeMalloc (nNodes * sizeof(int));
+        if (!m->tiProbsScratchIndex)
+            return (ERROR);
+        for (i=0; i<nNodes; i++)
+            {
+            m->tiProbsScratchIndex[i] = tiIndex;
+            tiIndex += indexStep;
+            }
+
+        /* allocate and set up node scaler indices */
+        scalerIndex = 0;
+        m->nodeScalerIndex = (int **) SafeMalloc (numLocalChains * sizeof(int *));
+        if (!m->nodeScalerIndex)
+            return (ERROR);
+        for (i=0; i<numLocalChains; i++)
+            {
+            m->nodeScalerIndex[i] = (int *) SafeMalloc (nNodes * sizeof(int));
+            if (!m->nodeScalerIndex[i])
+                return (ERROR);
+            for (j=0; j<nNodes; j++)
+                m->nodeScalerIndex[i][j] = -1;
+            for (j=0; j<nIntNodes; j++)
+                {
+                m->nodeScalerIndex[i][j+numLocalTaxa] = scalerIndex;
+                scalerIndex += indexStep;
+                }
+            }
+        m->nodeScalerScratchIndex = (int *) SafeMalloc (nNodes * sizeof (int));
+        if (!m->nodeScalerScratchIndex)
+            return (ERROR);
+        for (i=0; i<nNodes; i++)
+            m->nodeScalerScratchIndex[i] = -1;
+        for (i=0; i<nIntNodes; i++)
+            {
+            m->nodeScalerScratchIndex[i+numLocalTaxa] = scalerIndex;
+            scalerIndex += indexStep;
+            }
+
+        /* allocate and set up node scaler flags */
+        m->scalersSet = (int **) SafeMalloc (numLocalChains * sizeof(int *));
+        if (!m->scalersSet)
+            return (ERROR);
+        for (i=0; i<numLocalChains; i++)
+            {
+            m->scalersSet[i] = (int *) SafeMalloc (nNodes * sizeof(int));
+            if (!m->scalersSet[i])
+                return (ERROR);
+            for (j=0; j<nNodes; j++)
+                m->scalersSet[i][j] = NO;
+            }
+        m->scalersSetScratch = (int *) SafeMalloc (nNodes * sizeof (int));
+        if (!m->scalersSetScratch)
+            return (ERROR);
+        for (i=0; i<nNodes; i++)
+            m->scalersSetScratch[i] = NO;
+
+        /* allocate and set up site scaler indices */
+        m->siteScalerIndex = (int *) SafeMalloc (numLocalChains * sizeof(int));
+        if (!m->siteScalerIndex)
+            return (ERROR);
+        for (i=0; i<numLocalChains; i++)
+            {
+            m->siteScalerIndex[i] = scalerIndex;
+            scalerIndex += indexStep;
+            }
+        m->siteScalerScratchIndex = scalerIndex;
+
+#   if defined (BEAGLE_ENABLED)
+        /* used only with Beagle advanced dynamic rescaling where we set scaler nodes for each partition  */
+        if (m->useBeagle == YES)
+            {
+            m->succesCount = (int*) SafeMalloc((numLocalChains) * sizeof(int));
+            m->rescaleFreq = (int*) SafeMalloc((numLocalChains) * sizeof(int));
+            m->beagleComputeCount = (long *) SafeMalloc(sizeof(long) * numLocalChains);
+            t=BEAGLE_RESCALE_FREQ/m->numModelStates;
+            if (beagleFlags & BEAGLE_FLAG_PRECISION_DOUBLE) /*if double presition is used*/
+                t*=BEAGLE_RESCALE_FREQ_DOUBLE;
+            for (i=0; i<numLocalChains; i++)
+               {
+               m->rescaleFreq[i] = t;
+               }
+            m->isScalerNode = (int**) SafeMalloc((numLocalChains) * sizeof(int*));
+            /* we will use m->isScalerNode[chain][node->index] to determine whether the node is scaled or not. We do it only for internal nodes whose indexes start from numLocalTaxa thus we skew the pointer */
+            m->isScalerNodeScratch = (int*) SafeMalloc(nIntNodes * sizeof(int)) - numLocalTaxa; 
+            assert (NO == 0); /* SafeMalloc set the allocated memmory to 0 while we need to set it to NO */
+            for (i=0; i<numLocalChains; i++)
+               {
+               m->isScalerNode[i] = (int*) SafeMalloc(nIntNodes * sizeof(int)) - numLocalTaxa;
+               }
+            }
+#   endif
+
+        /* allocate and set up cijk indices */
+        if (m->nCijkParts > 0)
+            {
+            m->cijkIndex = (int *) SafeMalloc (numLocalChains * sizeof(int));
+            if (!m->cijkIndex)
+                return (ERROR);
+            for (i=0; i<numLocalChains; i++)
+                m->cijkIndex[i] = i*indexStep;
+            m->cijkScratchIndex = numLocalChains*indexStep;
+            }
+
+#   if defined (BEAGLE_ENABLED)
+            /* Set up nSitesOfPat for Beagle */
+            if (m->useBeagle == YES)
+                {
+                nSitesOfPat = (double *) SafeMalloc (m->numChars * sizeof(double));
+                for (c=0; c<m->numChars; c++)
+                    nSitesOfPat[c] = numSitesOfPat[m->compCharStart + c];
+                beagleSetPatternWeights(m->beagleInstance,
+                                        nSitesOfPat);
+                free (nSitesOfPat);
+                nSitesOfPat = NULL;
+
+                /* find category frequencies */
+                if (m->pInvar == NO)
+                    {
+                    freq =  1.0 /  m->numGammaCats;
+                    
+                    /* set category frequencies in beagle instance */
+                    if (m->numOmegaCats <= 1)
+                        {
+                        for (i=0; i<m->numGammaCats; i++)
+                            m->inWeights[i] = freq;
+                        for (i=0; i< (numLocalChains); i++) {
+                            beagleSetCategoryWeights(m->beagleInstance,
+                                                     m->cijkIndex[i],
+                                                     m->inWeights);
+                            }
+                        beagleSetCategoryWeights(m->beagleInstance,
+                                                 m->cijkScratchIndex,
+                                                 m->inWeights);
+                        }
+                    }
+                
+                /* Set up scalers for Beagle */
+                for (i=0; i<m->numScalers*m->nCijkParts; i++)
+                    beagleResetScaleFactors(m->beagleInstance, i);
+                }
+#   endif
+
+        /* fill in tip conditional likelihoods */
+        if (m->dataType == STANDARD)
+            {
+            clIndex = 0;
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                cL = m->condLikes[clIndex++];
+                for (t=0; t<m->numGammaCats;t++)
+                    {
+                    charBits = m->parsSets[i];
+                    for (c=0; c<m->numChars; c++)
+                        {                   
+                        if (m->nStates[c] == 2)
+                            numReps = m->numBetaCats;
+                        else
+                            numReps = 1;
+                        for (k=0; k<numReps; k++)
+                            {
+                            for (s=0; s<m->nStates[c]; s++)
+                                {
+                                if (IsBitSet(s, charBits))
+                                    (*cL) = 1.0;
+                                cL++;
+                                }
+                            }
+                        charBits += m->nParsIntsPerSite;
+                        }
+                    }
+                }
+            }
+        else if (useBeagle == NO)
+            {
+            if (m->gibbsGamma == YES)
+                numReps = m->numTiCats / m->numGammaCats;
+            else
+                numReps = m->numTiCats;
+
+            clIndex = 0;
+            for (i=0; i<numLocalTaxa; i++)
+                {
+#   if !defined (DEBUG_NOSHORTCUTS) && !defined (SSE_ENABLED)
+                /* TODO: Untill CondLikeRoot_XXX are fixed (case 4 when one of the children is non-ambig) we allocate space for non-ambig tips. if fixed also uncomment up the function */
+                /* if (m->isPartAmbig[i] == NO && m->dataType != RESTRICTION)
+                    continue;
+                */
+#   endif
+                cL = m->condLikes[clIndex++];
+#   if defined (SSE_ENABLED)
+                if (m->useSSE == YES)
+                    {
+                    for (k=0; k<numReps; k++)
+                        {
+                        charBits = m->parsSets[i];
+                        for (c=0; c<m->numChars/FLOATS_PER_VEC; c++)
+                            {
+                            for (j=0; j<m->numModelStates/m->numStates; j++)
+                                {
+                                for (s=0; s<m->numStates; s++)
+                                    {
+                                    for (j1=0; j1<FLOATS_PER_VEC; j1++)
+                                        {
+                                        if (IsBitSet(s, charBits + j1*m->nParsIntsPerSite))
+                                            (*cL) = 1.0;
+                                        cL++;
+                                        }
+                                    }
+                                }   
+                            charBits += FLOATS_PER_VEC * m->nParsIntsPerSite;
+                            }
+                        if (m->numChars % FLOATS_PER_VEC > 0)
+                            {
+                            /* add last characters and padd */
+                            for (j=0; j<m->numModelStates/m->numStates; j++)
+                                {
+                                for (s=0; s<m->numStates; s++)
+                                    {
+                                    for (j1=0; j1<m->numChars%FLOATS_PER_VEC; j1++)
+                                        {
+                                        if (IsBitSet(s, charBits + j1*m->nParsIntsPerSite))
+                                            (*cL) = 1.0;
+                                        cL++;
+                                        }
+                                    for (; j1<FLOATS_PER_VEC; j1++)
+                                        {
+                                        (*cL) = 1.0;
+                                        cL++;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    for (k=0; k<numReps; k++)
+                        {
+                        charBits = m->parsSets[i];
+                        for (c=0; c<m->numChars; c++)
+                            {
+                            for (j=0; j<m->numModelStates/m->numStates; j++)
+                                {
+                                for (s=0; s<m->numStates; s++)
+                                    {
+                                    if (IsBitSet(s, charBits))
+                                        (*cL) = 1.0;
+                                    cL++;
+                                    }
+                                }
+                                charBits += m->nParsIntsPerSite;
+                            }
+                        }
+                    }
+
+#   else
+                for (k=0; k<numReps; k++)
+                    {
+                    charBits = m->parsSets[i];
+                    for (c=0; c<m->numChars; c++)
+                        {
+                        for (j=0; j<m->numModelStates/m->numStates; j++)
+                            {
+                            for (s=0; s<m->numStates; s++)
+                                {
+                                if (IsBitSet(s, charBits))
+                                    (*cL) = 1.0;
+                                cL++;
+                                }
+                            }
+                            charBits += m->nParsIntsPerSite;
+                        }
+                    }
+#   endif
+                }
+            }
+
+        if (m->printAncStates == YES)
+            {
+            m->ancStateCondLikes = (CLFlt *) SafeMalloc (m->condLikeLength * sizeof(CLFlt));
+            if (!m->ancStateCondLikes)
+                return (ERROR);
+            }
+        }
+    /* allocate space for precalculated likelihoods */
+    j = 0;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        if (m->dataType == STANDARD || m->parsModelId == YES)
+            continue;
+
+        i = (m->numModelStates + 1) * m->numModelStates * m->numTiCats;
+        if (i > j)
+            j = i;
+        }
+    if (j > 0) /* don't bother allocating precalculated likelihoods if we only have parsimony model or morphological characters */
+        {
+        if (memAllocs[ALLOC_PRELIKES] == YES)
+            {
+            MrBayesPrint ("%s   Space for preLikes not free in InitChainCondLikes\n", spacer);
+            return ERROR;
+            }
+        preLikeL = (CLFlt *) SafeMalloc (3 * j * sizeof(CLFlt));
+        if (!preLikeL)
+            {
+            MrBayesPrint ("%s   Problem allocating preLikes\n", spacer);
+            return ERROR;
+            }
+        memAllocs[ALLOC_PRELIKES] = YES;
+        preLikeR = preLikeL + j;
+        preLikeA = preLikeR + j;
+        }
+
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitEigenSystemInfo: set info about eigen decompositions
+|
+-------------------------------------------------------------------------*/
+int InitEigenSystemInfo (ModelInfo *m)
+{
+    int         ts;
+    
+    if (m->dataType == STANDARD)
+        {
+        /* dealt with in ProcessStdChars */
+        return (NO_ERROR);
+        }
+
+    m->cijkLength = 0;
+    m->nCijkParts = 0;
+    if (m->dataType == PROTEIN)
+        {
+        ts = m->numModelStates;
+        m->cijkLength = (ts * ts * ts) + (2 * ts);
+        m->nCijkParts = 1;
+        if (m->switchRates != NULL) /* covarion model */
+            {
+            m->cijkLength *= m->numGammaCats;
+            m->nCijkParts = m->numGammaCats;
+            }
+        }
+    else if (m->dataType == DNA || m->dataType == RNA)
+        {
+        if (m->nucModelId == NUCMODEL_4BY4)
+            {
+            if (m->switchRates==NULL && m->nst != 6 && m->nst != NST_MIXED)
+                {
+                m->cijkLength = 0;
+                m->nCijkParts = 0;
+#   if defined (BEAGLE_ENABLED)
+                ts = m->numModelStates;
+                m->cijkLength = (ts * ts * ts) + (2 * ts);
+                m->nCijkParts = 1;
+#   endif
+                }
+            else
+                {
+                ts = m->numModelStates;
+                m->cijkLength = (ts * ts * ts) + (2 * ts);
+                m->nCijkParts = 1;
+                }
+            if (m->switchRates != NULL)
+                {
+                m->cijkLength *= m->numGammaCats;
+                m->nCijkParts = m->numGammaCats;
+                }
+            }
+        else if (m->nucModelId == NUCMODEL_DOUBLET)
+            {
+            ts = m->numModelStates;
+            m->cijkLength = (ts * ts * ts) + (2 * ts);
+            m->nCijkParts = 1;
+            }
+        else if (m->nucModelId == NUCMODEL_CODON)
+            {
+            ts = m->numModelStates;
+            m->cijkLength = (ts * ts * ts) + (2 * ts);
+            m->cijkLength *= m->numOmegaCats;
+            m->nCijkParts = m->numOmegaCats;
+            }
+        else
+            {
+            MrBayesPrint ("%s   ERROR: Something is wrong if you are here.\n", spacer);
+            return ERROR;
+            }
+        }
+#   if defined (BEAGLE_ENABLED)
+    else if (m->dataType == RESTRICTION)
+        {
+                assert (m->numModelStates == 2);
+                ts = 2;
+                m->cijkLength = (ts * ts * ts) + (2 * ts);
+                m->nCijkParts = 1;
+        }
+#   endif
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitFinalStateCondLikes: allocate space for final conditional
+|       likelihoods if needed
+|
+-------------------------------------------------------------------------*/
+int InitFinalStateCondLikes (void)
+{
+    int         d;
+    ModelInfo   *m;
+    
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        if (m->printAncStates == YES)
+            {
+            m->ancStateCondLikes = (CLFlt *) SafeMalloc (m->condLikeLength * sizeof(CLFlt));
+            if (!m->ancStateCondLikes)
+                return ERROR;
+            }
+        }
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitInvCondLikes: allocate and initialize invariable conditional
+|       likelihoods if needed
+|
+|       NB! Fills in invariable cond likes for all hidden states; this
+|       is convenient although some space is wasted
+|
+-------------------------------------------------------------------------*/
+int InitInvCondLikes (void)
+{
+    int         c, d, i, s, isConstant, usingInvCondLikes;
+    BitsLong    *charBits;
+    CLFlt       *cI;
+    ModelInfo   *m;
+
+#   if defined (SSE_ENABLED)
+    int         c1;
+#   endif
+
+    /* allocate space for invariable cond likes */
+    usingInvCondLikes = NO;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+
+        if (m->pInvar == NULL)
+            continue;
+
+        usingInvCondLikes = YES;
+#   if defined (SSE_ENABLED)
+        c1 = m->numSSEChars * FLOATS_PER_VEC * m->numModelStates;
+        m->invCondLikes = (CLFlt *) AlignedMalloc (c1 * sizeof(CLFlt), 16);
+        for (i=0; i<c1; i++)
+            m->invCondLikes[i] = 0.0f;
+#   else
+        m->invCondLikes = (CLFlt *) SafeMalloc (m->numChars * m->numModelStates * sizeof(CLFlt));
+#   endif
+        if (!m->invCondLikes)
+            return ERROR;
+        }
+    
+    if (usingInvCondLikes == NO)
+        return NO_ERROR;
+    
+    MrBayesPrint ("%s   Initializing invariable-site conditional likelihoods\n", spacer);
+        
+    /* fill in invariable-site conditional likelihoods */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+
+        m = &modelSettings[d];
+        
+        if (m->pInvar == NULL)
+            continue;
+        
+        cI = m->invCondLikes;
+        if (m->dataType == STANDARD)
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                for (s=0; s<m->nStates[c]; s++)
+                    {
+                    isConstant = YES;
+                    for (i=0; i<numLocalTaxa; i++)
+                        {
+                        charBits = &m->parsSets[i][c*m->nParsIntsPerSite];
+                        if (IsBitSet(s, charBits) == NO)
+                            {
+                            isConstant = NO;
+                            break;
+                            }
+                        }
+                    if (isConstant == YES)
+                        *cI = 1.0;
+                    else
+                        *cI = 0.0;
+                    cI++;
+                    }
+                }
+            }
+        else    /* all other models for which pInvar is applicable */
+            {
+            assert (m->numModelStates == m->numStates);
+#   if defined (SSE_ENABLED)
+             for (c=0; c<m->numChars/FLOATS_PER_VEC; c++)
+                {
+                for (s=0; s<m->numModelStates; s++)
+                    {
+                    for (c1=0; c1<FLOATS_PER_VEC; c1++)
+                        {
+                        isConstant = YES;
+                        //charBits = parsMatrix + m->parsMatrixStart + ((c * FLOATS_PER_VEC) + c1) * m->nParsIntsPerSite;
+                        for (i=0; i<numLocalTaxa; i++)
+                            {
+                            charBits = &m->parsSets[i][((c * FLOATS_PER_VEC) + c1) *m->nParsIntsPerSite];
+                            if (IsBitSet(s, charBits) == NO)
+                                {
+                                isConstant = NO;
+                                break;
+                                }
+                            //charBits += parsMatrixRowSize;
+                            }
+                        if (isConstant == YES)
+                            *cI = 1.0;
+                        cI++;
+                        }
+                    }
+                }
+             if (m->numChars % FLOATS_PER_VEC != 0)
+                {
+                for (s=0; s<m->numModelStates; s++)
+                    {
+                    for (c1=0; c1<m->numChars%FLOATS_PER_VEC; c1++)
+                        {
+                        isConstant = YES;
+                        //charBits = parsMatrix + m->parsMatrixStart + (((m->numChars / FLOATS_PER_VEC) * FLOATS_PER_VEC) + c1) * m->nParsIntsPerSite;
+                        for (i=0; i<numLocalTaxa; i++)
+                            {
+                            charBits = &m->parsSets[i][(((m->numChars / FLOATS_PER_VEC) * FLOATS_PER_VEC) + c1) *m->nParsIntsPerSite];
+                            if (IsBitSet(s, charBits) == NO)
+                                {
+                                isConstant = NO;
+                                break;
+                                }
+                            //charBits += parsMatrixRowSize;
+                            }
+                        if (isConstant == YES)
+                            *cI = 1.0;
+                        cI++;
+                        }
+                    for (; c1<FLOATS_PER_VEC; c1++)
+                        {
+                        *cI = 1.0;
+                        cI++;
+                        }
+                    }
+                }
+#   else
+            for (c=0; c<m->numChars; c++)
+                {
+                for (s=0; s<m->numModelStates; s++)
+                    {
+                    isConstant = YES;
+                    for (i=0; i<numLocalTaxa; i++)
+                        {
+                        charBits = &m->parsSets[i][c*m->nParsIntsPerSite];
+                        if (IsBitSet(s, charBits) == NO)
+                            {
+                            isConstant = NO;
+                            break;
+                            }
+                        }
+                    if (isConstant == YES)
+                        *cI = 1.0;
+                    cI++;
+                    }
+                }
+#   endif
+            }
+        }   /* next division */
+
+#   if 0
+    invCondLikeSize = 0;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        if (m->pInvar == NULL)
+            continue;
+        cI = m->invCondLikes;
+        if (m->dataType == STANDARD)
+            {
+            }
+        else
+            {
+            for (c=0; c<m->numChars; c++)
+                {
+                printf ("%4d -- ", c);
+                for (s=0; s<m->numModelStates; s++)
+                    {
+                    printf ("%1.0lf", *cI);
+                    cI++;
+                    }
+                printf ("\n");
+                }
+            }
+        }
+#   endif
+        
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   InitParsSets: allocate space for and set parsimony state sets
+|
+-------------------------------------------------------------------------*/
+int InitParsSets (void)
+{
+    int             c, i, j, k, d, nParsStatesForCont, nIntNodes, nNodes,
+                    nuc1, nuc2, nuc3, codingNucCode, allNucCode;
+    BitsLong        allAmbig, x, x1, x2, x3, *longPtr, bitsLongOne;
+    ModelInfo       *m;
+    ModelParams     *mp;
+
+    bitsLongOne = 1;
+
+    /* this variable determines how many parsimony states are used           */
+    /* to represent continuous characters (determines weight of these chars) */
+    nParsStatesForCont = 3;
+
+    /* find number and size of parsimony sets and node lengths */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m  = &modelSettings[d];
+        mp = &modelParams[d];
+
+        /* find how many parsimony ints (BitsLong) are needed for each model site */
+        if (mp->dataType == CONTINUOUS)
+            {
+            /* scale continuous characters down to an ordered parsimony character */
+            /* with nParsStatesForCont states, represent this character as a set */
+            /* of binary characters by additive binary coding */
+            m->nParsIntsPerSite = nParsStatesForCont - 1;
+            }
+        else
+            m->nParsIntsPerSite = 1 + m->numStates / nBitsInALong;
+
+        /* Calculate number of nodes and number of internal nodes */
+        nIntNodes = GetTree(m->brlens,0,0)->nIntNodes;
+        nNodes    = GetTree(m->brlens,0,0)->nNodes;
+        
+        /* Calculate number of parsimony sets */
+        m->numParsSets = numLocalTaxa;
+        if (m->parsimonyBasedMove == YES || !strcmp(chainParams.startTree, "Parsimony"))
+            m->numParsSets += nIntNodes;
+        if (m->parsModelId == YES)
+            m->numParsSets += (numLocalChains + 1) * nIntNodes;
+
+        if (m->parsModelId == YES)
+            m->numParsNodeLens = (numLocalChains + 1) * nNodes;
+        else
+            m->numParsNodeLens = 0;
+        }
+        
+    /* then allocate space for the sets and node lengths */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        m->parsSets = (BitsLong **) SafeCalloc (m->numParsSets, sizeof(BitsLong*));
+        if (!m->parsSets)
+            return (ERROR);
+        for (i=0; i<m->numParsSets; i++)
+            {
+            m->parsSets[i] = (BitsLong *) SafeCalloc (m->numChars*m->nParsIntsPerSite, sizeof(BitsLong));
+            if (!m->parsSets[i])
+                return (ERROR);
+            }
+
+        if (m->numParsNodeLens > 0)
+            {
+            m->parsNodeLens = (CLFlt *) SafeCalloc (m->numParsNodeLens, sizeof(CLFlt));
+            if (!m->parsNodeLens)
+                return (ERROR);
+            }
+        }
+    
+    /* finally fill in tip parsimony sets */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        if (mp->dataType == CONTINUOUS)
+            {
+            /* Note: This is only a placeholder since continuous characters are not implemented yet.
+               Using additive parsimony would be more efficient than using multiple binary chars as here. */
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                for (c=0, j=m->compMatrixStart; j<m->compMatrixStop; j++, c++)
+                    {
+                    x = compMatrix[pos(i,j,compMatrixRowSize)];
+
+                    for (k=0; k<m->nParsIntsPerSite; k++)
+                        {
+                        if (x > (unsigned int)(k + 1) * 1000 / (m->nParsIntsPerSite + 1))
+                            m->parsSets[i][c*m->nParsIntsPerSite + k] = 1;
+                        else
+                            m->parsSets[i][c*m->nParsIntsPerSite + k] = 2;
+                        }
+                    }
+                }
+            }
+        else if (m->nCharsPerSite == 1 && m->nParsIntsPerSite == 1)
+            {
+            allAmbig = (bitsLongOne<<mp->nStates) - 1UL;
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                for (c=0, j=m->compMatrixStart; j<m->compMatrixStop; j++, c++)
+                    {
+                    x = compMatrix[pos(i,j,compMatrixRowSize)];
+
+                    if (x == MISSING || x == GAP)
+                        m->parsSets[i][c] = allAmbig;
+                    else
+                        m->parsSets[i][c] = x;
+                    }
+                }
+            }
+        else if (!strcmp(mp->nucModel, "Doublet") && (mp->dataType == DNA || mp->dataType == RNA))
+            {
+            allAmbig = 15;
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                for (c=0, j=m->compMatrixStart; j<m->compMatrixStop; j+=m->nCharsPerSite, c++)
+                    {
+                    /* fetch the original values x1 and x2 */
+                    x1 = compMatrix[pos(i,j,compMatrixRowSize)];
+                    if (x1 == MISSING || x1 == GAP)
+                        x1 = allAmbig;
+                    x2 = compMatrix[pos(i,j+1,compMatrixRowSize)];
+                    if (x2 == MISSING || x2 == GAP)
+                        x2 = allAmbig;
+                    /* squeeze them together in the new value x */
+                    x = 0;
+                    for (nuc1=0; nuc1<4; nuc1++)
+                        {
+                        for (nuc2=0; nuc2<4; nuc2++)
+                            {
+                            if (IsBitSet(nuc1,&x1) == YES && IsBitSet(nuc2, &x2) == YES)
+                                x |= (bitsLongOne<<(nuc1*4 + nuc2));
+                            }
+                        }
+                    
+                    m->parsSets[i][c] = x;
+                    }
+                }
+            }
+        else if (!strcmp(mp->nucModel, "Codon") && (mp->dataType == DNA || mp->dataType == RNA))
+            {
+            allAmbig = 15;
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                for (c=0, j=m->compMatrixStart; j<m->compMatrixStop; j+=m->nCharsPerSite, c++)
+                    {
+                    /* fetch the original values x1, x2, and x3*/
+                    x1 = compMatrix[pos(i,j,compMatrixRowSize)];
+                    if (x1 == MISSING || x1 == GAP)
+                        x1 = allAmbig;
+                    x2 = compMatrix[pos(i,j+1,compMatrixRowSize)];
+                    if (x2 == MISSING || x2 == GAP)
+                        x2 = allAmbig;
+                    x3 = compMatrix[pos(i,j+2,compMatrixRowSize)];
+                    if (x3 == MISSING || x3 == GAP)
+                        x3 = allAmbig;
+
+                    /* squeeze them together in the new long string pointed to by longPtr */
+                    longPtr = &m->parsSets[i][c*m->nParsIntsPerSite];
+                    allNucCode = codingNucCode = 0;
+                    for (nuc1=0; nuc1<4; nuc1++)
+                        for (nuc2=0; nuc2<4; nuc2++)
+                            for (nuc3=0; nuc3<4; nuc3++)
+                                {
+                                if (mp->codon[allNucCode] != 21)
+                                    {
+                                    if (IsBitSet(nuc1, &x1) == YES && IsBitSet(nuc2, &x2) == YES && IsBitSet(nuc3, &x3) == YES)
+                                        SetBit(codingNucCode, longPtr);
+                                    codingNucCode++;
+                                    }
+                                allNucCode++;
+                                }
+                    }
+                }
+            }
+        else if (!strcmp(mp->nucModel, "Protein") && (mp->dataType == DNA || mp->dataType == RNA))
+            {
+            allAmbig = 15;
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                for (c=0, j=m->compMatrixStart; j<m->compMatrixStop; j+=m->nCharsPerSite, c++)
+                    {
+                    /* fetch the original values x1, x2, and x3*/
+                    x1 = compMatrix[pos(i,j,compMatrixRowSize)];
+                    if (x1 == MISSING || x1 == GAP)
+                        x1 = allAmbig;
+                    x2 = compMatrix[pos(i,j+1,compMatrixRowSize)];
+                    if (x2 == MISSING || x2 == GAP)
+                        x2 = allAmbig;
+                    x3 = compMatrix[pos(i,j+2,compMatrixRowSize)];
+                    if (x3 == MISSING || x3 == GAP)
+                        x3 = allAmbig;
+
+                    /* squeeze them together in the new long string pointed to by longPtr */
+                    longPtr = &m->parsSets[i][c*m->nParsIntsPerSite];   /* m->nParsIntsPerSite should be 1 */
+                    allNucCode = 0;
+                    for (nuc1=0; nuc1<4; nuc1++)
+                        for (nuc2=0; nuc2<4; nuc2++)
+                            for (nuc3=0; nuc3<4; nuc3++)
+                                {
+                                if (mp->codon[allNucCode] != 21)
+                                    {
+                                    if (IsBitSet(nuc1, &x1) == YES && IsBitSet(nuc2, &x2) == YES && IsBitSet(nuc3, &x3) == YES)
+                                        SetBit(mp->codon[allNucCode]-1, longPtr);
+                                    }
+                                allNucCode++;
+                                }
+                    }
+                }
+            }
+        else
+            {
+            MrBayesPrint ("%s   Unrecognized data format during bitset compression\n", spacer);
+            return ERROR;
+            }
+        }
+    
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------
+|
+|   InitPrintParams: Set up arrays of print para-
+|      meters and print tree parameters
+|
+------------------------------------------------*/
+int InitPrintParams (void)
+{
+    int     i, j, k, k1=0;
+    Param   *p;
+
+    /* count number of model params to print */
+    numPrintParams = 0;
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->printParam == YES &&
+            p->paramType != P_TOPOLOGY &&
+            p->paramType != P_BRLENS &&
+            p->paramType != P_SPECIESTREE &&
+            p->paramType != P_CPPEVENTS &&
+            p->paramType != P_TK02BRANCHRATES &&
+            p->paramType != P_IGRBRANCHRATES &&
+            p->paramType != P_MIXEDBRCHRATES)
+            numPrintParams++;
+        }
+
+    /* count number of tree params to print */
+    numPrintTreeParams = 0;
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            /* always print parsimony topology (printParam == YES), otherwise */
+            /* print topology only if brlens never requested (nPrintSubParams == 0)*/
+            if (p->printParam == YES || p->nPrintSubParams == 0)
+                numPrintTreeParams++;
+            }
+        else if (p->paramType == P_BRLENS)
+            {
+            /* print only if brlens (or events) requested for at least one partition */
+            if (p->printParam == YES || p->nPrintSubParams > 0)
+                numPrintTreeParams++;
+            }
+        else if (p->paramType == P_SPECIESTREE)
+            {
+            /* always print if printParam set to YES */
+            if (p->printParam == YES)
+                numPrintTreeParams++;
+            }
+        }
+
+    /* allocate space */
+    printParam = (Param **) SafeCalloc (numPrintParams + numPrintTreeParams + numTopologies, sizeof(Param *));
+    topologyPrintIndex = (int *) SafeCalloc (numTopologies + numPrintTreeParams, sizeof(int)); 
+    if (!printParam || !topologyPrintIndex)
+        {
+        free (printParam);
+        free (topologyPrintIndex);
+        MrBayesPrint ("%s   Could not allocate printParam vector in InitPrintParams\n", spacer);
+        return (ERROR);
+        }
+    printTreeParam = printParam + numPrintParams;
+    topologyParam = printTreeParam + numPrintTreeParams;
+    printTreeTopologyIndex = topologyPrintIndex + numTopologies;
+    memAllocs[ALLOC_PRINTPARAM] = YES;
+
+    /* assign normal print params */
+    for (i=j=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->printParam == YES &&
+            p->paramType != P_TOPOLOGY &&
+            p->paramType != P_BRLENS &&
+            p->paramType != P_SPECIESTREE &&
+            p->paramType != P_CPPEVENTS &&
+            p->paramType != P_TK02BRANCHRATES &&
+            p->paramType != P_IGRBRANCHRATES &&
+            p->paramType != P_MIXEDBRCHRATES)
+            printParam[j++] = p;
+        }
+    
+    /* assign tree print params */
+    for (i=j=k=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            /* always print parsimony topology (printParam == YES), otherwise */
+            /* print topology only if brlens never requested (nPrintSubParams == 0)*/
+            if (p->printParam == YES || p->nPrintSubParams == 0)
+                numPrintTreeParams++;
+            }
+        else if (p->paramType == P_BRLENS)
+            {
+            /* print only if brlens (or events) requested for at least one partition */
+            if (p->printParam == YES || p->nPrintSubParams > 0)
+                printTreeParam[k++] = p;
+            }
+        else if (p->paramType == P_SPECIESTREE)
+            {
+            if (p->printParam == YES)
+                printTreeParam[k++] = p;
+            }
+        }
+
+    /* find topologies, topology file index, and printtree topology index */
+    for (i=0; i<numPrintTreeParams; i++)
+        printTreeTopologyIndex[i] = numTopologies;
+    for (i=j=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_SPECIESTREE)
+            {
+            topologyParam[j] = p;
+            for (k=0; k<numPrintTreeParams; k++)
+                if (printTreeParam[k] == p)
+                    break;
+            topologyPrintIndex[j] = k;
+            printTreeTopologyIndex[k] = j;
+            j++;
+            }
+        else if (p->paramType == P_TOPOLOGY)
+            {
+            topologyParam[j] = p;
+            for (k=0; k<numPrintTreeParams; k++)
+                if (printTreeParam[k] == p)
+                    break;
+            if (k<numPrintTreeParams)
+                {
+                topologyPrintIndex[j] = k;
+                printTreeTopologyIndex[k] = j;
+                }
+            else
+                {
+                for (k=0; k<p->nSubParams; k++)
+                    {
+                    for (k1=0; k1<numPrintTreeParams; k1++)
+                        if (printTreeParam[k1] == p->subParams[k])
+                            break;
+                    if (k1 < numPrintTreeParams)
+                        break;
+                    }
+                topologyPrintIndex[j] = k1;
+                printTreeTopologyIndex[k1] = j;
+                }
+            j++;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int IsPFNodeEmpty (PFNODE *p)
+{
+    int i;
+
+    for (i=0; i<chainParams.numRuns; i++)
+        {
+        if (p->count[i] > 0)
+            break;
+        }
+    if (i == chainParams.numRuns)
+        return YES;
+    else
+        return NO;
+}
+
+
+/* LargestNonemptyPFNode: recursive function to largest nonempty node in a subtree */
+PFNODE *LargestNonemptyPFNode (PFNODE *p, int *i, int j)
+{
+    PFNODE *q;
+
+    ++j;
+    if (p == NULL)
+        return NULL;
+    
+    q = LargestNonemptyPFNode (p->left, i, j);
+    
+    if (q != NULL)
+        {
+        return q;
+        }
+    else if (IsPFNodeEmpty (p) == NO)
+        {
+        *i = j;
+        return p;
+        }
+    else
+        {
+        return LargestNonemptyPFNode (p->right, i, j);
+        }
+}
+
+
+/* ln prior ratio for clock trees */
+int LogClockTreePriorRatio (Param *param, int chain, MrBFlt *lnPriorRatio)
+{
+    MrBFlt          oldLnPrior, newLnPrior, theta, N, growth, clockRate, sF, *sR, *eR, *fR;
+    char            *sS;
+    Model           *mp;
+    ModelInfo       *m;
+    Tree            *newTree, *oldTree;
+    TreeNode        *p, *q=NULL;
+    int             i, j;
+
+    (*lnPriorRatio) = 0.0;
+    
+    mp = &modelParams[param->relParts[0]];
+    m  = &modelSettings[param->relParts[0]];
+    
+    newTree = GetTree (m->brlens, chain, state[chain]);
+    oldTree = GetTree (m->brlens, chain, state[chain] ^ 1);
+
+    if (m->clockRate != NULL)
+        clockRate = *GetParamVals(m->clockRate, chain, state[chain]);
+    else
+        clockRate = 1.0;
+    
+    /* calculate prior ratio on brlens of clock tree */
+    if (!strcmp(mp->clockPr,"Coalescence"))
+        {
+        /* coalescence prior */
+        /* first calculate theta as 4*N*mu, 3*N*mu or 2*N*mu */
+        N = *(GetParamVals (m->popSize, chain, state[chain]));
+        if (!strcmp(mp->ploidy, "Diploid"))
+            theta = 4 * N * clockRate;
+        else if (!strcmp(mp->ploidy, "Zlinked"))
+            theta = 3 * N * clockRate;
+        else
+            theta = 2 * N * clockRate;
+        /* deal with growth */
+        if (!strcmp(mp->growthPr, "Fixed"))
+            growth = mp->growthFix;
+        else
+            growth = *(GetParamVals (m->growthRate, chain, state[chain]));
+        if (LnCoalescencePriorPr (oldTree, &oldLnPrior, theta, growth) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for coalescence process\n", spacer);
+            return (ERROR);
+            }
+        if (LnCoalescencePriorPr (newTree, &newLnPrior, theta, growth) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for coalescence process\n", spacer);
+            return (ERROR);
+            }
+        (*lnPriorRatio) = (newLnPrior - oldLnPrior);
+        }
+    else if (!strcmp(mp->clockPr,"Birthdeath"))
+        {
+        /* birth-death prior */
+        sR = GetParamVals (m->speciationRates, chain, state[chain]);
+        eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+        sS = mp->sampleStrat;
+        sF = mp->sampleProb;
+        if (LnBirthDeathPriorPr (oldTree, clockRate, &oldLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        if (LnBirthDeathPriorPr (newTree, clockRate, &newLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        (*lnPriorRatio) = (newLnPrior - oldLnPrior);
+        }
+    else if (!strcmp(mp->clockPr,"Fossilization"))
+        {
+        /* fossilized birth-death prior */
+        sR = GetParamVals (m->speciationRates, chain, state[chain]);
+        eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+        sF = mp->sampleProb;
+        fR = GetParamVals (m->fossilizationRates, chain, state[chain]);
+        sS = mp->sampleStrat;
+        if (LnFossilizationPriorPr (oldTree, clockRate, &oldLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        if (LnFossilizationPriorPr (newTree, clockRate, &newLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        (*lnPriorRatio) = (newLnPrior - oldLnPrior);
+        }
+    else if (!strcmp(mp->clockPr,"Uniform"))
+        {
+        oldLnPrior = LnUniformPriorPr(oldTree, clockRate);
+        newLnPrior = LnUniformPriorPr(newTree, clockRate);
+        (*lnPriorRatio) = (newLnPrior - oldLnPrior);
+        }
+    else if (!strcmp(mp->clockPr,"Speciestreecoalescence"))
+        {
+        // Defer this calculation to the BEST code
+        }
+
+    assert (*lnPriorRatio > NEG_INFINITY);
+
+    /* take care of calibrations */
+    if (newTree->isCalibrated == YES)
+        {
+        for (i=0; i<newTree->nNodes-1; i++)
+            {
+            p = newTree->allDownPass[i];
+            if (p->isDated == NO)
+                continue;
+            for (j=0; j<oldTree->nNodes-1; j++)
+                {
+                q = oldTree->allDownPass[j];
+                if (p->lockID == q->lockID)
+                    break;
+                }
+            assert (j != oldTree->nNodes-1);
+            if (p->isDated == YES && p->calibration->prior != fixed)
+                {
+                (*lnPriorRatio) += p->calibration->LnPriorRatio(p->age, q->age, p->calibration->priorParams);
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   LogLike: calculate the log likelihood of the new state of the chain
+|
+-----------------------------------------------------------------*/
+MrBFlt LogLike (int chain)
+{
+    int             i, d;
+    ModelInfo       *m;
+    MrBFlt          chainLnLike, lnL;
+                        
+    /* initialize chain cond like */
+    chainLnLike = 0.0;
+    
+    if (chainParams.runWithData == NO)
+        return (chainLnLike);
+
+#   if defined (DEBUG_RUN_WITHOUT_DATA)
+    return (chainLnLike);
+#   endif
+
+#   if defined (THREADS_ENABLED)
+    if (tryToUseThreads && ScheduleLogLikeForAllDivisions()) 
+        {
+        /* Launch all divisions that require updating simultaneously */
+        chainLnLike = LaunchLogLikeForAllDivisionsInParallel(chain);
+        } 
+    else 
+        {
+        /* Launch divisions in series */
+#   endif
+        
+    /* Cycle through divisions and recalculate tis and cond likes as necessary. */
+    /* Code below does not try to avoid recalculating ti probs for divisions    */
+    /* that could share ti probs with other divisions.                          */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        
+#   if defined (BEST_MPI_ENABLED)
+        if (isDivisionActive[d] == NO)
+            continue;
+#   endif
+        m = &modelSettings[d];
+        if (m->upDateCl == YES) 
+            {   
+            /* Work has been delegated to a separate function so we can wrap    */
+            /* a thread around it                                               */              
+            LaunchLogLikeForDivision(chain, d, &(m->lnLike[2 * chain + state[chain]]));
+            }
+        if (abortMove == YES)
+            return MRBFLT_NEG_MAX;
+        chainLnLike += m->lnLike[2*chain + state[chain]];   
+        }
+        
+#   if defined (THREADS_ENABLED)
+        }
+#   endif
+
+    /* unmark all divisions */
+    if (chainHasAdgamma == YES)
+        {
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            m->mark = NO;
+            }
+        
+        /* update HMM likelihoods if appropriate */
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+#   if defined (BEST_MPI_ENABLED)
+            if (isDivisionActive[d] == NO)
+                continue;
+#   endif
+            m = &modelSettings[d];
+            
+            if (m->upDateCl == YES && m->correlation != NULL && m->mark != YES)
+                {
+                lnL = 0.0;
+                CalcLikeAdgamma(d, m->correlation, chain, &lnL);
+
+                /* store the value for the cases where the HMM is not touched */
+                m->lnLike[2*chain + state[chain]] =  lnL;
+                
+                /* add it to chainLnLike - it was not added above since the division */
+                /* lnL was set to zero after the update call to Likelihood_Adgamma */
+                chainLnLike += lnL;
+                
+                /* set mark for other divisions in the HMM
+                   (i.e., those with the same correlation parameter AND the same shape parameter) */
+                for (i=0; i<m->correlation->nRelParts; i++)
+                    {
+                    if (modelSettings[m->correlation->relParts[i]].shape == modelSettings[d].shape)
+                        {
+                        modelSettings[m->correlation->relParts[i]].mark = YES;
+                        }
+                    }
+                }
+            }
+        }
+
+    return (chainLnLike);   
+}
+
+
+MrBFlt LogOmegaPrior (MrBFlt w1, MrBFlt w2, MrBFlt w3)
+{
+
+    /* This function returns the log prior probability of 
+       the ratio on three omegas. Here, we have three
+       nonsynonymous/synonymous rate ratios, denoted w1, w2,
+       and w3. They have the property that w1 < w2 < w3. 
+       Remember that w1 = dN1/dS, w2 = dN2/dS, and
+       w3 = dN3/dS. We assume that dN1, dN2, dN3, and dS
+       are all independent draws from the same exponential
+       distribution, and that dN1, dN2, and dN3 are the
+       order statistics. The w1, w2, and w3, then, are
+       all scaled to the same dS r.v. */
+       
+    MrBFlt  lnProb;
+    
+    lnProb = log(36.0) - 4.0 * log(1.0 + w1 + w2 + w3);
+     
+    return (lnProb);
+}
+
+/* ------------------------------------------------------------------------------------------------------------- */
+/* Joint distribution of branch lengths t under gamma-Dirichlet prior:                                           */
+/* (Zhang et al. 2012, Eq. 4; Rannala et al. 2012, Eq. 36):                                                      */
+/* ln[f(t|aT,bT,a,c)] =  (aT - a*s - a*c*(s-3)) * ln(T) - bT * T + (a-1) * sum[ln(t_j)] + (a*c-1) * sum[ln(t_k)] */
+/*                      + aT * ln(bT) - lnG(aT) - lnB(a,c)                                                       */
+/*                                                                                                               */
+/* Joint distribution of branch lengths t under invgamma-Dirichlet prior:                                        */
+/* (Zhang et al. 2012, Eq. 6; Rannala et al. 2012, Eq. 39):                                                      */
+/* ln[f(t|aT,bT,a,c)] = (-aT - a*s - a*c*(s-3)) * ln(T) - bT / T + (a-1) * sum[ln(t_j)] + (a*c-1) * sum[ln(t_k)] */
+/*                      + aT * ln(bT) - lnG(aT) - lnB(a,c)                                                       */
+/* also see DoCitations()                                                                                        */
+/* ------------------------------------------------------------------------------------------------------------- */
+
+/* external (tip): 1, internal: 0 */
+#define IsTip(Node) (Node->index < numTaxa || (Node->anc)->index < numTaxa)
+
+MrBFlt LogDirPrior (Tree *t, ModelParams *mp, int PV)
+{
+    /* ln prior prob. under Dirichlet priors and twoExp prior
+     //chi */
+
+    int    i, nb[2] = {0,0};
+    MrBFlt lnprior = 0.0, tb[2] = {0,0}, treeL = 0.0;
+    MrBFlt aT, bT, a, c;
+    TreeNode  *p;
+    
+    /* Not safe, should define Marcos. YES or NO should never be defined to 2 or 3 or 4! */
+    /* PV is 2 or 3: Dirichlet priors */    
+    if (PV == 2 || PV == 3)
+        {
+        /* partially for calculating lnPriorRatio, full part is in LogPrior() */
+        aT = mp->brlensDir[0];
+        bT = mp->brlensDir[1];
+        a  = mp->brlensDir[2];
+        c  = mp->brlensDir[3];
+    
+        for (i = 0; i < t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc != NULL)
+                {
+                treeL += p->length;
+                nb[IsTip(p)]++;
+                tb[IsTip(p)] += log(p->length);
+                }
+            }
+        lnprior += (a-1)*tb[1] + (a*c -1)*tb[0];
+        if (PV == 2)
+            lnprior += (aT - a*nb[1] - a*c*nb[0]) * log(treeL) - bT*treeL;
+        else
+            lnprior += (-aT - a*nb[1] - a*c*nb[0]) * log(treeL) - bT/treeL;
+        }
+    /* or 4: twoExp prior */
+    else if (PV == 4)
+        {
+        for (i = 0; i < t->nNodes; i++) {
+            p = t->allDownPass[i];
+            if (p->anc != NULL)
+                {
+                nb[IsTip(p)]++;
+                tb[IsTip(p)] += p->length;
+                }
+            }
+        for (i = 0; i < 2; i++)
+            lnprior += nb[i] * log(mp->brlens2Exp[i]) - tb[i] * (mp->brlens2Exp[i]);
+        }
+    
+    return lnprior;
+}
+
+
+MrBFlt LogPrior (int chain)
+{
+    int             i, j, c, n, nStates, *nEvents, sumEvents, *ist, nRates, nParts[6];
+    const int       *rateCat;
+    MrBFlt          *st, *sst, lnPrior, sum, x, clockRate, theta, popSize, growth, *alphaDir, newProp[190],
+                    sF, *sR, *eR, *fR,  freq, pInvar, lambda, sigma, nu, igrvar, **rateMultiplier;
+    char            *sS;
+    CLFlt           *nSitesOfPat;
+    Param           *p;
+    ModelParams     *mp;
+    ModelInfo       *m;
+    Tree            *t;
+    TreeNode        *branch, *q;
+    
+    /* In the stepping-stone method, constants that appear in prior probability density functions must be fully specified.
+       It is not necessary for Bayesian MCMC analyses because such constants cancel out. */
+
+    lnPrior = 0.0;
+    for (n=0; n<numParams; n++)
+        {
+        p = &params[n];
+#   if defined (MPI_BEST_ENABLED)
+        /* We skip all parameters that are not handled on this processor. The scheme used here
+           requires that parameters either be unique to one partition (processor) or that they
+           are shared across all partitions and that the first processor has all the relevant
+           information about that parameter. */
+        if (isDivisionActive[p->relParts[0]] == NO)
+            continue;
+#   endif
+        
+        st  = GetParamVals (p, chain, state[chain]);
+        sst = GetParamSubVals (p, chain, state[chain]);
+        mp = &modelParams[p->relParts[0]];
+        m = &modelSettings[p->relParts[0]];
+
+        if (p->paramType == P_TRATIO)
+            {
+            /* tratio parameter */
+            if (p->paramId == TRATIO_DIR)
+                {
+                alphaDir = mp->tRatioDir;
+                /* we convert here from the ratio parameterization used in the parameter
+                   struct to the simplex parameterization used for the prior */
+                newProp[0] =  st[0] / (st[0] + 1.0);
+                newProp[1] =  (1.0 - newProp[0]);
+                x = LnGamma(alphaDir[0]+alphaDir[1]) - LnGamma(alphaDir[0]) - LnGamma(alphaDir[1]);
+                for (i=0; i<2; i++)
+                    x += (alphaDir[i]-1.0)*log(newProp[i]);
+                lnPrior += x;
+                }
+            }
+        else if (p->paramType == P_REVMAT)
+            {
+            /* revmat parameter */
+            if (p->paramId == REVMAT_DIR)
+                {
+                if (p->nValues == 6)
+                    alphaDir = mp->revMatDir;
+                else /* if (p->nValues == 190) */
+                    alphaDir = mp->aaRevMatDir;
+                sum = 0.0;
+                for (i=0; i<p->nValues; i++)
+                    sum += alphaDir[i];
+                x = LnGamma(sum);
+                for (i=0; i<p->nValues; i++)
+                    x -= LnGamma(alphaDir[i]);
+                for (i=0; i<p->nValues; i++)
+                    x += (alphaDir[i] - 1.0) * log(st[i]);
+                lnPrior += x;
+                }
+            else if (p->paramId == REVMAT_MIX)
+                {
+                assert (p->nValues == 6);
+                alphaDir = &mp->revMatSymDir;
+                ist      = GetParamIntVals(p, chain, state[chain]); /* the growth fxn */
+                nRates   = GetKFromGrowthFxn(ist);
+                /* get the actual rate proportions of the current groups */
+                for (i=0; i<nRates; i++)
+                    {
+                    newProp[i] = 0.0;
+                    nParts[i] = 0;
+                    }
+                for (i=0; i<6; i++)
+                    {
+                    nParts[ist[i]]++;
+                    newProp[ist[i]] += st[i];
+                    }
+                /* now we calculate probability as usual, with alpha
+                   parameter multiplied by number of parts */
+                x = LnGamma(6.0 * alphaDir[0]);
+                for (i=0; i<nRates; i++)
+                    x -= LnGamma(nParts[i] * alphaDir[0]);
+                for (i=0; i<nRates; i++)
+                    x += (nParts[i] * alphaDir[0] - 1.0) * log(newProp[i]);
+                /* finally take model probability into account */
+                x += log (1.0 / 203);
+                lnPrior += x;
+                }
+            else
+                {
+                /* fixed or empirical */
+                }
+            }
+        else if (p->paramType == P_OMEGA)
+            {
+            /* account for prior on omega proportion if 1 omega category */
+            if (p->paramId == OMEGA_DIR)
+                {
+                alphaDir = mp->omegaDir;
+                /* convert from ratio parameterization to simplex representation */
+                newProp[0] = st[0] / (st[0] + 1.0);
+                newProp[1] = 1.0 - newProp[0];
+                x = LnGamma(alphaDir[0]+alphaDir[1]) - LnGamma(alphaDir[0]) - LnGamma(alphaDir[1]);
+                for (i=0; i<2; i++)
+                    x += (alphaDir[i]-1.0)*log(newProp[i]);
+                lnPrior += x;
+                }
+            /* account for stationary state frequencies of M3 and ny98 omega categories */
+            if (p->paramId == OMEGA_BUD || p->paramId == OMEGA_BED ||
+                p->paramId == OMEGA_BFD || p->paramId == OMEGA_FUD ||
+                p->paramId == OMEGA_FED || p->paramId == OMEGA_FFD ||
+                p->paramId == OMEGA_ED  || p->paramId == OMEGA_FD)
+                {
+                alphaDir = mp->codonCatDir;             
+                x = 0.0;
+                for (i=0; i<3; i++)
+                    x += (alphaDir[i]-1.0)*log(sst[i]);
+                lnPrior += x;
+                }
+            /* account for beta prior on omeganeg in NY98 */
+            if (p->paramId == OMEGA_BUD || p->paramId == OMEGA_BUF ||
+                p->paramId == OMEGA_BED || p->paramId == OMEGA_BEF ||
+                p->paramId == OMEGA_BFD || p->paramId == OMEGA_BFF)
+                {
+                alphaDir = mp->ny98omega1Beta;
+                newProp[0] = st[0] / (st[0] + 1.0);
+                newProp[1] = 1.0 - newProp[0];
+                x = 0.0;
+                for (i=0; i<2; i++)
+                    x += (alphaDir[i]-1.0)*log(newProp[i]);
+                lnPrior += x;
+                }
+            /* account for omegapos in NY98 with uniform prior prob */
+            if (p->paramId == OMEGA_BUD || p->paramId == OMEGA_BUF ||
+                p->paramId == OMEGA_FUD || p->paramId == OMEGA_FUF)
+                {
+                lnPrior += log(1.0) - log(mp->ny98omega3Uni[1] - mp->ny98omega3Uni[0]);
+                }
+            /* account for omegapos in NY98 with exponential prior prob */
+            if (p->paramId == OMEGA_BED || p->paramId == OMEGA_BEF ||
+                p->paramId == OMEGA_FED || p->paramId == OMEGA_FEF)
+                {
+                lnPrior += (log(mp->ny98omega3Exp) - mp->ny98omega3Exp * st[2]);
+                }
+            /* account for omegas in M3, which can only be exponential; if fixed, ln prior prob is 0 */
+            if (p->paramId == OMEGA_EF || p->paramId == OMEGA_ED)
+                {
+                lnPrior += LogOmegaPrior (st[0], st[1], st[2]);
+                }
+            }
+        else if (p->paramType == P_PI)
+            {
+            /* state frequencies parameter */
+            if (p->paramId == PI_DIR)
+                {
+                nStates = p->nSubValues;
+                sum = 0.0;
+                for (i=0; i<nStates; i++)
+                    sum += st[i];
+                x = LnGamma(sum);
+                for (i=0; i<nStates; i++)
+                    x -= LnGamma(st[i]);
+                for (i=0; i<nStates; i++)
+                    x += (st[i] - 1.0)*log(sst[i]);
+                lnPrior += x;
+                }
+            else if (p->paramId == SYMPI_EXP || p->paramId == SYMPI_EXP_MS)
+                {
+                lnPrior += - mp->symBetaExp * st[0] + log(mp->symBetaExp);
+                }
+            else if (p->paramId == SYMPI_UNI || p->paramId == SYMPI_UNI_MS)
+                {
+                lnPrior += log(1.0) - log(mp->symBetaUni[1] - mp->symBetaUni[0]);
+                }                
+            if (p->paramId == SYMPI_EXP_MS || p->paramId == SYMPI_UNI_MS || p->paramId == SYMPI_FIX_MS)
+                {
+                sst = GetParamStdStateFreqs(p, chain, state[chain]);
+                sst += 2*m->numBetaCats;
+                for (i=0; i<p->nSympi; i++)
+                    {
+                    nStates = p->sympinStates[i];
+                    x = LnGamma(nStates*st[0]) - nStates*LnGamma(st[0]);
+                    for (j=0; j<nStates; j++)
+                        x += (st[0] - 1.0)*log(sst[j]);
+                    lnPrior += x;
+                    sst += nStates;
+                    }
+                }
+            }
+        else if (p->paramType == P_SHAPE)
+            {
+            /* gamma/lnorm shape parameter */
+            if (p->paramId == SHAPE_UNI)
+                {
+                lnPrior += log(1.0) - log(mp->shapeUni[1] - mp->shapeUni[0]);
+                }
+            else if (p->paramId == SHAPE_EXP)
+                {
+                lnPrior += log(mp->shapeExp) - mp->shapeExp * st[0];
+                }
+            for (i=0; i<p->nRelParts; i++)
+                {
+                m = &modelSettings[p->relParts[i]];
+                if (m->gibbsGamma == YES)
+                    {
+                    if (m->pInvar == NULL)
+                        lnPrior += log(1.0/m->numGammaCats) * m->numUncompressedChars;
+                    else
+                        {
+                        rateCat = m->tiIndex + chain * m->numChars;
+                        pInvar = *GetParamVals (m->pInvar, chain, state[chain]);
+                        nSitesOfPat = numSitesOfPat + m->compCharStart;
+                        freq = (1.0 - pInvar)/m->numGammaCats;
+                        for (c=0; c<m->numChars; c++)
+                            {
+                            if (rateCat[c] < m->numGammaCats)
+                                lnPrior += log(freq) * nSitesOfPat[c];
+                            else
+                                lnPrior += log(pInvar) * nSitesOfPat[c];
+                            }
+                        }
+                    }
+                }
+            }
+        else if (p->paramType == P_PINVAR)
+            {
+            /* proportion of invariable sites parameter */
+            lnPrior += log(1.0) - log(mp->pInvarUni[1] - mp->pInvarUni[0]);
+            }
+        else if (p->paramType == P_CORREL)
+            {
+            /* adGamma model parameter */
+            lnPrior += log(1.0) - log(mp->corrUni[1] - mp->corrUni[0]);
+            }
+        else if (p->paramType == P_SWITCH)
+            {
+            /* switching rate parameter of covarion model */
+            if (p->paramId == SWITCH_UNI)
+                {
+                lnPrior += log(1.0) - log(mp->covswitchUni[1] - mp->covswitchUni[0]);
+                }
+            else if (p->paramId == SWITCH_EXP)
+                {
+                lnPrior += log(mp->covswitchExp) - mp->covswitchExp * st[0];
+                }
+            }
+        else if (p->paramType == P_RATEMULT && p->nValues > 1)
+            {
+            nStates = p->nValues;
+            sum = 0.0;
+            for (i=0; i<nStates; i++)
+                sum += sst[i+nStates];
+            x = LnGamma(sum);
+            for (i=0; i<nStates; i++)
+                x -= LnGamma(sst[i+nStates]);
+            for (i=0; i<nStates; i++)
+                x += (sst[i+nStates] - 1.0) * log(st[i]);
+            sum = 0.0;  // the constant
+            for (i=0; i<nStates; i++)
+                sum += sst[i];
+            for (i=0; i<nStates; i++) {
+                if (i < nStates-1)
+                    x += (sst[i+nStates]) * log(sst[i]/sum);
+                else
+                    x += (sst[i+nStates] - 1.0) * log(sst[i]/sum);
+                }
+            lnPrior += x;
+            }
+        else if (p->paramType == P_GENETREERATE && p->nValues > 1)
+            {
+            nStates = p->nValues;
+            sum = 0.0;
+            for (i=0; i<nStates; i++)
+                sum += sst[i+nStates];
+            x = LnGamma(sum);
+            for (i=0; i<nStates; i++)
+                x -= LnGamma(sst[i+nStates]);
+            for (i=0; i<nStates; i++)
+                x += (sst[i+nStates] - 1.0) * log(st[i]);
+            sum = 0.0;  // the constant
+            for (i=0; i<nStates; i++)
+                sum += sst[i];
+            for (i=0; i<nStates; i++) {
+                if (i < nStates-1)
+                    x += (sst[i+nStates]) * log(sst[i]/sum);
+                else
+                    x += (sst[i+nStates] - 1.0) * log(sst[i]/sum);
+                }
+            lnPrior += x;
+            }
+        else if (p->paramType == P_TOPOLOGY)
+            {
+            // Note that a topology can have several unlinked branch length subparameters but only
+            // one set of clock branch lengths. To find all the branch length subparameters of a
+            // topology, cycle through the p->subParams, which will contain at least one branch length
+            // parameter.
+            t = GetTree (p, chain, state[chain]);
+            if (t->isClock == YES)
+                continue;   /* prior probability taken care of in the brlens parameter */
+            if (t->nLocks > 0)
+                {
+                for (i=0; i<t->nNodes-1; i++)
+                    {
+                    branch = t->allDownPass[i];
+                    if (branch->left == NULL)
+                        branch->x = 1;
+                    else
+                        branch->x = branch->left->x + branch->right->x;
+                    if (branch->isLocked == YES || branch->anc->anc == NULL)
+                        {
+                        for (j = 2*branch->x - 3; j>=1; j-=2)
+                            {
+                            lnPrior -= log ((MrBFlt)j);
+                            }
+                        branch->x = 1;
+                        }
+                    }
+                }
+            else
+                {
+                for (j = 2*(t->nNodes-t->nIntNodes)-5; j>=1; j-=2)
+                    {
+                    lnPrior -= log ((MrBFlt)j);
+                    }
+                }
+            }
+        else if (p->paramType == P_BRLENS)
+            {
+            /* branch lengths */
+            t = GetTree (p, chain, state[chain]);
+            if (t->isClock == YES)
+                {
+                if (p->paramId == BRLENS_CLOCK_UNI)
+                    {
+                    /* uniformly distributed branch lengths */
+                    clockRate = *(GetParamVals (m->clockRate, chain, state[chain]));
+                    lnPrior += LnUniformPriorPr(t, clockRate);
+                    }
+                else if (p->paramId == BRLENS_CLOCK_COAL)
+                    {
+                    /* coalescence prior */
+                    popSize   = *(GetParamVals (m->popSize, chain, state[chain]));
+                    clockRate = *(GetParamVals (m->clockRate, chain, state[chain]));
+                    if (strcmp(mp->ploidy, "Diploid") == 0)
+                        theta = 4.0 * popSize * clockRate;
+                    else if (strcmp(mp->ploidy, "Zlinked") == 0)
+                        theta = 3.0 * popSize * clockRate;
+                    else
+                        theta = 2.0 * popSize * clockRate;
+                    if (!strcmp(mp->growthPr, "Fixed"))
+                        growth = mp->growthFix;
+                    else
+                        growth = *(GetParamVals (m->growthRate, chain, state[chain]));
+                    if (LnCoalescencePriorPr (t, &x, theta, growth) == ERROR)
+                        {
+                        MrBayesPrint ("%s   Problem calculating prior for coalescence process\n", spacer);
+                        }
+                    lnPrior += x;
+                    }
+                else if (p->paramId == BRLENS_CLOCK_BD)
+                    {
+                    /* birth-death prior */
+                    sR = GetParamVals (m->speciationRates, chain, state[chain]);
+                    eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+                    sS = mp->sampleStrat;
+                    sF = mp->sampleProb;
+                    if (m->clockRate != NULL)
+                        clockRate = *(GetParamVals (m->clockRate, chain, state[chain]));
+                    else
+                        clockRate = 1.0;
+                    if (LnBirthDeathPriorPr (t, clockRate, &x, *sR, *eR, sS, sF) == ERROR)
+                        {
+                        MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+                        }
+                    lnPrior += x;
+                    }
+                else if (p->paramId == BRLENS_CLOCK_FOSSIL)
+                    {
+                    /* fossilized birth-death prior */
+                    sR = GetParamVals (m->speciationRates, chain, state[chain]);
+                    eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+                    sF = mp->sampleProb;
+                    fR = GetParamVals (m->fossilizationRates, chain, state[chain]);
+                    sS = mp->sampleStrat;
+                    if (m->clockRate != NULL)
+                        clockRate = *(GetParamVals (m->clockRate, chain, state[chain]));
+                    else
+                        clockRate = 1.0;
+                    if (LnFossilizationPriorPr (t, clockRate, &x, sR, eR, sF, fR, sS) == ERROR)
+                        {
+                        MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+                        }
+                    lnPrior += x;
+                    }
+                else if (p->paramId == BRLENS_CLOCK_SPCOAL)
+                    {
+                    /* delegate this calculation to the P_SPECIESTREE parameter */
+                    }
+                if (t->isCalibrated == YES)
+                    {
+                    /* take care of calibrations */
+                    for (i=0; i<t->nNodes-1; i++)
+                        {
+                        q = t->allDownPass[i];
+                        if (q->isDated == YES && q->calibration->prior != fixed)
+                            {
+                            lnPrior += q->calibration->LnPriorProb(q->age, q->calibration->priorParams);
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                if (p->paramId == BRLENS_UNI)
+                    {
+                    for (i=0; i<t->nNodes; i++)
+                        {
+                        branch = t->allDownPass[i];
+                        if (branch->anc != NULL)
+                            lnPrior += log(1.0) - log(mp->brlensUni[1] - BRLENS_MIN);
+                        }
+                    }
+                else if (p->paramId == BRLENS_EXP)
+                    {
+                    for (i=0; i<t->nNodes; i++)
+                        {
+                        branch = t->allDownPass[i];
+                        if (branch->anc != NULL)
+                            lnPrior += log(mp->brlensExp) - mp->brlensExp * branch->length;
+                        }
+                    }
+                /* Dirichlet priors */
+                else if (p->paramId == BRLENS_GamDir)  
+                    {
+                    lnPrior += LogDirPrior(t, mp, 2);
+                    lnPrior += (mp->brlensDir[0]) * log(mp->brlensDir[1]) - LnGamma(mp->brlensDir[0])
+                                + LnGamma (mp->brlensDir[2] * numTaxa + mp->brlensDir[2] * mp->brlensDir[3] * (numTaxa-3))
+                                - numTaxa * LnGamma(mp->brlensDir[2]) - (numTaxa-3) * LnGamma(mp->brlensDir[2] * mp->brlensDir[3]);
+                    } 
+                else if (p->paramId == BRLENS_iGmDir)
+                    {
+                    lnPrior += LogDirPrior(t, mp, 3);
+                    lnPrior += (mp->brlensDir[0]) * log(mp->brlensDir[1]) - LnGamma(mp->brlensDir[0])
+                                + LnGamma (mp->brlensDir[2] * numTaxa + mp->brlensDir[2] * mp->brlensDir[3] * (numTaxa-3))
+                                - numTaxa * LnGamma(mp->brlensDir[2]) - (numTaxa-3) * LnGamma(mp->brlensDir[2] * mp->brlensDir[3]);
+                    }
+                /* twoExp prior */
+                else if (p->paramId == BRLENS_twoExp)
+                    lnPrior += LogDirPrior(t, mp, 4);
+                }
+            }
+        else if (p->paramType == P_SPECRATE)
+            {
+            /* speciation rate parameter */
+            if (p->paramId == SPECRATE_UNI)
+                {
+                for (i=0; i<p->nValues; i++)
+                    lnPrior += log(1.0) - log(mp->speciationUni[1] - mp->speciationUni[0]);
+                }
+            else if (p->paramId == SPECRATE_EXP)
+                {
+                for (i=0; i<p->nValues; i++)
+                    lnPrior += log(mp->speciationExp) - mp->speciationExp * st[i];
+                }
+            }
+        else if (p->paramType == P_EXTRATE)
+            {
+            /* extinction rate parameter */
+            if (p->paramId == EXTRATE_BETA)
+                {
+                for (i=0; i<p->nValues; i++)
+                    {
+                    alphaDir = mp->extinctionBeta;
+                    newProp[0] =  st[i];
+                    newProp[1] =  (1.0 - newProp[0]);
+                    lnPrior += LnGamma(alphaDir[0]+alphaDir[1]) - LnGamma(alphaDir[0]) - LnGamma(alphaDir[1]);
+                    lnPrior += (alphaDir[0]-1.0)*log(newProp[0]) + (alphaDir[1]-1.0)*log(newProp[1]);
+                    }
+                }
+            }
+        else if (p->paramType == P_FOSLRATE)
+            {
+            /* fossilization rate parameter */
+            if (p->paramId == FOSLRATE_BETA)
+                {
+                for (i=0; i<p->nValues; i++)
+                    {
+                    alphaDir = mp->fossilizationBeta;
+                    newProp[0] =  st[i];
+                    newProp[1] =  (1.0 - newProp[0]);
+                    // if (newProp[0] > 0.0) /* to avoid psi=0 in [0, x_cut] under diversified sampling */
+                    lnPrior += LnGamma(alphaDir[0]+alphaDir[1]) - LnGamma(alphaDir[0]) - LnGamma(alphaDir[1]);
+                    lnPrior += (alphaDir[0]-1.0)*log(newProp[0]) + (alphaDir[1]-1.0)*log(newProp[1]);
+                    }
+                }
+            }
+        else if (p->paramType == P_POPSIZE)
+            {
+            /* neutral coalescence population size parameter; one value, or one value per branch of species tree */
+            for (i=0; i<p->nValues; i++)
+                {
+                lnPrior += p->LnPriorProb(st[i], p->priorParams);
+                }
+            }
+        else if (p->paramType == P_AAMODEL)
+            {
+            lnPrior += sst[(int)st[0]];
+            }
+        else if (p->paramType == P_BRCORR)
+            {
+
+            }
+        else if (p->paramType == P_BRSIGMA)
+            {
+
+            }
+        else if (p->paramType == P_GROWTH)
+            {
+            /* population growth parameter */
+            if (p->paramId == GROWTH_UNI)
+                {
+                lnPrior += log(1.0) - log(mp->growthUni[1] - mp->growthUni[0]);
+                }
+            else if (p->paramId == GROWTH_EXP)
+                {
+                lnPrior += log(mp->growthExp) - mp->growthExp * st[0];
+                }
+            }
+        else if (p->paramType == P_CPPRATE)
+            {
+            /* rate (lambda) of comp poisson process of relaxed clock */
+            if (p->paramId == CPPRATE_EXP)
+                {
+                lnPrior += log (mp->cppRateExp) - mp->cppRateExp * st[0];
+                }
+            }
+        else if (p->paramType == P_CPPMULTDEV)
+            {
+            /* standard deviation (log) of lognormal distribution of rate multipliers for cpp relaxed clock */
+            /* only fixed value allowed currently */
+            }
+        else if (p->paramType == P_CPPEVENTS)
+            {
+            /* events of CPP relaxed clock process */
+            lambda = *GetParamVals (m->cppRate, chain, state[chain]);
+            sigma = *GetParamVals (m->cppMultDev, chain, state[chain]);
+            nEvents = p->nEvents[2*chain+state[chain]];
+            rateMultiplier = p->rateMult[2*chain+state[chain]];
+            /* cpp events */
+            sumEvents = 0;
+            for (i=0; i<2*numLocalTaxa-2; i++)
+                sumEvents += nEvents[i];
+            t = GetTree (p, chain, state[chain]);
+            lnPrior += - lambda * TreeLength (p, chain) + (sumEvents * log (lambda));
+            /* rate multipliers */
+            for (i=0; i<2*numLocalTaxa-2; i++)
+                {
+                for (j=0; j<nEvents[i]; j++)
+                    lnPrior += LnProbLogNormal (0.0, sigma, rateMultiplier[i][j]);
+                }
+            for (i=0; i<t->nNodes-2; i++)
+                {
+                branch = t->allDownPass[i];
+                assert (fabs(branch->length - (branch->anc->nodeDepth - branch->nodeDepth)) < 0.000001);
+                }
+            }
+        else if (p->paramType == P_TK02VAR)
+            {
+            /* variance of rates (nu) in Thorne-Kishino model */
+            if (p->paramId == TK02VAR_EXP)
+                {
+                lnPrior += log (mp->tk02varExp) - mp->tk02varExp * st[0];
+                }
+            else if (p->paramId == TK02VAR_UNI)
+                {
+                lnPrior += log(1.0) - log (mp->tk02varUni[1] - mp->tk02varUni[0]);
+                }
+            }
+        else if (p->paramType == P_TK02BRANCHRATES || (p->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(p, chain, state[chain]) == RCL_TK02))
+            {
+            /* branch rates of Thorne-Kishino model */
+            t = GetTree (p, chain, state[chain]);
+            if (p->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (m->tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (m->mixedvar, chain, state[chain]);
+            for (i=0; i<t->nNodes-2; i++)
+                {
+                branch = t->allDownPass[i];
+                if (branch->length > 0.0)  // not ancestral fossil
+                    lnPrior += LnProbTK02LogNormal (st[branch->anc->index], nu*branch->length, st[branch->index]);
+                }
+            }
+        else if (p->paramType == P_IGRVAR)
+            {
+            /* variance of rates in independent gamma rates model */
+            if (p->paramId == IGRVAR_EXP)
+                {
+                lnPrior += log (mp->igrvarExp) - mp->igrvarExp * st[0];
+                }
+            else if (p->paramId == IGRVAR_UNI)
+                {
+                lnPrior += log(1.0) - log (mp->igrvarUni[1] - mp->igrvarUni[0]);
+                }
+            }
+        else if (p->paramType == P_IGRBRANCHRATES || (p->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(p, chain, state[chain]) == RCL_IGR))
+            {
+            /* branch rates of independent branch rate model */
+            t = GetTree (p, chain, state[chain]);
+            if (p->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (m->igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (m->mixedvar, chain, state[chain]);
+            for (i=0; i<t->nNodes-2; i++)
+                {
+                branch = t->allDownPass[i];
+                if (branch->length > 0.0)  // not ancestral fossil
+                    lnPrior += LnProbGamma (branch->length/igrvar, branch->length/igrvar, st[branch->index]);
+                assert (fabs(sst[branch->index] - branch->length * st[branch->index]) < BRLENS_MIN);
+                assert (fabs(branch->length - (branch->anc->nodeDepth - branch->nodeDepth)) < BRLENS_MIN);
+                }
+            }
+        else if (p->paramType == P_MIXEDVAR)
+            {
+            /* hyper prior of rates in mixed rel clock model */
+            if (p->paramId == MIXEDVAR_EXP)
+                {
+                lnPrior += log (mp->mixedvarExp) - mp->mixedvarExp * st[0];
+                }
+            else if (p->paramId == MIXEDVAR_UNI)
+                {
+                lnPrior += log(1.0) - log (mp->mixedvarUni[1] - mp->mixedvarUni[0]);
+                }
+            }
+        else if (p->paramType == P_CLOCKRATE)
+            {
+            /* base rate of molecular clock */
+            lnPrior += p->LnPriorProb(st[0], p->priorParams);
+            }
+        else if (p->paramType == P_SPECIESTREE)
+            {
+            /* calculate prior */
+            lnPrior += LnSpeciesTreeProb(chain);
+            }
+        }
+    assert (lnPrior == lnPrior);
+
+#   if defined (BEST_MPI_ENABLED)
+    /* Assemble prior probabilities across processors */
+    myLnPrior = lnPrior;
+    MPI_AllReduce (&myLnPrior, &lnPrior, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+#   endif
+
+    return (lnPrior);
+}
+
+
+int LnBirthDeathPriorPr (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, char *sS, MrBFlt sF)
+{
+    if (!strcmp(sS, "Random")) 
+        {
+        return LnBirthDeathPriorPrRandom (t, clockRate, prob, sR, eR, sF);
+        }
+    else if (!strcmp(sS, "Diversity")) 
+        {
+        return LnBirthDeathPriorPrDiversity (t, clockRate, prob, sR, eR, sF);
+        }
+    else if (!strcmp(sS, "Cluster")) 
+        {
+        return LnBirthDeathPriorPrCluster (t, clockRate, prob, sR, eR, sF);
+        }
+    else 
+        {
+        MrBayesPrint ("%s   ERROR: Sampling strategy for birth-death process not implemented\n", spacer);
+        return (ERROR);
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LnBirthDeathPriorPrRandom
+|
+|   We assume a rooted tree that satisfies the molecular clock constraint. The
+|   tree is labelled as follows:
+|
+|                                      t_4 (age of tips)
+|     \         \         \        /            
+|      \         \         \      /              
+|       \         \         \    /         
+|        \         \         \  /          
+|         \         \         \/       t_3 
+|          \         \        /            
+|           \         \      /             
+|            \         \    /              
+|             \         \  /               
+|              \         \/            t_2  
+|               \        /                 
+|                \      /                  
+|                 \    /                        
+|                  \  /                         
+|                   \/                 t_1 (age of most recent common ancestor)
+|    
+|
+|   This function calculates the probability of such a tree under the neutral
+|   birth death prior with constant birth and death rates, conditioned on
+|   a particular time of the first split, t_1, and a particular number of
+|   species, n. We assume rho-sampling, that is, a constant sampling pro-
+|   bability rho, which is known, across tips of the tree. Variables:
+|
+|   T:   the unlabeled oriented tree, which is equivalent to a set of unordered
+|        speciation times from a point process
+|   tau: the labeled unoriented tree
+|   b:   birth (speciation) rate
+|   d:   death (extintion) rate
+|   f:   sampling fraction
+|   n:   number of species in the sampled tree
+|
+|   See:
+|   Tanja Stadler (2009) On incomplete sampling under birth-death models and
+|   connections to the sampling-based coalescent. Journal of Theoretical Biology
+|   261: 58-66.
+|
+|   We use f(T|n), which is derived from f(T|n,t_or) using Stadler's approach,
+|   in which the time of origin of the tree is associated with a uniform prior
+|   and integrated out of the density. We then have:
+|
+|   We have the following distribution for ordered bifurcation times (cf.
+|   equation 5 in Stadler, 2009, simplified here using the p0 and p1 functions):
+|
+|
+|              n! * p1(t_1)    n-1
+|   f(T|n) = --------------- * prod (b * p1(t_i))
+|             (1 - p0(t_1))    i=1
+|
+|
+|   where   t_1   = time of most recent common ancestor
+|           p0(t) = prob. of no descendants surviving and being sampled after time t (see LnP0 function below)
+|           p1(t) = prob. of one descendant surviving and being sampled after time t (see LnP1 function below)
+|
+|   To get the distribution on oriented trees, this density needs to be divided by the
+|   number of ways of ordering n-1 bifurcation times, (n-1)!, since each way of ordering
+|   the bifurcation times corresponds to a distinct oriented tree. The result is the following
+|   density on oritented trees:
+|
+|              n * p1(t_1)     n-1
+|   f(T|n) = --------------- * prod (b * p1(t_i))
+|             (1 - p0(t_1))    i=1
+|
+|
+|   To translate this to a density on distinct labeled trees, the density needs to be multiplied by
+|   (2^(n-1) / n!).
+|
+|   For the critical process where the speciation and extinction rates are equal, we obtain the
+|   following result in the limit (cf. equation 6 in Stadler (2009)):
+|
+|                  n          n-1          f*b      
+|   f(T|n) = -------------- * prod -----------------
+|            (1 + f*b*t_1)    i=1   (1 + f*b*t_i)^2
+|
+---------------------------------------------------------------------------------*/
+int LnBirthDeathPriorPrRandom (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF)
+{
+    int             i, nTaxa;
+    MrBFlt          *nt, lambda, mu, rho;
+    TreeNode        *p;
+
+    /* allocate space for the speciation times */
+    nt = (MrBFlt *)SafeMalloc((size_t)(t->nIntNodes) * sizeof(MrBFlt));
+    if (!nt)
+        {
+        MrBayesPrint ("\n   ERROR: Problem allocating nt\n");
+        return (ERROR);
+        }
+
+    /* transform to standard variables */
+    rho    = sF;
+    lambda = sR / (1.0 - eR);
+    mu     = eR * lambda;
+
+    /* get the node times and put them into a vector */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        nt[i] = p->nodeDepth / clockRate;
+        }
+    nTaxa = t->nIntNodes + 1;
+
+    /* calculate probability of tree using standard variables */
+    if (AreDoublesEqual(lambda,mu,ETA)==NO)
+        {
+        // birth rate != death rate, see equation (5) in Stadler (2009) and above
+        (*prob) = log(nTaxa) + log(lambda - mu) - (lambda - mu) * nt[t->nIntNodes-1];
+        (*prob) -= log(rho*lambda + (lambda*(1.0 - rho) - mu)*exp((mu - lambda)*nt[t->nIntNodes-1]));
+        for (i=0; i<t->nIntNodes; i++)
+            (*prob) += log(rho*lambda) + LnP1Subsample(nt[i], lambda, mu, rho);
+        (*prob) += (nTaxa - 1.0) * log(2.0) - LnFactorial(nTaxa);    /* conversion to labeled tree from oriented tree */
+        }
+    else
+        {
+        // birth rate == death rate -> the critical branching process
+        (*prob) = log(nTaxa/(1.0 + rho*lambda*nt[t->nIntNodes-1]));
+        for (i=0; i<t->nIntNodes; i++)
+            (*prob) += log(rho*lambda) - 2.0 * log(1.0 + rho*lambda*nt[i]);
+        (*prob) += (nTaxa - 1.0) * log(2.0) - LnFactorial(nTaxa);    /* conversion to labeled tree from oriented tree */
+        }
+
+    /* free memory */
+    free (nt);
+    
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+ |
+ |   LnBirthDeathPriorPrDiversity
+ |
+ |   Eq.5 in Hohna et al. 2011 MBE
+ |
+ ---------------------------------------------------------------------------------*/
+int LnBirthDeathPriorPrDiversity (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF)
+{
+    int             i, nTaxa, n, m;
+    MrBFlt          *nt, lambda, mu, nt_min;
+    TreeNode        *p;
+    
+    /* allocate space for the speciation times */
+    nt = (MrBFlt *)SafeMalloc((size_t)(t->nIntNodes) * sizeof(MrBFlt));
+    if (!nt)
+        {
+        MrBayesPrint ("\n   ERROR: Problem allocating nt\n");
+        return (ERROR);
+        }
+    
+    /* transform to standard variables */
+    lambda = sR / (1.0 - eR);
+    mu     = eR * lambda;
+    
+    n      = t->nIntNodes+1;
+    m      = (int)floor(n/sF+0.5); /* equal to round(n/sF) plus it is compatible with MS Visual Studio */
+    
+    /* get the node times and put them into a vector */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        nt[i] = p->nodeDepth / clockRate;
+        }
+    nTaxa = t->nIntNodes + 1;
+
+    /* find the youngest interal node */
+    nt_min = nt[0];
+    for (i=0; i<t->nIntNodes-1; i++)
+        {
+        if (nt_min > nt[i])
+            nt_min = nt[i];
+        }
+    
+    /* calculate probability of tree using standard variables */
+    if (AreDoublesEqual(lambda,mu,ETA)==NO)
+        {
+        // birth rate != death rate
+        MrBFlt p0_t1;
+        p0_t1 = LnP0(nt[t->nIntNodes-1], lambda, mu);
+        (*prob) = log(nTaxa); // we need to add here the binomial coefficient
+        (*prob) += (m-n) * (LnP0(nt_min, lambda, mu) - p0_t1);
+        for (i=0; i<t->nIntNodes-1; i++)
+            (*prob) += (LnP1(nt[i], lambda, mu) - p0_t1);
+        (*prob) += (nTaxa - 1.0) * log(2.0) - LnFactorial(nTaxa);  /* conversion to labeled tree from oriented tree */
+        }
+    else
+        {
+        MrBayesPrint ("\n   ERROR: Critical branchin process for diversity sampling not implemented\n");
+        return (ERROR);
+        }
+
+    /* condition on tmrca ??? */
+
+    /* free memory */
+    free (nt);
+    
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+ |
+ |   LnBirthDeathPriorPrCluster
+ |
+ |   Eq.7 in Hohna et al. 2011 MBE
+ |
+ ---------------------------------------------------------------------------------*/
+int LnBirthDeathPriorPrCluster (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF)
+{
+    int             i, nTaxa, n, m;
+    MrBFlt          *nt, lambda, mu, nt_max;
+    TreeNode        *p;
+    
+    /* allocate space for the speciation times */
+    nt = (MrBFlt *)SafeMalloc((size_t)(t->nIntNodes) * sizeof(MrBFlt));
+    if (!nt)
+        {
+        MrBayesPrint ("\n   ERROR: Problem allocating nt\n");
+        return (ERROR);
+        }
+    
+    /* transform to standard variables */
+    lambda = sR / (1.0 - eR);
+    mu     = eR * lambda;
+    
+    n      = t->nIntNodes+1;
+    m      = (int)floor(n/sF+0.5); /* equal to round(n/sF) plus it is compatible with MS Visual Studio */
+    
+    /* get the node times and put them into a vector */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        nt[i] = p->nodeDepth / clockRate;
+        }
+    nTaxa = t->nIntNodes + 1;
+    
+    /* find the second oldest interal node */
+    nt_max = nt[0];
+    for (i=0; i<t->nIntNodes-1; i++)
+        {
+        if (nt_max < nt[i])
+            nt_max = nt[i];
+        }
+
+    /* calculate probability of tree using standard variables */
+    if (AreDoublesEqual(lambda,mu,ETA)==NO)
+        {
+        // birth rate != death rate
+        MrBFlt p0_t1;
+        p0_t1 = LnP0(nt[t->nIntNodes-1], lambda, mu);
+        (*prob) = log(nTaxa); // we need to add here the binomial coefficient
+        (*prob) += (m-n) * (LnP0(nt_max, lambda, mu) - p0_t1);
+        for (i=0; i<t->nIntNodes-1; i++)
+            (*prob) += (LnP1(nt[i], lambda, mu) - p0_t1);
+        (*prob) += (nTaxa - 1.0) * log(2.0) - LnFactorial(nTaxa);  /* conversion to labeled tree from oriented tree */
+        }
+    else
+        {
+        MrBayesPrint ("\n   ERROR: Critical branchin process for cluster sampling not implemented\n");
+        return (ERROR);
+        }
+
+    /* condition on tmrca ??? */
+
+    /* free memory */
+    free (nt);
+    
+    return (NO_ERROR);
+}
+
+
+/*
+ |
+ | The probability of having zero lineages remaining after time t in the
+ | birth-death process.
+ |
+ | param: t - speciation time
+ | param: b - birth rate
+ | param: d - death rate
+ | return: log probability of zero remaining lineages
+ |
+ */
+MrBFlt LnP0 (MrBFlt t, MrBFlt b, MrBFlt d)
+{
+    MrBFlt      p0t;
+    
+    p0t = d*(1.0-exp((d-b)*t)) / (b -d*exp((d-b)*t));
+    
+    return (log(p0t));
+}
+
+/*
+ |
+ | The probability of having zero lineages remaining after time t in the
+ | birth-death process.
+ |
+ | param: t - speciation time
+ | param: b - birth rate
+ | param: d - death rate
+ | param: f - sample frequency
+ | return: log probability of zero remaining lineages
+ |
+ */
+MrBFlt LnP0Subsample (MrBFlt t, MrBFlt b, MrBFlt d, MrBFlt f)
+{
+    MrBFlt      p0t;
+    
+    p0t = (f*d + (b*(1.0-f) - d)*exp((d-b)*t)) / (f*b + (b*(1.0-f)-d)*exp((d-b)*t));
+    
+    return (log(p0t));
+}
+
+/*
+ |
+ | The probability of having one lineage remaining after time t
+ | in the birth-death process.
+ |
+ | param: t - speciation time
+ | param: b - birth rate
+ | param: d - death rate
+ | return: log probability of one remaining lineage
+ |
+ */
+MrBFlt LnP1 (MrBFlt t, MrBFlt b, MrBFlt d)
+{
+    MrBFlt      p0t;
+    
+    p0t = 2.0 * log(b-d) - (b-d)*t;
+    
+    p0t -= 2.0 * log(b - d*exp((d-b)*t));
+    
+    return p0t;
+}
+
+/*
+ |
+ | The probability of having one lineage remaining after time t
+ | in the birth-death process.
+ |
+ | param: t - speciation time
+ | param: b - birth rate
+ | param: d - death rate
+ | param: f - sample frequency
+ | return: log probability of one remaining lineage
+ |
+ */
+MrBFlt LnP1Subsample (MrBFlt t, MrBFlt b, MrBFlt d, MrBFlt f)
+{
+    MrBFlt      p0t;
+    
+    p0t = (b-d) / (f*b + (b*(1.0-f)-d)*exp((d-b)*t));
+    
+    return (2.0*log(p0t) + (d-b)*t);
+}
+
+
+/* probability that an individual alive at time t before today has
+   no sampled extinct or extant descendants
+ */
+MrBFlt LnP0_fossil (MrBFlt t, MrBFlt lambda, MrBFlt mu, MrBFlt psi, MrBFlt c1, MrBFlt c2)
+{
+    MrBFlt other;
+    
+    // c1 = sqrt(pow(lambda-mu-psi, 2) + 4*lambda*psi);
+    // c2 = (-lambda + mu + 2*lambda*rho + psi) / c1;
+    other = (exp(-c1 *t) * (1 - c2) - (1 + c2)) / (exp(-c1 *t) * (1 - c2) + (1 + c2));
+    
+    return log(0.5) + log(lambda + mu + psi + c1 * other) - log(lambda);
+}
+
+/* probability that an individual alive at time t before today has
+   precisely one sampled extant descendant and no sampled extinct descendant
+ */
+MrBFlt LnP1_fossil (MrBFlt t, MrBFlt rho, MrBFlt c1, MrBFlt c2)
+{
+    MrBFlt other;
+    
+    // c1 = sqrt(pow(lambda-mu-psi, 2) + 4*lambda*psi);
+    // c2 = (-lambda + mu + 2*lambda*rho + psi) / c1;
+    other = 2.0 * (1- c2*c2) * exp(-c1 *t) + pow(1-c2, 2) * exp(-2 *c1 *t) + pow(1+c2, 2);
+    
+    return log(4.0) + log(rho) - c1 *t - log(other);
+}
+
+
+/* return which time interval t is in */
+int Slice_i (MrBFlt t, MrBFlt *t_f, int sl)
+{
+    int i = 0;
+    assert (t > 0.0 && sl >= 0);
+
+    /* we need some tolerance here, for t[i] < t <= t[i-1] to return i */
+    while (t < t_f[i] + BRLENS_MIN/5)
+        {
+        i++;
+        if (i > sl)
+            return sl;
+        }
+    return i;
+}
+
+/* probability density of an individual at time t giving rise to an edge
+   between time t and t_i with q_i(t_i) = 1
+ */
+MrBFlt  LnQi_fossil (MrBFlt t, MrBFlt *t_f, int sl, MrBFlt *c1, MrBFlt *c2)
+{
+    MrBFlt lnq;
+    int i = Slice_i (t, t_f, sl);
+    
+    lnq = log(4.0) +c1[i] *(t_f[i] -t);
+    lnq -= 2.0 * log(1 +c2[i] +(1 -c2[i]) *exp(c1[i] *(t_f[i] -t)));
+    
+    return lnq;
+}
+
+/* an individual at time t has no sampled descendants when the process is stopped
+   (i.e., at time t_s), with t_i < t <= t_{i-1} (i = 1,..,s)
+ */
+MrBFlt  LnPi_fossil (MrBFlt t, MrBFlt *t_f, int sl, MrBFlt *c1, MrBFlt *c2, MrBFlt *lambda, MrBFlt *mu, MrBFlt *psi)
+{
+    MrBFlt other;
+    int i = Slice_i (t, t_f, sl);
+    
+    other = lambda[i] +mu[i] +psi[i] -c1[i] * (1 +c2[i] -(1 -c2[i]) *exp(c1[i] *(t_f[i] -t)))
+                                            / (1 +c2[i] +(1 -c2[i]) *exp(c1[i] *(t_f[i] -t)));
+    return log(other) - log(2 *lambda[i]);
+}
+
+
+int LnFossilizationPriorPr (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt *sR, MrBFlt *eR, MrBFlt sF, MrBFlt *fR, char *sS)
+{
+    /* fossilization priors 
+     //chi */
+    
+    if (!strcmp(sS, "FossilTip"))
+        return LnFossilizedBDPriorFossilTip (t, clockRate, prob, *sR, *eR, sF, *fR);
+    else if (!strcmp(sS, "Random"))
+        return LnFossilizedBDPriorRandom    (t, clockRate, prob, sR, eR, sF, fR);
+    else if (!strcmp(sS, "Diversity"))
+        return LnFossilizedBDPriorDiversity (t, clockRate, prob, sR, eR, sF, fR);
+    else
+        {
+        MrBayesPrint ("%s   Sampling strategy %s for fossilized birth-death process not implemented\n", spacer, sS);
+        return (ERROR);
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+ |
+ |                                          time  ___  0
+ |     \                            /            |
+ |      \                          /             |___  y2
+ |       \                   \    /              |
+ |        \                   \  /               |
+ |         \                   \/         x3  ___|
+ |          \                  /                 |___  y1
+ |           \         \      /                  |
+ |            \         \    /                   |
+ |             \         \  /                    |
+ |              \         \/              x2  ___|
+ |               \        /                      |
+ |                \      /                       |
+ |                 \    /                        |
+ |                  \  /                         |
+ |                   \/                   x1  ___|
+ |
+ |
+ |   T:   oriented tree
+ |   b:   birth (speciation) rate
+ |   d:   death (extintion) rate
+ |   p:   extant sampling rate
+ |   q:   fossil sampling rate
+ |   n:   number of extant taxa
+ |   m:   number of fossil tips
+ |
+ |
+ |                     [p1(x1)]^2    n+m-1            m    q
+ |   f(T|tmrca) = ---------------- * prod b*p1(xi) * prod -----  .
+ |                [1 - ^p0(x1)]^2    i=2             i=1  p1(yi)
+ |
+ |   f(tmrca) ~ uniform, gamma, etc (see treeAge).
+ |
+ ---------------------------------------------------------------------------------*/
+int LnFossilizedBDPriorFossilTip (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, MrBFlt sF, MrBFlt fR)
+{
+    /* special case: upon sampling the lineage is dead and won't produce descendants. Each extinct sample is a tip */
+    
+    int         i, n, m;
+    MrBFlt      x, lambda, rho, psi, tmrca, c1, c2, hatP0;
+    TreeNode    *p;
+    Model       *mp;
+    
+    /* sR = lambda-mu-psi, eR = (mu+psi)/lambda, fR = psi/(mu+psi) */
+    lambda = sR / (1.0 - eR);
+    psi    = lambda * eR * fR;
+    rho    = sF;
+    
+    tmrca = t->root->left->nodeDepth / clockRate;
+    c1 = sqrt(sR*sR + 4 *lambda *psi);
+    c2 = (2 *lambda *rho - sR) / c1;
+
+    /* calculate prior prob of the fbd tree */
+    (*prob) = 0.0;
+
+    for (n = m = i = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        x = p->nodeDepth / clockRate;
+
+        if (p->left != NULL && p->right != NULL)  // internal
+            {
+            if (p != t->root->left)
+                (*prob) += log(lambda) + LnP1_fossil(x, rho, c1, c2);
+            }
+        else if (p->left == NULL && p->right == NULL)  // tip
+            {
+            if (p->nodeDepth > 0.0)
+                {
+                (*prob) += log(psi) - LnP1_fossil(x, rho, c1, c2);
+                m++;
+                }
+            else
+                n++;
+            }
+        }
+
+    /* p_0 (t |psi=0, mu->mu+psi) */
+    hatP0 = 1.0 - rho*sR / (rho*lambda + (sR - rho*lambda) * exp(-sR*tmrca));
+    
+    (*prob) += 2.0 * (LnP1_fossil(tmrca, rho, c1, c2) - log(1 - hatP0));
+    
+    /* condition on tmrca, calibrations are dealt with separately */
+    mp = &modelParams[t->relParts[0]];
+    if (t->root->left->isDated == NO)
+        (*prob) += mp->treeAgePr.LnPriorProb(tmrca, mp->treeAgePr.priorParams);
+    
+    /* conversion to labeled tree from oriented tree , constant for a given dataset */
+    (*prob) += (n + m - 1) * log(2.0) - LnFactorial(n) - LnFactorial(m);
+
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+ |
+ |   LnFossilizedBDPriorRandom
+ |
+ |   Gavryushkina, A., D. Welch, T. Stadler, and A. Drummond. 2014. 
+ |       Bayesian inference of sampled ancestor trees for epidemiology and fossil calibration. PLoS Comp. Biol.
+ |   Zhang C., T. Stadler, S. Klopfstein, T. A. Heath, and F. Ronquist. 2015.
+ |       Total-Evidence Dating under the Fossilized Birth-Death Process. Syst. Biol.
+ |
+ |
+ |                                       0  _____________  t3, rho3
+ |     \                            /          |
+ |      \                          /           |___  y2
+ |       \                   \    /   _________|_________  t2, rho2
+ |        \                   \  /             |
+ |         \                   \/       x3  ___|
+ |          \                  /               |___  y1
+ |           \         \      /                |
+ |           _\         \    /        _________|_________  t1, rho1
+ |             \         \  /                  |
+ |              \         \/            x2  ___|
+ |               \        /                    |
+ |                \      /                     |
+ |                 \    /                      |
+ |                  \  /                       |
+ |                   \/                 x1  ___|_________  t_mrca
+ |
+ |
+ |    sl = 2, t1 > t2 > t3 = 0
+ |    E = 2, K = 1, M = 2
+ |
+ ---------------------------------------------------------------------------------*/
+int LnFossilizedBDPriorRandom (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt *sR, MrBFlt *eR, MrBFlt sF, MrBFlt *fR)
+{
+    /* Fossils in the past are sampled with piecewise constant rates, 
+       also in several time slices each with a seperate probability.
+       Extant taxa are sampled uniformly at random at time 0 (present). */
+    
+    int         i, j, sl, K, M, E;
+    MrBFlt      x, *lambda, *mu, *rho, *psi, *t_f, tmrca, *c1, *c2, *p_t;
+    TreeNode    *p;
+    Model       *mp;
+    
+    mp = &modelParams[t->relParts[0]];
+    
+    /* time of most recent common ancestor */
+    tmrca = t->root->left->nodeDepth / clockRate;
+    
+    /* get the number of fossil slice sampling events, s >= 0 */
+    sl = mp->sampleFSNum;
+    
+    /* alloc memory for time of each slice, t_f[sl] = 0 */
+    t_f    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    /* lambda, mu, psi */
+    lambda = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    mu     = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    psi    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    /* for sampling prob in each slice, including extant */
+    rho    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    /* A_i, B_i, ... */
+    c1     = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    c2     = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    p_t    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    
+    if (!lambda || !mu || !psi || !rho || !t_f || !c1 || !c2 || !p_t)
+        {
+        MrBayesPrint ("%s   ERROR: Problem allocating memory in LnFossilizedBDPriorRandom\n", spacer);
+        free(lambda); free(mu); free(psi); free(rho);
+        free(t_f); free(c1); free(c2); free(p_t);
+        }
+    
+    /* initialization */
+    for (i = 0; i <= sl; i++)
+        {
+        /* sR = lambda-mu, eR = mu/lambda, fR = psi/(mu+psi) */
+        lambda[i] = sR[i] / (1.0 - eR[i]);
+        mu[i] = lambda[i] * eR[i];
+        psi[i] = mu[i] * fR[i] / (1.0 - fR[i]);
+        if (i < sl) {
+            rho[i] = mp->sampleFSProb[i];
+            t_f[i] = mp->sampleFSTime[i];
+            }
+        }
+    rho[sl] = sF;
+    t_f[sl] = 0.0;
+
+    if (sl > 0)  assert (mp->sampleFSTime[0] < tmrca);
+    for (i = sl; i >= 0; i--)
+        {
+        c1[i] = sqrt(pow(lambda[i]-mu[i]-psi[i], 2) + 4*lambda[i]*psi[i]);
+        if (i == sl)
+            c2[i] = ((1 - 2* (1-rho[i])) *lambda[i] +mu[i] +psi[i]) /c1[i];
+        else
+            c2[i] = ((1 - 2* (1-rho[i]) *p_t[i+1]) *lambda[i] +mu[i] +psi[i]) /c1[i];
+        if (i > 0)
+            p_t[i] = (lambda[i] +mu[i] +psi[i] -c1[i] * (1 +c2[i] -(1 -c2[i]) *exp(c1[i] *(t_f[i] -t_f[i-1])))
+                                                      / (1 +c2[i] +(1 -c2[i]) *exp(c1[i] *(t_f[i] -t_f[i-1])))) *0.5/lambda[i];
+        else
+            p_t[i] = (lambda[i] +mu[i] +psi[i] -c1[i] * (1 +c2[i] -(1 -c2[i]) *exp(c1[i] *(t_f[i] -tmrca)))
+                                                      / (1 +c2[i] +(1 -c2[i]) *exp(c1[i] *(t_f[i] -tmrca)))) *0.5/lambda[i];
+        }
+    
+#   ifdef DEBUG_FBDPR
+    for (i = 0; i <= sl; i++)
+        printf ("%d: lambad=%lf mu=%lf psi=%lf t=%lf rho=%lf\n",i+1, lambda[i], mu[i], psi[i], t_f[i], rho[i]);
+    for (i = 0; i <= sl; i++)
+        printf ("%d: A=%lf B=%lf p%d(t%d)=%lf\n", i+1, c1[i], c2[i], i+1, i, p_t[i]);
+#   endif
+    
+    /* calculate prior prob of the fbd tree */
+    (*prob) = 0.0;
+    
+    for (K = M = E = 0, i = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        x = p->nodeDepth / clockRate;
+        
+        if (p->left != NULL && p->right != NULL)  // internal
+            {
+            if (p->left->length > 0.0 && p->right->length > 0.0)
+                {
+                if (p != t->root->left)
+                    (*prob) += log(lambda[Slice_i(x, t_f, sl)]) + LnQi_fossil(x, t_f, sl, c1,c2);
+                }
+            else
+                {
+                for (j = 0; j < sl; j++)
+                    if (AreDoublesEqual(p->nodeDepth, t_f[j]*clockRate, BRLENS_MIN/5) == YES)  break;
+                if (j == sl)      /* fossil ancestor between t[j-1] and t[j] */
+                    {
+                    (*prob) += log(psi[Slice_i(x, t_f, sl)]);
+                    }
+                else              /* fossil ancestor at silice time t[j] */
+                if (rho[j] > 0.0 && rho[j] < 1.0)
+                    {
+                    (*prob) += log(rho[j]) - log(1 - rho[j]);
+                    }
+                K++;              /* number of fossil ancestors */
+                }
+            }
+        else if (p->left == NULL && p->length > 0.0)  // tip
+            {
+            if (p->nodeDepth > 0.0)
+                {
+                for (j = 0; j < sl; j++)
+                    if (AreDoublesEqual(p->nodeDepth, t_f[j]*clockRate, BRLENS_MIN/5) == YES)  break;
+                if (j == sl)      /* fossil tip between t[j-1] and t[j] */
+                    {
+                    (*prob) += LnPi_fossil(x, t_f, sl, c1,c2, lambda,mu,psi)
+                             - LnQi_fossil(x, t_f, sl, c1,c2);
+                    (*prob) += log(psi[Slice_i(x, t_f, sl)]);
+                    }
+                else              /* fossil tip at silice time t[j] */
+                    {
+                    (*prob) += log(p_t[j+1]);
+                    if (rho[j] > 0.0)  (*prob) += log(rho[j]);
+                    }
+                M++;              /* number of fossil tips */
+                }
+            else
+                {
+                if (rho[sl] > 0.0)
+                    {
+                    (*prob) += log(rho[sl]);
+                    }
+                E++;              /* number of extant taxa */
+                }
+            }
+        
+        for (j = 0; j < sl; j++)  /* degree-two vertices at silice time t_j */
+            {
+            if (p->length > 0.0)
+                if ((p->nodeDepth +BRLENS_MIN/10 < t_f[j]*clockRate) && (t_f[j]*clockRate < p->anc->nodeDepth +BRLENS_MIN/10))
+                    {
+                    (*prob) += LnQi_fossil(t_f[j], t_f, sl, c1,c2);
+                    if (rho[j] < 1.0)  (*prob) += log(1 - rho[j]);
+                    }
+            }
+        }
+    
+    (*prob) += 2.0 * (LnQi_fossil(tmrca, t_f, sl, c1,c2) - log(1- p_t[0]));
+    
+    /* condition on tmrca, calibrations are dealt with separately */
+    if (t->root->left->isDated == NO)
+        (*prob) += mp->treeAgePr.LnPriorProb(tmrca, mp->treeAgePr.priorParams);
+    
+    /* conversion to labeled tree from oriented tree */
+    (*prob) += (M + E - 1) * log(2.0);  // - LnFactorial(E + M + K) (# permutation is constant given data)
+    
+#   ifdef DEBUG_FBDPR
+    printf ("K=%d M=%d E=%d\n", K, M, E);
+    printf ("prob=%lf\n", *prob);
+#   endif
+    
+    /* free memory */
+    free(lambda); free(mu); free(psi); free(rho);
+    free(t_f); free(c1); free(c2); free(p_t);
+    
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+ |
+ |   LnFossilizedBDPriorDiversity
+ | 
+ |   Zhang C., T. Stadler, S. Klopfstein, T. A. Heath, and F. Ronquist. 2015.
+ |       Total-Evidence Dating under the Fossilized Birth-Death Process. Syst. Biol.
+ |
+ ---------------------------------------------------------------------------------*/
+int LnFossilizedBDPriorDiversity (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt *sR, MrBFlt *eR, MrBFlt sF, MrBFlt *fR)
+{
+    /* Fossils in the past are sampled with piecewise constant rates, 
+       also in several time slices each with a seperate probability.
+       Extant taxa are sampled with prop sF to maximize diversity. */
+    
+    int         i, j, sl, K, M, E;
+    MrBFlt      x, x_min, t_min, M_x, *lambda, *mu, *rho, *psi, *t_f, tmrca, *c1, *c2, *p_t;
+    TreeNode    *p;
+    Model       *mp;
+    
+    mp = &modelParams[t->relParts[0]];
+    
+    /* time of most recent common ancestor */
+    tmrca = t->root->left->nodeDepth / clockRate;
+    
+    /* get the number of fossil slice sampling events, plus 1 extra slice (x_cut) to shift psi to 0 */
+    sl = mp->sampleFSNum + 1;
+    
+    /* alloc memory for time of each slice */
+    t_f    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    /* lambda, mu, psi */
+    lambda = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    mu     = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    psi    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    /* for sampling prob in each slice, including extant */
+    rho    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    /* A_i, B_i, ... */
+    c1     = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    c2     = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    p_t    = (MrBFlt *)SafeMalloc((size_t)(sl+1) * sizeof(MrBFlt));
+    
+    if (!lambda || !mu || !psi || !rho || !t_f || !c1 || !c2 || !p_t)
+        {
+        MrBayesPrint ("%s   ERROR: Problem allocating memory in LnFossilizedBDPriorDiversity\n", spacer);
+        free(lambda); free(mu); free(psi); free(rho);
+        free(t_f); free(c1); free(c2); free(p_t);
+        }
+    
+    /* get time of youngest fossil and internal node */
+    t_min = x_min = tmrca;
+    for (i = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->nodeDepth > 0.0)  //fossil
+            if (t_min > p->nodeDepth / clockRate)
+                t_min = p->nodeDepth / clockRate;
+        if (p->left != NULL && p->right != NULL &&
+            p->left->length > 0.0 && p->right->length > 0.0)
+            if (x_min > p->nodeDepth / clockRate)
+                x_min = p->nodeDepth / clockRate;
+        }
+
+    /* lower the cutoff time if not compatible */
+    if (x_min > t_min)
+        x_min = t_min;
+    if (sl > 1 && mp->sampleFSTime[sl-2] < x_min)
+        x_min = mp->sampleFSTime[sl-2];
+    
+    /* initialization (sl >= 1) */
+    for (i = 0; i < sl; i++)
+        {
+        /* sR = lambda-mu, eR = mu/lambda, fR = psi/(mu+psi) */
+        lambda[i] = sR[i] / (1.0 - eR[i]);
+        mu[i] = lambda[i] * eR[i];
+        psi[i] = mu[i] * fR[i] / (1.0 - fR[i]);
+        }
+    lambda[sl] = lambda[sl-1];
+    mu[sl] = mu[sl-1];
+    psi[sl] = 0.0;  // psi = 0 in [0, x_cut]
+    for (i = 0; i < sl-1; i++)
+        {
+        rho[i] = mp->sampleFSProb[i];
+        t_f[i] = mp->sampleFSTime[i];
+        }
+    rho[sl-1] = 0.0;
+    t_f[sl-1] = x_min * 0.95; // x_cut
+    rho[sl]   = 1.0;          // not sF
+    t_f[sl]   = 0.0;
+    
+    if (sl > 1)  assert (mp->sampleFSTime[0] < tmrca);
+    for (i = sl; i >= 0; i--)
+        {
+        c1[i] = sqrt(pow(lambda[i]-mu[i]-psi[i], 2) + 4*lambda[i]*psi[i]);
+        if (i == sl)
+            c2[i] = ((1 - 2* (1-rho[i])) *lambda[i] +mu[i] +psi[i]) /c1[i];
+        else
+            c2[i] = ((1 - 2* (1-rho[i]) *p_t[i+1]) *lambda[i] +mu[i] +psi[i]) /c1[i];
+        if (i > 0)
+            p_t[i] = (lambda[i] +mu[i] +psi[i] -c1[i] * (1 +c2[i] -(1 -c2[i]) *exp(c1[i] *(t_f[i] -t_f[i-1])))
+                                                      / (1 +c2[i] +(1 -c2[i]) *exp(c1[i] *(t_f[i] -t_f[i-1])))) *0.5/lambda[i];
+        else
+            p_t[i] = (lambda[i] +mu[i] +psi[i] -c1[i] * (1 +c2[i] -(1 -c2[i]) *exp(c1[i] *(t_f[i] -tmrca)))
+                                                      / (1 +c2[i] +(1 -c2[i]) *exp(c1[i] *(t_f[i] -tmrca)))) *0.5/lambda[i];
+        }
+    
+#   ifdef DEBUG_FBDPR
+    for (i = 0; i <= sl; i++)
+        printf ("%d: lambad=%lf mu=%lf psi=%lf t=%lf rho=%lf\n",i+1, lambda[i], mu[i], psi[i], t_f[i], rho[i]);
+    for (i = 0; i <= sl; i++)
+        printf ("%d: A=%lf B=%lf p%d(t%d)=%lf\n", i+1, c1[i], c2[i], i+1, i, p_t[i]);
+#   endif
+    
+    /* first calculate prob of the fbd tree assuming complete sampling */
+    (*prob) = 0.0;
+    
+    for (K = M = E = 0, i = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        x = p->nodeDepth / clockRate;
+        
+        if (p->left != NULL && p->right != NULL)  // internal
+            {
+            if (p->left->length > 0.0 && p->right->length > 0.0)
+                {
+                if (p != t->root->left)
+                    (*prob) += log(lambda[Slice_i(x, t_f, sl)]) + LnQi_fossil(x, t_f, sl, c1,c2);
+                }
+            else
+                {
+                for (j = 0; j < sl; j++)
+                    if (AreDoublesEqual(p->nodeDepth, t_f[j]*clockRate, BRLENS_MIN/5) == YES)  break;
+                if (j == sl)      /* fossil ancestor between t[j-1] and t[j] */
+                    {
+                    (*prob) += log(psi[Slice_i(x, t_f, sl)]);
+                    }
+                else              /* fossil ancestor at silice time t[j] */
+                if (rho[j] > 0.0 && rho[j] < 1.0)
+                    {
+                    (*prob) += log(rho[j]) - log(1 - rho[j]);
+                    }
+                K++;              /* number of fossil ancestors */
+                }
+            }
+        else if (p->left == NULL && p->length > 0.0)  // tip
+            {
+            if (p->nodeDepth > 0.0)
+                {
+                for (j = 0; j < sl; j++)
+                    if (AreDoublesEqual(p->nodeDepth, t_f[j]*clockRate, BRLENS_MIN/5) == YES)  break;
+                if (j == sl)      /* fossil tip between t[j-1] and t[j] */
+                    {
+                    (*prob) += LnPi_fossil(x, t_f, sl, c1,c2, lambda,mu,psi)
+                             - LnQi_fossil(x, t_f, sl, c1,c2);
+                    (*prob) += log(psi[Slice_i(x, t_f, sl)]);
+                    }
+                else              /* fossil tip at silice time t[j] */
+                    {
+                    (*prob) += log(p_t[j+1]);
+                    if (rho[j] > 0.0)  (*prob) += log(rho[j]);
+                    }
+                M++;              /* number of fossil tips */
+                }
+            else
+                {
+                //  (*prob) += log(rho[sl]);  // rho[sl] == 1
+                E++;              /* number of extant taxa */
+                }
+            }
+        
+        for (j = 0; j < sl; j++)  /* degree-two vertices at silice time t_j */
+            {
+            if (p->length > 0.0)
+                if ((p->nodeDepth +BRLENS_MIN/10 < t_f[j]*clockRate) && (t_f[j]*clockRate < p->anc->nodeDepth +BRLENS_MIN/10))
+                    {
+                    (*prob) += LnQi_fossil(t_f[j], t_f, sl, c1,c2);
+                    if (rho[j] < 1.0)  (*prob) += log(1 - rho[j]);
+                    }
+            }
+        }
+    
+    (*prob) += 2.0 * (LnQi_fossil(tmrca, t_f, sl, c1,c2) - log(1- p_t[0]));
+    
+    /* number of extant taxa not sampled */
+    M_x = (int)floor(E/sF + 0.5) - E; /* equal to round(E/sF) plus it is compatible with MS Visual Studio */
+    
+    /* then calculate the prob of the fbd tree assuming diversified sampling of extant */
+    (*prob) += M_x * (log(lambda[sl] * (1.0 - exp((mu[sl]-lambda[sl])*t_f[sl-1]))) - log(lambda[sl] - mu[sl] * exp((mu[sl]-lambda[sl])*t_f[sl-1])));
+    
+    /* condition on tmrca, calibrations are dealt with separately */
+    if (t->root->left->isDated == NO)
+        (*prob) += mp->treeAgePr.LnPriorProb(tmrca, mp->treeAgePr.priorParams);
+    
+    /* conversion to labeled tree from oriented tree */
+    (*prob) += (M + E - 1) * log(2.0);  // - LnFactorial(E + M + K) (# permutation is constant given data)
+    
+#   ifdef DEBUG_FBDPR
+    printf ("K=%d M=%d E=%d\n", K, M, E);
+    printf ("prob=%lf\n", *prob);
+#   endif
+    
+    /* free memory */
+    free(lambda); free(mu); free(psi); free(rho);
+    free(t_f); free(c1); free(c2); free(p_t);
+    
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LnCoalescencePriorPr
+|
+|   This function calculates the probability of a tree under the neutral
+|   coalescence prior with a (potentially) exponentially growing population.
+|   We assume a rooted tree that satisfies the molecular clock constraint. The
+|   Tree is labelled as follows:
+|
+|                                      t_4 ___  
+|     \         \         \        /            \
+|      \         \         \      /             | 
+|   I_4 \         \         \    /              | g_4
+|        \         \         \  /               |
+|         \         \         \/       t_3 ___  /
+|          \         \        /                 \
+|           \         \      /                  |
+|   I_3      \         \    /                   | g_3
+|             \         \  /                    |
+|              \         \/            t_2 ___  / 
+|               \        /                      \
+|                \      /                       |
+|   I_2           \    /                        | g_2
+|                  \  /                         |
+|                   \/                 t_1 ___  /
+|    
+|   Each interval on the tree is specified by successive coalescence events.
+|   These intervals are denoted I_2, I_3, I_4, ..., with the subscript denoting
+|   how many lineages exist in that interval. The time of each coalescence event
+|   is designated t_1, t_2, t_3, ..., where the subscript denotes the number
+|   of lineages that exist after the coalescence (t_3, for instance, would be
+|   the time of the coalescence that went from four lineages to three lineages).
+|   The duration of the i-th interval is designated g_i.
+|
+|   The probability of the coalescence tree is:
+|   
+|   prob = (k_C_2 / (N(t_k + t_k))) * exp(-integral_(from x=t_k, to g_k + t_k)  (k_C_2 / N(x)) dx)
+|
+|   where N(x) = N(0) * exp(-r*x). For the constant population size case,
+|   N(0) = N_e. r is the population growth parameter for the exponentially
+|   growing population. Here, theta = N(0) * mu when organisms are haploid and
+|   theta = 2 * N(0) * mu when the organism is diploid.
+|
+|   Below, ct holds the n - 1 coalescence times (t_i, above) sorted from the
+|   smallest to the largest. Remember that t_4 < t_3 < t_2, etc. 
+|
+|   2010-03-23
+|   The original function (described above) was incorrect in that it used theta = 2 * N * mu
+|   in one part of the equation and theta = 4 * N * mu in another. It is now corrected to
+|   consistently use theta = 4 * N * mu, which is the standard for diploid populations
+|   and theta = 2 * N * mu for haploid populations. The calculations are the same for the
+|   diploid and haploid cases, only the interpretation is different. See, e.g., Felsenstein
+|   (2004; Inferring Phylogenies). -- Fredrik.
+|
+---------------------------------------------------------------------------------*/
+int LnCoalescencePriorPr (Tree *t, MrBFlt *prob, MrBFlt theta, MrBFlt growth)
+{
+    int             i, j, k, nNodes;
+    MrBFlt          *ct, tempD, lastCoalescenceTime, coalescenceTime, intervalLength;
+    TreeNode        *p;
+
+    /* allocate space for the coalescence times */
+    ct = (MrBFlt *)SafeMalloc((size_t)(t->nIntNodes) * sizeof(MrBFlt));
+    if (!ct)
+        {
+        MrBayesPrint ("\n   ERROR: Problem allocating ct\n");
+        return (ERROR);
+        }
+
+    /* get the coalescence times and put them into a vector */
+    for (i=j=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        if (p->anc != NULL)
+            ct[j++] = p->nodeDepth;  // Don't divide clockRate here, as mu is already in theta
+        }
+    nNodes = j;
+
+    /* sort the coalescence times */
+    SortMrBFlt (ct, 0, nNodes-1);
+    
+    /*for (i=0, k=numLocalTaxa; i<nNodes; i++)
+        {
+        printf ("%4d -- %2d %lf\n", i, k, ct[i]);
+        k--;
+        }*/
+        
+    /* calculate probability of the tree */
+    if (AreDoublesEqual (growth, 0.0, 0.000001) == YES)
+        {
+        /* use this if there is no population growth */
+        tempD = lastCoalescenceTime = 0.0;
+        for (i=0, k=numLocalTaxa; i<nNodes; i++)
+            {
+            coalescenceTime = ct[i];
+            intervalLength = coalescenceTime - lastCoalescenceTime;
+            lastCoalescenceTime = ct[i];
+            tempD += - (k * (k-1) * intervalLength) / (theta);
+            k--;
+            }
+        (*prob) = (numLocalTaxa - 1) * log(2.0 / theta) + tempD;
+        }
+    else
+        {
+        /* use this if the population is growing exponentially */
+        tempD = lastCoalescenceTime = 0.0;
+        for (i=0, k=numLocalTaxa; i<nNodes; i++)
+            {
+            coalescenceTime = ct[i];
+            intervalLength = coalescenceTime - lastCoalescenceTime;
+            tempD += growth * coalescenceTime + (((k * (k-1)) / (theta * growth)) * (exp(growth * lastCoalescenceTime) - exp(growth * coalescenceTime)));
+            lastCoalescenceTime = ct[i];
+            k--;
+            }
+        (*prob) = (numLocalTaxa - 1) * log(2.0 / theta) + tempD;
+        }
+
+    /* printf ("coal pr = %lf theta = %lf, nNodes = %d, nt = %d tempD = %lf\n", *prob, theta, nNodes, numLocalTaxa, tempD); */
+
+    /* free memory */
+    free (ct);
+    
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LnUniformPriorPr
+|
+|   This function calculates the probability of a calibrated clock tree under the
+|   uniform prior probability distribution on node depths. The tree is labeled as
+|   follows:
+|                                                interval between tip dates 
+|    t_0                          t_1      time  ____  0 (interval between t_0 and t_1, duration 0) 
+|     \                            /            |  
+|      \                  t_2     /             |___   1 (interval between t_1 and t_2)
+|       \                   \    /              | 
+|        \                   \  /               |
+|         \                   \/        0.33 ___|      2 (interval between t_2 and t_3)
+|          \        t_3       /                 |___ 
+|           \         \      /                  |
+|            \         \    /                   | 
+|             \         \  /                    |
+|              \   t_4   \/             0.67 ___| 
+|               \     \  /                      |      3 (interval between t_3 and root)
+|                \     \/                       |
+|                 \    /                        |      Note that t_4 is irrelevant for intervals
+|                  \  /                         |      because we need not have a single coalescent
+|                   \/                  1.00 ___|___   event beneath t_4 except for the root.
+|    
+|   The probability depends on the number of nodes falling in each interval between
+|   tip dates, the time interval on which each node depth can vary (if it is interior
+|   node number i, it can vary on the interval (t_{i+1},1)). Finally, the probability
+|   is multiplied by the number of coalescent histories compatible with the node order.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt LnUniformPriorPr (Tree *t, MrBFlt clockRate)
+{
+    int         i, j, k, *nLineages=NULL, nDatedTips, nLineagesIn, nLineagesOut, nTips;
+    MrBFlt      lnProb, treeAge, *nodeDepths=NULL;
+    TreeNode    *p, *root;
+    Model       *mp;
+
+    lnProb      = 0.0;
+    mp          = &modelParams[t->relParts[0]];
+    treeAge     = t->root->left->nodeDepth / clockRate;
+    assert (t->root->left->isDated == NO || AreDoublesEqual(treeAge, t->root->left->age, 0.000001) == YES);
+
+    /* Calculate number of tips for convenience */
+    nTips   = t->nNodes - t->nIntNodes - 1;
+
+    /* First take tree age into account f(t_0) */
+    if (t->root->left->isDated == YES)
+        {
+        lnProb += 0.0;  /* calibrations are dealt with separately in calling function */
+        }
+    else
+        {
+        lnProb += mp->treeAgePr.LnPriorProb(treeAge, mp->treeAgePr.priorParams);
+        }
+
+    /* If tree is not calibrated or only root is calibrated, it is easy */
+    for (i=j=0; i<t->nNodes-2; i++)
+        {
+        if (t->allDownPass[i]->isDated == YES)
+            j++;
+        }
+    if (j == 0)
+        {
+        /* Calculate simple probability f(tau|t_0) */
+        lnProb += (nTips - 1.0)*log(2.0) - LnFactorial(nTips) - log(nTips-1.0) - (nTips - 2.0)*log(treeAge);
+        assert (lnProb > NEG_INFINITY);
+        return lnProb;
+        }
+
+    /* We have a tree with interior or tip calibrations */
+
+    /* Color subtrees by assigning an index 1,...,k to the x variable of each node,
+       where k is the total number of separate subtrees. A subtree is characterized
+       by having all interior nodes being unconstrained and all tips being either
+       terminals or constrained interior nodes. The root of a subtree may be the
+       root of the tree, or an interior node that is constrained and dated, or an
+       interior node that is constrained but not dated. */
+    i = 0;
+    ColorClusters (t->root->left, &i);
+
+    /* Get the probability for each subtree */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        
+        /* Skip unless this is the root of a subtree */
+        if (p->anc->anc != NULL && p->isDated != YES)
+            continue;
+
+        /* Save the root of the subtree */
+        root = p;
+
+        /* Create an array containing the sorted times */
+
+        /* Allocate space for node depths */
+        nDatedTips = NumDatedTips (root);
+        nodeDepths = (MrBFlt *) SafeRealloc ((void *)nodeDepths, (nDatedTips+1)*sizeof(MrBFlt));
+
+        /* Get the dated node depths and sort them. The call to GetDatedNodeDepths also
+           returns the root node depth into nodeDepths, which is convenient. For now, this
+           only works for dated tips, not for constrained but undated interior nodes. */
+        GetDatedNodeDepths (root, nodeDepths);
+        SortMrBFlt (nodeDepths, 0, nDatedTips);   /* use index of left and right in call */
+
+        /* Get probability due to the uniform node depths; we do not use first and last tip depth
+           for obvious reasons (see figure above) */
+        for (j=1; j<nDatedTips-1; j++)
+            lnProb -= log ((root->nodeDepth - nodeDepths[j]) / clockRate);
+
+        /* Get probability due to sorting of interior node depths */
+        
+        /* First get the potential number of lineages leaving each interval j at time nodeDepths[j+1] */
+        nLineages = (int *) SafeRealloc ((void *)nLineages, nDatedTips*sizeof(int));
+        for (j=0; j<nDatedTips; j++)
+            nLineages[j] = j+1;
+        
+        /* Subtract interior nodes so that we get the real number of lineages leaving each interval.
+           The number of lineages entering each interval is always 1 + the number of lineages
+           leaving the previous interval. We utilize the fact here that the last node depth is the
+           root node depth and is held in nodeDepths[nDatedTips] */
+        for (j=0; j<t->nIntNodes; j++)
+            {
+            p = t->intDownPass[j];
+            if (p->x != root->x || p == root || p->isDated == YES)
+                continue;
+            for (k=0; k<nDatedTips; k++)
+                if (p->nodeDepth < nodeDepths[k+1])
+                        nLineages[k]--;
+            }
+        
+        /* Now get the density effect of the sorting constraints */
+        for (j=1; j<nDatedTips-1; j++)
+            {
+            nLineagesIn = nLineages[j-1] + 1;
+            if (j==nDatedTips-2)
+                nLineagesOut = 2;    /* skip the last segment and jump directly to root */
+            else
+                nLineagesOut = nLineages[j];
+            /* only calculate if ln different from 0 */
+            if (nLineagesIn > 1 && nLineagesIn - nLineagesOut >= 1)
+                {
+                lnProb += LnFactorial (nLineagesIn-1) - LnFactorial(nLineagesOut-1);
+                }
+            }
+
+        /* Finally get the effect of the number of possible coalescent histories */
+        for (j=1; j<nDatedTips; j++)
+            {
+            nLineagesIn = nLineages[j-1] + 1;
+            nLineagesOut = nLineages[j];
+            if (nLineagesIn != nLineagesOut)
+                {
+                lnProb += log(2.0) * (nLineagesIn - nLineagesOut);
+                lnProb += LnFactorial (nLineagesOut) + LnFactorial (nLineagesOut-1);
+                lnProb -= LnFactorial (nLineagesIn)  + LnFactorial (nLineagesIn-1);
+                }
+            }
+
+        /* Last but not least, change color of root so that it can be a tip in the next
+           subtree (if we wanted to use the colors). */
+        root->x = root->anc->x;
+
+        }
+
+    free (nodeDepths);
+    free (nLineages);
+
+    assert (lnProb > NEG_INFINITY);
+
+    return lnProb;
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   NewtonRaphsonBrlen: Find one maximum likelihood branch length using
+|      the Newton-Raphson method. This function assumes that the tree is
+|      a non-clock tree. For clock trees, you have to optimize the node
+|      depths instead.
+|
+------------------------------------------------------------------------*/
+int NewtonRaphsonBrlen (Tree *t, TreeNode *p, int chain)
+{
+    int         c, i, j, s, k, n, d, division, nIterations, maxNumIterations,
+                index, *rateCat, r;
+    MrBFlt      vOld, *pi, *cijk, *eigenValues, *catRate, baseRate, length, theRate, tolerance,
+                expLambdaV[64], pInvar=0.0, likeI=0.0, sum=0.0, sum1, sum2, beta, w, v, x, y, expBetaV,
+                expWV, kappa, bigPi, *ptr;
+    CLFlt       *nSitesOfPat, *clP, *clA, *tiP, *tiP1, *tiP2, like, like1, like2, CLsum, CLsum1, CLsum2,
+                freq, sumLike1, sumLike2, *lnScaler=NULL, *clInvar=NULL;
+    ModelInfo   *m;
+
+    /* TODO: Standard model (also check RES for ascertainment bias) */
+    tolerance = 0.001;
+    maxNumIterations = 5;
+    
+    nIterations = 0;
+    do {
+        /* reset f'(v) and f''(v) sums */
+        sumLike1 = sumLike2 = 0.0;
+        
+        /* cycle over character partitions */
+        for (d=0; d<t->nRelParts; d++)
+            {
+            division = t->relParts[d];
+
+            /* get pointer to model */
+            m = &modelSettings[division];
+            
+            /* get number of model states */
+            n = m->numModelStates;
+            
+            /* find conditional likelihoods */
+            clP = m->condLikes[m->condLikeIndex[chain][p->index     ]];
+            clA = m->condLikes[m->condLikeIndex[chain][p->anc->index]];
+            
+            /* get state frequencies */
+            pi = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+            /* get base rate */
+            theRate = 1.0;
+            baseRate = GetRate (division, chain);
+
+            /* get category rates */
+            if (m->shape == NULL)
+                catRate = &theRate;
+            else
+                catRate = GetParamSubVals (m->shape, chain, state[chain]);
+    
+            /* find category frequencies and some additional stuff for the invar model */
+            if (m->pInvar == NULL)
+                freq =  (CLFlt) (1.0 /  m->numGammaCats);
+            else
+                {
+                /* invariable sites model */
+                pInvar = * GetParamVals(m->pInvar, chain, state[chain]);
+                freq = (CLFlt) ((1.0 - pInvar) /  m->numGammaCats);
+                baseRate /= (1.0 - pInvar);
+                clInvar = m->invCondLikes;
+                lnScaler = m->scalers[m->siteScalerIndex[chain]];
+                }
+
+            /* find the branch lengths times any correction factor to make them
+               in terms of expected number of substitutions per character */
+            length = p->length;
+            if (m->dataType == DNA || m->dataType == RNA)
+                {
+                if (m->nucModelId == NUCMODEL_DOUBLET)
+                    length *= 2.0;
+                else if (m->nucModelId == NUCMODEL_CODON)
+                    length *= 3.0;
+                }
+
+            /* find nSitesOfPat */
+            nSitesOfPat = numSitesOfPat + ((chainId[chain] % chainParams.numChains)*numCompressedChars) + m->compCharStart;
+            
+            /* get tiProbs for current length; use the scratch location */
+            FlipTiProbsSpace(m, chain, p->index);
+            m->TiProbs (p, division, chain);
+            tiP = m->tiProbs[m->tiProbsIndex[chain][p->index]];
+            FlipTiProbsSpace(m, chain, p->index);
+
+            /* allocate space for first and second derivatives */
+            tiP1 = (CLFlt *) SafeCalloc (2*m->tiProbLength, sizeof (CLFlt));
+            if (!tiP1)
+                return (ERROR);
+            tiP2 = tiP1 + m->tiProbLength;
+            
+            /* calculate first and second derivatives of P(v): P'(v) and P''(v) */
+            index = 0;
+            if (m->TiProbs == &TiProbs_Fels || m->TiProbs == &TiProbs_Res)
+                {
+                /* calculate beta */
+                sum = 0.0;
+                for (i=0; i<m->numModelStates; i++)
+                    for (j=i+1; j<m->numModelStates; j++)
+                        sum += pi[i]*pi[j];
+                beta = 0.5 / sum;
+
+                /* calculate derivatives */
+                for (k=0; k<m->numGammaCats; k++)
+                    {
+                    v = length * catRate[k] * baseRate;
+                    expBetaV = exp (- beta * v);
+                    for (i=0; i<m->numModelStates; i++)
+                        {
+                        for (j=0; j<m->numModelStates; j++)
+                            {
+                            if (i == j)
+                                {
+                                x = - beta * (1.0 - pi[j]) * expBetaV;
+                                tiP1[index] = (CLFlt) x;
+                                tiP2[index] = (CLFlt) (- beta * x);
+                                }
+                            else
+                                {
+                                x = beta * pi[j] * expBetaV;
+                                tiP1[index] = (CLFlt) x;
+                                tiP2[index] = (CLFlt) (- beta * x);
+                                }
+                            index++;
+                            }
+                        }
+                    }
+                }
+            else if (m->TiProbs == &TiProbs_Hky)
+                {
+                /* get kappa */
+                kappa =  *GetParamVals (m->tRatio, chain, state[chain]);
+    
+                /* calculate beta */
+                sum = 0.0;
+                for (i=0; i<m->numModelStates; i++)
+                    {
+                    for (j=i+1; j<m->numModelStates; j++)
+                        {
+                        if (j - i == 2)
+                            sum += kappa * pi[i] * pi[j];
+                        else
+                            sum += pi[i] * pi[j];
+                        }
+                    }
+                beta = 0.5 / sum;
+
+                /* calculate derivatives */
+                for (k=0; k<m->numGammaCats; k++)
+                    {
+                    v = length * catRate[k] * baseRate;
+                    expBetaV = exp (- beta * v);
+                    for (i=0; i<m->numModelStates; i++)
+                        {
+                        for (j=0; j<m->numModelStates; j++)
+                            {
+                            s = (j + 2) % 4;
+                            bigPi = pi[j] + pi[s];
+                            w = (1.0 + bigPi * (kappa - 1.0)) * beta;
+                            expWV = exp (- w * v);
+                            if (i == j)
+                                {
+                                x = - beta * ((pi[j]/bigPi) - pi[j]) * expBetaV;
+                                y = - w * (pi[s]/bigPi) * expWV;
+                                tiP1[index] = (CLFlt) (x + y);
+                                tiP2[index] = (CLFlt) (- beta * x - w * y);
+                                }
+                            else if (abs(i-j) == 2)
+                                {
+                                x = - beta * pi[j] * ((pi[j]/bigPi) - pi[j]) * expBetaV;
+                                y = w * (pi[j]/bigPi) * expWV;
+                                tiP1[index] = (CLFlt) (x + y);
+                                tiP2[index] = (CLFlt) (- beta * x - w * y);
+                                }
+                            else
+                                {
+                                x = beta * pi[j] * expBetaV;
+                                tiP1[index] = (CLFlt) x;
+                                tiP2[index] = (CLFlt) (- beta * x);
+                                }
+                            index++;
+                            }
+                        }
+                    }
+                }
+            else if (m->TiProbs == &TiProbs_Gen || m->TiProbs == &TiProbs_GenCov)
+                {
+                /* get eigenvalues and cijk pointers */
+                eigenValues = m->cijks[m->cijkIndex[chain]];
+                cijk        = eigenValues + (2 * n);
+
+                /* calculate P'(v) and P''(v) */
+                for (k=0; k<m->numGammaCats; k++)
+                    {
+                    v = length * catRate[k];
+                    for (s=0; s<n; s++)
+                        expLambdaV[s] =  exp(eigenValues[s] * v);
+                    ptr = cijk;
+                    for (i=0; i<n; i++)
+                        {
+                        for (j=0; j<n; j++)
+                            {
+                            sum1 = sum2 = 0.0;
+                            for (s=0; s<n; s++)
+                                {
+                                if (fabs(eigenValues[s]) > 0.000001)
+                                    {
+                                    x = eigenValues[s] * (*ptr++) * expLambdaV[s];
+                                    sum1 += x;
+                                    sum2 += eigenValues[s] * x;
+                                    }
+                                else
+                                    ptr += n;
+                                }
+                            tiP1[index] = (CLFlt) ((sum1 < 0.0) ? 0.0 : sum);
+                            tiP2[index] = (CLFlt) ((sum2 < 0.0) ? 0.0 : sum);
+                            index++;
+                            }
+                        }
+                    }
+                }
+            else if (m->TiProbs == &TiProbs_GenCov)
+                {
+                /* get eigenvalues and cijk pointers */
+                eigenValues = m->cijks[m->cijkIndex[chain]];
+                cijk        = eigenValues + (2 * n);
+
+                /* calculate P'(v) and P''(v) */
+                for (k=0; k<m->numTiCats; k++)
+                    {
+                    if (m->numGammaCats > 1)
+                        v = length * catRate[k];
+                    else
+                        v = length;
+                    for (s=0; s<n; s++)
+                        expLambdaV[s] =  exp(eigenValues[s] * v);
+                    for (i=0; i<n; i++)
+                        {
+                        for (j=0; j<n; j++)
+                            {
+                            sum1 = sum2 = 0.0;
+                            for (s=0; s<n; s++)
+                                {
+                                if (fabs(eigenValues[s]) > 0.000001)
+                                    {
+                                    x = eigenValues[s] * (*cijk++) * expLambdaV[s];
+                                    sum1 += x;
+                                    sum2 += eigenValues[s] * x;
+                                    }
+                                }
+                            tiP1[index] = (CLFlt) ((sum1 < 0.0) ? 0.0 : sum);
+                            tiP2[index] = (CLFlt) ((sum2 < 0.0) ? 0.0 : sum);
+                            index++;
+                            }
+                        }
+                    /* get new eigenvalues and cijks */
+                    eigenValues += m->cijkLength / m->nCijkParts;
+                    cijk         = eigenValues + 2 * n;
+                    }
+                }
+            /* calculate f(v), f'(v) and f''(v) for this partition */
+            /* note that the scalers are irrelevant because they disappear when
+               we take the derivative of the log likelihood */
+            if (m->gibbsGamma == YES)
+                {
+                /* find rate category index */
+                rateCat = m->tiIndex + chain*m->numChars;
+                for (c=0; c<m->numChars; c++)
+                    {
+                    like = like1 = like2 = 0.0;
+                    r = rateCat[c];
+                    if (r < m->numGammaCats)
+                        {
+                        index = r*m->numModelStates*m->numModelStates;
+                        for (j=0; j<n; j++)
+                            {
+                            CLsum = CLsum1 = CLsum2 = 0.0;
+                            for (i=0; i<n; i++, index++)
+                                {
+                                CLsum += clP[i] * tiP[index];
+                                CLsum1 += clP[i] * tiP1[index];
+                                CLsum2 += clP[i] * tiP2[index];
+                                }
+                            like += CLsum * (CLFlt) pi[j] * clA[j];
+                            like1 += CLsum1 * (CLFlt) pi[j] * clA[j];
+                            like2 += CLsum2 * (CLFlt) pi[j] * clA[j];
+                            }
+                        like *= freq;
+                        sumLike1 += nSitesOfPat[c] * (like1 / like);
+                        sumLike2 += nSitesOfPat[c] * (like2 * like - like1 * like1) / (like * like);
+                        }
+                    clP += n;
+                    }
+                }
+            else
+                {
+                for (c=0; c<m->numChars; c++)
+                    {
+                    like = like1 = like2 = 0.0;
+                    index = 0;
+                    for (k=0; k<m->numTiCats; k++)
+                        {
+                        for (j=0; j<n; j++)
+                            {
+                            CLsum = CLsum1 = CLsum2 = 0.0;
+                            for (i=0; i<n; i++, index++)
+                                {
+                                CLsum += clP[i] * tiP[index];
+                                CLsum1 += clP[i] * tiP1[index];
+                                CLsum2 += clP[i] * tiP2[index];
+                                }
+                            like += CLsum * (CLFlt) pi[j] * clA[j];
+                            like1 += CLsum1 * (CLFlt) pi[j] * clA[j];
+                            like2 += CLsum2 * (CLFlt) pi[j] * clA[j];
+                            }
+                        clP += n;
+                        }
+                    like *= freq;
+                    if (m->pInvar != NULL)
+                        {
+                        /* get right like; like1 and like2 not affected */;
+                        for (i=0; i<n; i++)
+                            likeI += (*clInvar++) * pi[i];
+                        likeI *= pInvar;
+                        if (lnScaler[c] < -200.0)
+                            {
+                            /* we are not going to be able to exponentiate the scaling factor */
+                            if (likeI > 1E-70)
+                                {
+                                /* forget about like; it is going to be insignificant compared to likeI */
+                                like = (CLFlt) likeI;
+                                }
+                            else
+                                {
+                                /* treat likeI as if 0.0, that is, ignore it completely */
+                                like = like + (CLFlt)(0.0);
+                                }
+                            }
+                        else    /* take both likeI and like into account */
+                            like = like + (CLFlt) (likeI * exp (-lnScaler[c]));
+                        }
+                    sumLike1 += nSitesOfPat[c] * (like1 / like);
+                    sumLike2 += nSitesOfPat[c] * (like2 * like - like1 * like1) / (like * like);
+                    }
+                }
+            free (tiP1);
+            }
+        vOld = p->length;
+        p->length -= sumLike2 / sumLike1;
+        nIterations++;
+        } while (fabs(p->length - vOld) > tolerance && nIterations < maxNumIterations);
+
+    return (NO_ERROR);
+}
+
+
+void NodeToNodeDistances (Tree *t, TreeNode *fromNode)
+{
+    int             i;
+    TreeNode        *p;
+    
+    /* set all distances to 0.0 and also set marks on all nodes to NO */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = NO;
+        p->d = 0.0;
+        }
+        
+    /* find distances, and mark path, below "fromNode" */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p == fromNode)
+            {
+            p->x = YES;
+            }
+        if (p->left != NULL && p->right != NULL && p->anc != NULL)
+            {
+            if (p->left->x == YES)
+                {
+                p->x = YES;
+                p->d = p->left->d + p->left->length;
+                }
+            else if (p->right->x == YES)
+                {
+                p->x = YES;
+                p->d = p->right->d + p->right->length;
+                }
+            }
+        }
+        
+    /* find all other distances */
+    for (i=t->nNodes-1; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        if (p->anc == NULL)
+            {
+            if (p == fromNode)
+                p->d = 0.0;
+            else
+                p->d = p->left->d + p->left->length;
+            }
+        else
+            {
+            if (p->x == NO)
+                {
+                p->d = p->anc->d + p->length;
+                }
+            }
+        }
+}
+
+
+int NumCppEvents (Param *p, int chain)
+{
+    int         i, *nEvents, sumEvents;
+
+    nEvents = p->nEvents[2*chain+state[chain]];
+    
+    sumEvents = 0;
+    for (i=0; i<2*numLocalTaxa-2; i++)
+        sumEvents += nEvents[i];
+
+    return (sumEvents);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   OpenNewMBPrintFile: Open a file the first time for printing
+|
+------------------------------------------------------------------------*/
+FILE *OpenNewMBPrintFile (char *fileName)
+{
+    int     overWrite;
+    FILE    *fp;
+
+    /* Open file, use noWarn to determine if the user should be prompted
+       to have the file over-written or appended. */
+    if (noWarn == YES)
+        {
+        /* overwrite or append file, if already present */
+        if ((fp = TestOpenTextFileR(fileName)) != NULL)
+            {
+            SafeFclose (&fp);
+            if (autoOverwrite == NO)
+                {
+                MrBayesPrint ("%s   Appending to file \"%s\"\n", spacer, fileName); 
+                return (OpenTextFileA(fileName));
+                }
+            else 
+                MrBayesPrint ("%s   Overwriting file \"%s\"\n", spacer, fileName);      
+            }
+            return (OpenTextFileW(fileName));
+        }   
+    else
+        {
+        /* prompt user if file is already present */
+        if ((fp = TestOpenTextFileR(fileName)) != NULL)
+            {
+            SafeFclose (&fp);
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   File \"%s\" already exists\n", spacer, fileName);
+            overWrite = WantTo ("Overwrite information in this file");
+            
+            if (overWrite == YES)
+                {
+                MrBayesPrint ("%s   Overwriting file \"%s\"\n", spacer, fileName);
+                return (OpenTextFileW(fileName));
+                }
+            else
+                {
+                MrBayesPrint ("%s   Appending to file \"%s\"\n", spacer, fileName);
+                return (OpenTextFileA(fileName));
+                }
+            }
+
+        else
+            {
+            /* file is not present */
+            return (OpenTextFileW(fileName));
+            }
+        }
+}
+
+
+int PickProposal (RandLong *seed, int chainIndex)
+{
+    MrBFlt      ran;
+    int         i;
+
+    ran = RandomNumber(seed);
+    
+    for (i=0; usedMoves[i]->cumProposalProb[chainIndex] <= ran; i++);
+        
+    return i;
+}
+
+
+/* Calculate positive selection probabilities */
+int PosSelProbs (TreeNode *p, int division, int chain)
+{
+    int             c, j, k, nStates;
+    MrBFlt          catLike, *like, *bs, *omegaCatFreq, *omega,
+                    posProb, *ps, sum;
+    CLFlt           **clP;
+    ModelInfo       *m;
+    
+    /* find model partition */
+    m = &modelSettings[division];
+
+    /* allocate space for conditional likelihood pointer array and site likelihood array */
+    clP  = (CLFlt **) calloc (m->numOmegaCats, sizeof(CLFlt *));
+    like = (MrBFlt *) calloc (m->numOmegaCats, sizeof(MrBFlt));
+    if (!clP || !like)
+        {
+        MrBayesPrint ("%s   ERROR: Out of memory in PosSelProbs\n", spacer);
+        return (ERROR);
+        }
+    
+    /* number of states */
+    nStates = m->numModelStates;
+
+    /* find conditional likelihoods */
+    clP[0] = m->condLikes[m->condLikeIndex[chain][p->index]];
+    for (k=1; k<m->numOmegaCats; k++)
+        clP[k] = clP[0] + k*m->numModelStates*m->numChars;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find category frequencies */
+    omegaCatFreq = GetParamSubVals (m->omega, chain, state[chain]);
+    
+    /* get category omegas */
+    omega = GetParamVals (m->omega, chain, state[chain]);
+
+    /* find posSelProbs */
+    ps = posSelProbs + m->compCharStart;
+    for (c=0; c<m->numChars; c++)
+        {
+        sum = 0.0;
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            like[k] = 0.0;
+            catLike = 0.0;
+            for (j=0; j<nStates; j++)
+                catLike += clP[k][j] * bs[j];
+            like[k] = catLike * omegaCatFreq[k];
+            sum += like[k];
+            clP[k] += nStates;
+            }
+        posProb = 0.0;
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            if (omega[k] > 1.0)
+                posProb += like[k] / sum;
+            }
+        ps[c] = posProb;
+        }
+
+    free (clP);
+    free (like);
+    
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/* Calculate positive selection probabilities (SSE version) */
+int PosSelProbs_SSE (TreeNode *p, int division, int chain)
+{
+    int             i, c1, c2, j, k, nStates;
+    CLFlt           **catLike, *siteLike;
+    MrBFlt          *bs, *omegaCatFreq, *omega,
+                    posProb, *ps;
+    __m128          m1, m2, *clPtr, **clP, mSiteLike, *mCatLike;
+    ModelInfo       *m;
+    
+    /* find model partition */
+    m = &modelSettings[division];
+    
+    /* number of states */
+    nStates = m->numModelStates;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find category frequencies */
+    omegaCatFreq = GetParamSubVals (m->omega, chain, state[chain]);
+    
+    /* get category omegas */
+    omega = GetParamVals (m->omega, chain, state[chain]);
+    /* allocate space for category likelihood arrays */
+    catLike = (CLFlt **) calloc (m->numOmegaCats, sizeof(CLFlt *));
+    mCatLike = (__m128 *) calloc (m->numOmegaCats, sizeof(__m128));
+    if (!catLike || !mCatLike)
+        {
+        MrBayesPrint ("%s   ERROR: Out of memory in PosSelProbs_SSE\n", spacer);
+        return (ERROR);
+        }
+
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP_SSE;
+    for (k=0; k<m->numOmegaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * nStates;
+        catLike[k] = (CLFlt *) (&(mCatLike[k]));
+        }
+    siteLike = (CLFlt *) (&mSiteLike);
+    
+    /* find posSelProbs */
+    ps = posSelProbs + m->compCharStart;
+    for (c1=c2=0; c1<m->numSSEChars; c1++)
+        {
+        mSiteLike = _mm_setzero_ps ();
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            mCatLike[k] = _mm_setzero_ps();
+            m1 = _mm_setzero_ps ();
+            for (j=0; j<nStates; j++)
+                {
+                m2 = _mm_mul_ps (clP[k][j], _mm_set1_ps ((CLFlt)bs[j]));
+                m1 = _mm_add_ps (m1, m2);
+                }
+            mCatLike[k] = _mm_mul_ps (m1, _mm_set1_ps ((CLFlt)omegaCatFreq[k]));
+            mSiteLike = _mm_add_ps (mSiteLike, mCatLike[k]);
+            clP[k] += nStates;
+            }
+
+        for (i=0; i<FLOATS_PER_VEC && c2 < m->numChars; ++i, ++c2)
+            {
+            posProb = 0.0;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                if (omega[k] > 1.0)
+                    {
+                    posProb += catLike[k][i] / siteLike[i];
+                    }
+                }
+            ps[c2] = posProb;
+            }
+        }
+    
+    free (catLike);
+    free (mCatLike);
+    
+    return NO_ERROR;
+}
+#endif
+
+
+/* Calculate omega values for each site */
+int SiteOmegas (TreeNode *p, int division, int chain)
+{
+    int             c, j, k, nStates;
+    MrBFlt          catLike, *like, *bs, *omegaCatFreq, *omega,
+                    siteOmega, *ps, sum;
+    CLFlt           **clP;
+    ModelInfo       *m;
+    
+    /* find model partition */
+    m = &modelSettings[division];
+    
+    /* allocate space for conditional likelihood pointer array and site likelihood array */
+    clP  = (CLFlt **) calloc (m->numOmegaCats, sizeof(CLFlt *));
+    like = (MrBFlt *) calloc (m->numOmegaCats, sizeof(MrBFlt));
+    if (!clP || !like)
+        {
+        MrBayesPrint ("%s   ERROR: Out of memory in SiteOmegas\n", spacer);
+        return (ERROR);
+        }
+    
+    /* number of states */
+    nStates = m->numModelStates;
+
+    /* find conditional likelihoods */
+    clP[0] = m->condLikes[m->condLikeIndex[chain][p->index]];
+    for (k=1; k<m->numOmegaCats; k++)
+        clP[k] = clP[0] + k*m->numModelStates*m->numChars;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find category frequencies */
+    omegaCatFreq = GetParamSubVals (m->omega, chain, state[chain]);
+    
+    /* get category omegas */
+    omega = GetParamVals (m->omega, chain, state[chain]);
+
+    /* find site omegas (using posSelProbs space) */
+    ps = posSelProbs + m->compCharStart;
+    for (c=0; c<m->numChars; c++)
+        {
+        sum = 0.0;
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            like[k] = 0.0;
+            catLike = 0.0;
+            for (j=0; j<nStates; j++)
+                catLike += clP[k][j] * bs[j];
+            like[k] = catLike * omegaCatFreq[k];
+            sum += like[k];
+            clP[k] += nStates;
+            }
+        siteOmega = 0.0;
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            siteOmega += (like[k]/sum) * omega[k];
+            }
+        ps[c] = siteOmega;
+        }
+
+    free (clP);
+    free (like);
+    
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+/* Calculate omega values for each site (SSE version) */
+int SiteOmegas_SSE (TreeNode *p, int division, int chain)
+{
+    int             i, c1, c2, j, k, nStates;
+    CLFlt           **catLike, *siteLike;
+    MrBFlt          *bs, *omegaCatFreq, *omega,
+                    siteOmega, *ps;
+    __m128          m1, m2, *clPtr, **clP, mSiteLike, *mCatLike;
+    ModelInfo       *m;
+    
+    /* find model partition */
+    m = &modelSettings[division];
+    
+    /* number of states */
+    nStates = m->numModelStates;
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find category frequencies */
+    omegaCatFreq = GetParamSubVals (m->omega, chain, state[chain]);
+    
+    /* get category omegas */
+    omega = GetParamVals (m->omega, chain, state[chain]);
+
+    /* allocate space for category likelihood arrays */
+    catLike = (CLFlt **) calloc (m->numOmegaCats, sizeof(CLFlt *));
+    mCatLike = (__m128 *) calloc (m->numOmegaCats, sizeof(__m128));
+    if (!catLike || !mCatLike)
+        {
+        MrBayesPrint ("%s   ERROR: Out of memory in SiteOmegas_SSE\n", spacer);
+        return (ERROR);
+        }
+    
+    /* find conditional likelihood pointers */
+    clPtr = (__m128 *) m->condLikes[m->condLikeIndex[chain][p->index]];
+    clP   = m->clP_SSE;
+    for (k=0; k<m->numOmegaCats; k++)
+        {
+        clP[k] = clPtr;
+        clPtr += m->numSSEChars * nStates;
+        catLike[k] = (CLFlt *) (&(mCatLike[k]));
+        }
+    siteLike = (CLFlt *) (&mSiteLike);
+    
+    /* find site omegas (using posSelProbs space) */
+    ps = posSelProbs + m->compCharStart;
+    for (c1=c2=0; c1<m->numSSEChars; c1++)
+        {
+        mSiteLike = _mm_setzero_ps ();
+        for (k=0; k<m->numOmegaCats; k++)
+            {
+            mCatLike[k] = _mm_setzero_ps();
+            m1 = _mm_setzero_ps ();
+            for (j=0; j<nStates; j++)
+                {
+                m2 = _mm_mul_ps (clP[k][j], _mm_set1_ps ((CLFlt)bs[j]));
+                m1 = _mm_add_ps (m1, m2);
+                }
+            mCatLike[k] = _mm_mul_ps (m1, _mm_set1_ps ((CLFlt)omegaCatFreq[k]));
+            mSiteLike = _mm_add_ps (mSiteLike, mCatLike[k]);
+            clP[k] += nStates;
+            }
+        
+        for (i=0; i<FLOATS_PER_VEC && c2 < m->numChars; ++i, ++c2)
+            {
+            siteOmega = 0.0;
+            for (k=0; k<m->numOmegaCats; k++)
+                {
+                siteOmega += (catLike[k][i] / siteLike[i]) * omega[k];
+                }
+            ps[c2] = siteOmega;
+            }
+        }
+    
+    free (catLike);
+    free (mCatLike);
+    
+    return NO_ERROR;
+}
+#endif
+
+
+/*----------------------------------------------------------------------
+|
+|   PreparePrintFiles: Prepare .t, .p, and .mcmc files for printing
+|
+------------------------------------------------------------------------*/
+int PreparePrintFiles (void)
+{
+    int         i, n, previousResults, oldAutoOverwrite, oldNoWarn;
+    char        localFileName[100], fileName[220], bkupName[220];
+    FILE        *tempFile;
+
+#if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#endif
+
+    oldNoWarn        = noWarn;
+    oldAutoOverwrite = autoOverwrite;
+
+    /* Allocate space for file pointers */
+    if (memAllocs[ALLOC_FILEPOINTERS] == YES)
+        {
+        MrBayesPrint ("%s   File pointers already allocated in PreparePrintFiles\n", spacer);
+        return ERROR;
+        }
+    fpMcmc = NULL;
+    fpSS = NULL;
+    fpParm = NULL;
+    fpTree = NULL;  
+    fpParm = (FILE **) SafeCalloc (chainParams.numRuns, sizeof (FILE *));
+    if (fpParm == NULL)
+        {
+        MrBayesPrint ("%s   Could not allocate fpParm in PreparePrintFiles\n", spacer);
+        return ERROR;
+        }
+    memAllocs[ALLOC_FILEPOINTERS] = YES;
+    fpTree = (FILE ***) SafeCalloc (chainParams.numRuns, sizeof (FILE **));
+    if (fpTree == NULL)
+        {
+        MrBayesPrint ("%s   Could not allocate fpTree in PreparePrintFiles\n", spacer);
+        return ERROR;
+        }
+    fpTree[0] = (FILE **) SafeCalloc (numTrees*chainParams.numRuns, sizeof (FILE *));
+    if (fpTree[0] == NULL)
+        {
+        MrBayesPrint ("%s   Could not allocate fpTree[0] in PreparePrintFiles\n", spacer);
+        return ERROR;
+        }
+    for (i=1; i<chainParams.numRuns; i++)
+        fpTree[i] = fpTree[0] + i*numTrees;
+
+    /* Get root of local file name */
+    strcpy (localFileName, chainParams.chainFileName);
+
+    /* Determine whether to overwrite files */
+    if (noWarn == NO)
+        {
+        previousResults = NO;
+        if (chainParams.mcmcDiagn == YES)
+            {
+            sprintf (fileName, "%s.mcmc", localFileName);
+            if ((tempFile = TestOpenTextFileR(fileName)) != NULL)
+                {
+                fclose(tempFile);
+                previousResults = YES;
+                }
+            }
+        for (n=0; n<chainParams.numRuns; n++)
+            {
+            if (chainParams.numRuns == 1)
+                sprintf (fileName, "%s.p", localFileName);
+            else
+                sprintf (fileName, "%s.run%d.p", localFileName, n+1);
+            if ((tempFile = TestOpenTextFileR(fileName)) != NULL)
+                {
+                fclose(tempFile);
+                previousResults = YES;
+                }
+
+            for (i=0; i<numTrees; i++)
+                {
+                if (numTrees == 1 && chainParams.numRuns == 1)
+                    sprintf (fileName, "%s.t", localFileName);
+                else if (numTrees > 1 && chainParams.numRuns == 1)
+                    sprintf (fileName, "%s.tree%d.t", localFileName, i+1);
+                else if (numTrees == 1 && chainParams.numRuns > 1)
+                    sprintf (fileName, "%s.run%d.t", localFileName, n+1);
+                else
+                    sprintf (fileName, "%s.tree%d.run%d.t", localFileName, i+1, n+1);
+                if ((tempFile = TestOpenTextFileR(fileName)) != NULL)
+                    {
+                    fclose(tempFile);
+                    previousResults = YES;
+                    }
+                }
+            }
+        if (previousResults == YES)
+            {
+            MrBayesPrint("\n");
+            MrBayesPrint("%s   There are results from a previous run saved using the same filename(s).\n", spacer);
+            if (WantTo("Do you want to overwrite these results") == YES)
+                {
+                MrBayesPrint("\n");
+                noWarn = YES;
+                autoOverwrite = YES;
+                }
+            else
+                {
+                MrBayesPrint("\n");
+                MrBayesPrint("%s   Please specify a different file name before running the mcmc analysis.\n", spacer);
+                MrBayesPrint("%s      You can do that using 'mcmc filename=<name>'. You can also move or\n", spacer);
+                MrBayesPrint("%s      rename the old result files.\n", spacer);
+                return ERROR;
+                }
+            }
+        }
+
+    /* Prepare the .mcmc file */
+    if (chainParams.mcmcDiagn == YES)
+        {
+        sprintf (fileName, "%s.mcmc", chainParams.chainFileName);
+        if ((fpMcmc = OpenNewMBPrintFile (fileName)) == NULL)
+            {
+            noWarn = oldNoWarn;
+            autoOverwrite = oldAutoOverwrite;
+            return (ERROR);
+            }
+        }
+    
+    /* Prepare the .p and .t files */
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.numRuns == 1)
+            sprintf (fileName, "%s.p", localFileName);
+        else
+            sprintf (fileName, "%s.run%d.p", localFileName, n+1);
+        if ((fpParm[n] = OpenNewMBPrintFile (fileName)) == NULL)
+            {
+            noWarn = oldNoWarn;
+            autoOverwrite = oldAutoOverwrite;
+            return (ERROR);
+            }
+
+        for (i=0; i<numTrees; i++)
+            {
+            if (numTrees == 1 && chainParams.numRuns == 1)
+                sprintf (fileName, "%s.t", localFileName);
+            else if (numTrees > 1 && chainParams.numRuns == 1)
+                sprintf (fileName, "%s.tree%d.t", localFileName, i+1);
+            else if (numTrees == 1 && chainParams.numRuns > 1)
+                sprintf (fileName, "%s.run%d.t", localFileName, n+1);
+            else
+                sprintf (fileName, "%s.tree%d.run%d.t", localFileName, i+1, n+1);
+            if ((fpTree[n][i] = OpenNewMBPrintFile (fileName)) == NULL)
+                {
+                noWarn = oldNoWarn;
+                autoOverwrite = oldAutoOverwrite;
+                return (ERROR);
+                }
+            }
+        }
+
+    /* Prepare the .ss file */
+    if (chainParams.isSS == YES)
+        {
+        sprintf (fileName, "%s.ss", chainParams.chainFileName);
+        if ((fpSS = OpenNewMBPrintFile (fileName)) == NULL)
+            {
+            noWarn = oldNoWarn;
+            autoOverwrite = oldAutoOverwrite;
+            return (ERROR);
+            }
+        }
+
+    /* Remove previous chekpoint file if present */
+    sprintf (fileName, "%s%s.ckp", workingDir, chainParams.chainFileName);
+    strcpy (bkupName, fileName);
+    strcat (bkupName, "~");
+    remove (bkupName);
+    rename (fileName, bkupName);
+    
+#   if defined (PRINT_DUMP)
+    fpDump = (FILE **) SafeCalloc (chainParams.numRuns, sizeof (FILE *));
+
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.numRuns == 1)
+            sprintf (fileName, "%s.dump", localFileName);
+        else
+            sprintf (fileName, "%s.run%d.dump", localFileName, n+1);
+        
+        if ((fpDump[n] = OpenNewMBPrintFile (fileName)) == NULL)
+            return (ERROR);
+        }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   PrintAncStates_Bin: print ancestral states after final pass
+|       Binary model with or without rate variation
+|
+-----------------------------------------------------------------*/
+int PrintAncStates_Bin (TreeNode *p, int division, int chain)
+{
+    int             c, i, k;
+    MrBFlt          *bs, freq;
+    CLFlt           *clFP, *cL, sum, **clP;
+    char            *tempStr;
+    int             tempStrSize = TEMPSTRSIZE;
+    ModelInfo       *m;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* find state frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    
+    /* find frequencies of rate categories */
+    freq =  1.0 /  m->numGammaCats;
+    
+    /* find the conditional likelihoods from the final pass */
+    clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+
+    clP = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] =  clFP;
+        clFP += m->numChars * m->numModelStates;
+        }
+
+    /* find the preallocated working space */
+    cL = m->ancStateCondLikes;
+    
+    /* cycle over the compressed characters */
+    for (c=0; c<m->numChars; c++)
+        {
+        cL[0] = cL[1] = 0.0;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            cL[0] += clP[k][0];
+            cL[1] += clP[k][1];
+            clP[k]+=2;
+            }
+        cL[0] *= (CLFlt) (bs[0] * freq);
+        cL[1] *= (CLFlt) (bs[1] * freq);
+        sum = cL[0] + cL[1];
+        assert (cL[0]==cL[0]);
+        assert (cL[1]==cL[1]);
+        assert (sum<9999999999999999999999999999999.0);
+        cL[0] /= sum;
+        cL[1] /= sum;
+        assert (cL[0]==cL[0]);
+        assert (cL[1]==cL[1]);
+        cL += 2;
+        }
+
+    /* print the resulting conditional likelihoods cycling over uncompressed chars */
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != division+1)
+            continue;
+        i = compCharPos[c] - m->compCharStart;
+        cL = m->ancStateCondLikes + (i*2);
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[0]));
+        if (AddToPrintString (tempStr) == ERROR) return (ERROR);
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[1]));
+        if (AddToPrintString (tempStr) == ERROR) return (ERROR);
+        }
+
+    free (tempStr);
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   PrintAncStates_Gen: print ancestral states after final pass
+|       General model with or without rate variation
+|
+-----------------------------------------------------------------*/
+int PrintAncStates_Gen (TreeNode *p, int division, int chain)
+{
+    int             c, i, k, nStates, hasPInvar, nGammaCats;
+    const int       *rateCat;
+    MrBFlt          *bsVals;
+    CLFlt           *cL, sum, pInvar=0.0, freq, f, bs[64];
+    const CLFlt     *clFP, *clInvar=NULL, *lnScaler, **clP;
+    char            *tempStr, *printedChar;
+    int             tempStrSize = TEMPSTRSIZE;
+    ModelInfo       *m;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    if (!strcmp(modelParams[division].nucModel,"Codon") || !strcmp(modelParams[division].nucModel,"Protein") || !strcmp(modelParams[division].nucModel,"Doublet"))
+        {
+        assert (modelParams[division].dataType == DNA || modelParams[division].dataType == RNA);
+        /* Note that we can have matrix with Protein datatype which is not and should not be covered here */
+        printedChar = (char *) SafeMalloc (numChar*sizeof(char));
+        }
+    else
+        {
+        printedChar = NULL;
+        }
+
+        
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* find number of states */
+    nStates = m->numModelStates;
+    
+    /* find state frequencies */
+    bsVals = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    for (i=0; i<nStates; i++)
+        bs[i] = (CLFlt) bsVals[i];
+
+    /* find invar cond likes */
+    if (m->pInvar == NULL)
+        hasPInvar = NO;
+    else
+        {
+        hasPInvar = YES;
+        clInvar = m->invCondLikes;
+        pInvar = (CLFlt) *GetParamVals (m->pInvar, chain, state[chain]); 
+        }
+
+    /* find number of rate categories */
+    nGammaCats = m->numGammaCats;
+
+    /* find frequencies of rate categories (only relevant if gibbsGamma == NO) */
+    freq = ((CLFlt)1.0 - pInvar) / nGammaCats;
+    
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find rate category index */
+    rateCat = m->tiIndex + chain*m->numChars;
+
+    /* find the conditional likelihoods from the final pass */
+    clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+    
+    /* find the preallocated working space */
+    cL = m->ancStateCondLikes;
+    
+    /* cycle over the compressed characters */
+    if (m->gibbsGamma == YES)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            sum = 0.0;
+            if (rateCat[c] < nGammaCats)
+                {
+                for (i=0; i<nStates; i++)
+                    {
+                    cL[i] = *(clFP++) * bs[i];
+                    sum += cL[i];
+                    }
+                clInvar += nStates;
+                }
+            else
+                {
+                for (i=0; i<nStates; i++)
+                    {
+                    cL[i] = *(clInvar++) * bs[i];
+                    sum += cL[i];
+                    }
+                clFP += nStates;
+                }
+            for (i=0; i<nStates; i++)
+                cL[i] /= sum;
+            cL += nStates;
+            }
+        }
+    else
+        {
+        /* find conditional likelihood pointers */
+        clP = (const CLFlt**)m->clP;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            clP[k] = clFP;
+            clFP += m->numChars * m->numModelStates;
+            }
+        for (c=0; c<m->numChars; c++)
+            {
+            for (i=0; i<nStates; i++)
+                cL[i] = 0.0;
+            for (k=0; k<nGammaCats; k++)
+                {
+                for (i=0; i<nStates; i++)
+                    cL[i] += *(clP[k]++);
+                }
+            for (i=0; i<nStates; i++)
+                cL[i] *= bs[i];
+
+            if (hasPInvar == YES && pInvar > 0)
+                {
+                sum = 0.0;
+                for (i=0; i<nStates; i++)
+                    sum += clInvar[i];
+                if (sum > 0.0)
+                    {
+                    if (lnScaler[c] < -100.0)
+                        {
+                        /* only invar cond likes are relevant */
+                        for (i=0; i<nStates; i++)
+                            cL[i] = clInvar[i] * bs[i] * pInvar;
+                        }
+                    else
+                        {
+                        f = (CLFlt) exp(lnScaler[c]) * freq;
+                        for (i=0; i<nStates; i++)
+                            cL[i] = clInvar[i] * bs[i] * pInvar + cL[i] * f;
+                        }
+                    }
+                clInvar += nStates;
+                }
+            
+            sum = 0.0;
+            for (i=0; i<nStates; i++)
+                sum += cL[i];
+            assert (sum > 0.0);
+            for (i=0; i<nStates; i++)
+                cL[i] /= sum;
+            cL += nStates;
+            }
+        }
+
+    /* print the resulting conditional likelihoods cycling over uncompressed chars */
+    if (printedChar)
+        for (c=0; c<numChar; c++)
+            printedChar[c] = NO;
+
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != division+1 || (printedChar &&
+            printedChar[c] == YES))
+            continue;
+        i = compCharPos[c] - m->compCharStart;
+        cL = m->ancStateCondLikes + (i*nStates);
+        if (printedChar)
+            {
+            for (i=c+1; i<numChar; i++)
+                if (charInfo[c].charId == charInfo[i].charId)
+                    printedChar[i] = YES;
+            }
+        for (i=0; i<nStates; i++)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[i]));
+            if (AddToPrintString (tempStr) == ERROR) return (ERROR);
+            }
+        }
+    free (tempStr);
+    free (printedChar);
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   PrintAncStates_NUC4: print ancestral states after final pass
+|       4-state nucleotide model with or without rate variation
+|
+-----------------------------------------------------------------*/
+int PrintAncStates_NUC4 (TreeNode *p, int division, int chain)
+{
+    int             c, i, k, *rateCat, hasPInvar, nGammaCats;
+    MrBFlt          *bsVals;
+    CLFlt           *cL, sum, pInvar=0.0, bs[4], freq, f;
+    const CLFlt     *clFP, *clInvar=NULL, *lnScaler,**clP;
+    char            *tempStr;
+    int             tempStrSize = TEMPSTRSIZE;
+    ModelInfo       *m;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* find state frequencies */
+    bsVals = GetParamSubVals (m->stateFreq, chain, state[chain]);
+    bs[A] = (CLFlt) bsVals[A];
+    bs[C] = (CLFlt) bsVals[C];
+    bs[G] = (CLFlt) bsVals[G];
+    bs[T] = (CLFlt) bsVals[T];
+
+    /* find invar cond likes */
+    if (m->pInvar == NULL)
+        hasPInvar = NO;
+    else
+        {
+        hasPInvar = YES;
+        clInvar = m->invCondLikes;
+        pInvar = (CLFlt) *GetParamVals (m->pInvar, chain, state[chain]); 
+        }
+
+    /* find number of rate categories */
+    nGammaCats = m->numGammaCats;
+
+    /* find frequencies of rate categories (only relevant if gibbsGamma == NO) */
+    if (hasPInvar == NO)
+        freq =  (CLFlt) 1.0 /  nGammaCats;
+    else
+        freq = ((CLFlt)1.0 - pInvar) / nGammaCats;
+    
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find rate category index */
+    rateCat = m->tiIndex + chain*m->numChars;
+
+    /* find the conditional likelihoods from the final pass */
+    clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+    
+    /* find the preallocated working space */
+    cL = m->ancStateCondLikes;
+    
+    /* cycle over the compressed characters */
+    if (m->gibbsGamma == YES)
+        {
+        for (c=0; c<m->numChars; c++)
+            {
+            if (rateCat[c] < nGammaCats)
+                {
+                cL[A] = clFP[A] * (CLFlt) bs[A];
+                cL[C] = clFP[C] * (CLFlt) bs[C];
+                cL[G] = clFP[G] * (CLFlt) bs[G];
+                cL[T] = clFP[T] * (CLFlt) bs[T];
+                }
+            else
+                {
+                cL[A] = clInvar[A] * (CLFlt) bs[A];
+                cL[C] = clInvar[C] * (CLFlt) bs[C];
+                cL[G] = clInvar[G] * (CLFlt) bs[G];
+                cL[T] = clInvar[T] * (CLFlt) bs[T];
+                }
+            sum = cL[A] + cL[C] + cL[G] + cL[T];
+            cL[A] /= sum;
+            cL[C] /= sum;
+            cL[G] /= sum;
+            cL[T] /= sum;
+            clInvar += 4;
+            clFP += 4;
+            cL += 4;
+            }
+        }
+    else
+        {
+        /* find conditional likelihood pointers */
+        clP = (const CLFlt**)m->clP;
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            clP[k] = clFP;
+            clFP += m->numChars * m->numModelStates;
+            }
+
+        for (c=0; c<m->numChars; c++)
+            {
+            cL[A] = cL[C] = cL[G] = cL[T] = 0.0;
+            for (k=0; k<nGammaCats; k++)
+                {
+                cL[A] += clP[k][A];
+                cL[C] += clP[k][C];
+                cL[G] += clP[k][G];
+                cL[T] += clP[k][T];
+                clP[k] += 4;
+                }
+            cL[A] *= bs[A];
+            cL[C] *= bs[C];
+            cL[G] *= bs[G];
+            cL[T] *= bs[T];
+            if (hasPInvar == YES)
+                {
+                sum = clInvar[A] + clInvar[C] + clInvar[G] + clInvar[T];
+                if (sum > 0.0)
+                    {
+                    if (lnScaler[c] < -100.0)
+                        {
+                        /* only invar cond likes are relevant */
+                        cL[A] = clInvar[A] * bs[A] * pInvar;
+                        cL[C] = clInvar[C] * bs[C] * pInvar;
+                        cL[G] = clInvar[G] * bs[G] * pInvar;
+                        cL[T] = clInvar[T] * bs[T] * pInvar;
+                        }
+                    else
+                        {
+                        f = (CLFlt)exp(lnScaler[c]) * freq;
+                        cL[A] = clInvar[A] * bs[A] * pInvar + cL[A] * f;
+                        cL[C] = clInvar[C] * bs[C] * pInvar + cL[C] * f;
+                        cL[G] = clInvar[G] * bs[G] * pInvar + cL[G] * f;
+                        cL[T] = clInvar[T] * bs[T] * pInvar + cL[T] * f;
+                        }
+                    }
+                clInvar += 4;
+                }
+            sum = cL[A] + cL[C] + cL[G] + cL[T];
+            cL[A] /= sum;
+            cL[C] /= sum;
+            cL[G] /= sum;
+            cL[T] /= sum;
+            cL += 4;
+            }
+        }
+
+    /* print the resulting conditional likelihoods cycling over uncompressed chars */
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != division+1)
+            continue;
+        i = compCharPos[c] - m->compCharStart;
+        cL = m->ancStateCondLikes + (i*4);
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[A]));
+        if (AddToPrintString (tempStr) == ERROR) return ERROR;
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[C]));
+        if (AddToPrintString (tempStr) == ERROR) return ERROR;
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[G]));
+        if (AddToPrintString (tempStr) == ERROR) return ERROR;
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[T]));
+        if (AddToPrintString (tempStr) == ERROR) return ERROR;
+        }
+    free (tempStr);
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   PrintAncStates_Std: print ancestral states after final pass
+|       Standard model with or without rate variation
+|
+-----------------------------------------------------------------*/
+int PrintAncStates_Std (TreeNode *p, int division, int chain)
+{
+    int             c, i, j, k, s, nStates, numReps;
+    MrBFlt          *bsBase, *bs, freq;
+    CLFlt           *clFP, *cL, sum,** clP;
+    char            *tempStr;
+    int             tempStrSize = TEMPSTRSIZE;
+    ModelInfo       *m;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* find model settings for this division */
+    m = &modelSettings[division];
+
+    /* find state frequencies, base index */
+    bsBase = GetParamStdStateFreqs (m->stateFreq, chain, state[chain]);
+    
+    /* find the conditional likelihoods from the final pass */
+    clFP = m->condLikes[m->condLikeScratchIndex[p->index]];
+
+    numReps=0;
+    for (c=0; c<m->numChars; c++)
+        {
+        if (m->nStates[c] == 2)
+                numReps += m->numBetaCats * 2;
+            else
+                numReps += m->nStates[c];
+        }
+
+    /* find conditional likelihood pointers */
+    clP = m->clP;
+    for (k=0; k<m->numGammaCats; k++)
+        {
+        clP[k] = clFP;
+        clFP += numReps;
+        }
+
+    /* find the preallocated working space */
+    cL = m->ancStateCondLikes;
+    
+    /* cycle over the compressed characters */
+    for (c=0; c<m->numChars; c++)
+        {
+        nStates = m->nStates[c];
+        bs = bsBase + m->bsIndex[c];
+
+        for (s=0; s<nStates; s++)
+            cL[s] = 0.0;
+
+        if (nStates == 2)
+            {
+            freq = 1.0 / (m->numBetaCats * m->numGammaCats);
+            for (i=0; i<m->numBetaCats; i++)
+                {
+                for (k=0; k<m->numGammaCats; k++)
+                    {
+                    for (s=0; s<nStates; s++)
+                        cL[s] += clP[k][s] * (CLFlt)(bs[s] * freq);
+                    clP[k] += nStates;
+                    }
+                bs += nStates;
+                }
+           }
+        else
+            {
+            freq = 1.0 / (m->numGammaCats);
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                for (s=0; s<nStates; s++)
+                    cL[s] += clP[k][s] * (CLFlt)(bs[s] * freq);
+                clP[k] += nStates;
+                }
+            }
+
+        sum = 0.0;
+        for (s=0; s<nStates; s++)
+            sum += cL[s];
+
+        assert (sum != 0.0);
+
+        for (s=0; s<nStates; s++) 
+            cL[s] /= sum;
+
+        cL += nStates;
+        }
+
+    /* print the resulting conditional likelihoods cycling over uncompressed chars */
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != division+1)
+            continue;
+        
+        k = compCharPos[c] - m->compCharStart;
+        for (i=j=0; i<k; i++)
+            j += m->nStates[i];
+        cL = m->ancStateCondLikes + j;
+
+        for (i=0; i<m->nStates[k]; i++)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(cL[i]));
+            if (AddToPrintString (tempStr) == ERROR) return (ERROR);
+            }
+        }
+    free (tempStr);
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------------
+|
+|   PrintCheckPoint: Print checkpoint to file
+|
+------------------------------------------------------------------------*/
+int PrintCheckPoint (int gen)
+{
+    int         i, j, k, k1, nErrors=0, run, chn, nValues, tempStrSize = TEMPSTRSIZE,
+                hasEvents, *intValue, id, oldPrecision;
+    char        bkupFileName[220], oldBkupFileName[220], ckpFileName[220], *tempString=NULL;
+    MrBFlt      *value, clockRate;
+    Param       *p = NULL, *subParm = NULL;
+    Tree        *t;
+    FILE        *fp = NULL;
+    MCMCMove    *mv;
+    /*ModelInfo *m = NULL;*/
+
+#if defined (MPI_ENABLED)
+    int         sumErrors=0,ierror;
+    MrBFlt      r, sum;
+#endif
+
+    /* use high precision for checkpointing */
+    oldPrecision = precision;
+    precision = 15;
+
+    /* allocate tempString */
+    if ((tempString = (char *) SafeCalloc (tempStrSize, sizeof(char))) == NULL)
+        nErrors++;
+
+#if defined (MPI_ENABLED)
+    if (proc_id == 0)
+        {
+#endif
+    if (nErrors == 0)
+        {
+        /* figure out check-point file names */
+        sprintf(ckpFileName, "%s.ckp", chainParams.chainFileName);
+        strcpy (bkupFileName, ckpFileName);
+        strcat (bkupFileName, "~");
+        strcpy (oldBkupFileName, bkupFileName);
+        strcat (oldBkupFileName, "~");
+
+        /* shift check-point files */
+        remove (oldBkupFileName);
+        rename (bkupFileName, oldBkupFileName);
+        rename (ckpFileName, bkupFileName);
+
+        /* create new ckp file */
+        if ((fp = OpenTextFileW (ckpFileName)) == NULL)
+            {
+            MrBayesPrint ("%s   Problem opening checkpoint file\n", spacer);
+            nErrors++;
+            }
+        }
+    
+#if defined (MPI_ENABLED)
+        } /* end of if (proc_id == 0)*/
+#endif
+
+    ERROR_TEST2("",free(tempString),return(ERROR));
+    
+    /* write file header */
+    MrBayesPrintf (fp, "#NEXUS\n[ID: %s]\n[generation: %d]\n", stamp, gen);
+
+    if (chainParams.isSS == YES)
+        {
+        /* dump to .ckp file current step contribution */
+        MrBayesPrintf (fp, "[SsAcumulators:");
+#       if defined (MPI_ENABLED)
+        for (j=0; j<chainParams.numRuns ; j++)
+            {
+            if (stepAcumulatorSS[j]==0)
+                r=0;
+            else
+                r = log (stepAcumulatorSS[j]) + stepScalerSS[j];
+            ierror = MPI_Reduce (&r,&sum, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+            if (ierror != MPI_SUCCESS)
+                {
+                MrBayesPrint ("%s   Problem with MPI_Reduce\n", spacer);
+                return ERROR;
+                }
+            if (proc_id == 0)
+                {
+                MrBayesPrintf (fp, " %.4f", sum);
+                }
+            }
+#       else
+        for (j=0; j<chainParams.numRuns ; j++)
+            {
+            MrBayesPrintf (fp, " %.4f", log (stepAcumulatorSS[j]) + stepScalerSS[j]);
+            }
+#       endif
+        MrBayesPrintf (fp, "]\n");
+        }
+
+#if defined (MPI_ENABLED)
+if (proc_id == 0)
+    {
+#endif
+    MrBayesPrintf (fp, "\nbegin trees;\n\ttranslate\n");
+
+    /* remove old bkup file ('~~') */
+    remove (oldBkupFileName);
+
+    /* write translate block */
+    for (i=0; i<numLocalTaxa; i++)
+        {
+        if (i == numLocalTaxa - 1)
+            MrBayesPrintf (fp, "      %2d %s;\n", i+1, localTaxonNames[i]);
+        else
+            MrBayesPrintf (fp, "      %2d %s,\n", i+1, localTaxonNames[i]);
+        }
+   
+#if defined (MPI_ENABLED)
+    }
+#endif
+
+    /* allocate space for print string */
+    printStringSize = tempStrSize;
+    printString = (char *) SafeCalloc ((size_t)printStringSize, sizeof(char));
+    if (!printString)
+        nErrors++;
+    else
+        strcpy(printString,"");
+
+    ERROR_TEST2("Memory allocation error",free(tempString),return(ERROR));
+    /*
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Memory allocation error on at least one processor\n", spacer);
+        free (tempString);
+        return ERROR;
+        }
+#   else
+    if (nErrors > 0)
+        {
+        free (tempString);
+        return ERROR;
+        }
+#   endif
+*/
+    /* print trees (but not species trees) */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType != P_BRLENS && p->paramType != P_TOPOLOGY)
+            continue;
+        if (p->paramType == P_TOPOLOGY && p->subParams[0] != p)
+            continue;
+        hasEvents = NO;
+        for (j=0; j<numLocalChains; j++)
+            {
+            t = GetTree (p, j, state[j]);
+            /* write the tree preamble */
+            if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\ttree %s", t->name) == ERROR)
+                nErrors++;
+            if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                nErrors++;
+            if (p->paramType == P_BRLENS && p->nSubParams > 0)
+                {
+                for (k=0; k<p->nSubParams; k++)
+                    {
+                    subParm = p->subParams[k];
+                    if (subParm->paramType == P_CPPEVENTS)
+                        {
+                        hasEvents = YES;
+                        if (SafeSprintf (&tempString, &tempStrSize, " [&E %s]", subParm->name) == ERROR) nErrors++;
+                        if (nErrors == 0 && AddToPrintString (tempString) == ERROR) nErrors++;
+                        }
+                    if (nErrors == 0 && (subParm->paramType == P_CPPEVENTS || subParm->paramType == P_TK02BRANCHRATES ||
+                                         subParm->paramType == P_IGRBRANCHRATES || subParm->paramType == P_MIXEDBRCHRATES))
+                        {
+                        if (subParm->paramType == P_MIXEDBRCHRATES)
+                            {
+                            id = *GetParamIntVals(subParm, j, state[j]);
+                            if (SafeSprintf (&tempString, &tempStrSize, " [&B %s %d]", subParm->name, id) == ERROR) nErrors++;
+                            }
+                        else
+                            if (SafeSprintf (&tempString, &tempStrSize, " [&B %s]", subParm->name) == ERROR) nErrors++;
+                        if (nErrors == 0 && AddToPrintString (tempString) == ERROR) nErrors++;
+                        }
+                    }
+                }
+
+            if (t->isRooted == YES && t->isClock == NO)
+                SafeSprintf (&tempString, &tempStrSize, " = ");
+            else if (t->isRooted == YES && t->isClock == YES)
+                {
+                clockRate = *GetParamVals(modelSettings[p->relParts[0]].clockRate, j, state[j]);
+                SafeSprintf (&tempString, &tempStrSize, " = [&R] [&clockrate = %s] ", MbPrintNum(clockRate));
+                }
+            else /* if (t->isRooted == NO) */
+                SafeSprintf (&tempString, &tempStrSize, " = ");
+            if (nErrors == 0 && AddToPrintString (tempString) == ERROR) nErrors++;
+            /* write the tree in (extended) Newick format */
+            if (nErrors == 0)
+                {
+                if (p->paramType == P_TOPOLOGY)
+                    WriteNoEvtTreeToPrintString (t->root->left, j, p, NO, t->isRooted);
+                else if (hasEvents == NO)
+                    WriteNoEvtTreeToPrintString (t->root->left, j, p, YES, t->isRooted);
+                else
+                    WriteEventTreeToPrintString (t->root->left, j, p, YES);
+                if (AddToPrintString (";\n") == ERROR)
+                    nErrors++;
+                }
+            }
+        MrBayesPrintf (fp, "%s", printString);
+#if defined (MPI_ENABLED)
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+            goto errorExit;
+            }
+        if (PrintMPISlaves(fp) == ERROR)
+            goto errorExit;
+#else
+        if (nErrors > 0)
+            goto errorExit;
+#endif
+        strcpy (printString, "");
+        strcpy (tempString, "");
+        }
+    MrBayesPrintf (fp, "end;\n\n");
+
+    /* print species trees */
+    if (strcmp(modelParams[0].topologyPr,"Speciestree") == 0)
+        {
+        /* get the first species tree */
+        for (i=0; i<numParams; i++)
+            {
+            p = &params[i];
+            if (p->paramType == P_SPECIESTREE)
+                break;
+            }
+        t = GetTree(p, 0, state[0]);
+
+#if defined (MPI_ENABLED)
+if (proc_id == 0)
+        {
+#endif
+        /* write the block header and translate block */
+        MrBayesPrintf (fp, "\nbegin trees;\n");
+        PrintTranslateBlock (fp, t);
+#if defined (MPI_ENABLED)
+        }
+#endif
+
+        for (j=0; j<numLocalChains; j++)
+            {
+            t = GetTree (p, j, state[j]);
+
+            /* write the tree preamble */
+            if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\ttree %s", t->name) == ERROR)
+                nErrors++;
+            if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                nErrors++;
+                
+            subParm = modelSettings[p->relParts[0]].popSize;
+            if (subParm->nValues > 1)
+                {
+                if (SafeSprintf (&tempString, &tempStrSize, " [&N %s]", subParm->name) == ERROR) nErrors++;
+                if (nErrors == 0 && AddToPrintString (tempString) == ERROR) nErrors++;
+                }
+
+            clockRate = *GetParamVals(modelSettings[p->relParts[0]].clockRate, j, state[j]);
+            SafeSprintf (&tempString, &tempStrSize, " = [&R] [&clockrate = %s] ", MbPrintNum(clockRate));
+            if (nErrors == 0 && AddToPrintString (tempString) == ERROR) nErrors++;
+
+            /* write the tree in (extended) Newick format */
+            if (nErrors == 0)
+                {
+                WriteNoEvtTreeToPrintString (t->root->left, j, p, YES, t->isRooted);
+                if (AddToPrintString (";\n") == ERROR)
+                nErrors++;
+                }
+            }
+        MrBayesPrintf (fp, "%s", printString);
+#if defined (MPI_ENABLED)
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+            goto errorExit;
+            }
+        if (PrintMPISlaves(fp) == ERROR)
+            goto errorExit;
+#else
+        if (nErrors > 0)
+            goto errorExit;
+#endif
+        strcpy (printString, "");
+        strcpy (tempString, "");
+        MrBayesPrintf (fp, "end;\n\n");
+        }
+            
+    /* start startvals block */
+    MrBayesPrintf (fp,"begin mrbayes;\n");
+    MrBayesPrintf (fp, "\tstartvals\n");
+
+    /* first print topology values */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            for (j=0; j<numLocalChains; j++)
+                {
+                t = GetTree (p, j, state[j]);
+                run = (chainId[j] / chainParams.numChains) + 1;
+                chn = (chainId[j] % chainParams.numChains) + 1;
+                if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s(%d,%d)=%s\n", p->name, run, chn, t->name) == ERROR)
+                    nErrors++;
+                if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                    nErrors++;
+                }
+            MrBayesPrintf (fp, "%s", printString);
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+                goto errorExit;
+                }
+            if (PrintMPISlaves(fp) == ERROR)
+                goto errorExit;
+#   else
+            if (nErrors > 0)
+                goto errorExit;
+#   endif
+            strcpy (printString, "");
+            strcpy (tempString, "");
+            }
+        }
+
+    /* now print branch lengths and relaxed clock parameters */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_BRLENS)
+            {
+            for (j=0; j<numLocalChains; j++)
+                {
+                t = GetTree (p, j, state[j]);
+                run = (chainId[j] / chainParams.numChains) + 1;
+                chn = (chainId[j] % chainParams.numChains) + 1;
+                if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s(%d,%d)=%s\n", p->name, run, chn, t->name) == ERROR)
+                    nErrors++;
+                if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                    nErrors++;
+                for (k=0; k<p->nSubParams; k++)
+                    {
+                    if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s(%d,%d)=%s\n", p->subParams[k]->name, run, chn, t->name) == ERROR)
+                        nErrors++;
+                    if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                        nErrors++;
+                    }
+                }
+            MrBayesPrintf (fp, "%s", printString);
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+                goto errorExit;
+                }
+            if (PrintMPISlaves(fp) == ERROR)
+                goto errorExit;
+#   else
+            if (nErrors > 0)
+                goto errorExit;
+#   endif
+            strcpy (printString, "");
+            strcpy (tempString, "");
+            }
+        }
+
+    /* now print species tree and population size parameters */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_SPECIESTREE)
+            {
+            for (j=0; j<numLocalChains; j++)
+                {
+                t = GetTree (p, j, state[j]);
+                run = (chainId[j] / chainParams.numChains) + 1;
+                chn = (chainId[j] % chainParams.numChains) + 1;
+                if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s(%d,%d)=%s\n", p->name, run, chn, t->name) == ERROR)
+                    nErrors++;
+                if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                    nErrors++;
+                if (modelSettings[p->relParts[0]].popSize->nValues > 1)
+                if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s(%d,%d)=%s\n", modelSettings[p->relParts[0]].popSize->name, run, chn, t->name) == ERROR)
+                    nErrors++;
+                if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                    nErrors++;
+                }
+            MrBayesPrintf (fp, "%s", printString);
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+                goto errorExit;
+                }
+            if (PrintMPISlaves(fp) == ERROR)
+                goto errorExit;
+#   else
+            if (nErrors > 0)
+                goto errorExit;
+#   endif
+            strcpy (printString, "");
+            strcpy (tempString, "");
+            }
+        }
+
+    /* now print param values */
+    for (i=0; i<numPrintParams; i++)
+        {
+        p = printParam[i];
+        for (j=0; j<numLocalChains; j++)
+            {
+            run = (chainId[j] / chainParams.numChains) + 1;
+            chn = (chainId[j] % chainParams.numChains) + 1;
+            if (p->paramType == P_PI && modelSettings[p->relParts[0]].dataType != STANDARD)
+                {
+                value = GetParamSubVals (p, j, state[j]);
+                nValues = p->nSubValues;
+                }
+            else
+                {
+                value = GetParamVals (p, j, state[j]);
+                nValues = p->nValues;
+                }
+            if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s(%d,%d)=(%.15le", p->name, run, chn, value[0]) == ERROR)
+                nErrors++;
+            if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                nErrors++;
+            for (k=1; k<nValues; k++)
+                {
+                if (nErrors==0 && SafeSprintf (&tempString, &tempStrSize, ",%.15le", value[k]) == ERROR)
+                    nErrors++;
+                if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                    nErrors++;
+                }
+            /* print int values if present */
+            if (p->nIntValues > 0)
+                {
+                intValue = GetParamIntVals (p, j, state[j]);
+                nValues  = p->nIntValues;
+                for (k=0; k<nValues; k++)
+                    {
+                    if (nErrors==0 && SafeSprintf (&tempString, &tempStrSize, ",%d", intValue[k]) == ERROR)
+                        nErrors++;
+                    if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                        nErrors++;
+                    }
+                }
+            /* print extra params for symdir multistate */
+            if (p->nSympi > 0)
+                {
+                value = GetParamStdStateFreqs (p, j, state[j]);
+                if (p->hasBinaryStd == YES)
+                    value += 2 * modelSettings[p->relParts[0]].numBetaCats;
+                for (k=0; k<p->nSympi; k++)
+                    {
+                    for (k1=0; k1<p->sympinStates[k]; k1++)
+                        {
+                        if (nErrors==0 && SafeSprintf (&tempString, &tempStrSize, ",%.15le", *value++) == ERROR)
+                            nErrors++;
+                        if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                            nErrors++;
+                        }
+                    }
+                }
+            /* print extra params for omega */
+            if (p->paramType == P_OMEGA)
+                {
+                value = GetParamSubVals (p, j, state[j]);
+                nValues = p->nSubValues/2;
+                for (k=0; k<nValues; k++)
+                    {
+                    if (nErrors==0 && SafeSprintf (&tempString, &tempStrSize, ",%.15le", value[k]) == ERROR)
+                        nErrors++;
+                    if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                        nErrors++;
+                    }
+                }
+            if (nErrors == 0 && AddToPrintString (")\n") == ERROR)
+                nErrors++;
+            }
+        MrBayesPrintf (fp, "%s", printString);
+#if defined (MPI_ENABLED)
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+            goto errorExit;
+            }
+        if (PrintMPISlaves(fp) == ERROR)
+            goto errorExit;
+#else
+        if (nErrors > 0)
+            goto errorExit;
+#endif
+        strcpy (printString, "");
+        strcpy (tempString, "");
+        }
+    /* end startvals statement */
+    MrBayesPrintf (fp, "\t;\n");
+
+    /* print tuning parameters of moves */
+    MrBayesPrintf (fp, "\tpropset\n");
+    for (i=0; i<numUsedMoves; i++)
+        {
+        mv = usedMoves[i];
+        if (mv->moveType->Autotune == NULL)
+            continue;   /* tuning parameter(s) do not change */
+        for (j=0; j<numLocalChains; j++)
+            {
+            run = (chainId[j] / chainParams.numChains) + 1;
+            chn = (chainId[j] % chainParams.numChains) + 1;
+            /* format is:   <move_name>$<tuning_param_name>(<run>,<chain>)=<number> */
+            if (nErrors == 0 && SafeSprintf (&tempString, &tempStrSize, "\t\t%s$%s(%d,%d)=%.15le\n",
+                mv->name, mv->moveType->shortTuningName[0], run, chn, mv->tuningParam[chainId[j]][0]) == ERROR)
+                nErrors++;
+            if (nErrors == 0 && AddToPrintString (tempString) == ERROR)
+                nErrors++;
+            }
+        MrBayesPrintf (fp, "%s", printString);
+#if defined (MPI_ENABLED)
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Print error on at least one processor\n", spacer);
+            goto errorExit;
+            }
+        if (PrintMPISlaves(fp) == ERROR)
+            goto errorExit;
+#else
+        if (nErrors > 0)
+            goto errorExit;
+#endif
+        strcpy (printString, "");
+        strcpy (tempString, "");
+        }
+
+    /* end propset statement */
+    MrBayesPrintf (fp, "\t;\n"); 
+    
+    /* end mrbayes block */
+    MrBayesPrintf (fp, "end;\n\n");
+
+    /* change precision back */
+    precision = oldPrecision;
+    
+    SafeFclose (&fp);
+    free (tempString);
+    free (printString);
+    printStringSize = 0;
+    return (NO_ERROR);
+
+errorExit:
+    precision = oldPrecision;
+    free (tempString);
+    free (printString);
+    printString = NULL;
+    printStringSize = 0;
+    SafeFclose (&fp);
+    return (ERROR);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   PrintMCMCDiagnosticsToFile: Print acceptance ratios, swapping
+|      frequencies, and convergence diagnostics to file.
+|
+------------------------------------------------------------------------*/
+int PrintMCMCDiagnosticsToFile (int curGen)
+{
+    int         i, j, n;
+    MCMCMove    *theMove;
+    char        *diagnstat;
+
+    /* Simply print header if curGen == 0 */
+    if (curGen == 0)
+        {
+        // MrBayesPrintf (fpMcmc, "[LEGEND:]\n");
+        MrBayesPrintf (fpMcmc, "[ID: %s]\n", stamp);
+        MrBayesPrintf (fpMcmc, "[   Gen                --  Generation]\n");
+        if (chainParams.allChains == YES)
+            MrBayesPrintf (fpMcmc, "[   <name1>(<name2>)$acc_run2_chn3 --  Acceptance rate of move <name1> changing parameter <name2> in run 2, chain 3]\n");
+        else /* if (chainParams.allChains == NO) */
+            MrBayesPrintf (fpMcmc, "[   <name1>(<name2>)$acc_run2      --  Acceptance rate of move <name1> changing parameter 1 in run 2]\n");
+        if (chainParams.numChains > 1 && chainParams.numRuns > 1)
+            MrBayesPrintf (fpMcmc, "[   Swap(1<>2)$acc_run3            --  Acceptance rate of swaps between chains 1 and 2 in run 3]\n");
+        else if (chainParams.numChains > 1 && chainParams.numRuns == 1)
+            MrBayesPrintf (fpMcmc, "[   Swap(1<>2)$acc                 --  Acceptance rate of swaps between chains 1 and 2]\n");
+        if (chainParams.diagnStat == AVGSTDDEV)
+            diagnstat = "Average";
+        else
+            diagnstat = "Maximum";
+        if (chainParams.numRuns > 1 && numTopologies == 1 && chainParams.allComps == NO)
+            MrBayesPrintf (fpMcmc, "[   StdDev(s)                      --  %s standard deviation of split frequencies]\n", diagnstat);
+        else if (chainParams.numRuns > 1 && numTopologies == 1 && chainParams.allComps == YES)
+            MrBayesPrintf (fpMcmc, "[   StdDev(s)(run1-run2)           --  %s standard deviation of split frequencies between runs 1 and 2]\n", diagnstat);
+        else if (chainParams.numRuns > 1 && numTopologies > 1 && chainParams.allComps == NO)
+            MrBayesPrintf (fpMcmc, "[   StdDev(s.tree1)                --  %s standard deviation of split frequencies for topology 1]\n", diagnstat);
+        else if (chainParams.numRuns > 1 && numTopologies > 1 && chainParams.allComps == YES)
+            MrBayesPrintf (fpMcmc, "[   StdDev(s.tree1)(run1-run2)     --  %s standard deviation of split frequencies between runs 1 and 2 for topology 1]\n", diagnstat);
+
+        MrBayesPrintf (fpMcmc, "Gen");
+        for (n=0; n<chainParams.numRuns; n++)
+            {
+            if (chainParams.allChains == YES)
+                {
+                for (i=0; i<chainParams.numChains; i++)
+                    {
+                    for (j=0; j<numUsedMoves; j++)
+                        {
+                        theMove = usedMoves[j];
+                        MrBayesPrintf (fpMcmc, "\t%s(%s)$acc_run%d_chn%d", theMove->moveType->shortName,
+                                theMove->parm->name, n+1, i+1);
+                        if (theMove->moveType->Autotune != NULL && chainParams.autotune == YES)
+                            MrBayesPrintf (fpMcmc, "\t%s(%s)$%s_run%d_chn%d", theMove->moveType->shortName,
+                                theMove->parm->name, theMove->moveType->shortTuningName[0], n+1, i+1);
+                        }
+                    }
+                }
+            else
+                {
+                for (i=0; i<numUsedMoves; i++)
+                    {
+                    theMove = usedMoves[i];
+                    if (chainParams.numRuns == 1)
+                        {
+                        MrBayesPrintf (fpMcmc, "\t%s(%s)$acc", theMove->moveType->shortName, theMove->parm->name);
+                        if (theMove->moveType->Autotune != NULL && chainParams.autotune == YES)
+                            MrBayesPrintf (fpMcmc, "\t%s(%s)$%s", theMove->moveType->shortName, theMove->parm->name, theMove->moveType->shortTuningName[0]);
+                        }
+                    else
+                        {
+                        MrBayesPrintf (fpMcmc, "\t%s(%s)$acc_run%d", theMove->moveType->shortName, theMove->parm->name, n+1);
+                        if (theMove->moveType->Autotune != NULL && chainParams.autotune == YES)
+                            MrBayesPrintf (fpMcmc, "\t%s(%s)$%s_run%d", theMove->moveType->shortName, theMove->parm->name, theMove->moveType->shortTuningName[0], n+1);
+                        }
+                    }
+                }
+            if (chainParams.numChains > 1)
+                {
+                for (i=0; i<chainParams.numChains; i++)
+                    {
+                    for (j=i+1; j<chainParams.numChains; j++)
+                        {
+                        if (chainParams.numRuns == 1)
+                            MrBayesPrintf (fpMcmc, "\tSwap(%d<>%d)$acc", i+1, j+1);
+                        else
+                            MrBayesPrintf (fpMcmc, "\tSwap(%d<>%d)$acc(%d)", i+1, j+1, n+1);
+                        }
+                    }
+                }
+            }
+
+        if (chainParams.numRuns > 1)
+            {
+            for (n=0; n<numTopologies; n++)
+                {
+                if (numTopologies == 1)
+                    {
+                    if (chainParams.diagnStat == AVGSTDDEV)
+                        MrBayesPrintf (fpMcmc, "\tAvgStdDev(s)");
+                    else
+                        MrBayesPrintf (fpMcmc, "\tMaxStdDev(s)");
+                    }
+                else
+                    {
+                    if (chainParams.diagnStat == AVGSTDDEV)
+                        MrBayesPrintf (fpMcmc, "\tAvgStdDev(s.tree%d)", n+1);
+                    else
+                        MrBayesPrintf (fpMcmc, "\tMaxStdDev(s.tree%d)", n+1);
+                    }
+
+                if (chainParams.allComps == YES)
+                    {
+                    for (i=0; i<chainParams.numRuns; i++)
+                        {
+                        for (j=i+1; j<chainParams.numRuns; j++)
+                            {
+                            if (numTopologies == 1)
+                                {
+                                if (chainParams.diagnStat == AVGSTDDEV)
+                                    MrBayesPrintf (fpMcmc, "\tAvgStdDev(s)(run%d_run%d)", i+1,j+1);
+                                else
+                                    MrBayesPrintf (fpMcmc, "\tMaxStdDev(s)(run%d_run%d)", i+1, j+1);
+                                }
+                            else
+                                {
+                                if (chainParams.diagnStat == AVGSTDDEV)
+                                    MrBayesPrintf (fpMcmc, "\tAvgStdDev(s.tree%d)(run%d_run%d)", n+1, i+1, j+1);
+                                else
+                                    MrBayesPrintf (fpMcmc, "\tMaxStdDev(s.tree%d)(run%d_run%d)", n+1, i+1, j+1);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        MrBayesPrintf (fpMcmc, "\n");
+        fflush (fpMcmc);
+        return (NO_ERROR);
+        }
+
+#if defined (MPI_ENABLED)
+    /* Reassemble info if MPI version */
+    if (ReassembleMoveInfo() == ERROR)
+        return (ERROR);
+    if (chainParams.numChains > 1 && ReassembleSwapInfo() == ERROR)
+        return (ERROR);
+    if (proc_id != 0)
+        return (NO_ERROR);
+#endif
+
+    MrBayesPrintf (fpMcmc, "%d", curGen);
+
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.allChains == YES)
+            {
+            for (j=n*chainParams.numChains; j<(n+1)*chainParams.numChains; j++)
+                {
+                for (i=0; i<numUsedMoves; i++)
+                    {
+                    theMove = usedMoves[i];
+                    if (theMove->nBatches[j] < 1)
+                        MrBayesPrintf (fpMcmc, "\tNA");
+                    else
+                        MrBayesPrintf (fpMcmc, "\t%.6f", theMove->lastAcceptanceRate[j]);
+                    if (theMove->moveType->Autotune != NULL && chainParams.autotune == YES)
+                        MrBayesPrintf (fpMcmc, "\t%.6e", theMove->tuningParam[j][0]);
+                    }
+                }
+            }
+        else
+            {
+            j = n*chainParams.numChains;
+            for (i=0; i<numUsedMoves; i++)
+                {
+                theMove = usedMoves[i];
+                if (theMove->nBatches[j] < 1)
+                    MrBayesPrintf (fpMcmc, "\tNA");
+                else
+                    MrBayesPrintf (fpMcmc, "\t%.6f", theMove->lastAcceptanceRate[j]);
+                if (theMove->moveType->Autotune != NULL && chainParams.autotune == YES)
+                    MrBayesPrintf (fpMcmc, "\t%.6e", theMove->tuningParam[j][0]);
+                }
+            }
+        if (chainParams.numChains > 1)
+            {
+            for (i=0; i<chainParams.numChains; i++)
+                {
+                for (j=i+1; j<chainParams.numChains; j++)
+                    {
+                    MrBayesPrintf (fpMcmc, "\t%.6f", (MrBFlt) swapInfo[n][i][j] / (MrBFlt) swapInfo[n][j][i]);
+                    }
+                }
+            }
+        }
+
+    if (chainParams.numRuns > 1)
+        {
+        for (n=0; n<numTopologies; n++)
+            {
+            if (chainParams.relativeBurnin == NO && curGen < chainParams.chainBurnIn * chainParams.sampleFreq)
+                MrBayesPrintf (fpMcmc, "\tNA");
+            else
+                {
+                if (chainParams.diagnStat == AVGSTDDEV)
+                    MrBayesPrintf (fpMcmc, "\t%.6f", chainParams.stat[n].avgStdDev);
+                else
+                    MrBayesPrintf (fpMcmc, "\t%.6f", chainParams.stat[n].max);
+                }
+            if (chainParams.allComps == YES)
+                {
+                for (i=0; i<chainParams.numRuns; i++)
+                    {
+                    for (j=i+1; j<chainParams.numRuns; j++)
+                        {
+                        if (chainParams.relativeBurnin == NO && curGen < chainParams.chainBurnIn * chainParams.sampleFreq)
+                            MrBayesPrintf (fpMcmc, "\tNA");
+                        else if (chainParams.diagnStat == AVGSTDDEV)
+                            MrBayesPrintf (fpMcmc, "\t%.6f", chainParams.stat[n].pair[i][j] / chainParams.stat[n].pair[j][i]);
+                        else /*if (chainParams.diagnStat == MAXSTDDEV) */
+                            MrBayesPrintf (fpMcmc, "\t%.6f", chainParams.stat[n].pair[i][j]);
+                        }
+                    }
+                }
+            }
+        }
+
+    MrBayesPrintf (fpMcmc, "\n");
+    fflush (fpMcmc);
+
+#if defined MPI_ENABLED
+    /* Redistribute the move info in the parallel version, so that
+       swapping occurs correctly; only necessary on processor 0 */
+    RedistributeMoveInfo();
+#endif
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------------
+|
+|   PrintMPISlaves: Print strings from MPI slave nodes
+|
+------------------------------------------------------------------------*/
+#if defined (MPI_ENABLED)
+int PrintMPISlaves (FILE *fp)
+{
+    char        *s=NULL;
+    int         i, len, ierror, nErrors, sumErrors, tag;
+    MPI_Status  status;
+
+    nErrors = sumErrors = tag = 0;
+    if (proc_id==0)
+        {
+        s = (char *) SafeCalloc (100, sizeof(char));
+        // if (s!=NULL)
+        //    lenS = 100;
+        // else
+        //    lenS = 0;
+        }
+
+    for (i=1; i<num_procs; i++)
+        {
+        /* communicate length */
+        if (proc_id == 0)
+            {
+            /* receive size */
+            ierror = MPI_Recv (&len, 1, MPI_INT, i, tag, MPI_COMM_WORLD, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                MrBayesPrint ("%s   Problem receiving string length from proc_id = %d\n", spacer, i);
+                nErrors++;
+                }
+            }
+        else if (proc_id == i)
+            {
+            /* send size */
+            len = (int)strlen(printString);
+            ierror = MPI_Send (&len, 1, MPI_INT, 0, tag, MPI_COMM_WORLD);
+            if (ierror != MPI_SUCCESS)
+                {
+                MrBayesPrint ("%s   Problem sending string length from proc_id = %d\n", spacer, i);
+                nErrors++;
+                }
+            }
+        /* reallocate string s on processor 0 if necessary */
+        if (nErrors == 0 && proc_id == 0 && len+5 > strlen(s))
+            {
+            if ((s = (char *) SafeRealloc ((void *)s, ((size_t)len+5)*sizeof(char))) == NULL)
+                {
+                MrBayesPrint ("%s   Problem reallocating %d chars to string 's' on proc 0 in PrintMPISlaves()\n", spacer, len+5);
+                nErrors++;
+                }
+            }
+        /* communicate and print string */
+        if (nErrors == 0)
+            {
+            if (proc_id == 0)
+                {
+                /* receive string */
+                ierror = MPI_Recv (s, len+1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    MrBayesPrint ("%s   Problem receiving printString from proc_id = %d\n", spacer, i);
+                    nErrors++;
+                    }
+                /* print string */
+                if (nErrors == 0)
+                    MrBayesPrintf (fp, "%s", s);
+                }
+            else if (proc_id == i)
+                {
+                /* send string */
+                ierror = MPI_Send (printString, len+1, MPI_CHAR, 0, tag, MPI_COMM_WORLD);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    MrBayesPrint ("%s   Problem sending printString from proc_id = %d\n", spacer, i);
+                    nErrors++;
+                    }
+                }
+            }
+        if (nErrors > 0)
+            break;
+        }
+
+    if (proc_id == 0)
+        {
+        free (s);
+        s = NULL;
+        }
+
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Problem with the printing in PrintMPISlaves().\n", spacer);
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+#endif
+
+
+/*----------------------------------------------------------------------
+|
+|   PrintParamValues: print parameter values and subvalues for param
+|
+----------------------------------------------------------------------*/
+void PrintParamValues (Param *p, int chain, char *s)
+{
+    int         j;
+    MrBFlt      *value0, *value1;
+    
+    if (p == NULL)
+        MrBayesPrint ("%s   %s = NULL\n", spacer, s);
+    else
+        {
+        if (p->nValues > 0)
+            {
+            value0 = GetParamVals (p, chain, 0);
+            value1 = GetParamVals (p, chain, 1);
+            for (j=0; j<p->nValues; j++)
+                MrBayesPrint ("%s   hyper [%s] = (%lf %lf)\n", spacer, s, value0[j], value1[j]);
+            }
+        if (p->nSubValues > 0)
+            {
+            value0 = GetParamSubVals (p, chain, 0);
+            value1 = GetParamSubVals (p, chain, 1);
+            for (j=0; j<p->nSubValues; j++)
+                MrBayesPrint ("%s   %s = (%lf %lf)\n", spacer, s, value0[j], value1[j]);
+            }
+        }
+    MrBayesPrint ("\n\n");
+
+    return;
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   PrintParsMatrix: Print parsimony (bitset) matrix
+|       using hexadecimal representation
+|
+|
+------------------------------------------------------------------------*/
+int PrintParsMatrix (void)
+{
+    int             i, j=0, k, c, d, printWidth, nextColumn, nChars, inputChar;
+    BitsLong        x, y, bitsLongOne;
+    char            ch;
+    ModelInfo       *m;
+
+    bitsLongOne = 1;
+
+    printWidth = 79;
+
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        MrBayesPrint ("\nParsimony (bitset) matrix for division %d\n\n", d+1);
+
+        m = &modelSettings[d];
+
+        nChars = 1 + (int) (log((bitsLongOne << m->numStates) - 1) / log(16));
+    
+        for (c=0; c<m->numChars; c++)
+            {
+            MrBayesPrint ("Parsimony sets for character %d -- \n", (c / m->nParsIntsPerSite));
+            for (i=0; i<numTaxa; i++)
+                {
+                MrBayesPrint ("%-10.10s   ", taxaNames[i]);
+                j = c*m->nParsIntsPerSite;
+                for (nextColumn=13; nextColumn < printWidth; nextColumn+=nChars + 1)
+                    {
+                    if (j >= m->numChars*m->nParsIntsPerSite)
+                        break;
+                    x = m->parsSets[i][j];
+                    for (k=8 - nChars; k<8; k++)
+                        {
+                        y = (x >> (4* (7 - k))) & 15;
+                        // if (y > 16) printf ("y is too big %ld\n",y);
+                        if (y < 10)
+                            ch = (char) y + '0';
+                        else
+                            ch = (char) y - 10 + 'A';
+                        MrBayesPrint("%c", ch);
+                        }
+                    MrBayesPrint(" ");
+                    j++;
+                    }
+                MrBayesPrint ("\n");
+                }
+            MrBayesPrint("\n");
+            printf ("Do you want to stop (y/n)?\n");
+            inputChar = getchar();
+            if (inputChar == 'y' || inputChar == 'Y')
+                return NO_ERROR;
+            else
+                MrBayesPrint ("\n");
+            }
+        }   /* next division */
+
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   PrintSiteRates_Gen: general n-state models with rate variation
+|
+-------------------------------------------------------------------*/
+int PrintSiteRates_Gen (TreeNode *p, int division, int chain)
+{
+    int             c, j, k, nStates, hasPInvar;
+    MrBFlt          freq, siteLike, invLike, catLike, pInvar=0.0, *bs,
+                    *catRate, baseRate;
+    MrBFlt          s01, s10, probOn, probOff, *swr, covBF[40];
+    CLFlt           *lnScaler, *clP, *siteRates, *clInvar=NULL;
+    char            *tempStr;
+    int             tempStrSize = TEMPSTRSIZE;
+    ModelInfo       *m;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* find model settings and nStates, pInvar, invar cond likes */
+    m = &modelSettings[division];
+    nStates = m->numModelStates;
+    if (m->pInvar == NULL)
+        {
+        hasPInvar = NO;
+        }
+    else
+        {
+        hasPInvar = YES;
+        pInvar =  *(GetParamVals (m->pInvar, chain, state[chain]));
+        clInvar = m->invCondLikes;
+        }
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+    
+    /* use scratch space for root node for temporary calculations */
+    siteRates = m->condLikes[m->condLikeScratchIndex[p->index]];
+    
+    /* find site scaler */
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    
+    /* find base frequencies */
+    bs = GetParamSubVals (m->stateFreq, chain, state[chain]);
+
+    /* if covarion model, adjust base frequencies */
+    if (m->switchRates != NULL)
+        {
+        /* find the stationary frequencies */
+        swr = GetParamVals(m->switchRates, chain, state[chain]);
+        s01 = swr[0];
+        s10 = swr[1];
+        probOn = s01 / (s01 + s10);
+        probOff = 1.0 - probOn;
+
+        /* now adjust the base frequencies; on-state stored first in cond likes */
+        for (j=0; j<nStates/2; j++)
+            {
+            covBF[j] = bs[j] * probOn;
+            covBF[j+nStates/2] = bs[j] * probOff;
+            }
+
+        /* finally set bs pointer to adjusted values */
+        bs = covBF;
+        }
+
+    /* find category frequencies */
+    if (hasPInvar == NO)
+        freq = 1.0 /  m->numGammaCats;
+    else
+        freq = (1.0 - pInvar) /  m->numGammaCats;
+
+    /* get rate multipliers (for gamma & partition specific rates) */
+    baseRate = GetRate (division, chain);
+    
+    /* compensate for invariable sites */
+    if (hasPInvar == YES)
+        baseRate /= (1.0 - pInvar);
+        
+    /* get category rates */
+    catRate = GetParamSubVals (m->shape, chain, state[chain]);
+
+    /* loop over characters */
+    if (hasPInvar == NO)
+        {
+        /* no invariable category */
+        for (c=0; c<m->numChars; c++)
+            {
+            siteLike = 0.0;
+            siteRates[c] = 0.0;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                catLike = 0.0;
+                for (j=0; j<nStates; j++)
+                    catLike += (*(clP++)) * bs[j];
+                siteRates[c] += (CLFlt) (catLike * catRate[k]);
+                siteLike += catLike;
+                }
+            siteRates[c] *= (CLFlt) (baseRate / siteLike);  /* category frequencies and site scaler cancel out */
+            }
+        }
+    else
+        {
+        /* has invariable category */
+        for (c=0; c<m->numChars; c++)
+            {
+            siteLike = invLike = 0.0;
+            siteRates[c] = 0.0;
+            for (k=0; k<m->numGammaCats; k++)
+                {
+                catLike = 0.0;
+                for (j=0; j<nStates; j++)
+                    catLike += (*(clP++)) * bs[j];
+                siteRates[c] += (CLFlt) (catLike * catRate[k]);
+                siteLike += catLike;
+                }
+            siteLike *= freq;
+            siteRates[c] *= (CLFlt) freq;
+            for (j=0; j<nStates; j++)
+                invLike += (*(clInvar++)) * bs[j];
+            siteLike += (invLike /  exp (lnScaler[c]) * pInvar);
+            /* we do not need to add the invariable category into siteRates before rescaling because the rate is 0.0 */
+            siteRates[c] *= (CLFlt) (baseRate / siteLike);  /* site scaler cancels out; category frequencies dealt with above */
+            }
+        }
+        
+    /* print the resulting site rates cycling over uncompressed chars */
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != division+1)
+            continue;
+        j = compCharPos[c] - m->compCharStart;
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(siteRates[j]));
+        if (AddToPrintString (tempStr) == ERROR) return (ERROR);
+        }
+
+    free (tempStr);
+    return NO_ERROR;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   PrintSiteRates_Std: standard model with rate variation
+|
+-------------------------------------------------------------------*/
+int PrintSiteRates_Std (TreeNode *p, int division, int chain)
+{
+    int             c, j, k, nStates;
+    MrBFlt          siteLike, catLike, *bs, *catRate, baseRate;
+    CLFlt           *clP, *siteRates;
+    char            *tempStr;
+    int             tempStrSize = TEMPSTRSIZE;
+    ModelInfo       *m;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* find model settings */
+    m = &modelSettings[division];
+
+    /* find conditional likelihood pointer */
+    clP = m->condLikes[m->condLikeIndex[chain][p->index]];
+    
+    /* use scratch space for root node for temporary calculations */
+    siteRates = m->condLikes[m->condLikeScratchIndex[p->index]];
+    
+    /* find base frequencies */
+    bs = GetParamStdStateFreqs (m->stateFreq, chain, state[chain]);
+
+    /* get rate multiplier */
+    baseRate = GetRate (division, chain);
+    
+    /* get category rates */
+    catRate = GetParamSubVals (m->shape, chain, state[chain]);
+
+    /* loop over characters */
+    for (c=0; c<m->numChars; c++)
+        {
+        siteLike = 0.0;
+        siteRates[c] = 0.0;
+        nStates = m->nStates[c];
+        for (k=0; k<m->numGammaCats; k++)
+            {
+            catLike = 0.0;
+            for (j=0; j<nStates; j++)
+                catLike += (*(clP++)) * bs[j];
+            siteRates[c] += (CLFlt) (catLike * catRate[k]);
+            siteLike += catLike;
+            }
+        siteRates[c] *= (CLFlt)(baseRate / siteLike);   /* category frequencies and site scaler cancel out */
+        }
+        
+    /* print the resulting site rates cycling over uncompressed chars */
+    for (c=0; c<numChar; c++)
+        {
+        if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != division+1)
+            continue;
+        j = compCharPos[c] - m->compCharStart;
+        SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(siteRates[j]));
+        if (AddToPrintString (tempStr) == ERROR) return (ERROR);
+        }
+
+    free (tempStr);
+    return NO_ERROR;
+}
+
+
+int PrintStates (int curGen, int coldId)
+{
+    int             d, i, j, k, k1, compressedCharPosition, *printedChar=NULL, origAlignmentChars[3];
+    char            *partString=NULL, stateString[4];
+    MrBFlt          *st, *sst, sum;
+    Param           *p;
+    ModelInfo       *m;
+    Tree            *tree;
+    TreeNode        *node;
+    ModelParams     *mp;
+    char            *tempStr;
+    int             tempStrSize;
+
+    /* allocate the print string */
+    printStringSize = tempStrSize = TEMPSTRSIZE;
+    printString = (char *)SafeMalloc((size_t)printStringSize * sizeof(char));
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+
+    if (!printString)
+        {
+        MrBayesPrint ("%s   Problem allocating printString (%d)\n", spacer, printStringSize * sizeof(char));
+        goto errorExit;
+        }
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        goto errorExit;
+        }
+    
+    *printString = '\0';
+    *tempStr = '\0';
+
+    /* Allocate memory, temporarily, in case we infer positive selection probs, site omegas, or site rates */
+    if (inferPosSel == YES || inferSiteOmegas == YES)
+        {
+        if (memAllocs[ALLOC_POSSELPROBS] == YES)
+            {
+            MrBayesPrint ("%s   posSelProbs not free in PrintStates\n", spacer);
+            goto errorExit;
+            }
+        posSelProbs = (MrBFlt *)SafeMalloc((size_t)numCompressedChars * sizeof(MrBFlt));
+        if (!posSelProbs)
+            {
+            MrBayesPrint ("%s   Problem allocating posSelProbs (%d)\n", spacer, numCompressedChars * sizeof(MrBFlt));
+            goto errorExit;
+            }
+        for (i=0; i<numCompressedChars; i++)
+            posSelProbs[i] =  -10.0;
+        memAllocs[ALLOC_POSSELPROBS] = YES;
+        }
+    if (inferPosSel == YES || inferSiteOmegas == YES || inferSiteRates == YES || inferAncStates == YES)
+        {
+        printedChar = (int *)SafeMalloc((size_t)numChar * sizeof(int));
+        if (!printedChar)
+            {
+            MrBayesPrint ("%s   Problem allocating printedChar (%d)\n", spacer, numChar * sizeof(int));
+            goto errorExit;
+            }
+        for (i=0; i<numChar; i++)
+            printedChar[i] = NO;
+        }
+
+    /* Set up the header to the file. */
+    if (curGen == 0)
+        {
+        SafeSprintf (&tempStr, &tempStrSize, "[ID: %s]\n", stamp);
+        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+        SafeSprintf (&tempStr, &tempStrSize, "Gen");
+        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+        SafeSprintf (&tempStr, &tempStrSize, "\tLnL");
+        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+        SafeSprintf (&tempStr, &tempStrSize, "\tLnPr");
+        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+
+        for (i=0; i<numParams; i++)
+            {
+            p = &params[i];
+            if (p->paramType == P_BRLENS)
+                {
+                /* print tree lengths or heights for all trees */
+                tree = GetTree (p, coldId, state[coldId]);
+                if (tree->isRooted == YES)
+                    {
+                    if (FillRelPartsString(p, &partString) == YES)
+                        SafeSprintf (&tempStr, &tempStrSize, "\tTH%s\tTL%s", partString, partString);
+                    else
+                        SafeSprintf (&tempStr, &tempStrSize, "\tTH\tTL");
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                else
+                    {
+                    if (FillRelPartsString(p, &partString) == YES)
+                        SafeSprintf (&tempStr, &tempStrSize, "\tTL%s", partString);
+                    else
+                        SafeSprintf (&tempStr, &tempStrSize, "\tTL");
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                /* print # cpp events, or relaxed clock model indicator */
+                for (j=0; j<p->nSubParams; j++)
+                    {
+                    if (p->subParams[j]->paramType == P_CPPEVENTS)
+                        {
+                        if (FillRelPartsString(p->subParams[j], &partString) == YES)
+                            SafeSprintf (&tempStr, &tempStrSize, "\tn_CPP%s", partString);
+                        else
+                            SafeSprintf (&tempStr, &tempStrSize, "\tn_CPP");
+                        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                        }
+                    else if (p->subParams[j]->paramType == P_MIXEDBRCHRATES)
+                        {
+                        if (FillRelPartsString(p->subParams[j], &partString) == YES)
+                            SafeSprintf (&tempStr, &tempStrSize, "\tm_RCl%s", partString);
+                        else
+                            SafeSprintf (&tempStr, &tempStrSize, "\tm_RCl");
+                        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                        }
+                    }
+                }
+            /* print proportion of ancestral fossils */
+            else if (p->paramType == P_FOSLRATE)
+                {
+                if (FillRelPartsString(p, &partString) == YES)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\tprop_ancfossil%s", partString);
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                else
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\tprop_ancfossil");
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            }
+
+        /* print ordinary parameters header */
+        for (i=0; i<numPrintParams; i++)
+            {
+            p = printParam[i];
+            SafeSprintf (&tempStr, &tempStrSize, "\t%s", p->paramHeader);
+            if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+            }
+            
+        /* print substitution model parameters header */
+        if (inferSiteRates == YES)
+            {
+            for (i=0; i<numChar; i++)
+                printedChar[i] = NO;
+    
+            for (i=0; i<numChar; i++)
+                { 
+                if (charInfo[i].isExcluded == YES)
+                    continue;
+                if (printedChar[i] == YES)
+                    continue;
+                d = partitionId[i][partitionNum] - 1;
+                m = &modelSettings[d];
+                mp = &modelParams[d];
+                if (m->printSiteRates == YES)
+                    {
+                    if (m->nCharsPerSite == 1)
+                        {
+                        SafeSprintf (&tempStr, &tempStrSize, "\tr(%d)", i+1);
+                        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                        }
+                    else
+                        {
+                        origAlignmentChars[0] = i;
+                        k = 1;
+                        for (j=i+1; j<numChar; j++)
+                            {
+                            if (compCharPos[i] == compCharPos[j])
+                                {
+                                if (k > m->nCharsPerSite)
+                                    return (ERROR);
+                                origAlignmentChars[k++] = j;
+                                printedChar[j] = YES;
+                                }
+                            }
+                        if (k != m->nCharsPerSite)
+                            return (ERROR);
+                        SafeSprintf (&tempStr, &tempStrSize, "\tr(%d,", origAlignmentChars[0]);
+                        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                        for (j=1; j<k-1; j++)
+                            {
+                            SafeSprintf (&tempStr, &tempStrSize, "%d,", origAlignmentChars[j]);
+                            if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                            }
+                        SafeSprintf (&tempStr, &tempStrSize, "%d)", origAlignmentChars[k-1]);
+                        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                        }
+                    }
+                }
+            }
+
+        if (inferPosSel == YES)
+            {
+            for (i=0; i<numChar; i++)
+                printedChar[i] = NO;
+            for (d=0; d<numCurrentDivisions; d++)
+                {
+                m = &modelSettings[d];
+                tree = GetTree(m->brlens, coldId, state[coldId]);
+                if (m->printPosSel == YES)
+                    {
+                    if (m->PosSelProbs (tree->root->left, d, coldId) == ERROR)
+                        goto errorExit;
+                    }
+                }
+            /* for (i=0; i<numChar; i++)
+                printf ("%4d -- %3d %3d\n", i, compCharPos[i], compColPos[i]); */
+            for (i=0; i<numChar; i++)
+                {
+                compressedCharPosition = compCharPos[i];
+                if (!(posSelProbs[compressedCharPosition] < 0.0) && printedChar[i] == NO && charInfo[i].isExcluded == NO)
+                    {
+                    for (j=k=0; j<numChar; j++)
+                        {
+                        if (charInfo[j].charId == charInfo[i].charId)
+                            {
+                            origAlignmentChars[k++] = j;
+                            printedChar[j] = YES;
+                            }
+                        }
+                    SafeSprintf (&tempStr, &tempStrSize, "\tpr+(%d,%d,%d)", origAlignmentChars[0]+1, origAlignmentChars[1]+1, origAlignmentChars[2]+1);
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }   
+            for (i=0; i<numChar; i++)
+                printedChar[i] = NO;
+            }
+            
+        if (inferSiteOmegas == YES)
+            {
+            for (i=0; i<numChar; i++)
+                printedChar[i] = NO;
+            for (d=0; d<numCurrentDivisions; d++)
+                {
+                m = &modelSettings[d];
+                tree = GetTree(m->brlens, coldId, state[coldId]);
+                if (m->printSiteOmegas == YES)
+                    {
+                    if (m->SiteOmegas (tree->root->left, d, coldId) == ERROR)
+                        goto errorExit;
+                    }
+                }
+            /* for (i=0; i<numChar; i++)
+                printf ("%4d -- %3d %3d\n", i, compCharPos[i], compColPos[i]); */
+            for (i=0; i<numChar; i++)
+                {
+                compressedCharPosition = compCharPos[i];
+                if (posSelProbs[compressedCharPosition] >= 0.0 && printedChar[i] == NO && charInfo[i].isExcluded == NO)
+                    {
+                    for (j=k=0; j<numChar; j++)
+                        {
+                        if (charInfo[j].charId == charInfo[i].charId)
+                            {
+                            origAlignmentChars[k++] = j;
+                            printedChar[j] = YES;
+                            }
+                        }
+                    SafeSprintf (&tempStr, &tempStrSize, "\tomega(%d,%d,%d)", origAlignmentChars[0]+1, origAlignmentChars[1]+1, origAlignmentChars[2]+1);
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }   
+            for (i=0; i<numChar; i++)
+                printedChar[i] = NO;
+            }
+            
+        if (inferAncStates == YES)
+            {
+            for (j=0; j<numChar; j++)
+                printedChar[j] = NO;
+            for (d=0; d<numCurrentDivisions; d++)
+                {
+                m = &modelSettings[d];
+                mp = &modelParams[d];
+                if (m->printAncStates != YES)
+                    continue;
+                for (i=0; i<numDefinedConstraints; i++)
+                    {
+                    if (mp->activeConstraints[i] == NO || definedConstraintsType[i] != HARD)
+                        continue;
+                    for (j=0; j<numChar; j++)
+                        {
+                        if (partitionId[j][partitionNum] - 1 != d || charInfo[j].isExcluded == YES || printedChar[j] == YES)
+                            continue;
+                        if (mp->dataType == STANDARD)
+                            {
+                            for (k=0; k<m->nStates[compCharPos[j] - m->compCharStart]; k++)
+                                {
+                                SafeSprintf (&tempStr, &tempStrSize, "\tp(%c){%d@%s}", m->StateCode(k), j+1, constraintNames[i]);
+                                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                                }
+                            }
+                        else if ((mp->dataType == DNA || mp->dataType == RNA) && !strcmp(mp->nucModel,"Codon"))
+                            {
+                            origAlignmentChars[0] = j+1;
+                            k1 = 1;
+                            for (k=j+1; k<numChar; k++)
+                                {
+                                if (charInfo[k].charId == charInfo[j].charId)
+                                    {
+                                    origAlignmentChars[k1++] = k+1;
+                                    printedChar[k] = YES;
+                                    }
+                                }
+                            for (k=0; k<m->numStates; k++)
+                                {
+                                State_CODON(stateString, k, d);
+                                SafeSprintf (&tempStr, &tempStrSize, "\tp(%s){%d,%d,%d@%s}",
+                                    stateString,
+                                    origAlignmentChars[0],
+                                    origAlignmentChars[1],
+                                    origAlignmentChars[2],
+                                    constraintNames[i]);
+                                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                                }
+                            }
+                        else if ((mp->dataType == DNA || mp->dataType == RNA) && !strcmp(mp->nucModel,"Doublet"))
+                            {
+                            origAlignmentChars[0] = j+1;
+                            k1 = 1;
+                            for (k=j+1; k<numChar; k++)
+                                {
+                                if (charInfo[k].charId == charInfo[j].charId)
+                                    {
+                                    origAlignmentChars[k1++] = k+1;
+                                    printedChar[k] = YES;
+                                    }
+                                }
+                            for (k=0; k<m->numStates; k++)
+                                {
+                                State_DOUBLET(stateString, k);
+                                SafeSprintf (&tempStr, &tempStrSize, "\tp(%s){%d,%d@%s}",
+                                    stateString,
+                                    origAlignmentChars[0],
+                                    origAlignmentChars[1],
+                                    constraintNames[i]);
+                                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                                }
+                            }
+                        else if ((mp->dataType == DNA || mp->dataType == RNA) && !strcmp(mp->nucModel,"Protein"))
+                            {
+                            origAlignmentChars[0] = j+1;
+                            k1 = 1;
+                            for (k=j+1; k<numChar; k++)
+                                {
+                                if (charInfo[k].charId == charInfo[j].charId)
+                                    {
+                                    origAlignmentChars[k1++] = k+1;
+                                    printedChar[k] = YES;
+                                    }
+                                }
+                            for (k=0; k<m->numStates; k++)
+                                {
+                                SafeSprintf (&tempStr, &tempStrSize, "\tp(%c){%d,%d,%d@%s}",
+                                    m->StateCode(k),
+                                    origAlignmentChars[0],
+                                    origAlignmentChars[1],
+                                    origAlignmentChars[2],
+                                    constraintNames[i]);
+                                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                                }
+                            }
+                        else
+                            {
+                            for (k=0; k<m->numStates; k++)
+                                {
+                                SafeSprintf (&tempStr, &tempStrSize, "\tp(%c){%d@%s}", m->StateCode(k), j+1, constraintNames[i]);
+                                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            
+        SafeSprintf (&tempStr, &tempStrSize, "\n");
+        if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+        }
+        
+    /* now print parameter values */
+    SafeSprintf (&tempStr, &tempStrSize, "%d", curGen);
+    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(curLnL[coldId]));
+    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(curLnPr[coldId]));
+    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_BRLENS)
+            {
+            /* print tree lengths or heights for all trees */
+            tree = GetTree (p, coldId, state[coldId]);
+            if (tree->isRooted == NO)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(TreeLength(p, coldId)));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            else
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(tree->root->left->nodeDepth));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(TreeLength(p, coldId)));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            /* print # cpp events, or relaxed clock model indicator */
+            for (j=0; j<p->nSubParams; j++)
+                {
+                if (p->subParams[j]->paramType == P_CPPEVENTS)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%d", NumCppEvents(p->subParams[j],coldId));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                else if (p->subParams[j]->paramType == P_MIXEDBRCHRATES)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%d", *GetParamIntVals(p->subParams[j],coldId,state[coldId]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            }
+        else if (p->paramType == P_FOSLRATE)
+            {
+            /* print proportion of ancestral fossils */
+            SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(PropAncFossil(p, coldId)));
+            if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+            }
+        }
+
+    /* print ordinary parameters */
+    for (i=0; i<numPrintParams; i++)
+        {
+        p = printParam[i];
+
+        /* get model params and settings */
+        mp = &modelParams[p->relParts[0]];
+        m  = &modelSettings[p->relParts[0]];
+        
+        st  = GetParamVals (p, coldId, state[coldId]);
+        sst = GetParamSubVals (p, coldId, state[coldId]);
+
+        if (p->paramId == SYMPI_EXP_MS || p->paramId == SYMPI_UNI_MS || p->paramId == SYMPI_FIX_MS)
+            {
+            /* We print symmetric dirichlet alpha value if not fixed and then multistate character state frequencies */
+            if (p->paramId != SYMPI_FIX_MS)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[0]));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            sst = GetParamStdStateFreqs (p, coldId, state[coldId]);
+            if (p->hasBinaryStd == YES)
+                sst += 2 * m->numBetaCats;
+            for (j=0; j<p->nSympi; j++)
+                {
+                for (k=0; k<p->sympinStates[j]; k++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(*sst++));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            }
+        else if (p->paramType == P_PI)
+            {
+            /* We print the subvalues if we are dealing with state frequencies (state frequencies are held in subvalues). */
+            for (j=0; j<p->nSubValues; j++)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(sst[j]));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            }
+        else if (p->paramType == P_TRATIO && !strcmp(mp->tratioFormat,"Dirichlet"))
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[0] / (1.0 + st[0])));
+            if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+            SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(1.0 / (1.0 + st[0])));
+            if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+            }
+        else if (p->paramType == P_REVMAT)
+            {
+            if (!strcmp(mp->revmatFormat,"Ratio"))
+                {
+                sum = st[p->nValues-1];
+                for (j=0; j<p->nValues; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[j] / sum));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            else
+                {
+                /* we already have rate proportions */
+                for (j=0; j<p->nValues; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[j]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            if (p->paramId == REVMAT_MIX)
+                {
+                /* add model index and k for nst=mixed */
+                SafeSprintf (&tempStr, &tempStrSize, "\t%d", FromGrowthFxnToIndex(GetParamIntVals(p, coldId, state[coldId])));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                SafeSprintf (&tempStr, &tempStrSize, "\t%d", GetKFromGrowthFxn(GetParamIntVals(p, coldId, state[coldId])));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            }
+        else if (p->paramType == P_RATEMULT)
+            {
+            if (!strcmp(mp->ratemultFormat,"Ratio"))
+                {
+                for (j=0; j<p->nValues; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[j] / st[0]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            else if (!strcmp(mp->ratemultFormat, "Dirichlet"))
+                {
+                sum = 0.0;
+                for (j=0; j<p->nValues; j++)
+                    sum += st[j];
+                for (j=0; j<p->nValues; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[j] / sum));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            else
+                {
+                for (j=0; j<p->nValues; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[j]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            }
+        else if (p->paramType == P_AAMODEL)
+            {
+            for (j=0; j<p->nValues; j++)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "\t%d", (int)st[j]);
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            }
+        else
+            {
+            /* run of the mill parameter */
+            for (j=0; j<p->nValues; j++)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(st[j]));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                }
+            }
+
+        if (p->paramType == P_OMEGA && p->paramId != OMEGA_DIR && p->paramId != OMEGA_FIX && p->paramId != OMEGA_FFF && p->paramId != OMEGA_FF && p->paramId != OMEGA_10FFF)
+            {
+            /* OK, we also need to print subvalues for the category frequencies in a NY98-like model. */
+            if (!strcmp(mp->omegaVar, "M10"))
+                {
+                for (j=0; j<4; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(sst[mp->numM10BetaCats + mp->numM10GammaCats + 4 + j]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                for (j=0; j<2; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(sst[mp->numM10BetaCats + mp->numM10GammaCats + j]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            else
+                {
+                for (j=0; j<3; j++)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(sst[j]));
+                    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                    }
+                }
+            }
+        }
+        
+    /* if user wants site rates, we print those here */
+    if (inferSiteRates == YES)
+        {
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            if (m->printSiteRates == YES)
+                {
+                mp = &modelParams[d];
+                tree = GetTree (m->brlens, coldId, state[coldId]);
+                node = tree->root->left;
+                m->PrintSiteRates (node, d, coldId);
+                }
+            }
+        }
+
+    /* If the user wants to infer sites that are under positive selection, then we need to print out the posterior
+       probability that each site is a positively selected one here. */
+    if (inferPosSel == YES)
+        {
+        /* loop over the divisions, calculating the probability of being in the positively
+           selected class for each relevant partition */
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            tree = GetTree(m->brlens, coldId, state[coldId]);
+            if (m->printPosSel == YES)
+                {
+                if (m->PosSelProbs (tree->root->left, d, coldId) == ERROR)
+                    {
+                    goto errorExit;
+                    }
+                }
+            }
+
+        /* print the probabilities for the appropriate sites in the original alignment */
+        for (i=0; i<numChar; i++)
+            printedChar[i] = NO;
+        for (i=0; i<numChar; i++)
+            {
+            compressedCharPosition = compCharPos[i];
+            if (!(posSelProbs[compressedCharPosition] < 0.0) && printedChar[i] == NO && charInfo[i].isExcluded == NO)
+                {
+                for (j=k=0; j<numChar; j++)
+                    {
+                    if (charInfo[j].charId == charInfo[i].charId)
+                        {
+                        origAlignmentChars[k++] = j;
+                        printedChar[j] = YES;
+                        }
+                    }
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(posSelProbs[compressedCharPosition]));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                /* printf ("%4d -> (%3d,%3d,%3d) %1.25le\n", i, origAlignmentChars[0]+1, origAlignmentChars[1]+1,
+                                                                origAlignmentChars[2]+1, posSelProbs[compressedCharPosition]); */
+                }
+            }
+        }
+    
+    /* If the user wants omega values for each site, we print those here. */
+    if (inferSiteOmegas == YES)
+        {
+        /* loop over the divisions, calculating the omega value for each site */
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            tree = GetTree(m->brlens, coldId, state[coldId]);
+            if (m->printSiteOmegas == YES)
+                {
+                if (m->SiteOmegas (tree->root->left, d, coldId) == ERROR)
+                    {
+                    goto errorExit;
+                    }
+                }
+            }
+
+        /* print the site omegas for the appropriate sites in the original alignment */
+        /* note that we use posSelProbs to pass values between SiteOmegas and this function */
+        for (i=0; i<numChar; i++)
+            printedChar[i] = NO;
+        for (i=0; i<numChar; i++)
+            {
+            compressedCharPosition = compCharPos[i];
+            if (posSelProbs[compressedCharPosition] >= 0.0 && printedChar[i] == NO && charInfo[i].isExcluded == NO)
+                {
+                for (j=k=0; j<numChar; j++)
+                    {
+                    if (charInfo[j].charId == charInfo[i].charId)
+                        {
+                        origAlignmentChars[k++] = j;
+                        printedChar[j] = YES;
+                        }
+                    }
+                SafeSprintf (&tempStr, &tempStrSize, "\t%s", MbPrintNum(posSelProbs[compressedCharPosition]));
+                if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+                /* printf ("%4d -> (%3d,%3d,%3d) %1.25le\n", i, origAlignmentChars[0]+1, origAlignmentChars[1]+1,
+                                                                origAlignmentChars[2]+1, posSelProbs[compressedCharPosition]); */
+                }
+            }
+        }
+     
+    /* free memory for positive selection probs or site omegas */
+    if (inferPosSel == YES || inferSiteOmegas == YES)
+        {
+        if (memAllocs[ALLOC_POSSELPROBS] == YES)
+            free (posSelProbs);
+        memAllocs[ALLOC_POSSELPROBS] = NO;
+        free (printedChar);
+        }
+
+    /* if user wants ancestral states for constrained nodes, we obtain and print those here */
+    if (inferAncStates == YES)
+        {
+        for (d=0; d<numCurrentDivisions; d++)
+            {
+            m = &modelSettings[d];
+            if (m->printAncStates == YES)
+                {
+                mp = &modelParams[d];
+                tree = GetTree (m->brlens, coldId, state[coldId]);
+                for (i=j=tree->nIntNodes - 1; i>=0; i--)
+                    {
+                    node = tree->intDownPass[i];
+                    m->CondLikeUp (node, d, coldId);
+                    }
+                for (k=0; k<numDefinedConstraints; k++)
+                    {
+                    if (mp->activeConstraints[k] == NO || definedConstraintsType[k] != HARD)
+                        continue;
+                    for (i=tree->nIntNodes-1; i>=0; i--)
+                        {
+                        node = tree->intDownPass[i];
+                        if (node->isLocked == YES && k == node->lockID)
+                            m->PrintAncStates (node, d, coldId);
+                        }
+                    }
+                }
+            }
+        }
+
+    SafeSprintf (&tempStr, &tempStrSize, "\n");
+    if (AddToPrintString (tempStr) == ERROR) goto errorExit;
+    
+    free (tempStr);
+    SafeFree ((void **)&partString);
+    
+    return (NO_ERROR);
+    
+    errorExit:
+        if (printedChar)
+            free (printedChar);
+        if (memAllocs[ALLOC_POSSELPROBS] == YES)
+            free (posSelProbs);
+        memAllocs[ALLOC_POSSELPROBS] = NO;
+        free (tempStr);
+        SafeFree ((void **)&partString);
+        return (ERROR);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   PrintStatesToFiles: Print trees and model parameters to files. We
+|      only come into this function if it is the first cycle of the chain
+|      or if we hit a cycle number evenly divisible by the sample frequency,
+|      or this is the last cycle of the chain.
+|
+------------------------------------------------------------------------*/
+int PrintStatesToFiles (int curGen)
+{
+    int             i, j, chn, coldId, runId;
+    MrBFlt          clockRate;
+    Tree            *tree=NULL;
+    Param           *param;
+#   if defined (MPI_ENABLED)
+    int             id, x, doesThisProcHaveId, procWithChain, ierror, tag, nErrors, sumErrors;
+    MPI_Status      status;
+#   endif
+
+#   if !defined (MPI_ENABLED)
+
+    /* print parameter values and trees (single-processor version) */
+    for (chn=0; chn<numLocalChains; chn++)
+        {
+        if ((chainId[chn] % chainParams.numChains) == 0)
+            {
+            coldId = chn;
+            runId = chainId[chn] / chainParams.numChains;
+
+            /* print parameter values */
+            if (PrintStates (curGen, coldId) == ERROR)
+                return (ERROR);
+            fprintf (fpParm[runId], "%s", printString);
+            fflush (fpParm[runId]);
+            free(printString);
+
+            /* print trees */
+            for (i=0; i<numPrintTreeParams; i++)
+                {
+                param = printTreeParam[i];
+                tree = GetTree(param, coldId, state[coldId]);
+                if (param->paramType == P_TOPOLOGY)
+                    {
+                    if (tree->isClock == YES)
+                        clockRate = *GetParamVals(modelSettings[tree->relParts[0]].clockRate, coldId, state[coldId]);
+                    else
+                        clockRate = 0.0;
+                    if (PrintTree (curGen, param, coldId, NO, clockRate) == ERROR)
+                        return (ERROR);
+                    }
+                else
+                    {
+                    if (tree->isClock == YES)
+                        clockRate = *GetParamVals(modelSettings[tree->relParts[0]].clockRate, coldId, state[coldId]);
+                    else
+                        clockRate = 0.0;
+                    if (PrintTree (curGen, param, coldId, YES, clockRate) == ERROR)
+                        return (ERROR);
+                    }
+
+                fprintf (fpTree[runId][i], "%s", printString);
+                fflush (fpTree[runId][i]);
+                free(printString);
+
+                j = printTreeTopologyIndex[i];
+                if (j<numTopologies)
+                    {
+                    if (chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+                        {
+                        if (chainParams.relativeBurnin == YES || curGen >= chainParams.chainBurnIn * chainParams.sampleFreq)
+                            {
+                            if (AddTreeToPartitionCounters (tree, j, runId) == ERROR)
+                                return ERROR;
+                            if (chainParams.relativeBurnin == YES && chainParams.saveTrees == YES && (noWarn == NO || curGen <= chainParams.stopTreeGen))
+                                {
+                                ResetTopologyFromTree (chainParams.dtree, tree);
+                                if (AddToTreeList (&chainParams.treeList[numTopologies*runId+j], chainParams.dtree) == ERROR)
+                                    return (ERROR);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+#   else
+    /* print parameter values and trees (parallel version) */
+    
+    /* Wait for all of the processors to get to this point before starting the printing. */
+    ierror = MPI_Barrier (MPI_COMM_WORLD);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem at chain barrier.\n", spacer);
+        return ERROR;
+        }
+    tag = nErrors = 0;
+        
+    /* Loop over runs. */
+    for (runId=0; runId<chainParams.numRuns; runId++)
+        {
+        /* Get the ID of the chain we want to print. Remember, the ID's should be numbered
+           0, 1, 2, ..., numChains X numRuns. Chains numbered 0, numChains, 2 X numChains, ...
+           are cold. */
+        id = runId * chainParams.numChains;
+        
+        /* Does this processor have the chain? */
+        doesThisProcHaveId = NO;
+        coldId = 0;
+        for (chn=0; chn<numLocalChains; chn++)
+            {
+            if (chainId[chn] == id)
+                {
+                doesThisProcHaveId = YES;
+                coldId = chn;
+                break;
+                }
+            }
+        
+        /* Tell all the processors which has the chain we want to print. We do this using the MPI_AllReduce
+           function. If the processor does not have the chain, then it initializes x = 0. If it does
+           have the chain, then x = proc_id. When the value of x is summed over all the processors, the sum
+           should be the proc_id of the processor with the chain. Possible values are 0, 1, 2, num_procs-1. 
+           Note that every processor knows procWithChain because we are using MPI_Allreduce, instead of MPI_Reduce. */
+        x = 0;
+        if (doesThisProcHaveId == YES)
+            x = proc_id;
+        ierror = MPI_Allreduce (&x, &procWithChain, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (ierror != MPI_SUCCESS)
+            {
+            MrBayesPrint ("%s   Problem finding processor with chain to print.\n", spacer);
+            return (ERROR);
+            }
+
+        /* ****************************************************************************************************/
+        /* print parameter values *****************************************************************************/
+        
+        /* Fill printString with the contents to be printed on proc_id = 0. Note
+           that printString is allocated in the function. */
+        if (doesThisProcHaveId == YES)
+            {
+            if (PrintStates (curGen, coldId) == ERROR)
+                nErrors++;
+            }
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Problem with PrintStates.\n", spacer);
+            return ERROR;
+            }
+        
+        /* First communication: Send/receive the length of the printString. */
+        if (proc_id == 0 || proc_id == procWithChain)
+            {
+            if (procWithChain != 0)
+                {
+                if (proc_id == procWithChain)
+                    {
+                    /* Find out how large the string is, and send the information to proc_id = 0. */
+                    ierror = MPI_Send (&printStringSize, 1, MPI_LONG, 0, tag, MPI_COMM_WORLD);
+                    if (ierror != MPI_SUCCESS)
+                        nErrors++;
+                    }
+                else
+                    {
+                    /* Receive the length of the string from proc_id = procWithChain, and then allocate
+                       printString to be that length. */
+                    ierror = MPI_Recv (&printStringSize, 1, MPI_LONG, procWithChain, tag, MPI_COMM_WORLD, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        MrBayesPrint ("%s   Problem receiving printStringSize from proc_id = %d\n", spacer, procWithChain);
+                        nErrors++;
+                        }
+                    printString = (char *)SafeMalloc((size_t)printStringSize * sizeof(char));
+                    if (!printString)
+                        {
+                        MrBayesPrint ("%s   Problem allocating printString (%d)\n", spacer, printStringSize * sizeof(char));
+                        nErrors++;
+                        }
+                    strcpy (printString, "");
+                    }
+                }
+            }
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Problem with first communication (states).\n", spacer);
+            return ERROR;
+            }
+
+        /* Second communication: Send/receive the printString. */
+        if (proc_id == 0 || proc_id == procWithChain)
+            {
+            if (procWithChain != 0)
+                {                   
+                if (proc_id == procWithChain)
+                    {
+                    /* Send the printString to proc_id = 0. After we send the string to proc_id = 0, we can
+                       free it. */
+                    ierror = MPI_Send (&printString[0], (int)printStringSize, MPI_CHAR, 0, tag, MPI_COMM_WORLD);
+                    if (ierror != MPI_SUCCESS)
+                        nErrors++;
+                    free(printString);
+                    }
+                else
+                    {
+                    /* Receive the printString from proc_id = procWithChain. */
+                    ierror = MPI_Recv (&printString[0], (int)printStringSize, MPI_CHAR, procWithChain, tag, MPI_COMM_WORLD, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        MrBayesPrint ("%s   Problem receiving printString from proc_id = %d\n", spacer, procWithChain);
+                        nErrors++;
+                        }
+                    }
+                }
+            }
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Problem with second communication (states).\n", spacer);
+            return ERROR;
+            }
+
+        /* Print the string with the parameter information if we are proc_id = 0. */
+        if (proc_id == 0)
+            {
+            fprintf (fpParm[runId], "%s", printString);
+            fflush (fpParm[runId]);
+            free(printString);
+            }
+
+        /* ****************************************************************************************************/
+        /* print trees ****************************************************************************************/
+
+        for (i=0; i<numPrintTreeParams; i++)
+            {
+            /* Print trees to file. */
+
+            /* Fill printString with the contents to be printed on proc_id = 0. Note
+               that printString is allocated in the function. */
+            if (doesThisProcHaveId == YES)
+                {
+                param = printTreeParam[i];
+                tree = GetTree(param, coldId, state[coldId]);
+                if (param->paramType == P_TOPOLOGY)
+                    {
+                    if (tree->isClock == YES)
+                        clockRate = *GetParamVals(modelSettings[tree->relParts[0]].clockRate, coldId, state[coldId]);
+                    else
+                        clockRate = 0.0;
+                    if (PrintTree (curGen, param, coldId, NO, clockRate) == ERROR)
+                        nErrors++;
+                    }
+                else
+                    {
+                    if (tree->isClock == YES)
+                        clockRate = *GetParamVals(modelSettings[tree->relParts[0]].clockRate, coldId, state[coldId]);
+                    else
+                        clockRate = 0.0;
+                    if (PrintTree (curGen, param, coldId, YES, clockRate) == ERROR)
+                        nErrors++;
+                    }
+                }
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Problem with printing trees.\n", spacer);
+                return ERROR;
+                }
+                
+            /* First communication: Send/receive the length of the printString. */
+            if (proc_id == 0 || proc_id == procWithChain)
+                {
+                if (procWithChain != 0)
+                    {
+                    if (proc_id == procWithChain)
+                        {
+                        /* Find out how large the string is, and send the information to proc_id = 0. */
+                        ierror = MPI_Send (&printStringSize, 1, MPI_LONG, 0, tag, MPI_COMM_WORLD);
+                        if (ierror != MPI_SUCCESS)
+                            nErrors++;
+                        }
+                    else
+                        {
+                        /* Receive the length of the string from proc_id = procWithChain, and then allocate
+                           printString to be that length. */
+                        ierror = MPI_Recv (&printStringSize, 1, MPI_LONG, procWithChain, tag, MPI_COMM_WORLD, &status);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            MrBayesPrint ("%s   Problem receiving printStringSize from proc_id = %d\n", spacer, procWithChain);
+                            nErrors++;
+                            }
+                        printString = (char *)SafeMalloc((size_t)printStringSize * sizeof(char));
+                        if (!printString)
+                            {
+                            MrBayesPrint ("%s   Problem allocating printString (%d)\n", spacer, printStringSize * sizeof(char));
+                            nErrors++;
+                            }
+                        strcpy (printString, "");
+                        }
+                    }
+                }
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Problem with first communication (states).\n", spacer);
+                return ERROR;
+                }
+
+            /* Second communication: Send/receive the printString. */
+            if (proc_id == 0 || proc_id == procWithChain)
+                {
+                if (procWithChain != 0)
+                    {                   
+                    if (proc_id == procWithChain)
+                        {
+                        /* Send the printString to proc_id = 0. After we send the string to proc_id = 0, we can
+                           free it. */
+                        ierror = MPI_Send (&printString[0], (int)printStringSize, MPI_CHAR, 0, tag, MPI_COMM_WORLD);
+                        if (ierror != MPI_SUCCESS)
+                            nErrors++;
+                        free(printString);
+                        }
+                    else
+                        {
+                        /* Receive the printString from proc_id = procWithChain. */
+                        ierror = MPI_Recv (&printString[0], (int)printStringSize, MPI_CHAR, procWithChain, tag, MPI_COMM_WORLD, &status);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            MrBayesPrint ("%s   Problem receiving printString from proc_id = %d\n", spacer, procWithChain);
+                            nErrors++;
+                            }
+                        }
+                    }
+                }
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Problem with second communication (states).\n", spacer);
+                return ERROR;
+                }
+
+            /* Print the string with the parameter information if we are proc_id = 0. */
+            if (proc_id == 0)
+                {
+                fprintf (fpTree[runId][i], "%s", printString);
+                fflush (fpTree[runId][i]);
+                j = printTreeTopologyIndex[i];
+                if (j < numTopologies)
+                    {
+                    if (chainParams.numRuns > 1 && chainParams.mcmcDiagn == YES)
+                        {
+                        if (chainParams.relativeBurnin == YES || curGen >= chainParams.chainBurnIn * chainParams.sampleFreq)
+                            {
+                            char *s = NULL;
+                            StripComments (printString);
+                            /* if it is the first tree, we strip out the translate block first (twice) */
+                            if (curGen==0) {
+                                if (strtok (printString, ";")==NULL) /* get translate lock */
+                                    return (ERROR);
+                                if (strtok (NULL, ";")==NULL)
+                                    return (ERROR);
+                                if (strtok (NULL, "\n\t\r ")==NULL) /* get 'tree' */
+                                    return (ERROR);
+                                }
+                            else {
+                                if (strtok (printString, "\n\t\r ")==NULL) /* get 'tree' */
+                                    return (ERROR);
+                                }
+                            if (strtok (NULL, " =")==NULL)  /* get 'rep.xxxx' */
+                                return (ERROR);
+                            if ((s = strtok (NULL, " =;"))==NULL)  /* get Newick string */
+                                return (ERROR);
+                            ResetTopology (chainParams.dtree, s);
+                            if (AddTreeToPartitionCounters (chainParams.dtree, j, runId) == ERROR)
+                                return ERROR;
+                            if (chainParams.relativeBurnin == YES && chainParams.saveTrees == YES && (noWarn == NO || curGen <= chainParams.stopTreeGen))
+                                {
+                                if (AddToTreeList (&chainParams.treeList[runId*numTopologies+j], chainParams.dtree) == ERROR)
+                                    return (ERROR);
+                                }
+                            }
+                        }
+                    }
+                free(printString);
+                }
+            }
+
+        /* Have all of the chains wait here, until the string has been successfully printed on proc_id = 0. */
+        ierror = MPI_Barrier (MPI_COMM_WORLD);
+        if (ierror != MPI_SUCCESS)
+            {
+            MrBayesPrint ("%s   Problem at chain barrier.\n", spacer);
+            return ERROR;
+            }
+        }
+#   endif
+        
+    return (NO_ERROR);
+}
+
+
+int PrintSwapInfo (void)
+{
+    int         i, j, n, maxNumExchanges, len, maxLen, reweightingChars=0;
+    char        *tempStr;
+    int             tempStrSize;
+
+    if (chainParams.numChains == 1)
+        return NO_ERROR;
+
+#   if defined (MPI_ENABLED)
+    if (ReassembleSwapInfo() == ERROR)
+        return ERROR;
+    if (proc_id != 0)
+        return NO_ERROR;
+#   endif
+
+    tempStrSize = TEMPSTRSIZE;
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        maxNumExchanges = 0;
+        for (i=0; i<chainParams.numChains; i++)
+            for (j=0; j<chainParams.numChains; j++)
+                if (i > j && swapInfo[n][i][j] > maxNumExchanges)
+                    maxNumExchanges = swapInfo[n][i][j];
+        SafeSprintf (&tempStr, &tempStrSize, "%d", maxNumExchanges);
+        maxLen = (int) strlen(tempStr);
+        if (maxLen < 4)
+            maxLen = 4;
+            
+        reweightingChars = NO;
+        if ((chainParams.weightScheme[0] + chainParams.weightScheme[1]) > 0.00001)
+            reweightingChars = YES;
+
+        if (chainParams.numRuns == 1)
+            MrBayesPrint ("\n%s   Chain swap information:\n\n", spacer);
+        else
+            MrBayesPrint ("\n%s   Chain swap information for run %d:\n\n", spacer, n+1);
+
+        MrBayesPrint ("%s          ", spacer);
+        for (j=0; j<chainParams.numChains; j++)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "%d", j+1);
+            len = (int) strlen(tempStr);
+            MrBayesPrint ("%*c %d ", maxLen-len, ' ', j+1);
+            }
+        MrBayesPrint ("\n");
+        
+        MrBayesPrint ("%s        --", spacer);
+        for (j=0; j<chainParams.numChains; j++)
+            {
+            MrBayesPrint ("--");
+            for (i=0; i<maxLen; i++)
+                MrBayesPrint ("-");
+            }
+        MrBayesPrint ("\n");
+        
+        for (i=0; i<chainParams.numChains; i++)
+            {
+            MrBayesPrint ("%s   %4d | ", spacer, i+1);
+            for (j=0; j<chainParams.numChains; j++)
+                {
+                if (i < j)
+                    {
+                    if (swapInfo[n][j][i] <= 0)
+                        {
+                        MrBayesPrint ("%*c%s ", maxLen-3, ' ', " NA ");
+                        }
+                    else
+                        {
+                        SafeSprintf (&tempStr, &tempStrSize, "%1.2lf", (MrBFlt)swapInfo[n][i][j]/swapInfo[n][j][i]);
+                        len = (int) strlen(tempStr);
+                        MrBayesPrint ("%*c%1.2lf ", maxLen-len+1, ' ', (MrBFlt)swapInfo[n][i][j]/swapInfo[n][j][i]);
+                        }
+                    }
+                else if (i == j)
+                    {
+                    MrBayesPrint ("%*c ", maxLen+1, ' ');
+                    }
+                else
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "%d", swapInfo[n][i][j]);
+                    len = (int) strlen(tempStr);
+                    MrBayesPrint ("%*c%d ", maxLen-len+1, ' ', swapInfo[n][i][j]);
+                    }
+                }
+            MrBayesPrint ("\n");
+            }
+        }
+
+    MrBayesPrint ("\n%s   Upper diagonal: Proportion of successful state exchanges between chains\n", spacer);
+    MrBayesPrint ("%s   Lower diagonal: Number of attempted state exchanges between chains\n", spacer);
+        
+    MrBayesPrint ("\n%s   Chain information:\n\n", spacer);
+    MrBayesPrint ("%s     ID -- Heat ", spacer);
+    if (reweightingChars == YES)
+        MrBayesPrint ("%% Dn %% Up\n");
+    else
+        MrBayesPrint ("\n");
+    
+    MrBayesPrint ("%s    -----------", spacer);
+    if (reweightingChars == YES)
+        MrBayesPrint ("----------\n");
+    else
+        MrBayesPrint ("\n");
+    for (i=0; i<chainParams.numChains; i++)
+        {
+        MrBayesPrint ("%s   %4d -- %1.2lf ", spacer, i+1, Temperature (i)/*1.0 / (1.0 + chainParams.chainTemp * i)*/);
+        if (reweightingChars == YES)
+            {
+            if (i == 0)
+                {
+                MrBayesPrint ("  0%%   0%% (cold chain)\n");
+                }
+            else
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "%d", (int)chainParams.weightScheme[0]);
+                len = (int) strlen(tempStr);
+                MrBayesPrint ("%*c%d%% ", 3-len, ' ', (int)chainParams.weightScheme[0]);
+                SafeSprintf (&tempStr, &tempStrSize, "%d", (int)chainParams.weightScheme[1]);
+                len = (int) strlen(tempStr);
+                MrBayesPrint ("%*c%d%% \n", 3-len, ' ', (int)chainParams.weightScheme[1]);
+                }
+            }
+        else
+            {
+            if (i == 0)
+                MrBayesPrint (" (cold chain)\n");
+            else
+                MrBayesPrint ("\n");
+            }
+        }
+    if (chainParams.userDefinedTemps == NO)
+        {
+        MrBayesPrint ("\n%s   Heat = 1 / (1 + T * (ID - 1))\n", spacer);
+        MrBayesPrint ("%s      (where T = %1.2lf is the temperature and ID is the chain number)\n", spacer, chainParams.chainTemp);
+        }
+    if (reweightingChars == YES)
+        MrBayesPrint ("%s   Reweighting increment = %1.2lf\n", spacer, chainParams.weightScheme[2]);
+    MrBayesPrint ("\n");
+        
+    free (tempStr);
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   PrintTermState: Print terminal state index matrix
+|
+------------------------------------------------------------------------*/
+int PrintTermState (void)
+{
+    int             i, j=0, c, d, printWidth, nextColumn, nDigits, nReps;
+    ModelInfo       *m;
+    ModelParams     *mp;
+
+    printWidth = 79;
+
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        MrBayesPrint ("\nTerminal state index matrix for division %d\n\n", d+1);
+
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        if (!strcmp(mp->covarionModel, "Yes"))
+            nReps = 2;
+        else
+            nReps = 1;
+
+        nDigits = 1 + (int)(log10(mp->nStates * mp->nStates * nReps));
+    
+        for (c=m->compCharStart; c<m->compCharStop; c=j)
+            {
+            for (i=0; i<numTaxa; i++)
+                {
+                MrBayesPrint ("%-10.10s   ", taxaNames[i]);
+                j = c;
+                for (nextColumn=13; nextColumn < printWidth; nextColumn+=nDigits + 1)
+                    {
+                    if (j >= m->compCharStop)
+                        break;
+                    MrBayesPrint ("%*d ",nDigits, m->termState[i][j-c]);
+                    j++;
+                    }
+                MrBayesPrint ("\n");
+                }
+            MrBayesPrint("\n");
+            }
+        }   /* next division */
+
+    return NO_ERROR;
+}
+
+
+/*--------------------------------------------------
+|
+|   PrintTiProbs: This function is for debugging of
+|       tiProbs; it will print a square matrix of
+|       tiProbs, check row sums, and check for time
+|       reversibility
+|
+---------------------------------------------------*/
+void PrintTiProbs (CLFlt *tP, MrBFlt *bs, int nStates)
+{
+    int     i, j;
+    CLFlt   *tiP, sum;
+
+    tiP = tP;
+
+    printf ("\nTransition matrix\n");
+    for (i=0; i<nStates; i++)
+        {
+        printf ("\t%d", i);
+        }
+    printf ("\tsum\n");
+
+    for (i=0; i<nStates; i++)
+        {
+        printf ("%d\t", i);
+        sum = 0.0;
+        for (j=0; j<nStates; j++)
+            {
+            printf ("\t%.6f",tP[j]);
+            sum += tP[j];
+            }
+        printf ("\t%.6f\n",sum);
+        tP += nStates;
+        }
+
+    printf ("\nStationary state frequencies\n");
+    for (i=0; i<nStates; i++)
+        printf ("%d -- %f\n",i,bs[i]);
+    
+    printf ("\nTime reversibility\n");
+
+    printf ("State 1\tState 2\tforward\tbackward\tabs diff\n");
+    for (i=0; i<nStates; i++)
+        {
+        for (j=i+1; j<nStates; j++)
+            {
+            printf ("%d\t%d\t%.6f\t%.6f\t%.6f\n", i, j, tiP[i*nStates+j]*bs[i],
+                tiP[j*nStates+i]*bs[j], fabs(tiP[i*nStates+j]*bs[i] - tiP[j*nStates+i]*bs[j]));
+            }
+        }
+
+    getchar();
+    return;
+}
+
+
+int PrintTopConvInfo (void)
+{
+    int         i, j, n, len, maxLen;
+    char        *tempStr;
+    int         tempStrSize;
+    MrBFlt      maxNumPartitions;
+    STATS       *stat;
+
+    if (chainParams.numRuns == 1)
+        return NO_ERROR;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    tempStrSize = TEMPSTRSIZE;
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    for (n=0; n<numTopologies; n++)
+        {
+        stat = &(chainParams.stat[n]);
+        maxNumPartitions = 0.0;
+        for (i=0; i<chainParams.numRuns; i++)
+            for (j=0; j<chainParams.numRuns; j++)
+                if (i > j && stat->pair[i][j] > maxNumPartitions)
+                    maxNumPartitions = stat->pair[i][j];
+        SafeSprintf (&tempStr, &tempStrSize, "%d", (int) maxNumPartitions);
+        maxLen = (int) strlen(tempStr);
+        if (maxLen < 5)
+            maxLen = 5;
+        
+        if (numTopologies == 1)
+            {
+            if (chainParams.diagnStat == AVGSTDDEV)
+                MrBayesPrint ("%s   Pairwise average standard deviation of split frequencies (upper triangle)\n", spacer);
+            else
+                MrBayesPrint ("%s   Pairwise maximum standard deviation of split frequencies (upper triangle)\n", spacer);
+            MrBayesPrint ("%s      and number of qualifying splits for each comparison (lower triangle):\n\n", spacer);
+            }
+        else
+            {
+            if (chainParams.diagnStat == AVGSTDDEV)
+                MrBayesPrint ("%s   Pairwise average standard deviation of split frequencies in topology %d (upper triangle)\n", spacer, n);
+            else
+                MrBayesPrint ("%s   Pairwise maximum standard deviation of split frequencies in topology %d (upper triangle)\n", spacer, n);
+            MrBayesPrint ("%s      and number of qualifying splits for each comparison (lower triangle):\n\n", spacer);
+            }
+
+        MrBayesPrint ("%s          ", spacer);
+        for (j=0; j<chainParams.numRuns; j++)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "%d", j+1);
+            len = (int) strlen(tempStr);
+            MrBayesPrint ("%*c %d ", maxLen-len, ' ', j+1);
+            }
+        MrBayesPrint ("\n");
+    
+        MrBayesPrint ("%s        --", spacer);
+        for (j=0; j<chainParams.numRuns; j++)
+            {
+            MrBayesPrint ("--");
+            for (i=0; i<maxLen; i++)
+                MrBayesPrint ("-");
+            }
+        MrBayesPrint ("\n");
+    
+        for (i=0; i<chainParams.numRuns; i++)
+            {
+            MrBayesPrint ("%s   %4d | ", spacer, i+1);
+            for (j=0; j<chainParams.numRuns; j++)
+                {
+                if (i < j)
+                    {
+                    if (chainParams.diagnStat == AVGSTDDEV)
+                        SafeSprintf (&tempStr, &tempStrSize, "%1.3lf", (MrBFlt) (stat->pair[i][j]) / (MrBFlt) (stat->pair[j][i]));
+                    else /* if (chainParams.diagnStat == MAXSTDDEV) */
+                        SafeSprintf (&tempStr, &tempStrSize, "%1.3lf", stat->pair[i][j]);
+                    len = (int) strlen(tempStr);
+                    MrBayesPrint ("%*c%s ", maxLen-len+1, ' ', tempStr);
+                    }
+                else if (i == j)
+                    {
+                    MrBayesPrint ("%*c ", maxLen+1, ' ');
+                    }
+                else
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "%d", (int) stat->pair[i][j]);
+                    len = (int) strlen(tempStr);
+                    MrBayesPrint ("%*c%s ", maxLen-len+1, ' ', tempStr);
+                    }
+                }
+            MrBayesPrint ("\n");
+            }
+    
+        MrBayesPrint ("\n");
+        }
+
+    free (tempStr);
+    return (NO_ERROR);
+}
+
+
+void PrintToScreen (int curGen, int startGen, time_t endingT, time_t startingT)
+{
+    int         i, chn, nHours, nMins, nSecs;
+    MrBFlt      timePerGen;
+
+#   if defined (MPI_ENABLED)
+    int         numLocalColdChains, numFirstAndLastCold;
+    
+    if (curGen == 0)
+        {
+        if (chainParams.isSS == NO && chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+            {
+            MrBayesPrint ("\n");
+            if (chainParams.relativeBurnin == YES)
+                MrBayesPrint ("%s   Using a relative burnin of %.1f %% for diagnostics\n", spacer, 100.0*chainParams.burninFraction);
+            else
+                MrBayesPrint ("%s   Using an absolute burnin of %d samples for diagnostics\n", spacer, chainParams.chainBurnIn);
+            }
+        MrBayesPrint ("\n");
+        MrBayesPrint ("%s   Chain results (%d generations requested):\n\n", spacer, chainParams.numGen);
+        }
+    MrBayesPrint ("%s   %4d -- ", spacer, curGen);
+    numLocalColdChains = numFirstAndLastCold = 0;
+    for (chn=0; chn<numLocalChains; chn++)
+        {
+        if ((chainId[chn] % chainParams.numChains) == 0)
+            {
+            numLocalColdChains++;
+            if (chn == 0 || chn == numLocalChains - 1)
+                numFirstAndLastCold++;
+            }
+        }
+
+    i = 1;
+    for (chn=0; chn<numLocalChains; chn++)
+        {
+        if (i > chainParams.printMax)   
+            {
+            if (i == chainParams.printMax +1)
+                {
+                i++;
+                if (numLocalColdChains > 0 && numLocalColdChains > numFirstAndLastCold)
+                    MrBayesPrint ("[...%d more local chains...] ", numLocalChains - chainParams.printMax);
+                else
+                    MrBayesPrint ("(...%d more local chains...) ", numLocalChains - chainParams.printMax);
+                continue;
+                }
+            else
+                continue;
+            }
+        if ((chainId[chn] % chainParams.numChains) == 0)
+            {
+            i++;
+            if (chainParams.printAll == YES)
+                MrBayesPrint ("[%1.3lf] ", curLnL[chn]);
+            else
+                MrBayesPrint ("[%1.3lf] .. ", curLnL[chn]);
+            }
+        else if (chainParams.printAll == YES)
+            {
+            i++;
+            MrBayesPrint ("(%1.3lf) ", curLnL[chn]);
+            }
+        if (chn < numLocalChains - 1 && (chainId[chn] / chainParams.numChains != chainId[chn+1] / chainParams.numChains))
+            MrBayesPrint ("* ");
+        }
+        
+    if (numLocalColdChains == chainParams.numRuns)
+        MrBayesPrint ("(...%d remote chains...) ", (chainParams.numChains*chainParams.numRuns) - numLocalChains);
+    else
+        MrBayesPrint ("[...%d remote chains...] ", (chainParams.numChains*chainParams.numRuns) - numLocalChains);
+
+    if (curGen > 0)
+        {
+        timePerGen = (MrBFlt) ((MrBFlt)(endingT-startingT)/(MrBFlt)(curGen-startGen));
+        nSecs = (int)((chainParams.numGen - curGen) * timePerGen);
+        nHours = nSecs / 3600;
+        nSecs  = nSecs % 3600;
+        nMins  = nSecs / 60; 
+        nSecs  = nSecs % 60;
+        MrBayesPrint ("-- %d:%0.2d:%0.2d", nHours, nMins, nSecs);
+        }
+    MrBayesPrint ("\n");
+    fflush (stdout);
+    
+#   else
+
+    if (curGen == 0)
+        {
+        if (chainParams.isSS == NO && chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+            {
+            MrBayesPrint ("\n");
+            if (chainParams.relativeBurnin == YES)
+                MrBayesPrint ("%s   Using a relative burnin of %.1f %% for diagnostics\n", spacer, 100.0*chainParams.burninFraction);
+            else
+                MrBayesPrint ("%s   Using an absolute burnin of %d samples for diagnostics\n", spacer, chainParams.chainBurnIn);
+            }
+        MrBayesPrint ("\n");
+        MrBayesPrint ("%s   Chain results (%d generations requested):\n\n", spacer, chainParams.numGen);
+        }
+    MrBayesPrint ("%s   %5d -- ", spacer, curGen);
+    if (numLocalChains == 1)
+        MrBayesPrint ("%1.3lf ", curLnL[0]);
+    else
+        {
+        i = 0;
+        for (chn=0; chn<numLocalChains; chn++)
+            {
+            if (i >= chainParams.printMax)
+                {
+                if (i == chainParams.printMax)
+                    MrBayesPrint (".. ");
+                i++;
+                continue;
+                }
+            if (chainParams.numChains == 1)
+                {
+                MrBayesPrint ("%1.3lf ", curLnL[chn]);
+                i++;
+                }
+            else if (chainId[chn] % chainParams.numChains == 0)
+                {
+                if (chainParams.printAll == YES)
+                    MrBayesPrint ("[%1.3lf] ", curLnL[chn]);
+                else
+                    MrBayesPrint ("[%1.3lf][%d] .. ", curLnL[chn], chn % chainParams.numChains + 1);
+                i++;
+                }
+            else if (chainParams.printAll == YES)
+                {
+                MrBayesPrint ("(%1.3lf) ", curLnL[chn]);
+                i++;
+                }
+            if (chn < numLocalChains - 1 && (chainId[chn] / chainParams.numChains != chainId[chn+1] / chainParams.numChains)
+                && i < chainParams.printMax - 1)
+                MrBayesPrint ("* ");
+            }
+        }
+        
+    if (curGen > 0)
+        {
+        timePerGen = (MrBFlt) ((MrBFlt)(endingT-startingT)/(MrBFlt)(curGen-startGen));
+        nSecs = (int)((chainParams.numGen - curGen) * timePerGen);
+        nHours = nSecs / 3600;
+        nSecs  = nSecs % 3600;
+        nMins  = nSecs / 60; 
+        nSecs  = nSecs % 60;
+        MrBayesPrint ("-- %d:%0.2d:%0.2d", nHours, nMins, nSecs);
+        }
+    MrBayesPrint ("\n");
+    
+    fflush (stdout);
+    
+#   endif
+        
+}
+
+
+int PrintTree (int curGen, Param *treeParam, int chain, int showBrlens, MrBFlt clockRate)
+{
+    int             i, tempStrSize;
+    char            *tempStr;
+    Tree            *tree;
+    TreeNode        *p=NULL, *q;
+    Param           *subParm;
+
+    /* allocate the print string */
+    printStringSize = 200;
+    printString = (char *)SafeMalloc((size_t)printStringSize * sizeof(char));
+    if (!printString)
+        {
+        MrBayesPrint ("%s   Problem allocating printString (%d)\n", spacer, printStringSize * sizeof(char));
+        return (ERROR);
+        }
+    *printString = '\0';
+
+    tempStrSize = TEMPSTRSIZE;
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* get tree */
+    tree = GetTree(treeParam, chain, state[chain]);
+
+    /* order the taxa */
+    if (chainParams.orderTaxa == YES)
+        {
+        for (i=0; i<tree->nNodes-1; i++)
+            {
+            p = tree->allDownPass[i];
+            if (p->left == NULL)
+                {
+                if (p->index == localOutGroup)
+                    p->x = -1;
+                else
+                    p->x = p->index;
+                }
+            else if (p->left->x < p->right->x)
+                p->x = p->left->x;
+            else
+                p->x = p->right->x;
+            }
+        for (i=0; i<tree->nIntNodes; i++)
+            {
+            if (p->left->x > p->right->x)
+                {
+                q = p->left;
+                p->left = p->right;
+                p->right = q;
+                }
+            }
+        }
+    
+    /* print the translate block information and the top of the file */
+    if (curGen == 0)
+        {
+        /* print #NEXUS and translation block information */
+        SafeSprintf (&tempStr, &tempStrSize, "#NEXUS\n");
+        if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+        SafeSprintf (&tempStr, &tempStrSize, "[ID: %s]\n", stamp);
+        if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+        SafeSprintf (&tempStr, &tempStrSize, "[Param: tree");
+        if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+        if (numCurrentDivisions == 1)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "]\n");
+            if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+            }
+        else if (numCurrentDivisions == tree->nRelParts)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "{all}]\n");
+            if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+            }
+        else
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "{%d", tree->relParts[0]+1);
+            if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+            for (i=1; i<tree->nRelParts; i++)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, ",%d", tree->relParts[i]+1);
+                if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+                }
+            SafeSprintf (&tempStr, &tempStrSize, "}]\n");
+            if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+            }
+        SafeSprintf (&tempStr, &tempStrSize, "begin trees;\n");
+        if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+        SafeSprintf (&tempStr, &tempStrSize, "   translate\n");
+        if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+        if (treeParam->paramType == P_SPECIESTREE)
+            {
+            for (i=0; i<numSpecies; i++)
+                {
+                if (i != numSpecies - 1)
+                    SafeSprintf (&tempStr, &tempStrSize, "      %2d %s,\n", i+1, speciesNameSets[speciespartitionNum].names[i]);
+                else
+                    SafeSprintf (&tempStr, &tempStrSize, "      %2d %s;\n", i+1, speciesNameSets[speciespartitionNum].names[i]);
+                if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+                }
+            }
+        else
+            {
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                if (i != numLocalTaxa - 1)
+                    SafeSprintf (&tempStr, &tempStrSize, "      %2d %s,\n", i+1, localTaxonNames[i]);
+                else
+                    SafeSprintf (&tempStr, &tempStrSize, "      %2d %s;\n", i+1, localTaxonNames[i]);
+                if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+                }
+            }
+        }
+    
+    /* write the tree preamble */
+    if (SafeSprintf (&tempStr, &tempStrSize, "   tree gen.%d", curGen) == ERROR) return (ERROR);
+    if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+    if (treeParam->paramType == P_BRLENS && treeParam->nSubParams > 0)
+        {
+        for (i=0; i<treeParam->nSubParams; i++)
+            {
+            subParm = treeParam->subParams[i];
+            if (subParm->paramType == P_CPPEVENTS)
+                {
+                if (SafeSprintf (&tempStr, &tempStrSize, " [&E %s]", subParm->name) == ERROR) return (ERROR);
+                if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+                }
+            //  if (subParm->paramType == P_MIXEDBRCHRATES)
+            //  {
+            //  id = *GetParamIntVals(subParm, chain, state[chain]);
+            //  if (SafeSprintf (&tempStr, &tempStrSize, " [&B %s %d]", subParm->name, id) == ERROR) return (ERROR);
+            //  }
+            else
+                if (SafeSprintf (&tempStr, &tempStrSize, " [&B %s]", subParm->name) == ERROR) return (ERROR);
+            if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+            }
+        }
+    subParm = modelSettings[treeParam->relParts[0]].popSize;
+    if (treeParam->paramType == P_SPECIESTREE && subParm->nValues > 1)
+        {
+        if (SafeSprintf (&tempStr, &tempStrSize, " [&N %s]", subParm->name) == ERROR) return (ERROR);
+        if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+        }
+
+    /* write the tree in (extended) Newick format */
+    if (tree->isRooted == YES && tree->isCalibrated == NO)
+        SafeSprintf (&tempStr, &tempStrSize, " = [&R] ");
+    else if (tree->isRooted == YES && tree->isCalibrated == YES)
+        SafeSprintf (&tempStr, &tempStrSize, " = [&R] [&clockrate=%s] ", MbPrintNum(clockRate));
+    else /* if (tree->isRooted == NO) */
+        SafeSprintf (&tempStr, &tempStrSize, " = [&U] ");
+    if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+    WriteNoEvtTreeToPrintString (tree->root->left, chain, treeParam, showBrlens, tree->isRooted);
+    SafeSprintf (&tempStr, &tempStrSize, ";\n");
+    if (AddToPrintString (tempStr) == ERROR) return(ERROR);
+
+    free (tempStr); 
+    return (NO_ERROR);
+}
+
+
+#if defined (MPI_ENABLED)
+int ReassembleMoveInfo (void)
+{
+    int             i, n, ierror;
+    double          x[7], sum[7];
+    MCMCMove        *mv;
+
+    for (n=0; n<numGlobalChains; n++)
+        {
+        for (i=0; i<numUsedMoves; i++)
+            {
+            mv = usedMoves[i];
+
+            /* collect counts */
+            x[0] = mv->nAccepted[n];
+            x[1] = mv->nTried[n];
+            x[2] = mv->nBatches[n];
+            x[3] = mv->nTotAccepted[n];
+            x[4] = mv->nTotTried[n];
+            x[5] = mv->lastAcceptanceRate[n];
+            if (mv->moveType->Autotune != NULL)
+                x[6]=mv->tuningParam[n][0];
+
+            ierror = MPI_Allreduce (&x, &sum, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+            if (ierror != MPI_SUCCESS)
+                return (ERROR);
+
+            if (proc_id == 0)
+                {
+                mv->nAccepted[n]          = (int)sum[0];
+                mv->nTried[n]             = (int)sum[1];
+                mv->nBatches[n]           = (int)sum[2];
+                mv->nTotAccepted[n]       = (int)sum[3];
+                mv->nTotTried[n]          = (int)sum[4];
+                mv->lastAcceptanceRate[n] = (MrBFlt)sum[5];
+                if (mv->moveType->Autotune != NULL)
+                    mv->tuningParam[n][0]=(MrBFlt)sum[6];
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int ReassembleParamVals (int *curId)
+{
+    int             i, j, k, orderLen, nBrlens, lower, upper, numChainsForProc, proc, ierror, *y, *order, *id, *nEvents;
+    MrBFlt          *x, *brlens, **position, **rateMult;
+    MPI_Status      status;
+    MPI_Request     request;
+    Tree            *tree;
+    Param           *p;
+
+    extern MrBFlt   *paramValues;
+    extern int      paramValsRowSize;
+    extern int      intValsRowSize;
+
+    for (i=0; i<numLocalChains; i++)
+        curId[i] = chainId[i];
+
+    numChainsForProc = numGlobalChains / num_procs;
+    if (numGlobalChains % num_procs > 0)
+        lower = upper = numChainsForProc+1;
+    else
+        lower = upper = numChainsForProc;
+
+    for (proc=1; proc<num_procs; proc++, lower=upper)
+        {
+        if (proc < numGlobalChains % num_procs)
+            upper += numChainsForProc+1;
+        else
+            upper += numChainsForProc;
+        
+        /* chain ids */
+        if (proc_id == 0)
+            {
+        id = curId + lower;
+            ierror = MPI_Irecv (id, upper-lower, MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            }
+        else if (proc_id == proc)
+            {
+            id = curId;
+            ierror = MPI_Isend (id, upper-lower, MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            }
+        
+        /* chain states */
+        if (proc_id == 0)
+            {
+            ierror = MPI_Irecv (state+lower, upper-lower, MPI_CHAR, proc, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            }
+        else if (proc_id == proc)
+            {
+            ierror = MPI_Isend (state, upper-lower, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            }
+
+        /* normal parameter values */
+        if (proc_id == 0)
+            {
+            x = paramValues + 2*paramValsRowSize*lower;
+            ierror = MPI_Irecv (x, paramValsRowSize*2*(upper-lower), MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            if (intValsRowSize > 0)
+                {
+                y = intValues + 2*intValsRowSize*lower;
+                ierror = MPI_Irecv (y, intValsRowSize*2*(upper-lower), MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (1, &request, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        else if (proc_id == proc)
+            {
+            x = paramValues;
+            ierror = MPI_Isend (x, paramValsRowSize*2*(upper-lower), MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            if (intValsRowSize > 0)
+                {
+                y = intValues;
+                ierror = MPI_Isend (y, intValsRowSize*2*(upper-lower), MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (1, &request, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+
+        /* std state frequencies */
+        if (stdStateFreqsRowSize > 0)
+            {
+            if (proc_id == 0)
+                {
+                x = stdStateFreqs + 2*stdStateFreqsRowSize*lower;
+                ierror = MPI_Irecv (x, stdStateFreqsRowSize*2*(upper-lower), MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (1, &request, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                }
+            else if (proc_id == proc)
+                {
+                x = stdStateFreqs;
+                ierror = MPI_Isend (x, stdStateFreqsRowSize*2*(upper-lower), MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (1, &request, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        
+        /* mcmc trees */
+        brlens = (MrBFlt *) SafeCalloc (2*numLocalTaxa, sizeof(MrBFlt));
+        order  = (int *)    SafeCalloc (2*numLocalTaxa,   sizeof(int));
+        for (i=lower; i<upper; i++)
+            {
+            for (j=0; j<numTrees; j++)
+                {
+                tree = GetTreeFromIndex(j,0,0);
+                orderLen = 2*tree->nIntNodes - 1;
+                nBrlens = tree->nNodes - 1;
+                if (proc_id == 0)
+                    {
+                    tree = GetTreeFromIndex(j,i,state[i]);
+                    ierror = MPI_Irecv (order, orderLen, MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Irecv (brlens, nBrlens, MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    if (tree->isRooted == YES)
+                        RetrieveRTreeWithIndices(tree, order, brlens);
+                    else
+                        {
+                        RetrieveUTree(tree, order, brlens);
+                        if (localOutGroup!=0)
+                            MoveCalculationRoot(tree,localOutGroup);
+                        }
+                    /* since we only transferred some info, there are additional things we need to
+                       consider, like constraints and calibrations; tree names are OK on proc 0 */
+                    InitializeTreeCalibrations(tree);
+                    CheckSetConstraints(tree);
+                    SetDatedNodeAges(modelSettings[tree->relParts[0]].brlens, i, state[i]);
+                    }
+                else if (proc_id == proc)
+                    {
+                    tree = GetTreeFromIndex(j,i-lower,state[i-lower]);
+                    if (tree->isRooted == YES)
+                        StoreRTreeWithIndices(tree, order, brlens);
+                    else
+                        StoreUTree(tree, order, brlens);
+                    ierror = MPI_Isend (order, orderLen, MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Isend (brlens, nBrlens, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    }
+                }
+            }
+        free (brlens);
+        free (order);
+
+        /* CPP event parameters */
+        for (i=lower; i<upper; i++)
+            {
+            for (j=0; j<numParams; j++)
+                {
+                p = &params[j];
+                if (p->paramType == P_CPPEVENTS)
+                    {
+                    if (proc_id == proc)
+                        {
+                        /* get pointers */
+                        nEvents = p->nEvents[2*(i-lower)+state[i-lower]];
+                        position = p->position[2*(i-lower)+state[i-lower]];
+                        rateMult = p->rateMult[2*(i-lower)+state[i-lower]];
+
+                        /* send number of events */
+                        ierror = MPI_Isend (nEvents, 2*numLocalTaxa, MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+                        ierror = MPI_Waitall (1, &request, &status);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+
+                        /* send events and clear pointers */
+                        for (k=0; k<2*numLocalTaxa; k++)
+                            {
+                            if (nEvents[k] > 0)
+                                {
+                                ierror = MPI_Isend (position[k], nEvents[k], MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+
+                                ierror = MPI_Isend (rateMult[k], nEvents[k], MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+
+                                free(position[k]);
+                                free(rateMult[k]);
+                                position[k] = NULL;
+                                rateMult[k] = NULL;
+                                nEvents[k] = 0;
+                                }
+                            }
+                        }
+                    else if (proc_id == 0)
+                        {
+                        /* find pointers */
+                        nEvents = p->nEvents[2*i];
+                        position = p->position[2*i];
+                        rateMult = p->rateMult[2*i];
+
+                        /* clear previous events */
+                        for (k=0; k<2*numLocalTaxa; k++)
+                            {
+                            if (nEvents[k] > 0)
+                                {
+                                free (position[k]);
+                                free (rateMult[k]);
+                                position[k] = NULL;
+                                rateMult[k] = NULL;
+                                nEvents[k] = 0;
+                                }
+                            }
+
+                        /* receive events */
+                        ierror = MPI_Irecv (nEvents, 2*numLocalTaxa, MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+                        ierror = MPI_Waitall (1, &request, &status);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+
+                        for (k=0; k<2*numLocalTaxa; k++)
+                            {
+                            if (nEvents[k] > 0)
+                                {
+                                position[k] = (MrBFlt *) SafeCalloc (nEvents[k], sizeof(MrBFlt));
+                                rateMult[k] = (MrBFlt *) SafeCalloc (nEvents[k], sizeof(MrBFlt));
+
+                                ierror = MPI_Irecv (position[k], nEvents[k], MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+
+                                ierror = MPI_Irecv (rateMult[k], nEvents[k], MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                }
+                            }
+                        }
+                    }
+                }
+            } 
+        }
+
+    return (NO_ERROR);
+}
+
+
+int ReassembleSwapInfo (void)
+{
+    int i, j, n, x, sum, ierror;
+    
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        for (i=0; i<chainParams.numChains; i++)
+            {
+            for (j=0; j<chainParams.numChains; j++)
+                {
+                if (i != j)
+                    {
+                    if (proc_id == 0)
+                        x = 0;
+                    else
+                        x = swapInfo[n][i][j];
+                    ierror = MPI_Allreduce (&x, &sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+                    if (ierror != MPI_SUCCESS)
+                        return (ERROR);
+                    if (proc_id == 0)
+                        swapInfo[n][i][j] += sum;
+                    else
+                        swapInfo[n][i][j] = 0;
+                    }
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int ReassembleTuningParams (void)
+{
+    int        i, j, k, lower, ierror;
+    MrBFlt     *x, *sum;
+    
+    x = (MrBFlt *) SafeCalloc (2*numUsedMoves, sizeof(MrBFlt));
+    sum = x + numUsedMoves;
+
+    lower = numGlobalChains / num_procs;
+    if (numGlobalChains % num_procs != 0)
+        lower++;
+
+    for (i=lower; i<numGlobalChains; i++)
+        {
+        for (j=0; j<numLocalChains; j++)
+            {
+            if (chainId[j] == i)
+                break;
+            }
+
+        for (k=0; k<numUsedMoves; k++)
+            {
+            if (j != numLocalChains && usedMoves[k]->moveType->numTuningParams > 0) /* we have the tuning parameter of interest */
+                x[k] = usedMoves[k]->tuningParam[i][0];
+            else
+                x[k] = 0.0;
+            }
+
+        ierror = MPI_Allreduce (x, sum, numUsedMoves, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+        if (ierror != MPI_SUCCESS)
+            {
+            free (x);
+            return (ERROR);
+            }
+
+        if (proc_id == 0)
+            {
+            for (k=0; k<numUsedMoves; k++)
+                {
+                if (usedMoves[k]->moveType->numTuningParams > 0)
+                    usedMoves[k]->tuningParam[i][0] = sum[k];
+                }
+            }
+        }
+
+    free (x);
+    return (NO_ERROR);
+}
+
+
+void RedistributeMoveInfo (void)
+{
+    int         i, j, k;
+    MCMCMove    *mv;
+
+    /* Leave if not processor 0, because then we already have the necessary info since
+       it was not deleted in ReassembleMoveInfo */
+    if (proc_id != 0)
+        return;
+
+    /* If we are processor 0, simply delete the unnecessary information */
+    for (i=0; i<numGlobalChains; i++)
+        {
+        for (j=0; j<numLocalChains; j++)
+            if (chainId[j] == i)
+                break;
+        
+        if (j == numLocalChains)
+            {
+            /* we do not have this chain, so delete the move info */
+            for (k=0; k<numUsedMoves; k++)
+                {
+                mv = usedMoves[k];
+
+                /* reset counts */
+                mv->nAccepted[i] = 0;
+                mv->nTried[i] = 0;
+                mv->nBatches[i] = 0;
+                mv->nTotAccepted[i] = 0;
+                mv->nTotTried[i] = 0;
+                mv->lastAcceptanceRate[i] = 0;
+        if (mv->moveType->Autotune != NULL)
+                    mv->tuningParam[i][0]=0.0;            
+                }
+            }
+        }
+}
+
+
+int RedistributeParamVals (void)
+{
+    int             i, j, k, orderLen, nBrlens, lower, upper, numChainsForProc, proc, ierror, *y, *order, *nEvents;
+    MrBFlt          *x, *brlens, **position, **rateMult;
+    MPI_Status      status;
+    MPI_Request     request;
+    Tree            *tree;
+    Param           *p;
+
+    extern MrBFlt   *paramValues;
+    extern int      paramValsRowSize;
+    extern int      intValsRowSize;
+
+    numChainsForProc = numGlobalChains / num_procs;
+    if (numGlobalChains % num_procs > 0)
+        lower = upper = numChainsForProc+1;
+    else
+        lower = upper = numChainsForProc;
+
+    for (proc=1; proc<num_procs; proc++, lower=upper)
+        {
+        if (proc < numGlobalChains % num_procs)
+            upper += numChainsForProc+1;
+        else
+            upper += numChainsForProc;
+        
+        /* normal parameter values */
+        if (proc_id == 0)
+            {
+            x = paramValues + 2*paramValsRowSize*lower;
+            ierror = MPI_Isend (x, paramValsRowSize*2*(upper-lower), MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            if (intValsRowSize > 0)
+                {
+                y = intValues + 2*intValsRowSize*lower;
+                ierror = MPI_Isend (y, intValsRowSize*2*(upper-lower), MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (1, &request, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        else if (proc_id == proc)
+            {
+            x = paramValues;
+            ierror = MPI_Irecv (x, paramValsRowSize*2*(upper-lower), MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            ierror = MPI_Waitall (1, &request, &status);
+            if (ierror != MPI_SUCCESS)
+                {
+                return (ERROR);
+                }
+            if (intValsRowSize > 0)
+                {
+                y = intValues;
+                ierror = MPI_Irecv (y, intValsRowSize*2*(upper-lower), MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                ierror = MPI_Waitall (1, &request, &status);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    return (ERROR);
+                    }
+                }
+            }
+        
+        /* mcmc trees */
+        brlens = (MrBFlt *) SafeCalloc (2*numLocalTaxa, sizeof(MrBFlt));
+        order  = (int *)    SafeCalloc (2*numLocalTaxa,   sizeof(int));
+        for (i=lower; i<upper; i++)
+            {
+            for (j=0; j<numTrees; j++)
+                {
+                tree = GetTreeFromIndex(j,0,0);
+                orderLen = 2*tree->nIntNodes - 1;
+                nBrlens = tree->nNodes - 1;
+                if (proc_id == 0)
+                    {
+                    tree = GetTreeFromIndex(j,i,0);
+                    if (tree->isRooted == YES)
+                        StoreRTreeWithIndices(tree, order, brlens);
+                    else
+                        StoreUTree(tree, order, brlens);
+                    ierror = MPI_Isend (order, orderLen, MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Isend (brlens, nBrlens, MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                   ierror = MPI_Waitall (1, &request, &status);
+                   if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    }
+                else if (proc_id == proc)
+                    {
+                    tree = GetTreeFromIndex(j,i-lower,0);
+                    ierror = MPI_Irecv (order, orderLen, MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Irecv (brlens, nBrlens, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    ierror = MPI_Waitall (1, &request, &status);
+                    if (ierror != MPI_SUCCESS)
+                        {
+                        return (ERROR);
+                        }
+                    if (tree->isRooted == YES)
+                        RetrieveRTreeWithIndices(tree, order, brlens);
+                    else
+                        {    
+                        RetrieveUTree(tree, order, brlens);
+                        if (localOutGroup != 0)
+                            MoveCalculationRoot(tree,localOutGroup);
+                        }
+                    /* since we only transferred some info, there are additional things we need to
+                       consider, like names, constraints and calibrations */
+                    InitializeTreeCalibrations(tree);
+                    CheckSetConstraints(tree);
+                    SetDatedNodeAges(modelSettings[tree->relParts[0]].brlens, i-lower, 0);
+                    strcpy(tree->name, GetTreeFromIndex(j, i, 0)->name);
+                    tree = GetTreeFromIndex(j,i-lower,1);
+                    strcpy(tree->name, GetTreeFromIndex(j, i, 0)->name);
+                    }
+                }
+            }
+        free (brlens);
+        free (order);
+
+        /* CPP relaxed clock  parameters */
+        for (i=lower; i<upper; i++)
+            {
+            for (j=0; j<numParams; j++)
+                {
+                p = &params[j];
+                if (p->paramType == P_CPPEVENTS)
+                    {
+                    if (proc_id == 0)
+                        {
+                        /* get pointers */
+                        nEvents = p->nEvents[2*i];
+                        position = p->position[2*i];
+                        rateMult = p->rateMult[2*i];
+
+                        /* send number of events */
+                        ierror = MPI_Isend (nEvents, 2*numLocalTaxa, MPI_INT, proc, 0, MPI_COMM_WORLD, &request);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+                        ierror = MPI_Waitall (1, &request, &status);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+
+                        /* send events and clear pointers */
+                        for (k=0; k<2*numLocalTaxa; k++)
+                            {
+                            if (nEvents[k] > 0)
+                                {
+                                ierror = MPI_Isend (position[k], nEvents[k], MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+
+                                ierror = MPI_Isend (rateMult[k], nEvents[k], MPI_DOUBLE, proc, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+
+                                free(position[k]);
+                                free(rateMult[k]);
+                                position[k] = NULL;
+                                rateMult[k] = NULL;
+                                nEvents[k] = 0;
+                                }
+                            }
+                        }
+                    else if (proc_id == proc)
+                        {
+                        /* find pointers */
+                        nEvents = p->nEvents[2*(i-lower)];
+                        position = p->position[2*(i-lower)];
+                        rateMult = p->rateMult[2*(i-lower)];
+
+                        /* clear previous events */
+                        for (k=0; k<2*numLocalTaxa; k++)
+                            {
+                            if (nEvents[k] > 0)
+                                {
+                                free (position[k]);
+                                free (rateMult[k]);
+                                position[k] = NULL;
+                                rateMult[k] = NULL;
+                                nEvents[k] = 0;
+                                }
+                            }
+
+                        /* receive events */
+                        ierror = MPI_Irecv (nEvents, 2*numLocalTaxa, MPI_INT, 0, 0, MPI_COMM_WORLD, &request);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+                        ierror = MPI_Waitall (1, &request, &status);
+                        if (ierror != MPI_SUCCESS)
+                            return (ERROR);
+                        for (k=0; k<2*numLocalTaxa; k++)
+                            {
+                            if (nEvents[k] > 0)
+                                {
+                                position[k] = (MrBFlt *) SafeCalloc (nEvents[k], sizeof(MrBFlt));
+                                rateMult[k] = (MrBFlt *) SafeCalloc (nEvents[k], sizeof(MrBFlt));
+
+                                ierror = MPI_Irecv (position[k], nEvents[k], MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+
+                                ierror = MPI_Irecv (rateMult[k], nEvents[k], MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &request);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                ierror = MPI_Waitall (1, &request, &status);
+                                if (ierror != MPI_SUCCESS)
+                                    return (ERROR);
+                                }
+                            }
+                       }
+                   }
+                }
+            }
+
+        /* update evolutionary branch lengths or rates (because node indices have changed) */
+        if (proc_id == proc)
+            {
+            for (i=0; i<upper-lower; i++)
+                {
+                for (j=0; j<numParams; j++)
+                    {
+                    p = &params[j];
+                    if (p->paramType == P_CPPEVENTS)
+                        {
+                        tree = GetTree(p, i, 0);
+                        UpdateCppEvolLengths (p, tree->root->left, i);
+                        }
+                    else if (p->paramType == P_TK02BRANCHRATES || (p->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(p, i, 0) == RCL_TK02))
+                        {
+                        tree = GetTree (p, i, 0);
+                        UpdateTK02EvolLengths (p, tree, i);
+                        }
+                    else if (p->paramType == P_IGRBRANCHRATES || (p->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(p, i, 0) == RCL_IGR))
+                        {
+                        tree = GetTree(p, i, 0);
+                        UpdateIgrBrachLengths (p, tree, i);
+                        }
+                    }
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int RedistributeTuningParams (void)
+{
+    int     i, j, k, lower, ierror;
+    MrBFlt  *x, *sum;
+    
+    x = (MrBFlt *) SafeCalloc (2*numUsedMoves, sizeof(MrBFlt));
+    sum = x + numUsedMoves;
+
+    lower = numGlobalChains / num_procs;
+    if (numGlobalChains % num_procs != 0)
+        lower++;
+
+    if (proc_id != 0)
+        {
+        for (i=0; i<numGlobalChains; i++)
+            {
+            for (k=0; k<numUsedMoves; k++)
+                                {
+                                if (usedMoves[k]->moveType->numTuningParams > 0)
+                        usedMoves[k]->tuningParam[i][0] = 0.0;
+                                }
+        }
+        }
+
+    for (i=lower; i<numGlobalChains; i++)
+        {
+        for (j=0; j<numLocalChains; j++)
+            {
+            if (chainId[j] == i)
+                break;
+            }
+
+        for (k=0; k<numUsedMoves; k++)
+            {
+            if (proc_id == 0 && usedMoves[k]->moveType->numTuningParams > 0) /* we have the tuning parameter of interest */
+        {
+                x[k] = usedMoves[k]->tuningParam[i][0];
+        usedMoves[k]->tuningParam[i][0]=0.0;
+        }
+            else
+                x[k] = 0.0;
+        }
+
+        ierror = MPI_Allreduce (x, sum, numUsedMoves, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+        if (ierror != MPI_SUCCESS)
+            {
+            free (x);
+            return (ERROR);
+            }
+
+        if (j != numLocalChains)   /* we have the chain of interest */
+            {
+            for (k=0; k<numUsedMoves; k++)
+                {
+                if (usedMoves[k]->moveType->numTuningParams > 0)
+                    usedMoves[k]->tuningParam[i][0] = sum[k];
+                }
+            }
+        }
+
+    free (x);
+    return (NO_ERROR);
+}
+
+#endif
+
+
+/* RemovePartition: Remove a partition from the tree keeping track of partition frequencies */
+int RemovePartition (PFNODE *r, BitsLong *p, int runId)
+{
+    int     i, comp;
+    
+    if (r == NULL)
+        {
+        return (ERROR);
+        }
+    else
+        {
+        for (i=0; i<nLongsNeeded; i++)
+            {
+            if (r->partition[i] != p[i])
+                break;
+            }
+        
+        if (i == nLongsNeeded)
+            comp = 0;
+        else if (r->partition[i] < p[i])
+            comp = -1;
+        else
+            comp = 1;
+        
+        if (comp == 0)          /* match */
+            {
+            if (r->count[runId] == 0)
+                return ERROR;
+            else
+                r->count[runId]--;
+            }
+        else if (comp < 0)      /* greater than -> into left subtree */
+            {
+            if ((RemovePartition (r->left, p, runId)) == ERROR)
+                return ERROR;
+            }
+        else
+            {
+            /* less than -> into right subtree */
+            if ((RemovePartition (r->right, p, runId)) == ERROR)
+                return ERROR;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* RemoveTreeFromPartitionCounters: Break a tree into partitions and remove those from counters */
+int RemoveTreeFromPartitionCounters (Tree *tree, int treeId, int runId)
+{
+    int         i, j, nTaxa;
+    TreeNode    *p;
+
+    if (tree->isRooted == YES)
+        nTaxa = tree->nNodes - tree->nIntNodes - 1;
+    else
+        nTaxa = tree->nNodes - tree->nIntNodes;
+
+    for (i=0; i<nTaxa; i++)
+        {
+        ClearBits(partition[i], nLongsNeeded);
+        SetBit(i, partition[i]);
+        }
+
+    for (i=0; i<tree->nIntNodes-1; i++)
+        {
+        p = tree->intDownPass[i];
+        assert (p->index >= tree->nNodes - tree->nIntNodes - (tree->isRooted == YES ? 1 : 0));
+        for (j=0; j<nLongsNeeded; j++)
+            {
+            partition[p->index][j] = partition[p->left->index][j] | partition[p->right->index][j];
+            }
+        
+        if ((RemovePartition (partFreqTreeRoot[treeId], partition[p->index], runId)) == ERROR)
+            {
+            MrBayesPrint ("%s   Could not remove partition %d in RemoveTreeFromPartitionCounters\n", spacer, p->index);
+            ShowParts(stdout,partition[p->index],numLocalTaxa);
+            return ERROR;
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/* RemoveTreeSamples: Remove tree samples from partition counters */
+int RemoveTreeSamples (int from, int to)
+{
+    int         i, j, k, longestLine, line;
+    char        c, *s, *lineBuf=0;
+    FILE        *fp;
+    Tree        *t;
+    TreeList    *treeList;
+    char        *tempStr;
+    int         tempStrSize = TEMPSTRSIZE;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    if (chainParams.saveTrees == YES)
+        {
+        for (i=0; i<numTopologies; i++)
+            {
+            t = chainParams.dtree;
+            if (topologyParam[i]->tree[0]->isRooted == YES)
+                t->isRooted = YES;
+            else
+                t->isRooted = NO;
+
+            for (j=0; j<chainParams.numRuns; j++)
+                {               
+                treeList = &chainParams.treeList[j*numTopologies + i];
+                
+                for (k=from; k<=to; k++)
+                    {
+                    GetFromTreeList (treeList, t);
+                    if (RemoveTreeFromPartitionCounters (t, i, j) == ERROR)
+                        {
+                        SafeFclose (&fp);
+                        free (tempStr);
+                        free (lineBuf);
+                        return (ERROR);
+                        }
+                    }
+                }
+            }
+        }
+    else
+        {
+        for (i=0; i<numTopologies; i++)
+            {
+            t = chainParams.dtree;
+
+            for (j=0; j<chainParams.numRuns; j++)
+                {
+                if (numPrintTreeParams == 1)
+                    {
+                    if (chainParams.numRuns == 1)
+                        SafeSprintf (&tempStr, &tempStrSize, "%s.t", chainParams.chainFileName);
+                    else
+                        SafeSprintf (&tempStr, &tempStrSize, "%s.run%d.t", chainParams.chainFileName, j+1);
+                    }
+                else
+                    {
+                    if (chainParams.numRuns == 1)
+                        SafeSprintf (&tempStr, &tempStrSize, "%s.tree%d.t", chainParams.chainFileName, topologyPrintIndex[i]+1);
+                    else
+                        SafeSprintf (&tempStr, &tempStrSize, "%s.tree%d.run%d.t", chainParams.chainFileName, topologyPrintIndex[i]+1, j+1);
+                    }
+
+                if ((fp = OpenTextFileR (tempStr)) == NULL)
+                        {
+                        free (tempStr);
+                        return (ERROR);
+                        }
+                
+                if (from == 1)
+                    {
+                    longestLine = LongestLine(fp);
+                    lineBuf = (char *) SafeCalloc (longestLine+2,sizeof(char));
+                    fseek (fp, LastBlock(fp, lineBuf, longestLine), SEEK_SET);
+                    fseek (fp, FirstTree(fp, lineBuf, longestLine), SEEK_SET);
+                    fgetpos (fp, &chainParams.tFilePos[j*numTopologies+i]);
+                    free(lineBuf);
+                    lineBuf = NULL;
+                    }
+                fsetpos (fp, &chainParams.tFilePos[j*numTopologies+i]);
+
+                longestLine = 0;
+                for (k=0; k<=to-from; k++)
+                    {
+                    line = 0;
+                    do {
+                        line++;
+                        } while ((c = fgetc(fp)) != '\r' && c != '\n');
+                    
+                    if (line > longestLine)
+                        longestLine = line;
+                    
+                    while ((c = fgetc(fp)) == '\r' || c == '\n')
+                        ;
+                    }
+
+                lineBuf = (char *) SafeCalloc (longestLine + 10, sizeof (char));
+                if (!lineBuf)
+                    {
+                    SafeFclose (&fp);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                fsetpos (fp, &chainParams.tFilePos[j*numTopologies+i]);
+                /* The fsetpos and fgetpos pair are affected by writing to the file,
+                    at least on Windows systems. The effect is to put the subsequent
+                    fsetpos back a few positions. The following code will deal with this
+                    problem without affecting systems where this does not happen. */
+                do { c = fgetc(fp);
+                } while (c != 't');
+
+                for (k=from; k<=to; k++)
+                    {
+                    if (fgets (lineBuf, longestLine + 5, fp) == NULL) 
+                        {
+                        free (tempStr);
+                        free (lineBuf);
+                        return ERROR;
+                        }
+
+                    s = strtok (lineBuf, " ");
+                    for (s = strtok (NULL, ";"); *s != '('; s++)
+                        ;
+                    
+                    StripComments (s);
+                    if (ResetTopology (t, s) == ERROR)
+                        {
+                        SafeFclose (&fp);
+                        free (tempStr);
+                        free (lineBuf);
+                        return (ERROR);
+                        }
+                    
+                    if (RemoveTreeFromPartitionCounters (t, i, j) == ERROR)
+                        {
+                        SafeFclose (&fp);
+                        free (tempStr);
+                        free (lineBuf);
+                        return (ERROR);
+                        }
+                    }
+                fgetpos (fp, &chainParams.tFilePos[j*numTopologies+i]);
+                free (lineBuf);
+                SafeFclose (&fp);
+                }
+            }
+        }
+
+    /* remove unnecessary nodes from the tree holding partition counters */
+    for (i=0; i<numTopologies; i++)
+        {
+        partFreqTreeRoot[i] = CompactTree (partFreqTreeRoot[i]);
+        }
+
+    free (tempStr);
+    return (NO_ERROR);
+}
+
+
+int ReopenMBPrintFiles (void)
+{
+    int     i, n;
+    char    fileName[120], localFileName[100];
+    
+    /* Take care of the mpi procs that do not have a file */
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    /* Get root of local file name */
+    strcpy (localFileName, chainParams.chainFileName);
+
+    /* Reopen the .p and .t files */
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.numRuns == 1)
+            sprintf (fileName, "%s.p", localFileName);
+        else
+            sprintf (fileName, "%s.run%d.p", localFileName, n+1);
+
+        if ((fpParm[n] = OpenTextFileA (fileName)) == NULL)
+            return (ERROR);
+
+        for (i=0; i<numTrees; i++)
+            {
+            if (numTrees == 1 && chainParams.numRuns == 1)
+                sprintf (fileName, "%s.t", localFileName);
+            else if (numTrees > 1 && chainParams.numRuns == 1)
+                sprintf (fileName, "%s.tree%d.t", localFileName, i+1);
+            else if (numTrees == 1 && chainParams.numRuns > 1)
+                sprintf (fileName, "%s.run%d.t", localFileName, n+1);
+            else
+                sprintf (fileName, "%s.tree%d.run%d.t", localFileName, i+1, n+1);
+
+            if ((fpTree[n][i] = OpenTextFileA (fileName)) == NULL)
+                return (ERROR);
+            }
+        }
+
+    /* Reopen the .mcmc file */
+    if (chainParams.mcmcDiagn == YES)
+        {
+        sprintf (fileName, "%s.mcmc", localFileName);
+
+        if ((fpMcmc = OpenTextFileA (fileName)) == NULL)
+            return (ERROR);
+        }
+    
+#   if defined (PRINT_DUMP)
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.numRuns == 1)
+            sprintf (fileName, "%s.dump", localFileName);
+        else
+            sprintf (fileName, "%s.run%d.dump", localFileName, n+1);
+
+        if ((fpDump[n] = OpenTextFileA (fileName)) == NULL)
+            return (ERROR);
+        }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int ConfirmAbortRun(void)
+{
+    char c, line[100];
+    int  ret=0, i;
+
+    /* reset requestAbortRun */
+    requestAbortRun = NO;
+
+    MrBayesPrint("   Do you really want to stop the run (y/n)?");
+    if (fgets (line,98,stdin) == NULL)
+        {
+        printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+        }
+    for (i=0; (c=line[i])!='\0' && !isgraph(c); i++)
+        ;
+    if (c == 'y' || c == 'Y')
+        ret=1;
+    else 
+        {
+        MrBayesPrint("   Mcmc run continued ...\n\n");
+        ret=0;
+        }
+    return ret;
+}
+
+
+/*-------------------------------------------------------------------
+|
+|   ResetChainIds: Make sure parameter values are swapped back 
+|       at the end of a Metropolis-coupled MCMC run
+|
+--------------------------------------------------------------------*/
+void ResetChainIds (void)
+{
+    int     j, k, k1, tempId, *curId, toChn, fromChn, *to, *from, *swap;
+    Param   *p;
+    MrBFlt  *fromVals, *toVals, *swapVals, **fromPosition, **toPosition,
+            **swapPosition, **fromRateMult, **toRateMult, **swapRateMult;
+    Tree    *toTree, *fromTree, *swapTree;
+
+    curId = (int *) SafeCalloc (numGlobalChains, sizeof(int));
+
+#if defined (MPI_ENABLED)
+    ReassembleParamVals(curId);
+    ReassembleTuningParams();
+    SetChainIds();
+    if (proc_id != 0)
+    {
+        /* reset state */
+        for (j=0; j<numLocalChains; j++)
+            state[j] = 0;
+        free (curId);
+    return;
+        }
+#else
+    for (j=0; j<numGlobalChains; j++)
+        curId[j] = chainId[j];
+    SetChainIds();
+#endif
+    
+    for (toChn=0; toChn<numGlobalChains; toChn++)
+        {
+        if (curId[toChn] == toChn)
+            {
+            if (state[toChn] != 0)
+                {
+                CopyParams (toChn);
+                CopyTrees (toChn);
+                state[toChn] ^= 1;
+                }
+            continue;
+            }
+
+        /* we need to swap all values */
+        /* first find the chain to swap with */
+        for (j=toChn+1; j<numGlobalChains; j++)
+            if (curId[j] == toChn)
+                break;
+        fromChn = j;
+
+        /* normal params */
+        CopyParams (toChn);
+        CopyTrees (toChn);
+        CopyParams (fromChn);
+        CopyTrees (fromChn);
+
+        for (j=0; j<numParams; j++)
+            {
+            p = &params[j];
+            toVals = GetParamVals (p, toChn, 0);
+            swapVals = GetParamVals (p, toChn, 1);
+            fromVals = GetParamVals (p, fromChn, state[fromChn]);
+            for (k=0; k<p->nValues; k++)
+                {
+                toVals[k] = fromVals[k];
+                fromVals[k] = swapVals[k];
+                }
+            toVals = GetParamSubVals (p, toChn, 0);
+            swapVals = GetParamSubVals (p, toChn, 1);
+            fromVals = GetParamSubVals (p, fromChn, state[fromChn]);
+            for (k=0; k<p->nSubValues; k++)
+                {
+                toVals[k] = fromVals[k];
+                fromVals[k] = swapVals[k];
+                }
+            if (p->nStdStateFreqs > 0)
+                {
+                toVals = GetParamStdStateFreqs (p, toChn, 0);
+                swapVals = GetParamStdStateFreqs (p, toChn, 1);
+                fromVals = GetParamStdStateFreqs (p, fromChn, state[fromChn]);
+                for (k=0; k<p->nStdStateFreqs; k++)
+                    {
+                    toVals[k] = fromVals[k];
+                    fromVals[k] = swapVals[k];
+                    }
+                }
+            }
+
+        /* mcmc trees */
+        for (j=0; j<numTrees; j++)
+            {
+            toTree = GetTreeFromIndex(j, toChn, 0);
+            swapTree = GetTreeFromIndex(j, toChn, 1);
+            fromTree = GetTreeFromIndex(j, fromChn, state[fromChn]);
+            CopyToTreeFromTree (toTree, fromTree);
+            CopyToTreeFromTree (fromTree, swapTree);
+            CopyToTreeFromTree (swapTree, toTree);
+            swapTree = GetTreeFromIndex(j, fromChn, state[fromChn] ^ 1);
+            CopyToTreeFromTree (swapTree, fromTree);
+            }
+        /* CPP relaxed clock params */
+        for (j=0; j<numParams; j++)
+            {
+            p = &params[j];
+            if (p->paramType == P_CPPEVENTS)
+                {
+                to = p->nEvents[2*toChn];
+                swap = p->nEvents[2*toChn+1];
+                from = p->nEvents[2*fromChn+state[fromChn]];
+                toPosition = p->position[2*toChn];
+                swapPosition = p->position[2*toChn+1];
+                fromPosition = p->position[2*fromChn+state[fromChn]];
+                toRateMult = p->rateMult[2*toChn];
+                swapRateMult = p->rateMult[2*toChn+1];
+                fromRateMult = p->rateMult[2*fromChn+state[fromChn]];
+                for (k=0; k<2*numLocalTaxa; k++)
+                    {
+                    if (from[k] > 0)
+                        {
+                        toPosition[k] = (MrBFlt *) SafeRealloc ((void *)toPosition[k], from[k]*sizeof (MrBFlt));
+                        toRateMult[k] = (MrBFlt *) SafeRealloc ((void *)toRateMult[k], from[k]*sizeof (MrBFlt));
+                        for (k1=0; k1<from[k]; k1++)
+                            {
+                            toPosition[k][k1] = fromPosition[k][k1];
+                            toRateMult[k][k1] = fromRateMult[k][k1];
+                            }
+                        }
+                    else if (to[k] > 0)
+                        {
+                        free (toPosition[k]);
+                        toPosition[k] = NULL;
+                        free (toRateMult[k]);
+                        toRateMult[k] = NULL;
+                        }
+                    to[k] = from[k];
+                    if (swap[k] > 0)
+                        {
+                        fromPosition[k] = (MrBFlt *) SafeRealloc ((void *)fromPosition[k], swap[k]*sizeof (MrBFlt));
+                        fromRateMult[k] = (MrBFlt *) SafeRealloc ((void *)fromRateMult[k], swap[k]*sizeof (MrBFlt));
+                        for (k1=0; k1<swap[k]; k1++)
+                            {
+                            fromPosition[k][k1] = swapPosition[k][k1];
+                            fromRateMult[k][k1] = swapRateMult[k][k1];
+                            }
+                        }
+                    else if (from[k] > 0)
+                        {
+                        free (fromPosition[k]);
+                        fromPosition[k] = NULL;
+                        free (fromRateMult[k]);
+                        fromRateMult[k] = NULL;
+                        }
+                    from[k] = swap[k];
+                    }
+                }   
+            }
+        /* reset state of chain */
+        state[toChn] = 0;
+
+        /* make sure that the id is correct for the from chain */
+        tempId = curId[toChn];
+        curId[fromChn] = curId[toChn];
+        curId[toChn] = tempId;
+        }
+
+    free (curId);
+}
+
+
+/* ResetFlips: Reset flipped cond likes etc after rejection */
+void ResetFlips (int chain)
+{
+    int         d, i;
+    ModelInfo   *m;
+    TreeNode    *p;
+    Tree        *tree;
+#if defined (BEAGLE_ENABLED)
+    int         *isScalerNode=NULL;
+#endif    
+    
+    for (d=0; d<numCurrentDivisions; d++)
+    {
+        m = &modelSettings[d];
+#if defined (BEAGLE_ENABLED)
+        if (m->useBeagle == YES)
+            isScalerNode = m->isScalerNode[chain];
+#endif
+        if (m->upDateCl != YES)
+            continue;
+        
+#if defined (BEAGLE_ENABLED)
+        if (m->useBeagle == NO || 
+            beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS ||
+            m->rescaleBeagleAll == YES)
+                {
+                FlipSiteScalerSpace (m, chain);
+                if (m->useBeagle == YES && m->rescaleBeagleAll == YES)
+                    m->rescaleFreq[chain] = m->rescaleFreqOld;
+                }
+#else
+        FlipSiteScalerSpace (m, chain);
+#endif
+            
+        
+        if (m->upDateCijk == YES && m->nCijkParts > 0)
+            FlipCijkSpace (m, chain);
+        
+        /* cycle over tree */
+        tree = GetTree (m->brlens, chain, state[chain]);
+        for (i=0; i<tree->nNodes; i++)
+            {
+            p = tree->allDownPass[i];
+            if (p->upDateTi == YES)
+                FlipTiProbsSpace (m, chain, p->index);
+            if (p->right != NULL)    /* do not flip terminals in case these flags are inappropriately set by moves */
+                {
+                if (p->upDateCl == YES)
+                    {
+                    FlipCondLikeSpace (m, chain, p->index);
+#if defined (BEAGLE_ENABLED)
+                    if (m->useBeagle == NO || 
+                        beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS ||
+                        (m->rescaleBeagleAll == YES && isScalerNode[p->index] == YES))
+                        FlipNodeScalerSpace (m, chain, p->index);
+#else
+                    FlipNodeScalerSpace (m, chain, p->index);
+#endif
+                    }
+#if defined (BEAGLE_ENABLED)
+                else if (m->rescaleBeagleAll == YES)
+                    {
+                    FlipCondLikeSpace (m, chain, p->index);
+                    if (isScalerNode[p->index] == YES)
+                        FlipNodeScalerSpace (m, chain, p->index);
+                    }
+#endif
+                }
+            }
+        
+        /* division flag and tree node flags are reset when trees are copied */
+    }
+}
+
+
+/*-------------------------------------------------------------------
+|
+|   ResetScalersPartition: reset scaler nodes of the given tree by appropriately setting isScalerNode array.
+| @param isScalerNode   is an array which gets set with information about scaler node. 
+|                       For each internal node isScalerNode[node->index] is set to YES if it has to be scaler node.
+|                       Note: Only internal nodes can become scaler nodes thus isScalerNode is set only for elemnts in interval [numLocalTaxa, numLocalTaxa+t->nIntNodes]
+|
+| @param rescaleFreq    effectively represent gaps between rescaling, higher number means more sparse choice of rescaling nodes 
+|
+--------------------------------------------------------------------*/
+int ResetScalersPartition (int *isScalerNode, Tree* t, unsigned rescaleFreq)
+{
+    int         n;
+    TreeNode    *p;
+        
+    /* set the node depth value of terminal nodes to zero; reset scalerNode */
+    for (n=0; n<t->nNodes; n++)
+        {
+        p = t->allDownPass[n];
+        if (p->left == NULL)
+            p->x = 0;
+        }
+
+    /* loop over interior nodes */
+    for (n=0; n<t->nIntNodes; n++)
+        {
+        p = t->intDownPass[n];
+        assert (((p->index - numLocalTaxa) >= 0) && ((p->index - numLocalTaxa) < t->nIntNodes));
+        p->x = p->left->x + p->right->x + 1;
+
+        if (p->x > 2 * (int)rescaleFreq)
+            {
+            assert (p->left->left != NULL && p->right->left != NULL);
+            isScalerNode[p->left->index] = YES;
+            p->left->x = 0;
+            isScalerNode[p->right->index] = YES;
+            p->right->x = 0;
+            p->x = 1;
+            }
+        else if (p->x > (int)rescaleFreq)
+            {
+            if (p->left->x > p->right->x)
+                {
+                assert (p->left->left != NULL);
+                isScalerNode[p->left->index] = YES;
+                p->left->x = 0;
+                }
+            else
+                {
+                assert (p->right->left != NULL);
+                isScalerNode[p->right->index] = YES;
+                p->right->x = 0;
+                }
+            p->x = p->left->x + p->right->x + 1;
+            }
+        else
+            isScalerNode[p->index] = NO;
+        }
+
+    return NO_ERROR;
+}
+
+
+/*-------------------------------------------------------------------
+|
+|   ResetScalers: reset scaler nodes of all trees of all chains
+|       This scheme ensures that minimally RESCALE_FREQ
+|       unscaled interior nodes occur before rescaling is done
+|
+--------------------------------------------------------------------*/
+int ResetScalers (void)
+{
+    int         i, n, chn;
+    Tree        *t;
+    TreeNode    *p;
+
+#if defined (DEBUG_NOSCALING)
+    return (NO_ERROR);
+#endif
+
+    for (chn=0; chn<numLocalChains; chn++)
+        {
+        for (i=0; i<numTrees; i++)
+            {
+            t = GetTreeFromIndex (i, chn, state[chn]);
+        
+            /* set the node depth value of terminal nodes to zero; reset scalerNode */
+            for (n=0; n<t->nNodes; n++)
+                {
+                p = t->allDownPass[n];
+                p->scalerNode = NO;
+                if (p->left == NULL)
+                    p->x = 0;
+                }
+
+            /* loop over interior nodes */
+            for (n=0; n<t->nIntNodes; n++)
+                {
+                p = t->intDownPass[n];
+
+                p->x = p->left->x + p->right->x + 1;
+
+                if (p->x > 2 * RESCALE_FREQ)
+                    {
+                    assert (p->left->left != NULL && p->right->left != NULL);
+                    p->left->scalerNode = YES;
+                    p->left->x = 0;
+                    p->right->scalerNode = YES;
+                    p->right->x = 0;
+                    p->x = 1;
+                    }
+                else if (p->x > RESCALE_FREQ)
+                    {
+                    if (p->left->x > p->right->x)
+                        {
+                        assert (p->left->left != NULL);
+                        p->left->scalerNode = YES;
+                        p->left->x = 0;
+                        }
+                    else
+                        {
+                        assert (p->right->left != NULL);
+                        p->right->scalerNode = YES;
+                        p->right->x = 0;
+                        }
+                    p->x = p->left->x + p->right->x + 1;
+                    }
+                else
+                    p->scalerNode = NO;
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+void ResetSiteScalers (ModelInfo *m, int chain)
+{
+    int     c;
+    CLFlt   *lnScaler;
+
+#if defined (BEAGLE_ENABLED)
+    if (m->useBeagle == YES)
+        {
+        beagleResetScaleFactors(m->beagleInstance, m->siteScalerIndex[chain]);
+        return;
+        }
+#endif
+    lnScaler = m->scalers[m->siteScalerIndex[chain]];
+    for (c=0; c<m->numChars; c++)
+        lnScaler[c] = 0.0;
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   ReusePreviousResults: Save old .p, .t, .ss and .mcmc files with ~ extension,
+|      then prepare new print files with the relevant old values added in
+|      The number of samples is returned in numSamples
+|
+------------------------------------------------------------------------*/
+int ReusePreviousResults (int *numSamples, int steps)
+{
+    int         i, n;
+    char        localFileName[100], fileName[220], bkupName[220];
+
+    (*numSamples) = 0;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    /* Allocate space for file pointers */
+    if (memAllocs[ALLOC_FILEPOINTERS] == YES)
+        {
+        MrBayesPrint ("%s   File pointers already allocated in ReusePreviousResults\n", spacer);
+        return ERROR;
+        }
+    fpMcmc = NULL;
+    fpSS = NULL;
+    fpParm = NULL;
+    fpTree = NULL;  
+    fpParm = (FILE **) SafeCalloc (chainParams.numRuns, sizeof (FILE *));
+    if (fpParm == NULL)
+        {
+        MrBayesPrint ("%s   Could not allocate fpParm in ReusePreviousResults\n", spacer);
+        return ERROR;
+        }
+    memAllocs[ALLOC_FILEPOINTERS] = YES;
+    fpTree = (FILE ***) SafeCalloc (chainParams.numRuns, sizeof (FILE **));
+    if (fpTree == NULL)
+        {
+        MrBayesPrint ("%s   Could not allocate fpTree in ReusePreviousResults\n", spacer);
+        return ERROR;
+        }
+    fpTree[0] = (FILE **) SafeCalloc (numTrees*chainParams.numRuns, sizeof (FILE *));
+    if (fpTree[0] == NULL)
+        {
+        MrBayesPrint ("%s   Could not allocate fpTree[0] in ReusePreviousResults\n", spacer);
+        return ERROR;
+        }
+    for (i=1; i<chainParams.numRuns; i++)
+        fpTree[i] = fpTree[0] + i*numTrees;
+
+    /* Get root of local file name */
+    strcpy (localFileName, chainParams.chainFileName);
+
+    /* Store old and prepare new .p and .t files */
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.numRuns == 1)
+            sprintf (fileName, "%s%s.p", workingDir, localFileName);
+        else
+            sprintf (fileName, "%s%s.run%d.p", workingDir, localFileName, n+1);
+        strcpy(bkupName,fileName);
+        strcat(bkupName,"~");
+        remove(bkupName);
+        if (rename(fileName,bkupName) != 0)
+            {
+            MrBayesPrint ("%s   Could not rename file %s\n", spacer, fileName);
+            return ERROR;
+            }
+
+        if ((fpParm[n] = OpenNewMBPrintFile (fileName+strlen(workingDir))) == NULL)
+            return (ERROR);
+        else if (CopyResults(fpParm[n],bkupName+strlen(workingDir),numPreviousGen) == ERROR)
+            return (ERROR);
+
+        for (i=0; i<numTrees; i++)
+            {
+            if (numTrees == 1 && chainParams.numRuns == 1)
+                sprintf (fileName, "%s%s.t", workingDir, localFileName);
+            else if (numTrees > 1 && chainParams.numRuns == 1)
+                sprintf (fileName, "%s%s.tree%d.t", workingDir, localFileName, i+1);
+            else if (numTrees == 1 && chainParams.numRuns > 1)
+                sprintf (fileName, "%s%s.run%d.t", workingDir, localFileName, n+1);
+            else
+                sprintf (fileName, "%s%s.tree%d.run%d.t", workingDir, localFileName, i+1, n+1);
+            strcpy(bkupName,fileName);
+            strcat(bkupName,"~");
+            remove(bkupName);
+            if (rename(fileName,bkupName) != 0)
+                {
+                MrBayesPrint ("%s   Could not rename file %s\n", spacer, fileName);
+                return ERROR;
+                }
+            if ((fpTree[n][i] = OpenNewMBPrintFile (fileName+strlen(workingDir))) == NULL)
+                return (ERROR);
+            else if (CopyTreeResults(fpTree[n][i],bkupName+strlen(workingDir),numPreviousGen,numSamples) == ERROR)
+                return (ERROR);
+            }
+        }
+
+    /* Store old and prepare new .ss file */
+    if (chainParams.isSS == YES)
+        {
+        sprintf (fileName, "%s%s.ss", workingDir, chainParams.chainFileName);
+        strcpy(bkupName,fileName);
+        strcat(bkupName,"~");
+        remove(bkupName);
+        if (rename(fileName,bkupName) != 0)
+            {
+            MrBayesPrint ("%s   Could not rename file %s\n", spacer, fileName);
+            return ERROR;
+            }
+        if ((fpSS = OpenNewMBPrintFile (fileName+strlen(workingDir))) == NULL)
+            return (ERROR);
+        else if (CopyProcessSsFile(fpSS,bkupName+strlen(workingDir),steps,marginalLnLSS,splitfreqSS)==ERROR)
+            return (ERROR);
+        }
+
+    /* Store old and prepare new .mcmc file */
+    if (chainParams.mcmcDiagn == YES)
+        {
+        sprintf (fileName, "%s%s.mcmc", workingDir, chainParams.chainFileName);
+        strcpy(bkupName,fileName);
+        strcat(bkupName,"~");
+        remove(bkupName);
+        if (rename(fileName,bkupName) != 0)
+            {
+            MrBayesPrint ("%s   Could not rename file %s\n", spacer, fileName);
+            return ERROR;
+            }
+        if ((fpMcmc = OpenNewMBPrintFile (fileName+strlen(workingDir))) == NULL)
+            return (ERROR);
+        else if (CopyResults(fpMcmc,bkupName+strlen(workingDir),numPreviousGen)==ERROR)
+            return (ERROR);
+        }
+    
+#   if defined (PRINT_DUMP)
+    fpDump = (FILE **) SafeCalloc (chainParams.numRuns, sizeof (FILE *));
+    
+    for (n=0; n<chainParams.numRuns; n++)
+        {
+        if (chainParams.numRuns == 1)
+            sprintf (fileName, "%s.dump", localFileName);
+        else
+            sprintf (fileName, "%s.run%d.dump", localFileName, n+1);
+        
+        if ((fpDump[n] = OpenTextFileA (fileName)) == NULL)
+            return (ERROR);
+    }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int RunChain (RandLong *seed)
+{
+    int         i, j, n, chn, swapA=0, swapB=0, whichMove, acceptMove;
+    int         lastDiagnostics;    // the sample no. when last diagnostic was performed
+    int         removeFrom, removeTo=0;
+    int         stopChain, nErrors;
+    MrBFlt      r=0.0, lnLikelihoodRatio, lnPriorRatio, lnProposalRatio, lnLike=0.0, lnPrior=0.0, f=0.0, CPUTime;
+    MCMCMove    *theMove, *mv;
+    time_t      startingT, endingT, stoppingT1, stoppingT2;
+    clock_t     previousCPUTime, currentCPUTime;
+    /* Stepping-stone sampling variables */
+    int         run, samplesCountSS=0, stepIndexSS=0, numGenInStepSS=0, numGenOld, lastStepEndSS=0, numGenInStepBurninSS=0;
+    MrBFlt      stepLengthSS=0, meanSS, varSS, *tempX;
+    char        ckpFileName[220], bkupFileName[220];
+
+#   if defined (BEAGLE_ENABLED)
+    int         ResetScalersNeeded;  //set to YES if we need to reset node->scalerNode, used in old style rescaling;
+#       ifdef DEBUG_BEAGLE
+    int         beagleScalingSchemeOld;
+#       endif
+    ModelInfo   *m;
+    ResetScalersNeeded = NO;
+    
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = &modelSettings[i];
+        if (m->useBeagle == NO || beagleScalingScheme == MB_BEAGLE_SCALE_ALWAYS)
+            {
+            ResetScalersNeeded =YES;
+            break;
+            }
+        }
+#   endif
+
+#   if defined (MPI_ENABLED)
+    int         ierror, sumErrors;
+    MrBFlt      best, sum=0.0;
+    MPI_Status  status;
+#   endif
+#   if defined (DEBUG_RUNCHAIN)
+    ModelInfo   *m;
+#   endif
+    
+    /* set nErrors to 0 */
+    nErrors = 0;
+    if (numLocalTaxa < 4)
+        {
+        for (i=0; i<numTrees; i++)
+            if (GetTreeFromIndex(i, 0, 0)->isRooted == NO)
+                break;
+        if (i < numTrees && numLocalTaxa < 4)
+            {
+            MrBayesPrint ("%s   There must be at least four taxa in the analysis\n", spacer);
+            return (ERROR);
+            }
+        else if (i == numTrees && numLocalTaxa < 3)
+            {
+            MrBayesPrint ("%s   There must be at least three taxa in the analysis\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    /* allocate some memory for the chains */
+    if (memAllocs[ALLOC_CURLNL] == YES)
+        {
+        MrBayesPrint ("%s   curLnL is already allocated\n", spacer);
+        nErrors++;
+        }
+    else if ((curLnL = (MrBFlt *)SafeMalloc((size_t)numLocalChains * sizeof(MrBFlt))) == NULL)
+        {
+        MrBayesPrint ("%s   Problem allocating curLnL (%d)\n", spacer, numLocalChains * sizeof(MrBFlt));
+        nErrors++;
+        }
+    else if ((maxLnL0 = (MrBFlt *) SafeCalloc ((size_t)(chainParams.numRuns) * (size_t)(chainParams.numChains), sizeof(MrBFlt))) == NULL)
+        {
+        MrBayesPrint ("%s   Problem allocating maxLnL0\n", spacer, numLocalChains * sizeof(MrBFlt));
+        free (curLnL);
+        nErrors++;
+        }
+    else
+        memAllocs[ALLOC_CURLNL] = YES;
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Memory allocation error on at least one processor\n", spacer);
+        return ERROR;
+        }
+#   else
+    if (nErrors > 0)
+        return ERROR;
+#   endif
+
+    if (memAllocs[ALLOC_CURLNPR] == YES)
+        {
+        MrBayesPrint ("%s   curLnPr is already allocated\n", spacer);
+        nErrors++;
+        }
+    else if ((curLnPr = (MrBFlt *)SafeMalloc((size_t)numLocalChains * sizeof(MrBFlt))) == NULL)
+        {
+        MrBayesPrint ("%s   Problem allocating curLnPr (%d)\n", spacer, numLocalChains * sizeof(MrBFlt));
+        nErrors++;
+        }
+    else
+        memAllocs[ALLOC_CURLNPR] = YES;
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Memory allocation error on at least one processor\n", spacer);
+        return ERROR;
+        }
+#   else
+    if (nErrors > 0)
+        return ERROR;
+#   endif
+
+    if (memAllocs[ALLOC_CHAINID] == YES)
+        {
+        MrBayesPrint ("%s   chainId is already allocated\n", spacer);
+        nErrors++;
+        }
+    else if ((chainId = (int *)SafeMalloc((size_t)numLocalChains * sizeof(int))) == NULL)
+        {
+        MrBayesPrint ("%s   Problem allocating chainId (%d)\n", spacer, numLocalChains * sizeof(int));
+        nErrors++;
+        }
+    else
+        memAllocs[ALLOC_CHAINID] = YES;
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Memory allocation error on at least one processor\n", spacer);
+        return ERROR;
+        }
+#   else
+    if (nErrors > 0)
+        return ERROR;
+#   endif
+
+    if (memAllocs[ALLOC_SWAPINFO] == YES)
+        {
+        MrBayesPrint ("%s   swapInfo is already allocated\n", spacer);
+        nErrors++;
+        }
+    else if ((swapInfo = (int ***) SafeCalloc (chainParams.numRuns, sizeof (int **))) == NULL)
+        {
+        MrBayesPrint ("%s   Problem allocating swapInfo\n", spacer);
+        nErrors++;
+        }
+    else
+        {
+        for (n=0; n<chainParams.numRuns; n++)
+            {
+            swapInfo[n] = AllocateSquareIntegerMatrix (chainParams.numChains);
+            if (!swapInfo[n])
+                {
+                MrBayesPrint ("%s   Problem allocating swapInfo[%d]\n", spacer, n);
+                for (i=0; i<n; i++)
+                    free (swapInfo[i]);
+                free (swapInfo);
+                nErrors++;
+                break;
+                }
+            }
+        memAllocs[ALLOC_SWAPINFO] = YES;
+        }
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Memory allocation error on at least one processor\n", spacer);
+        return ERROR;
+        }
+#   else
+    if (nErrors > 0)
+        return ERROR;
+#   endif
+
+    for (n=0; n<chainParams.numRuns; n++)
+        for (i=0; i<chainParams.numChains; i++)
+            for (j=0; j<chainParams.numChains; j++)
+                swapInfo[n][i][j] = 0;
+
+    /* set up counters for topological convergence diagnostics */
+    /* allocate tree used for some topological convergence diagnostics */
+    if (chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+        {
+        if (SetUpPartitionCounters () == ERROR)
+            nErrors++;
+#   if defined (MPI_ENABLED)
+        if (proc_id == 0)
+            {
+#   endif
+        if (chainParams.relativeBurnin == YES)
+            {
+            /* we have to remove trees later on */
+            if (chainParams.saveTrees == YES)
+                {
+                if (chainParams.treeList)
+                    nErrors++;
+                else 
+                    {
+                    chainParams.treeList = (TreeList *) SafeCalloc (chainParams.numRuns*numTopologies, sizeof (TreeList));
+                    if (!chainParams.treeList)
+                        nErrors++;
+                    }
+                if (nErrors == 0)
+                    memAllocs[ALLOC_TREELIST] = YES;
+                if (noWarn == YES)
+                    chainParams.stopTreeGen = (int) (chainParams.numGen * chainParams.burninFraction);
+                else
+                    chainParams.stopTreeGen = chainParams.numGen;
+                }
+            else /* if (chainParams.saveTrees == NO) */
+                {
+                chainParams.tFilePos = (fpos_t*) SafeRealloc ((void *)chainParams.tFilePos, chainParams.numRuns*numTopologies*sizeof (fpos_t));
+                if (!chainParams.tFilePos)
+                    nErrors++;
+                else
+                    memAllocs[ALLOC_TFILEPOS] = YES;
+                }
+            }
+#   if defined (MPI_ENABLED)
+            }
+#   endif
+#   if defined (MPI_ENABLED)
+        if (proc_id == 0)
+            {
+            if ((chainParams.stat = (STATS *) SafeCalloc (numTopologies, sizeof (STATS))) == NULL)
+                nErrors++;
+            else
+                {
+                memAllocs[ALLOC_STATS] = YES;
+                for (i=0; i<numTopologies; i++)
+                    chainParams.stat[i].pair = NULL;
+                }
+
+            if ((chainParams.dtree = AllocateTree (numLocalTaxa)) == NULL)
+                {
+                nErrors++;
+                }
+            else
+                memAllocs[ALLOC_DIAGNTREE] = YES;
+
+            if (chainParams.allComps == YES)
+                {
+                for (i=0; i<numTopologies; i++)
+                    {
+                    if ((chainParams.stat[i].pair = AllocateSquareDoubleMatrix (chainParams.numRuns)) == NULL)
+                        {
+                        nErrors++;
+                        break;
+                        }
+                    }
+                }
+            }
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Memory allocation error on at least one processor\n", spacer);
+            return ERROR;
+            }
+#   else
+        if ((chainParams.stat = (STATS *) SafeCalloc (numTopologies, sizeof (STATS))) == NULL)
+            return ERROR;
+        else
+            {
+            memAllocs[ALLOC_STATS] = YES;
+            for (i=0; i<numTopologies; i++)
+                chainParams.stat[i].pair = NULL;
+            }
+            
+        if ((chainParams.dtree = AllocateTree (numLocalTaxa)) == NULL)
+            {
+            MrBayesPrint ("%s   Could not allocate chainParams.dtree in RunChain\n", spacer);
+            return ERROR;
+            }
+        else
+            memAllocs[ALLOC_DIAGNTREE] = YES;
+        
+        if (chainParams.allComps == YES)
+            {
+            for (i=0; i<numTopologies; i++)
+                {
+                if ((chainParams.stat[i].pair = AllocateSquareDoubleMatrix (chainParams.numRuns)) == NULL)
+                    {
+                    MrBayesPrint ("%s   Could not allocate chainParams.stat.pair in RunChain\n", spacer);
+                    return ERROR;
+                    }
+                }
+            }
+#   endif
+        }
+
+    /* get chain IDs */
+    SetChainIds ();
+    
+    /* distribute parameter starting values and tuning parameters for MPI version */
+#   if defined (MPI_ENABLED)
+    RedistributeParamVals();
+    RedistributeTuningParams();
+#   endif
+
+#   if defined (TIMING_ANALIZ)
+    CPUCondLikeDown = 0;
+    CPUScalers = 0;
+    CPUScalersRemove = 0;
+    CPUCondLikeRoot = 0;
+    CPULilklihood = 0;
+#   endif
+
+    /* initialize likelihoods and prior                  */
+    /* touch everything and calculate initial cond likes */
+#   if defined (BEAGLE_ENABLED)
+    if (ResetScalersNeeded)
+        ResetScalers();
+#   else
+    ResetScalers();
+#   endif
+    TouchAllPartitions ();
+    for (chn=0; chn<numLocalChains; chn++)
+        {
+        if (chn % chainParams.numChains == 0)
+            {
+            if (chainParams.numRuns == 1)
+                MrBayesPrint ("\n%s   Initial log likelihoods and log prior probs:\n", spacer);
+            else
+                MrBayesPrint ("\n%s   Initial log likelihoods and log prior probs for run %d:\n", spacer, chn / chainParams.numChains + 1);
+            }
+        TouchAllTrees (chn);
+        TouchAllCijks (chn);
+        curLnL[chn] = LogLike(chn);
+        curLnPr[chn] = LogPrior(chn);
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (modelSettings[i].gibbsGamma == YES)
+                curLnL[chn] += GibbsSampleGamma (chn, i, seed);
+            }
+        MrBayesPrint ("%s      Chain %d -- %.6lf -- %.6lf\n", spacer, (chn % chainParams.numChains) + 1, curLnL[chn], curLnPr[chn]);
+        }
+    MrBayesPrint("\n");
+
+#   if defined (MPI_ENABLED)
+    if (num_procs > 2)
+        MrBayesPrint ("%s   There are %d more chains on other processor(s)\n\n", spacer, numGlobalChains - numLocalChains);
+    else if (num_procs==2)
+        MrBayesPrint ("%s   There are %d more chains on the other processor\n\n", spacer, numGlobalChains - numLocalChains);
+#   endif
+
+    /* All steps are assumed to have the same length. */
+    if (chainParams.isSS == YES)
+        {
+        numGenInStepSS = (chainParams.numGen - chainParams.burninSS*chainParams.sampleFreq)/ chainParams.numStepsSS;
+        numGenInStepSS = chainParams.sampleFreq*(numGenInStepSS/chainParams.sampleFreq); /*make muliple of chainParams.sampleFreq*/
+        numGenOld = chainParams.numGen;
+        chainParams.numGen = (chainParams.burninSS * chainParams.sampleFreq + chainParams.numStepsSS*numGenInStepSS) ; 
+        if (stepRelativeBurninSS==YES)
+            numGenInStepBurninSS = ((int)(numGenInStepSS*chainParams.burninFraction / chainParams.sampleFreq))*chainParams.sampleFreq;
+        else
+            numGenInStepBurninSS = chainParams.chainBurnIn * chainParams.sampleFreq;
+        MrBayesPrint ("\n");
+        MrBayesPrint ("%s   Starting stepping-stone sampling to estimate marginal likelihood.         \n", spacer);
+        MrBayesPrint ("%s   %d steps will be used with %d generations (%d samples) within each step.  \n", spacer, chainParams.numStepsSS, numGenInStepSS, numGenInStepSS/chainParams.sampleFreq);
+        MrBayesPrint ("%s   Total of %d generations (%d samples) will be collected while first        \n", spacer, chainParams.numGen, chainParams.numGen/chainParams.sampleFreq);
+        MrBayesPrint ("%s   %d generations (%d samples) will be discarded as initial burnin.          \n", spacer, chainParams.burninSS*chainParams.sampleFreq, chainParams.burninSS);
+        MrBayesPrint ("%s   Additionally at the begining of each step %d generations (%d samples)     \n", spacer, numGenInStepBurninSS, numGenInStepBurninSS/chainParams.sampleFreq);
+        MrBayesPrint ("%s   will be discarded as burnin.  \n", spacer);
+        if (chainParams.startFromPriorSS==YES)
+            MrBayesPrint ("%s   Sampling from prior to posterior, i.e. first step samples from prior.   \n", spacer);
+        else
+            {
+            MrBayesPrint ("%s   Sampling from posterior to prior, i.e. first step samples from close to \n", spacer);
+            MrBayesPrint ("%s   posterior.                                                              \n", spacer);
+            }
+        if (numGenOld != chainParams.numGen)
+            {
+            MrBayesPrint ("%s   NOTE: Number of generation of each step is reduced to the closest multi-\n", spacer);
+            MrBayesPrint ("%s   ple of sampling frequency. That is why, in total it will be taken %d    \n", spacer, chainParams.numGen);
+            MrBayesPrint ("%s   generations instead of requested %d.                                    \n", spacer, numGenOld);
+            }
+        MrBayesPrint ("\n");
+        if ((numGenInStepSS-numGenInStepBurninSS)/chainParams.sampleFreq < 1)
+            {
+            MrBayesPrint ("%s   There is less then one sample in each step of stepping-stone sampling.  \n", spacer);
+            MrBayesPrint ("%s   Please adjust burnin, nuber of generations, sampling frequency or       \n", spacer);
+            MrBayesPrint ("%s   numnber of step in order to allow at least one sample per step.         \n", spacer);
+            return ERROR; /*All MPI run will return here since all of them have the same values*/
+            }
+        if (numPreviousGen==0 || numPreviousGen < chainParams.burninSS * chainParams.sampleFreq)
+            {
+            lastStepEndSS = chainParams.burninSS * chainParams.sampleFreq;
+            stepIndexSS = chainParams.numStepsSS-1;
+            if (numPreviousGen != 0)
+                removeTo=(numPreviousGen/chainParams.sampleFreq)+1;
+            if (chainParams.startFromPriorSS==YES)
+                {
+                // powerSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-1-stepIndexSS)/(MrBFlt)chainParams.numStepsSS);
+                powerSS = 0.0;
+                stepLengthSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-stepIndexSS)/(MrBFlt)chainParams.numStepsSS)-powerSS;
+                }
+            else
+                {
+                powerSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)stepIndexSS/(MrBFlt)chainParams.numStepsSS);
+                stepLengthSS = 1.0-powerSS;
+                }
+            samplesCountSS=0;
+            }
+        else
+            {
+            stepIndexSS     = (numPreviousGen-chainParams.burninSS * chainParams.sampleFreq)/numGenInStepSS; /* for now it holds number of steps we fully complited*/
+            lastStepEndSS   = chainParams.burninSS * chainParams.sampleFreq + stepIndexSS*numGenInStepSS;
+            removeTo        = chainParams.burninSS + (stepIndexSS*numGenInStepSS+numGenInStepBurninSS)/chainParams.sampleFreq + 1;
+            if (numPreviousGen < (removeTo-1)*chainParams.sampleFreq)
+                removeTo=numPreviousGen/chainParams.sampleFreq+1;
+            stepIndexSS     = chainParams.numStepsSS-1-stepIndexSS;
+            if (chainParams.startFromPriorSS==YES)
+                {
+                powerSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-1-stepIndexSS)/(MrBFlt)chainParams.numStepsSS);
+                stepLengthSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-stepIndexSS)/(MrBFlt)chainParams.numStepsSS)-powerSS;
+                }
+            else
+                {
+                powerSS         = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)stepIndexSS/(MrBFlt)chainParams.numStepsSS);
+                stepLengthSS    = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(stepIndexSS+1)/(MrBFlt)chainParams.numStepsSS)-powerSS;
+                }
+#   ifdef SAMPLE_ALL_SS
+            samplesCountSS  = (numPreviousGen-lastStepEndSS-numGenInStepBurninSS);
+#   else
+            samplesCountSS  = (numPreviousGen-lastStepEndSS-numGenInStepBurninSS)/chainParams.sampleFreq;
+#   endif
+            if (samplesCountSS < 0)
+                samplesCountSS=0;
+
+            MrBayesPrint("%s   Continue sampling step %d out of %d steps...\n",spacer, chainParams.numStepsSS-stepIndexSS, chainParams.numStepsSS);
+            /*marginalLnLSS will be red from file and destributed to other MPI_proc later. stepScalerSS, stepAcumulatorSS are lready red and if (samplesCountSS!=0) they will be redestributed. */
+            }
+
+        if (samplesCountSS == 0) /* in appended case it also can happen */
+            {
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                marginalLnLSS[run] = 0.0;
+                stepScalerSS[run] = 0.0;
+                stepAcumulatorSS[run] = 0.0;
+                }
+            for (chn=0; chn<numLocalChains; chn++)
+                {
+                if (chainId[chn] % chainParams.numChains == 0)
+                    {
+                    run = chainId[chn] / chainParams.numChains;
+                    stepScalerSS[run] = curLnL[chn]*stepLengthSS;
+                    }
+                }      
+            }
+        }
+
+    /* Append to previous analysis if this is requested, otherwise just open new print files */
+    if (chainParams.append == YES)
+        {
+#   if defined (MPI_ENABLED)
+    if (proc_id == 0) {
+#   endif
+        /* We get the number of samples in i */
+        if (ReusePreviousResults(&i, chainParams.numStepsSS-stepIndexSS-1) == ERROR || i < 2)
+            nErrors++;
+        else if (chainParams.numRuns > 1 && chainParams.mcmcDiagn == YES)  /* we potentially need to add tree samples for conv diagn */
+            {
+            /* Add tree samples to partition counters */
+            if (chainParams.relativeBurnin == YES)
+                {
+                if (numPreviousGen/(i-1) != chainParams.sampleFreq)
+                    {
+                    MrBayesPrint ("%s   1. Use the same sampling frequency as in the previous run to use relative burnin.\n", spacer);
+                    MrBayesPrint ("%s   2. Check (and modify) the number in [generation: number] at line 3 of the .ckp file\n", spacer);
+                    MrBayesPrint ("%s      to match the previous number of generations in all the .p and .t files. This may\n", spacer);
+                    MrBayesPrint ("%s      happen if checkfreq was smaller than samplefreq.\n", spacer);
+                    MrBayesPrint ("%s   3. Rarely, delete the last sample/line in the .p and .t files to achieve 2. above.\n", spacer);
+                    MrBayesPrint ("%s      This may happen if ngen was not divisible by samplefreq.\n", spacer);
+                    nErrors++;
+                    }
+                if (chainParams.isSS == NO)
+                    {
+                    if (noWarn == YES)
+                        {
+                        /* We definitely know the final number of generations */
+                        j = (chainParams.numGen/chainParams.sampleFreq)+1;
+                        j = (int) (j*chainParams.burninFraction);
+                        }
+                    else /* User may extend chain so save all trees if saving trees */
+                        j = i;
+                    if (j < i)
+                        {
+                        if (AddTreeSamples(1,j,chainParams.saveTrees) == ERROR) nErrors++;
+                        if (AddTreeSamples(j+1,i,NO) == ERROR) nErrors++;
+                        /* Since we never need to remove trees from partition counter after total burnin we put NO in the last argument */
+                        }
+                    else
+                        {
+                        if (AddTreeSamples(1,i,chainParams.saveTrees) == ERROR) nErrors++;
+                        }
+                    }
+                else
+                    {
+                    if (SetFilePositions(removeTo) == ERROR) nErrors++;
+                    if (AddTreeSamples(removeTo+1,i,chainParams.saveTrees) == ERROR) nErrors++;
+                    }
+                }
+            else if (chainParams.chainBurnIn < i)
+                {
+                if (AddTreeSamples(chainParams.chainBurnIn,i-1,chainParams.saveTrees) == ERROR) nErrors++;
+                }
+            }
+        if (nErrors == 0)
+            {
+            if (chainParams.isSS == NO && chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+                {
+                MrBayesPrint ("\n");
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using a relative burnin of %.1f %% for diagnostics\n", spacer, 100.0*chainParams.burninFraction);
+                else
+                    MrBayesPrint ("%s   Using an absolute burnin of %d samples for diagnostics\n", spacer, chainParams.chainBurnIn);
+                }
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   Chain results (continued from previous run; %d generations requested):\n\n", spacer, chainParams.numGen);
+            }
+#   if defined (MPI_ENABLED)
+        }
+#   endif
+
+        if (chainParams.autotune == YES)
+            {
+            for (i=0; i<numLocalChains; i++)
+                {
+                for (j=0; j<numUsedMoves; j++)
+                    {
+                    if (j==0)
+                        f = usedMoves[j]->cumProposalProb[chainId[i]];
+                    else
+                        f = usedMoves[j]->cumProposalProb[chainId[i]] - usedMoves[j-1]->cumProposalProb[chainId[i]];
+                    if (usedMoves[j]->targetRate[chainId[i]] > 0.0)
+                        {
+                        /* autotuned move; we assume it was perfectly tuned and start tuning from there at appropriate rate */
+                        usedMoves[j]->nBatches[chainId[i]] = (int) (f*numPreviousGen/chainParams.tuneFreq);
+                        usedMoves[j]->lastAcceptanceRate[chainId[i]] = usedMoves[j]->targetRate[chainId[i]];
+                        }
+                    else
+                        {
+                        /* not autotuned move; no previous batches will result in acceptance rate calculated from new samples */
+                        usedMoves[j]->nBatches[chainId[i]] = 0;
+                        usedMoves[j]->lastAcceptanceRate[chainId[i]] = 0.0;
+                        }
+                    }
+                }
+            }
+#   if defined (MPI_ENABLED)
+        if (chainParams.isSS == YES)
+            {
+            MPI_Bcast (marginalLnLSS, chainParams.numRuns, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+
+            if (samplesCountSS != 0)
+                {
+                MPI_Bcast (stepScalerSS, chainParams.numRuns, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+                MPI_Bcast (stepAcumulatorSS, chainParams.numRuns, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+                }
+            /*Set to zero all runs that we are not responsable for*/
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                for (chn=0; chn<numLocalChains; chn++)
+                    {
+                    if (chainId[chn] % chainParams.numChains == 0 && run == chainId[chn] / chainParams.numChains)
+                        break;
+                    }
+                if (chn<numLocalChains)
+                    continue;
+
+                marginalLnLSS[run] = 0.0;
+                stepScalerSS[run] = 0.0;
+                stepAcumulatorSS[run] = 0.0;    
+                }
+            }
+
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s    Error appending to previous run\n", spacer);
+            return ERROR;
+            }            
+#   else
+        if (nErrors == 1)
+            {
+            MrBayesPrint ("%s    Error appending to previous run\n", spacer);
+            return ERROR;
+            }
+#   endif
+        }
+    else
+        {
+        if (PreparePrintFiles() == ERROR)
+            nErrors++;
+        }
+
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   Error preparing print files on at least one processor\n", spacer);
+        CloseMBPrintFiles();
+        return ERROR;
+        }
+#   else
+    if (nErrors > 0)
+        {
+        MrBayesPrint ("%s   Error preparing print files\n", spacer);
+        CloseMBPrintFiles();
+        return ERROR;
+        }
+#   endif
+
+    if (chainParams.relativeBurnin == NO)
+        lastDiagnostics = chainParams.chainBurnIn;
+    else
+        lastDiagnostics = 0;
+    stopChain = NO;
+
+    for (i=0; i<chainParams.numRuns; i++)
+        maxLnL0[i] = -100000000.0;
+
+    startingT=time(0);
+    CPUTime = 0.0;
+    previousCPUTime = clock();
+
+    /* print headers and starting states */
+    if (numPreviousGen==0)
+        {
+        /* make sure we print headers */
+        PrintToScreen(0, 0, time(0), startingT);
+        if (PrintStatesToFiles (0) == ERROR)
+            {
+            MrBayesPrint("%s   Error in printing headers to files\n");
+#   if defined (MPI_ENABLED)
+            nErrors++;
+#   else
+            return ERROR;
+#   endif
+            }
+#   if defined (MPI_ENABLED)
+        MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+        if (sumErrors > 0)
+            {
+            MrBayesPrint ("%s   Aborting run.\n");
+            return ERROR;
+            }
+#   endif
+
+        if (chainParams.mcmcDiagn == YES)
+            {
+            if (PrintMCMCDiagnosticsToFile (0) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem printing mcmc diagnostics headers to file\n", spacer);
+#   if defined (MPI_ENABLED)
+                nErrors++;
+#   else
+                return (ERROR);
+#   endif
+                }
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Aborting run.\n");
+                return ERROR;
+                }
+#   endif
+        
+            if (chainParams.isSS == YES && chainParams.burninSS == 0 && chainParams.numRuns > 1)
+                {
+                /* Remove first sample (generation 0) from diagnostics */
+                removeTo=1;
+                if (RemoveTreeSamples (1,1) == ERROR)
+                    {
+                     MrBayesPrint("%s   Problem removing tree samples\n");
+#   if defined (MPI_ENABLED)
+                       nErrors++;
+#   else
+                      return ERROR;
+#   endif
+                    }
+#   if defined (MPI_ENABLED)
+                MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+                if (sumErrors > 0)
+                    {
+                    MrBayesPrint ("%s   Aborting run.\n");
+                    return ERROR;
+                    }
+#   endif
+                }
+            }
+        if (chainParams.isSS == YES)
+            {
+            if (chainParams.burninSS == 0)
+                MrBayesPrint("%s   Sampling step 1 out of %d steps...\n\n",spacer, chainParams.numStepsSS);
+
+            /*Printing SS header*/
+            MrBayesPrintf (fpSS, "[LEGEND: The file contains statistics on the Steppingstone Sampling.]\n");
+            MrBayesPrintf (fpSS, "[ID: %s]\n", stamp);
+            MrBayesPrintf (fpSS, "[   Step                --  Index of the step ]\n");
+            MrBayesPrintf (fpSS, "[   Power               --  At each step we sample from the distribution with density (Likelihood^Power)*Prior ]\n");
+            MrBayesPrintf (fpSS, "[   runX                --  Contribution to the marginal log likelihood of run X, i.e. marginal log likelihood for run X is the sum across all steps in column runX.   ]\n");
+            if (chainParams.diagnStat == AVGSTDDEV)
+                MrBayesPrintf (fpSS, "[   aSplitX             --  Average standard deviation of split frequencies of tree X. -2.0 is printed if no diagnostics was requested. -1.0 is printed if there were no splits with frequency above minimum.]\n");
+            else
+                MrBayesPrintf (fpSS, "[   mSplitX             --  Maximal standard deviation of split frequencies of tree X. -2.0 is printed if no diagnostics was requested. -1.0 is printed if there were no splits with frequency above minimum.]\n");
+            MrBayesPrintf (fpSS, "Step\tPower");
+            for (j=0; j<chainParams.numRuns ; j++)
+                MrBayesPrintf (fpSS, "\trun%d", j+1);
+            if (chainParams.diagnStat == AVGSTDDEV)
+                {
+                for (j=0; j<numTopologies; j++)
+                    MrBayesPrintf (fpSS, "\taSplit%d", j);
+                }
+            else
+                {
+                for (j=0; j<numTopologies; j++)
+                    MrBayesPrintf (fpSS, "\tmSplit%d", j);
+                }
+            MrBayesPrintf (fpSS, "\n");
+            }
+        }
+
+    for (n=numPreviousGen+1; n<=chainParams.numGen; n++) /* begin run chain */
+        {
+        currentCPUTime = clock();
+        if (currentCPUTime - previousCPUTime > 10 * CLOCKS_PER_SEC)
+            {
+            CPUTime += (currentCPUTime - previousCPUTime) / (MrBFlt) (CLOCKS_PER_SEC);
+            previousCPUTime = currentCPUTime;
+            }
+
+        /*! requestAbortRun is set by the signal handler when it receives a CTRL-C (serial version only) */
+        if (requestAbortRun == YES && ConfirmAbortRun() == 1)
+            return ABORT;
+
+        /* Refresh scalers every SCALER_REFRESH_FREQ generations.                */
+        /* It is done before copying so we know it will take effect immediately. */
+        /* However, the actual scalers are recalculated only when really needed. */
+#   if defined (BEAGLE_ENABLED)
+        if (ResetScalersNeeded && n % SCALER_REFRESH_FREQ == 0)
+            ResetScalers();
+#   else
+        if (n % SCALER_REFRESH_FREQ == 0)
+            ResetScalers();
+#   endif
+
+        // RandLong oldSeed = *seed;  /* record the old seed for debugging */
+        for (chn=0; chn<numLocalChains; chn++)
+            {
+            /* Do Gibbs resampling of rate categories for current state if time to do so */
+            for (i=0; i<numCurrentDivisions; i++)
+                {
+                if (modelSettings[i].gibbsGamma == YES && n % modelSettings[i].gibbsFreq == 0)
+                    curLnL[chn] += GibbsSampleGamma (chn, i, seed);
+                }
+
+            /* First copy everything from current state of chain to new state.   */
+            /* The global variable state[chain] gives state.                     */
+
+            /* copy all touched trees and reset update flags                     */
+            CopyTrees (chn);
+
+            /* copy all model parameters */
+            CopyParams (chn);
+
+            /* shift the state of the chain to the new state */
+            /* all calculations will be done on this state   */
+            state[chn] ^= 1;  /* XORing with 1 switches between 0 and 1 */
+
+            /* decide which move to make */
+            whichMove = PickProposal(seed, chainId[chn]);
+            theMove = usedMoves[whichMove];
+#   if defined SHOW_MOVE
+            printf ("Making move '%s'\n", theMove->name);
+#   endif
+
+#   if defined (BEST_MPI_ENABLED)
+            bestCycleGen = n % (numNonTreeMoves + numTreeMoves + numBestMoves);
+            if (bestCycleGen < numNonTreeMoves)
+                PickNonTreeProposal(seed, chainId[chn]);
+            else if (bestCycleGen < numNonTreeMoves + numTreeMoves)
+                PickTreeProposal(seed, chainId[chn]);
+            else
+                PickBestProposal(chainId[chn]);
+#   endif
+
+            /* set prior and proposal ratios */
+            lnProposalRatio = 0.0;
+            lnPriorRatio = 0.0;
+
+            /* reset abort move flag */
+            abortMove = NO;
+            
+            /* Touch the relevant partitions       */
+            /* as a service to the move functions. */
+            for (i=0; i<theMove->parm->nRelParts; i++)
+                modelSettings[theMove->parm->relParts[i]].upDateCl = YES;
+
+#   ifndef NDEBUG
+            if (IsTreeConsistent(theMove->parm, chn, state[chn]) != YES)
+                {
+                printf ("IsTreeConsistent failed before a move!\n");
+                return ERROR;
+                }
+#   endif
+#   if defined (DEBUG_CONSTRAINTS)
+            if (theMove->parm->paramType == P_TOPOLOGY && DoesTreeSatisfyConstraints(GetTree (theMove->parm, chn, state[chn]))!=YES)
+                {
+                printf ("DEBUG ERROR: DoesTreeSatisfyConstraints failed before a move\n");
+                return ERROR;
+                }
+#   endif
+            /* make move */
+            if ((theMove->moveFxn)(theMove->parm, chn, seed, &lnPriorRatio, &lnProposalRatio, theMove->tuningParam[chainId[chn]]) == ERROR)
+                {
+                printf ("%s   Error in move %s\n", spacer, theMove->name);
+#   if defined (MPI_ENABLED)
+                nErrors++;
+#   else
+                return ERROR;
+#   endif
+                }
+
+            if (theMove->parm->paramType == P_TOPOLOGY && DoesTreeSatisfyConstraints(GetTree (theMove->parm, chn, state[chn])) != YES)
+                {
+#   if defined (DEBUG_CONSTRAINTS)
+                if (DoesTreeSatisfyConstraints(GetTree (theMove->parm, chn, state[chn]))==ABORT)
+                    {
+                    printf ("DEBUG ERROR: DoesTreeSatisfyConstraints failed after move '%s'\n", theMove->name);
+                    }
+#   endif
+                abortMove = YES;
+                }
+
+            /* abortMove is set to YES if the calculation fails because the likelihood is too small */
+            if (abortMove == NO)
+                lnLike = LogLike(chn);
+
+            /* calculate acceptance probability */
+            if (abortMove == NO)
+                {
+                lnLikelihoodRatio = lnLike - curLnL[chn];
+                lnPrior = curLnPr[chn] + lnPriorRatio;
+
+#   ifndef NDEBUG
+                /* We check various aspects of calculations in debug version of code */
+                if (IsTreeConsistent(theMove->parm, chn, state[chn]) != YES)
+                    {
+                    printf ("DEBUG ERROR: IsTreeConsistent failed after move '%s'\n", theMove->name);
+                    return ERROR;
+                    }
+                if (lnPriorRatio != lnPriorRatio)
+                    {
+                    printf ("DEBUG ERROR: Log prior ratio nan after move '%s'\n", theMove->name);
+                    // printf ("Seed: %ld\n", oldSeed);  state[chn] ^= 1;  PrintCheckPoint (n);
+                    return ERROR;
+                    }
+                if (fabs((lnPrior-LogPrior(chn))/lnPrior) > 0.0001)
+                    {
+                    printf ("DEBUG ERROR: Log prior incorrect after move '%s' :%e :%e\n", theMove->name,lnPrior,LogPrior(chn));
+                    // printf ("Seed: %ld\n", oldSeed);  state[chn] ^= 1;  PrintCheckPoint (n);
+                    return ERROR;
+                    }
+                if (lnProposalRatio != lnProposalRatio)
+                    {
+                    printf ("DEBUG ERROR: Log proposal ratio nan after move '%s'\n", theMove->name);
+                    // printf ("Seed: %ld\n", oldSeed);  state[chn] ^= 1;  PrintCheckPoint (n);
+                    return ERROR;
+                    }
+                if (lnLike != lnLike)
+                    {
+                    printf ("DEBUG ERROR: Log likelihood nan after move '%s'\n", theMove->name);
+                    // printf ("Seed: %ld\n", oldSeed);  state[chn] ^= 1;  PrintCheckPoint (n);
+                    return ERROR;
+                    }
+#       if defined (DEBUG_LNLIKELIHOOD) /* slow */
+                ResetFlips(chn); /* needed to return flags so they point to old state */
+                TouchEverything(chn);
+                if (fabs((lnLike-LogLike(chn))/lnLike) > 0.0001)
+                    {
+                    printf ("DEBUG ERROR: Log likelihood incorrect after move '%s'\n", theMove->name);
+                    return ERROR;
+                    }
+#       endif
+                if (theMove->parm->paramType == P_TOPOLOGY && GetTree (theMove->parm, chn, state[chn])->isClock == YES &&
+                    IsClockSatisfied (GetTree (theMove->parm, chn, state[chn]),0.001) == NO)
+                    {
+                    printf ("%s   Branch lengths of the tree do not satisfy the requirements of a clock tree.\n", spacer);
+                    ShowNodes(GetTree (theMove->parm, chn, state[chn])->root,0,YES);
+                    return (ERROR);
+                    }
+#   endif
+
+                /* heat */
+                lnLikelihoodRatio *= Temperature (chainId[chn]);
+                lnPriorRatio      *= Temperature (chainId[chn]);
+
+                if (chainParams.isSS == YES)
+                    lnLikelihoodRatio *= powerSS;
+
+                /* calculate the acceptance probability */
+                if (lnLikelihoodRatio + lnPriorRatio + lnProposalRatio < -100.0)
+                    r = 0.0;
+                else if (lnLikelihoodRatio + lnPriorRatio + lnProposalRatio > 0.0)
+                    r = 1.0;
+                else
+                    r = exp(lnLikelihoodRatio + lnPriorRatio + lnProposalRatio);
+                }
+
+            /* decide to accept or reject the move */
+            acceptMove = NO;
+            i = chainId[chn];
+            theMove->nTried[i]++;
+            theMove->nTotTried[i]++;
+            if (abortMove == NO && RandomNumber(seed) < r)
+                {
+                acceptMove = YES;
+                theMove->nAccepted[i]++;
+                theMove->nTotAccepted[i]++;
+                }
+
+            /* update the chain */
+            if (acceptMove == NO)
+                {
+                /* the new state did not work out so shift chain back */
+                if (abortMove == NO)
+                    ResetFlips(chn);
+                state[chn] ^= 1;
+#   if defined (BEAGLE_ENABLED)
+                if (recalcScalers == YES)
+                    {
+                    recalculateScalers(chn);
+                    recalcScalers = NO;
+                    }
+#   endif
+                }
+            else
+                {
+                /* if the move is accepted then let the chain stay in the new state */
+                /* store the likelihood and prior of the chain */
+                curLnL[chn] = lnLike;
+                curLnPr[chn] = lnPrior;
+                }
+
+            /* check if time to autotune */
+            if (theMove->nTried[i] >= chainParams.tuneFreq)
+                {
+                theMove->lastAcceptanceRate[i] = (MrBFlt) theMove->nAccepted[i] / (MrBFlt) theMove->nTried[i];
+                theMove->nTried[i] = 0;
+                theMove->nAccepted[i] = 0;
+                theMove->nBatches[i]++;                                     /* we only autotune at most 10000 times */
+                if (chainParams.autotune == YES && theMove->moveType->Autotune != NULL && theMove->nBatches[i] < MAXTUNINGPARAM)
+                    {
+                    theMove->moveType->Autotune(theMove->lastAcceptanceRate[i],
+                                                theMove->targetRate[i],
+                                                theMove->nBatches[i],
+                                                &theMove->tuningParam[i][0],
+                                                theMove->moveType->minimum[0],
+                                                theMove->moveType->maximum[0]);
+                    }
+                }
+
+            /* ShowValuesForChain (chn); */
+
+            if (curLnL[chn] > maxLnL0[chainId[chn]])
+                maxLnL0[chainId[chn]] = curLnL[chn];
+
+            }
+
+        /* attempt swap(s) Non-blocking for MPI if no swap with external process. */
+        if (chainParams.numChains > 1 && n % chainParams.swapFreq == 0)
+            {
+            for (i = 0; i<chainParams.numRuns; i++)
+                {
+                for (j = 0; j<chainParams.numSwaps; j++)
+                    GetSwappers (&swapA, &swapB, i);
+                if (AttemptSwap (swapA, swapB, seed) == ERROR)
+                    {
+                    MrBayesPrint ("%s   Unsuccessful swap of states\n", spacer);
+#   if defined (MPI_ENABLED)
+                    nErrors++;
+#   else
+                    return ERROR;
+#   endif
+                    }
+                }
+            }
+
+        /* print information to screen. Non-blocking for MPI */
+        if (n % chainParams.printFreq == 0)
+            {
+            PrintToScreen(n, numPreviousGen, time(0), startingT);
+#   if defined (TIMING_ANALIZ)
+            MrBayesPrint ("%s   Time elapsed:%f CondlikeDownTime:%f CondLikeRoot:%f Likelihood:%f ScalersTime:%f ScalersRemove:%f\n", spacer,
+                          CPUTime, CPUCondLikeDown/(MrBFlt)CLOCKS_PER_SEC, CPUCondLikeRoot/(MrBFlt)CLOCKS_PER_SEC, CPULilklihood/(MrBFlt)CLOCKS_PER_SEC,
+                          CPUScalers/(MrBFlt)CLOCKS_PER_SEC, CPUScalersRemove/(MrBFlt)CLOCKS_PER_SEC);
+#   endif
+            }
+
+        /* print information to files */
+        /* this will also add tree samples to topological convergence diagnostic counters */
+        if (n == chainParams.numGen || n % chainParams.sampleFreq == 0)
+            {
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Aborting run.\n");
+                return ERROR;
+                }
+#   endif
+            if (PrintStatesToFiles (n) == ERROR)
+                {
+                MrBayesPrint("%s   Error in printing states to files\n");
+#   if defined (MPI_ENABLED)
+                nErrors++;
+#   else
+                return ERROR;
+#   endif
+                }
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Aborting run.\n");
+                return ERROR;
+                }
+#   endif
+            }
+
+        /* print mcmc diagnostics. Blocking for MPI */
+        if (chainParams.mcmcDiagn == YES && (n % chainParams.diagnFreq == 0
+                                             || n == chainParams.numGen
+                                             || (chainParams.isSS == YES && (n-lastStepEndSS) % numGenInStepSS == 0)))
+            {
+            if (chainParams.numRuns > 1 &&
+                ((n > 0 && chainParams.relativeBurnin == YES && (chainParams.isSS == NO || (n > chainParams.burninSS * chainParams.sampleFreq && (n-lastStepEndSS) > numGenInStepBurninSS)))
+                 || (n >= chainParams.chainBurnIn * chainParams.sampleFreq && chainParams.relativeBurnin == NO)))
+                {
+                /* we need some space for coming output */
+                MrBayesPrint ("\n");
+                /* remove tree samples if using burninpercentage */
+                /* the following function returns immediately in MPI if proc_id != 0 */
+                if (chainParams.relativeBurnin == YES && chainParams.isSS == NO)
+                    {
+                    removeFrom = removeTo;
+                    removeTo = (int)(chainParams.burninFraction * (n/chainParams.sampleFreq+1)); /* (n/chainParams.sampleFreq+1) is the current number of samples */
+                    if (removeFrom < removeTo)
+                        {
+                        if (RemoveTreeSamples (removeFrom+1, removeTo) == ERROR)
+                            {
+                            MrBayesPrint("%s   Problem removing tree samples\n");
+#   if defined (MPI_ENABLED)
+                            nErrors++;
+#   else
+                            return ERROR;
+#   endif
+                            }
+                        }
+#   if defined (MPI_ENABLED)
+                    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+                    if (sumErrors > 0)
+                        {
+                        MrBayesPrint ("%s   Aborting run.\n");
+                        return ERROR;
+                        }
+#   endif
+                    }
+
+                lastDiagnostics = (n/chainParams.sampleFreq)+1; /* +1 because we always have start tree sampled*/
+                if (chainParams.relativeBurnin == YES)
+                    {
+                    i = lastDiagnostics - removeTo;
+                    }
+                else
+                    i = lastDiagnostics - chainParams.chainBurnIn;
+#   if defined (MPI_ENABLED)
+                if (proc_id == 0)
+                    {
+#   endif
+                /* calculate statistics */
+                CalcTopoConvDiagn (i);
+                /* output statistics */
+                if (numTopologies == 1)
+                    {
+                    f = -1.0;
+                    if (chainParams.stat[0].numPartitions == 0)
+                        {
+                        MrBayesPrint ("%s   Average standard deviation of split frequencies: NA (no splits above min. frequency)\n", spacer);
+                        }
+                    else if (chainParams.diagnStat == AVGSTDDEV)
+                        {
+                        f = chainParams.stat[0].avgStdDev;
+                        MrBayesPrint ("%s   Average standard deviation of split frequencies: %.6f\n", spacer, f);
+                        }
+                    else
+                        {
+                        f = chainParams.stat[0].max;
+                        MrBayesPrint ("%s   Max standard deviation of split frequencies: %.6f\n", spacer, f);
+                        }
+                    if (chainParams.isSS == YES)
+                        splitfreqSS[chainParams.numStepsSS-stepIndexSS-1] = f;
+                    if (chainParams.stat[0].numPartitions > 0 && f <= chainParams.stopVal)
+                        stopChain = YES;
+                    if (n < chainParams.numGen - chainParams.printFreq && (chainParams.stopRule == NO || stopChain == NO))
+                        MrBayesPrint ("\n");
+                    }
+                else
+                    {
+                    stopChain = YES;
+                    for (i=0; i<numTopologies; i++)
+                        {
+                        f=-1.0;
+                        if (chainParams.stat[i].numPartitions == 0)
+                            {
+                            if (strcmp(modelParams[0].topologyPr,"Speciestree") == 0)
+                                {
+                                if (i == numTopologies-1)
+                                    MrBayesPrint ("%s   Average standard deviation of split frequencies for species tree (tree %d): NA (no splits above min. frequency)\n", spacer, i+1);
+                                else
+                                    MrBayesPrint ("%s   Average standard deviation of split frequencies for gene tree %d: NA (no splits above min. frequency)\n", spacer, i+1);
+                                }
+                            else
+                                MrBayesPrint ("%s   Average standard deviation of split frequencies for topology %d: NA (no splits above min. frequency)\n", spacer, i+1);
+                            }
+                        else if (chainParams.diagnStat == AVGSTDDEV)
+                            {
+                            f = chainParams.stat[i].avgStdDev;
+                            if (strcmp(modelParams[0].topologyPr,"Speciestree") == 0)
+                                {
+                                if (i == numTopologies-1)
+                                    MrBayesPrint ("%s   Average standard deviation of split frequencies for species tree (tree %d): %.6f\n", spacer, i+1, f);
+                                else
+                                    MrBayesPrint ("%s   Average standard deviation of split frequencies for gene tree %d: %.6f\n", spacer, i+1, f);
+                                }
+                            else
+                                MrBayesPrint ("%s   Average standard deviation of split frequencies for topology %d: %.6f\n", spacer, i+1, f);
+                            }
+                        else
+                            {
+                            f = chainParams.stat[i].max;
+                            if (strcmp(modelParams[0].topologyPr,"Speciestree") == 0)
+                                {
+                                if (i == numTopologies-1)
+                                    MrBayesPrint ("%s   Max standard deviation of split frequencies for species tree: %.6f\n", spacer, f);
+                                else
+                                    MrBayesPrint ("%s   Max standard deviation of split frequencies for gene tree %d: %.6f\n", spacer, i+1, f);
+                                }
+                            else
+                                MrBayesPrint ("%s   Max standard deviation of split frequencies for topology %d: %.6f\n", spacer, i+1, f);
+                            }
+                        if (chainParams.isSS == YES)
+                            splitfreqSS[i*chainParams.numStepsSS+chainParams.numStepsSS-stepIndexSS-1] = f;
+                        if (chainParams.stat[i].numPartitions == 0 || f > chainParams.stopVal)
+                            stopChain = NO;
+                        }
+                    if (n < chainParams.numGen - chainParams.printFreq && (chainParams.stopRule == NO || stopChain == NO))
+                        MrBayesPrint ("\n");
+                    }
+                if (chainParams.allComps == YES)
+                    PrintTopConvInfo ();
+#   if defined (MPI_ENABLED)
+                    }
+                ierror = MPI_Bcast (&stopChain, 1, MPI_INT, 0, MPI_COMM_WORLD);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    MrBayesPrint ("%s   Problem broadcasting stop value\n", spacer);
+                    nErrors++;
+                    }
+#   endif
+                }
+
+            /* part of the following function needs to be performed by all MPI processors. Blocking for MPI. */
+            if (PrintMCMCDiagnosticsToFile (n) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem printing mcmc diagnostics to file\n", spacer);
+#   if defined (MPI_ENABLED)
+                nErrors++;
+#   else
+                return (ERROR);
+#   endif
+                }
+#   if defined (MPI_ENABLED)
+            MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+            if (sumErrors > 0)
+                {
+                MrBayesPrint ("%s   Aborting run.\n");
+                return ERROR;
+                }
+#   endif
+            }
+
+        /* check if time to break because stopVal reached */
+        if (chainParams.isSS == NO && (chainParams.stopRule == YES && stopChain == YES))
+            {
+            MrBayesPrint ("\n%s   Analysis stopped because convergence diagnostic hit stop value.\n", spacer);
+            break;
+            }
+            
+        /* user may want to extend chain */
+        if (chainParams.isSS == NO && (n == chainParams.numGen && autoClose == NO))
+            {
+            stoppingT1 = time(0);
+            currentCPUTime = clock();
+            CPUTime += (currentCPUTime - previousCPUTime) / (MrBFlt) CLOCKS_PER_SEC;
+            previousCPUTime = currentCPUTime;
+            chainParams.numGen += ExtendChainQuery ();
+            stoppingT2 = time(0);
+            startingT += (stoppingT2-stoppingT1);
+            previousCPUTime = clock();
+            /* timers should not be increased during the wait for a reply */
+            }
+
+        /* Do stepping sampling staf if needed */
+        if (chainParams.isSS == YES && n >= chainParams.burninSS*chainParams.sampleFreq)
+            {
+#   ifndef SAMPLE_ALL_SS
+            if ((n-lastStepEndSS) % chainParams.sampleFreq == 0)
+#   endif
+                {
+                if (n > chainParams.burninSS*chainParams.sampleFreq && (n-lastStepEndSS > numGenInStepBurninSS))
+                    { /* do sampling */
+                    for (chn=0; chn<numLocalChains; chn++)
+                        {
+                        if (chainId[chn] % chainParams.numChains == 0)
+                            {
+                            run = chainId[chn] / chainParams.numChains;
+                            if (curLnL[chn]*stepLengthSS > stepScalerSS[run] + 200.0)
+                                {
+                                // adjust scaler;
+                                stepAcumulatorSS[run] /= exp (curLnL[chn]*stepLengthSS - 100.0 - stepScalerSS[run]); 
+                                stepScalerSS[run]= curLnL[chn]*stepLengthSS - 100.0;
+                                }
+                            stepAcumulatorSS[run] += exp (curLnL[chn]*stepLengthSS - stepScalerSS[run]);
+                            }
+                        }
+                    samplesCountSS++;
+                    }
+                }
+
+            if ((n-lastStepEndSS) == numGenInStepBurninSS)
+                {
+                /* Remove all previouse samples from diagnostics */
+                if (chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+                    {
+                    removeFrom = removeTo;
+                    removeTo = (int)(n/chainParams.sampleFreq); /* (n/chainParams.sampleFreq+1) is the current number of samples including 0 one*/
+                    removeTo++;
+                    if (removeFrom < removeTo)
+                        {
+                        if (RemoveTreeSamples (removeFrom+1, removeTo) == ERROR)
+                            {
+                            nErrors++;
+                            }
+                        ERROR_TEST2("Problem removing tree samples",return(ERROR),);
+                        }
+                    }               
+                }
+
+            if ((n-lastStepEndSS) % numGenInStepSS == 0)      /* prepare sample of next step */
+                {
+                assert (n-lastStepEndSS <= numGenInStepSS);
+                lastStepEndSS=n;
+
+                if (n > chainParams.burninSS*chainParams.sampleFreq)
+                    {
+                    /* dump to file current step contribution */
+                    MrBayesPrintf (fpSS, "%3d\t%.4f", chainParams.numStepsSS-stepIndexSS, powerSS);
+#   if defined (MPI_ENABLED)
+                    for (j=0; j<chainParams.numRuns ; j++)
+                        {
+                        if (stepAcumulatorSS[j]==0)
+                            r=0;
+                        else
+                            r = log (stepAcumulatorSS[j]/samplesCountSS) + stepScalerSS[j];
+                        ierror = MPI_Reduce (&r,&sum, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+                        if (ierror != MPI_SUCCESS)
+                            {
+                            MrBayesPrint ("%s   Problem with MPI_Reduce\n", spacer);
+                            return ERROR;
+                            }
+                        if (proc_id == 0)
+                            {
+                            MrBayesPrintf (fpSS, "\t%.6f", sum);
+                            }
+                        }
+#   else
+                    for (j=0; j<chainParams.numRuns ; j++)
+                        {
+                        MrBayesPrintf (fpSS, "\t%.6f", log (stepAcumulatorSS[j]/samplesCountSS) + stepScalerSS[j]);
+                        }
+#   endif
+                    if (chainParams.mcmcDiagn == YES && chainParams.numRuns > 1)
+                        {
+                        for (i=0; i<numTopologies; i++)
+                            {
+                            MrBayesPrintf (fpSS, "\t%.6f",splitfreqSS[i*chainParams.numStepsSS+chainParams.numStepsSS-stepIndexSS-1]);
+                            }
+                        }
+                    else{
+                        for (i=0; i<numTopologies; i++)
+                            {
+                            MrBayesPrintf (fpSS, "\t-2.0");
+                            }
+
+                        }
+
+                    MrBayesPrintf (fpSS, "\n");
+                    fflush (fpSS);
+
+                    stepIndexSS--;
+
+                    if (chainParams.startFromPriorSS==YES)
+                        {
+                        powerSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-1-stepIndexSS)/(MrBFlt)chainParams.numStepsSS);
+                        stepLengthSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-stepIndexSS)/(MrBFlt)chainParams.numStepsSS)-powerSS;
+                        }
+                    else
+                        {
+                        stepLengthSS = powerSS; 
+                        powerSS = BetaQuantile (chainParams.alphaSS, 1.0, (MrBFlt)stepIndexSS/(MrBFlt)chainParams.numStepsSS);
+                        stepLengthSS -= powerSS;
+                        }
+                    if (n != chainParams.numGen)
+                        MrBayesPrint("%s   Sampling step %d out of %d steps...\n\n",spacer, chainParams.numStepsSS-stepIndexSS, chainParams.numStepsSS);
+                    for (chn=0; chn<numLocalChains; chn++)
+                        {
+                        if (chainId[chn] % chainParams.numChains == 0)
+                            {
+                            run = chainId[chn] / chainParams.numChains;
+                            if (samplesCountSS != 0)
+                                marginalLnLSS[run] += log (stepAcumulatorSS[run]/samplesCountSS) + stepScalerSS[run];
+                            stepScalerSS[run] = curLnL[chn]*stepLengthSS;
+                            stepAcumulatorSS[run]=0.0;
+                            }
+                        }
+                    samplesCountSS=0;
+                    }
+                else
+                    {
+                    MrBayesPrint("\n%s   Sampling step 1 out of %d steps...\n\n",spacer, chainParams.numStepsSS);
+                    }
+
+                if (chainParams.backupCheckSS !=0 && (chainParams.numStepsSS-stepIndexSS-1)% chainParams.backupCheckSS == 0)
+                    {
+                    /* print check-point file. Blocking for MPI */
+                    ERROR_TEST2("Error before printing checkpoint",return(ERROR),);
+                    if (PrintCheckPoint (n) == ERROR)
+                        {
+                        nErrors++;
+                        }
+                    ERROR_TEST2("Error in printing checkpoint",return(ERROR),);
+                       
+#   if defined (MPI_ENABLED)
+                if (proc_id == 0)
+                    {
+#   endif
+                    /* figure out check-point file names */
+                    sprintf (ckpFileName, "%s%s.ckp", workingDir, chainParams.chainFileName);
+                    sprintf (bkupFileName,"%s.ss%d", ckpFileName,chainParams.numStepsSS-stepIndexSS);
+                    if (rename (ckpFileName, bkupFileName)!=0)
+                        {
+                        MrBayesPrint ("%s   Could not rename file %s to %s\n", spacer, ckpFileName, bkupFileName);
+                        return ERROR;
+                        }
+                    strcpy (bkupFileName, ckpFileName);
+                    strcat (bkupFileName, "~");
+                    rename (bkupFileName,ckpFileName);
+#   if defined (MPI_ENABLED)
+                    } /* end of if (proc_id == 0)*/
+#   endif
+                    }
+                }             
+            }
+
+        /* print check-point file. Blocking for MPI */
+        if (chainParams.checkPoint == YES && (n % chainParams.checkFreq == 0))
+            {
+            ERROR_TEST2("Error before printing checkpoint",return(ERROR),);
+            if (PrintCheckPoint (n) == ERROR)
+                {
+                nErrors++;
+                }
+            ERROR_TEST2("Error in printing checkpoint",return(ERROR),);
+            }
+
+        } /* end run chain */
+    endingT = time(0);
+    currentCPUTime = clock();
+    CPUTime += (currentCPUTime - previousCPUTime) / (MrBFlt) CLOCKS_PER_SEC;
+
+    CloseMBPrintFiles (); /* redundant because files closed in FreeChainMemory but kept here as a safeguard in case of future changes */
+
+#   if defined (BEAGLE_ENABLED)
+#       ifdef DEBUG_BEAGLE
+    ResetScalers ();
+    beagleScalingSchemeOld = beagleScalingScheme;
+    beagleScalingScheme = MB_BEAGLE_SCALE_ALWAYS;
+    for (chn=0; chn<numLocalChains; chn++)
+        {
+        if (chn % chainParams.numChains == 0)
+            {
+            if (chainParams.numRuns == 1)
+                MrBayesPrint ("%s   Final log likelihoods and log prior probs (stored and calculated):\n", spacer);
+            else
+                MrBayesPrint ("%s   Final log likelihoods and log prior probs for run %d (stored and calculated):\n", spacer, chn / chainParams.numChains + 1);
+            }
+        TouchEverything (chn);
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (modelSettings[i].gibbsGamma == YES)
+                curLnL[chn] += GibbsSampleGamma (chn, i, seed);
+            }
+        MrBayesPrint ("%s      Chain %d -- %.6lf -- %.6lf\n", spacer, (chn % chainParams.numChains) + 1, curLnL[chn], curLnPr[chn]);
+        MrBayesPrint ("%s      Chain %d -- %.6lf -- %.6lf\n", spacer, (chn % chainParams.numChains) + 1, LogLike(chn), LogPrior(chn));
+        }
+    beagleScalingScheme = beagleScalingSchemeOld;
+#       endif
+#   endif
+
+    /* Make sure current state is reset and values copied back to state 0.
+       Note that this can be tricky for Metropolis-coupled chains because
+       the chain ids may necessitate some swapping of values among chains. */
+    ResetChainIds ();
+
+    MrBayesPrint ("\n");
+    if (difftime (endingT, startingT) > 3600.0)
+        MrBayesPrint ("%s   Analysis completed in %d hours %d mins %d seconds\n", spacer, 
+              (int) (difftime(endingT, startingT)/3600), 
+              ((int) (difftime(endingT, startingT))%3600)/60, 
+              (int) (difftime(endingT, startingT))%60);
+    else if (difftime (endingT, startingT) > 60.0)
+        MrBayesPrint ("%s   Analysis completed in %d mins %d seconds\n", spacer, 
+              (int) (difftime(endingT, startingT)/60), 
+              (int) (difftime(endingT, startingT))%60);
+    else if (difftime (endingT, startingT) > 2.0)
+        MrBayesPrint ("%s   Analysis completed in %.0f seconds\n", spacer, 
+              difftime(endingT, startingT));
+    else if (difftime (endingT, startingT) >= 1.0)
+        MrBayesPrint ("%s   Analysis completed in 1 second\n", spacer);
+    else
+        MrBayesPrint ("%s   Analysis completed in less than 1 second\n", spacer);
+
+#   if defined (MPI_ENABLED)
+    MrBayesPrint ("%s   Analysis used %1.2f seconds of CPU time on processor 0\n", spacer, (MrBFlt) CPUTime);
+#   else
+    MrBayesPrint ("%s   Analysis used %1.2f seconds of CPU time\n", spacer, (MrBFlt) CPUTime);
+#   endif
+
+#   if defined (MPI_ENABLED)
+    /* find the best likelihoods across all of the processors */
+    ierror = MPI_Barrier (MPI_COMM_WORLD);
+    if (ierror != MPI_SUCCESS)
+        {
+        MrBayesPrint ("%s   Problem at chain barrier\n", spacer);
+        return (ERROR);
+        }
+    for (j=0; j<numGlobalChains; j++)
+        {
+        best = maxLnL0[j];
+        for (i=1; i<num_procs; i++)
+            {
+            if (proc_id == 0)
+                {
+                ierror = MPI_Recv (&maxLnL0[j], 1, MPI_DOUBLE, i, i, MPI_COMM_WORLD, &status);
+                if (ierror != MPI_SUCCESS)
+                    { 
+                    MrBayesPrint ("%s   Problem with MPI_Recv", spacer);
+                    return ERROR;
+                    }
+                if (maxLnL0[j] > best)
+                    best = maxLnL0[j];
+                }
+            else if (proc_id == i)
+                {
+                ierror = MPI_Send (&maxLnL0[j], 1, MPI_DOUBLE, 0, i, MPI_COMM_WORLD);
+                if (ierror != MPI_SUCCESS)
+                    {
+                    MrBayesPrint ("%s   Problem with MPI_Send\n", spacer);
+                    return ERROR;
+                    }
+                }
+            }
+        maxLnL0[j] = best;
+        }
+
+    /* Collecting  marginal log likelihoods if SS is used */
+    if (chainParams.isSS == YES)
+        {
+        for (j=0; j<chainParams.numRuns ; j++)
+            {
+            ierror = MPI_Reduce (&marginalLnLSS[j],&r, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+            if (ierror != MPI_SUCCESS)
+                {
+                MrBayesPrint ("%s   Problem with MPI_Send\n", spacer);
+                return ERROR;
+                }
+            if (proc_id == 0)
+                {
+                marginalLnLSS[j]=r;
+                }
+            }
+        }
+#   endif
+
+    if (chainParams.numRuns == 1)
+        {
+        if (chainParams.numChains == 1)
+            MrBayesPrint ("%s   Log likelihood of best state was %1.2lf\n", spacer, maxLnL0[0]);
+        else
+            MrBayesPrint ("%s   Log likelihood of best state for \"cold\" chain was %1.2lf\n", spacer, maxLnL0[0]);
+        }
+    else
+        {
+        for (j=0; j<chainParams.numRuns*chainParams.numChains; j++)
+            {
+            if (j % chainParams.numChains == 0)
+                {
+                if (chainParams.numChains == 1)
+                    MrBayesPrint ("%s   Likelihood of best state for run %d was %1.2lf\n", spacer, j/chainParams.numChains+1, maxLnL0[j/chainParams.numChains]);
+                else
+                    MrBayesPrint ("%s   Likelihood of best state for \"cold\" chain of run %d was %1.2lf\n", spacer, j/chainParams.numChains+1, maxLnL0[j/chainParams.numChains]);
+                }
+            }
+        }
+
+    if (chainParams.isSS == YES)
+        {
+        MrBayesPrint ("\n");
+        MrBayesPrint ("%s   Marginal likelihood (in natural log units) estimated using stepping-stone sampling based on\n", spacer);
+        MrBayesPrint ("%s   %d steps with %d generations (%d samples) within each step. \n\n", spacer, chainParams.numStepsSS, numGenInStepSS, numGenInStepSS/chainParams.sampleFreq);
+        MrBayesPrint ("%s       Run   Marginal likelihood (ln)\n",spacer);
+        MrBayesPrint ("%s       ------------------------------\n",spacer);
+        for (j=0; j<chainParams.numRuns; j++)
+            {
+            MrBayesPrint ("%s       %3d    %9.2f   \n", spacer, j+1, marginalLnLSS[j]);
+            }
+        MrBayesPrint ("%s       ------------------------------\n",spacer);
+        if (chainParams.numRuns > 1)
+            {
+            MeanVarianceLog(marginalLnLSS,chainParams.numRuns,&meanSS,&varSS,NULL);
+            MrBayesPrint ("%s       Mean:  %9.2f\n\n",spacer,meanSS);
+            //MrBayesPrint ("%s       Mean:  %9.2lf  Scaled variance: %.2f of Marginal log likelihood estimates among runs.\n",spacer,meanSS,varSS-2*meanSS);
+            //MrBayesPrint ("%s       Note: Scaled variance is given in log units and calculated as \"variance/mean^2\"\n",spacer);     
+            }
+        MrBayesPrint ("%s   More statistics on stepping-stone sampling is dumped to %s.ss file.\n", spacer, chainParams.chainFileName);
+
+        if (chainParams.mcmcDiagn == YES)
+            {
+            if ((tempX = (MrBFlt *) SafeCalloc (chainParams.numStepsSS, sizeof(MrBFlt))) == NULL)
+                {
+                nErrors++;
+                }
+            ERROR_TEST2("Problem allocating memory", return(ERROR),);
+
+            for (i=0; i<chainParams.numStepsSS; i++)
+                {
+                tempX[i]=i+1;
+                }
+            MrBayesPrint ("\n");
+
+            if (numTopologies > 1)
+                {
+                if (chainParams.diagnStat == AVGSTDDEV)
+                    MrBayesPrint ("   Plots of average standard deviation of split frequencies across steps for different topology.");
+                else
+                    MrBayesPrint ("   Plots of max standard deviation of split frequencies across steps for different topology.");
+                }
+            else
+                {
+                if (chainParams.diagnStat == AVGSTDDEV)
+                    MrBayesPrint ("   Plot of average standard deviation of split frequencies across steps.");
+                else
+                    MrBayesPrint ("   Plot of max standard deviation of split frequencies across steps.");
+                }
+            MrBayesPrint ("\n");
+            MrBayesPrint ("   Points at -1.0 (y-axis) indicate that there were no splits\n");
+            MrBayesPrint ("   above minimum frequency for corresponding step.");
+            if (numTopologies > 1)
+                {
+                for (i=0; i<numTopologies; i++)
+                    {
+                    MrBayesPrint ("%s   Topology %d.\n", spacer, i+1);
+                    PrintPlot (tempX, splitfreqSS+i*chainParams.numStepsSS, chainParams.numStepsSS);
+                    }
+                }
+            else
+                PrintPlot (tempX, splitfreqSS, chainParams.numStepsSS);
+
+            free(tempX);
+            }
+        }
+
+#   if defined (MPI_ENABLED)
+    /* we need to collect the information on the number of accepted moves if
+       this is a parallel version */
+    if (ReassembleMoveInfo() == ERROR)
+        nErrors++;
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   ReassembleMoveInfo failed\n", spacer);
+        return ERROR;
+        }
+#   endif
+
+    /* print acceptance rates for the moves */
+    for (j=0; j<chainParams.numChains*chainParams.numRuns; j++)
+        {
+        if (chainParams.numChains == 1)
+            {
+            if (chainParams.numRuns == 1)
+                MrBayesPrint ("%s   Acceptance rates for the moves:\n", spacer);
+            else
+                MrBayesPrint ("%s   Acceptance rates for the moves in run %d:\n", spacer, j/chainParams.numChains+1);
+            }
+        else if (j % chainParams.numChains == 0)
+            {
+            if (chainParams.numRuns == 1)
+                MrBayesPrint ("\n%s   Acceptance rates for the moves in the \"cold\" chain:\n", spacer);
+            else
+                MrBayesPrint ("\n%s   Acceptance rates for the moves in the \"cold\" chain of run %d:\n", spacer, j/chainParams.numChains+1);
+            }
+        else if (chainParams.allChains == YES)
+            {
+            if (chainParams.numRuns == 1)
+                MrBayesPrint ("\n%s   Acceptance rates for the moves in chain %d (heated):\n\n", spacer, j+1);
+            else
+                MrBayesPrint ("\n%s   Acceptance rates for the moves in chain %d of run %d (heated):\n\n", spacer, j%chainParams.numChains+1, j/chainParams.numChains+1);
+            }
+
+        if (j % chainParams.numChains == 0 || chainParams.allChains == YES)
+            {
+            MrBayesPrint ("%s      With prob.   (last %d)   chain accepted proposals by move\n", spacer, chainParams.tuneFreq);
+
+            for (i=0; i<numUsedMoves; i++)
+                {
+                mv = usedMoves[i];
+                if (mv->nBatches[j] < 1)
+                    MrBayesPrint ("%s          NA           NA       %s\n",
+                    spacer, mv->name);
+                else
+                    MrBayesPrint ("%s       %6.1f %%     (%3.0f %%)     %s\n", spacer,
+                    100.0*mv->nTotAccepted[j]/(MrBFlt)(mv->nTotTried[j]),
+                    100.0*mv->lastAcceptanceRate[j],
+                    mv->name);
+                }
+            }
+        }
+
+#   if defined MPI_ENABLED
+    /* Redistribute move info in case it is needed in a follow-up run */
+    RedistributeMoveInfo();
+#   endif
+    
+    /* output information on the success of the chain state swap proposals */
+    if (PrintSwapInfo () == ERROR)
+        nErrors++;
+#   if defined (MPI_ENABLED)
+    MPI_Allreduce (&nErrors, &sumErrors, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+    if (sumErrors > 0)
+        {
+        MrBayesPrint ("%s   PrintSwapInfo failed\n", spacer);
+        return ERROR;
+        }
+#   else
+    if (nErrors > 1)
+        {
+        MrBayesPrint ("%s   PrintSwapInfo failed\n", spacer);
+        return ERROR;
+        }
+#   endif
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    if (chainParams.isSS == NO && (chainParams.numRuns > 1 && chainParams.mcmcDiagn == YES))
+        {
+        f = 0.0;
+        for (i=0; i<numTrees; i++)
+            {
+            if (chainParams.stat[i].avgStdDev > f)
+                f = chainParams.stat[i].avgStdDev;
+            }
+        if (f > 0.10)
+            {
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   ************************* WARNING!! ************************************  \n", spacer);
+            MrBayesPrint ("%s   MrBayes suspects that your runs have not converged because the tree       \n", spacer);
+            MrBayesPrint ("%s   samples are very different (average standard deviation of split frequen-  \n", spacer);
+            MrBayesPrint ("%s   cies larger than 0.10 (%1.2lf)). MrBayes suggests that you run the ana-   \n", spacer, f);
+            MrBayesPrint ("%s   lysis longer or try to improve the MCMC sampling efficiency by fine-      \n", spacer);
+            MrBayesPrint ("%s   tuning MCMC proposal or heating parameters.                               \n", spacer);
+            }
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int SafeSprintf (char **target, int *targetLen, char *fmt, ...)
+{
+    va_list    argp;
+    int        retval;
+
+    while (1) {
+        /* try to print in the available space */
+        va_start(argp, fmt);
+#   ifdef VISUAL
+        retval = _vsnprintf (*target, *targetLen, fmt, argp);
+#   else
+        /* With SGI IRIX this function returns 0. Allen Smith suggested using 
+           _xpg5_vnsprintf, but this function needs a recent version of IRIX. 
+           For now, I just allocate a large buffer for SGI, so there is no need for
+           memory reallocation on this kind of machines */
+        /* It appears to me that the reason for the bug is that the old version of
+           this function relies on nonstandard return values for vsnprintf. With
+           the current version of the code, SGI should do fine without special
+           treatment.  FR  */
+        retval = vsnprintf (*target, *targetLen, fmt, argp);
+#   endif
+        va_end(argp);
+
+        /* if it worked, retval will be in interval [0,*targetLen-1], else -1 or true length */
+        if (retval > -1 && retval < *targetLen)
+            return NO_ERROR;
+
+        /* readjust length */
+        if (retval > -1)     /* some C compilers will return true length in retval */
+            *targetLen = retval + 1;     /* exactly what is needed */
+        else                 /* some C compilers will return -1 on buffer overwrite */
+            *targetLen += TARGETLENDELTA;
+
+        /* reallocate target */
+        *target = SafeRealloc ((void *)*target, *targetLen);
+        if (*target == NULL)
+            return ERROR;
+        }
+}
+
+
+void SetChainIds (void)
+{
+    /* Fill <chainId[]> with the global chain number.
+       Ex. For proc_0, chain[0] = 0;
+             chain[1] = 1;
+             chain[2] = 2; (numchains = 3)
+       For proc_1, chain[0] = 3;
+             chain[1] = 4; (numchains = 2)
+       etc... 
+    */
+
+#   if defined (MPI_ENABLED)
+
+    int     i, proc, numChainsForProc, numGlobalChains;
+    int     id;
+    int     remainder;
+
+    /* calculate global number of chains */
+    numGlobalChains = chainParams.numChains * chainParams.numRuns;
+    
+    /* there are <remainder> chains left over after
+       load balancing the chains */
+    remainder = numGlobalChains % num_procs;
+
+    /* get the number of chains handled by this proc */
+    numChainsForProc = (int) (numGlobalChains / num_procs);
+
+    /* we must distribute the remaining chains (causing
+       the chain load between procs to become unbalanced) */
+    if (proc_id < remainder) 
+        numChainsForProc++;
+
+    /* NOTE: at this point, procs can have different number of numChainsForProc
+       (one more for chains < remainder, one less for procs larger than or equal
+       to the remainder) */
+
+    id = 0;
+    for (proc=0; proc<num_procs; proc++)
+        {
+        /* assign or increment chain id */
+        if (proc == proc_id)
+            {
+            for (i=0; i<numChainsForProc; i++)
+                chainId[i] = id++;
+            }
+        else
+            {
+            /* procs below the remainder have 1 more chain
+               than procs above */
+            if (proc < remainder) 
+                {
+                for (i=0; i<(numGlobalChains / num_procs) + 1; i++)
+                    id++;
+                }
+            /* procs above the remainder have one less chain
+               than procs below */
+            else
+                {
+                for (i=0; i<(numGlobalChains / num_procs); i++)
+                    id++;
+                }
+            }
+        }
+#   else
+
+    int chn;
+    
+    for (chn=0; chn<numLocalChains; chn++)
+        chainId[chn] = chn;
+
+#   endif
+        
+}
+
+
+/* It sets chainParams.tFilePos[] to point immidiatly after sampled tree in position "samplePos" for all .t files. */
+int SetFilePositions (int samplePos)
+{
+    int i, j, k, longestLine;
+    BitsLong    lastBlock;
+    char    *lineBuf;
+    FILE    *fp;
+    char    *tempStr;
+    int     tempStrSize = TEMPSTRSIZE;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    for (i=0; i<numTopologies; i++)
+        {
+        for (j=0; j<chainParams.numRuns; j++)
+            {
+            if (numPrintTreeParams == 1)
+                {
+                if (chainParams.numRuns == 1)
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.t", chainParams.chainFileName);
+                else
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.run%d.t", chainParams.chainFileName, j+1);
+                }
+            else
+                {
+                if (chainParams.numRuns == 1)
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.tree%d.t", chainParams.chainFileName, i+1);
+                else
+                    SafeSprintf (&tempStr, &tempStrSize, "%s.tree%d.run%d.t", chainParams.chainFileName, i+1, j+1);
+                }
+
+            if ((fp = OpenBinaryFileR (tempStr)) == NULL) 
+                {
+                MrBayesPrint ("%s   Problem openning file %s.\n", spacer, tempStr);
+                free (tempStr);
+                return (ERROR);
+                }
+
+            longestLine = LongestLine (fp);
+            SafeFclose (&fp);
+
+            if ((fp = OpenTextFileR (tempStr)) == NULL) 
+                {
+                free (tempStr);
+                return (ERROR);
+                }
+
+            lineBuf = (char *) SafeCalloc (longestLine + 10, sizeof (char));
+            if (!lineBuf)
+                {
+                SafeFclose (&fp);
+                free (tempStr);
+                return (ERROR);
+                }
+
+            lastBlock = LastBlock (fp, lineBuf, longestLine);
+            fseek (fp, lastBlock, SEEK_SET);
+            fseek (fp, FirstTree(fp, lineBuf, longestLine), SEEK_SET);
+
+            for (k=0; k<samplePos; k++)
+                {
+                if (fgets (lineBuf, longestLine + 5, fp) == NULL) 
+                    {
+                    MrBayesPrint ("%s   Not enough records in file %s.\n", spacer, tempStr);
+                    SafeFclose (&fp);
+                    free (tempStr);
+                    free (lineBuf);
+                    return ERROR;
+                    }
+                }
+            fgetpos (fp, &chainParams.tFilePos[j*numTopologies+i]);
+
+            SafeFclose (&fp);
+            free (lineBuf);
+            } /* next run */
+        } /* next tree */
+    free (tempStr);
+    return (NO_ERROR);
+}
+
+
+/* SetFileNames: Set file names */
+void SetFileNames (void)
+{
+    strcpy (sumtParams.sumtFileName, chainParams.chainFileName);
+    strcpy (sumtParams.sumtOutfile, chainParams.chainFileName);
+    strcpy (sumpParams.sumpFileName, chainParams.chainFileName);
+    strcpy (sumpParams.sumpOutfile, chainParams.chainFileName);
+    if (chainParams.numRuns == 1)
+        {
+        sprintf (comptreeParams.comptFileName1, "%s.t", chainParams.chainFileName);
+        sprintf (comptreeParams.comptFileName2, "%s.t", chainParams.chainFileName);
+        sprintf (plotParams.plotFileName, "%s.p", chainParams.chainFileName);
+        MrBayesPrint ("%s   Setting chain output file names to \"%s.<p/t>\"\n", spacer, chainParams.chainFileName);
+        }
+    else /* if (chainParams.numRuns > 1) */
+        {
+        sprintf (comptreeParams.comptFileName1, "%s.run1.t", chainParams.chainFileName);
+        sprintf (comptreeParams.comptFileName2, "%s.run2.t", chainParams.chainFileName);
+        sprintf (plotParams.plotFileName, "%s.run1.p", chainParams.chainFileName);
+        MrBayesPrint ("%s   Setting chain output file names to \"%s.run<i>.<p/t>\"\n", spacer, chainParams.chainFileName);
+        }
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   SetLikeFunctions: This function will set up the pointers from each
+|       data division to the relevant likelihood functions
+|
+-----------------------------------------------------------------------------*/
+int SetLikeFunctions (void)
+{
+    int         i;
+
+    ModelInfo   *m;
+
+    /* couple divisions with likelihood functions */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = &modelSettings[i];
+        m->useSSE= NO;
+        
+        if (m->dataType == DNA || m->dataType == RNA)
+            {
+            if (m->parsModelId == YES)
+                {
+                m->Likelihood = &Likelihood_Pars;
+                }
+            else
+                {
+                if (m->nucModelId == NUCMODEL_4BY4)
+                    {
+                    if (m->numModelStates > 4)
+                        {
+                        /* covariotide model */
+                        /* TODO: allow autocorrelated rates */
+                        if (m->gibbsGamma == YES)
+                            {
+                            m->CondLikeDown = &CondLikeDown_Gen_GibbsGamma;
+                            m->CondLikeRoot = &CondLikeRoot_Gen_GibbsGamma;
+                            m->CondLikeScaler = &CondLikeScaler_Gen_GibbsGamma;
+                            m->Likelihood = &Likelihood_Gen_GibbsGamma;
+                            }
+                        else
+                            {
+                            m->CondLikeDown = &CondLikeDown_Gen;
+                            m->CondLikeRoot = &CondLikeRoot_Gen;
+                            m->CondLikeScaler = &CondLikeScaler_Gen;
+                            m->Likelihood = &Likelihood_Gen;
+                            }
+                        if (m->correlation != NULL)
+                            m->Likelihood = &Likelihood_Adgamma;
+                        else
+                            m->Likelihood = &Likelihood_Gen;
+                        if (m->nCijkParts == 1)
+                            m->TiProbs = &TiProbs_Gen;
+                        else if (m->nCijkParts > 1)
+                            m->TiProbs = &TiProbs_GenCov;
+                        m->PrintAncStates = &PrintAncStates_NUC4;
+                        m->PrintSiteRates = &PrintSiteRates_Gen;
+                        }
+                    else
+                        {
+#   if defined (SSE_ENABLED)
+                        if (m->printAncStates == YES || m->printSiteRates == YES)
+                            {
+                            MrBayesPrint ("%s   Non-SSE version of conditional likelihood calculator will be used for division %d\n", spacer, i+1);
+                            MrBayesPrint ("%s   due to request of reporting 'ancestral states' or 'site rates'.\n", spacer);
+                            }
+
+                        m->CondLikeUp = &CondLikeUp_NUC4;
+                        m->PrintAncStates = &PrintAncStates_NUC4;
+                        m->PrintSiteRates = &PrintSiteRates_Gen;
+
+                        if (m->gibbsGamma == YES)
+                            {
+                            m->CondLikeDown = &CondLikeDown_NUC4_GibbsGamma;
+                            m->CondLikeRoot = &CondLikeRoot_NUC4_GibbsGamma;
+                            m->CondLikeScaler = &CondLikeScaler_NUC4_GibbsGamma;
+                            }
+                        else if (m->correlation != NULL || m->printAncStates == YES || m->printSiteRates == YES)
+                            {
+                            m->CondLikeDown = &CondLikeDown_NUC4;
+                            m->CondLikeRoot = &CondLikeRoot_NUC4;
+                            m->CondLikeScaler = &CondLikeScaler_NUC4;
+                            }
+                        else
+                            {
+                            m->useSSE= YES;
+                            m->CondLikeDown = &CondLikeDown_NUC4_SSE;
+                            m->CondLikeRoot = &CondLikeRoot_NUC4_SSE;
+                            m->CondLikeScaler = &CondLikeScaler_NUC4_SSE;
+                            /* Should be sse versions if we want to handle m->printAncStates == YES || inferSiteRates == YES.
+                            For now just set to NULL for early error detection if functions anyway got called by mistake */
+                            m->CondLikeUp = NULL;
+                            m->PrintAncStates = NULL;
+                            m->PrintSiteRates = NULL;
+                            }
+
+                        if (m->correlation != NULL)
+                            m->Likelihood = &Likelihood_Adgamma;
+                        else if (m->gibbsGamma == YES)
+                            m->Likelihood = &Likelihood_NUC4_GibbsGamma;
+                        else if (m->printAncStates == YES || inferSiteRates == YES)
+                            m->Likelihood = &Likelihood_NUC4;
+                        else
+                            m->Likelihood = &Likelihood_NUC4_SSE;
+#   else
+                        if (m->gibbsGamma == YES)
+                            {
+                            m->CondLikeDown = &CondLikeDown_NUC4_GibbsGamma;
+                            m->CondLikeRoot = &CondLikeRoot_NUC4_GibbsGamma;
+                            m->CondLikeScaler = &CondLikeScaler_NUC4_GibbsGamma;
+                            }
+                        else
+                            {
+                            m->CondLikeDown = &CondLikeDown_NUC4;
+                            m->CondLikeRoot = &CondLikeRoot_NUC4;
+                            m->CondLikeScaler = &CondLikeScaler_NUC4;
+                            }
+
+                        if (m->correlation != NULL)
+                            m->Likelihood = &Likelihood_Adgamma;
+                        else if (m->gibbsGamma == YES)
+                            m->Likelihood = &Likelihood_NUC4_GibbsGamma;
+                        else
+                            m->Likelihood = &Likelihood_NUC4;
+
+                        m->CondLikeUp = &CondLikeUp_NUC4;
+                        m->PrintAncStates = &PrintAncStates_NUC4;
+                        m->PrintSiteRates = &PrintSiteRates_Gen;
+#   endif
+                        if (m->nst == 1)
+                            m->TiProbs = &TiProbs_Fels;
+                        else if (m->nst == 2)
+                            m->TiProbs = &TiProbs_Hky;
+                        else
+                            m->TiProbs = &TiProbs_Gen;
+                        m->StateCode = &StateCode_NUC4;
+                        }
+                    }
+                else if (m->nucModelId == NUCMODEL_DOUBLET)
+                    {
+                    if (m->gibbsGamma == YES)
+                        {
+                        m->CondLikeDown = &CondLikeDown_Gen_GibbsGamma;
+                        m->CondLikeRoot = &CondLikeRoot_Gen_GibbsGamma;
+                        m->CondLikeScaler = &CondLikeScaler_Gen_GibbsGamma;
+                        m->Likelihood = &Likelihood_Gen_GibbsGamma;
+                        }
+                    else
+                        {
+                        m->CondLikeDown = &CondLikeDown_Gen;
+                        m->CondLikeRoot = &CondLikeRoot_Gen;
+                        m->CondLikeScaler = &CondLikeScaler_Gen;
+                        m->Likelihood = &Likelihood_Gen;
+                        }
+                    if (m->nst == 1)
+                        m->TiProbs = &TiProbs_Gen;
+                    else if (m->nst == 2)
+                        m->TiProbs = &TiProbs_Gen;
+                    else
+                        m->TiProbs = &TiProbs_Gen;
+                    m->CondLikeUp = &CondLikeUp_Gen;
+                    m->PrintAncStates = &PrintAncStates_Gen;
+                    m->PrintSiteRates = &PrintSiteRates_Gen;
+                    }
+                else if (m->nucModelId == NUCMODEL_CODON)
+                    {
+                    /* codon models */
+                    if (m->numOmegaCats == 1)
+                        {
+                        if (m->gibbsGamma == YES)
+                            {
+                            m->CondLikeDown = &CondLikeDown_Gen_GibbsGamma;
+                            m->CondLikeRoot = &CondLikeRoot_Gen_GibbsGamma;
+                            m->CondLikeScaler = &CondLikeScaler_Gen_GibbsGamma;
+                            m->Likelihood = &Likelihood_Gen_GibbsGamma;
+                            }
+                        else
+                            {
+                            m->CondLikeDown = &CondLikeDown_Gen;
+                            m->CondLikeRoot = &CondLikeRoot_Gen;
+                            m->CondLikeScaler = &CondLikeScaler_Gen;
+                            m->Likelihood = &Likelihood_Gen;
+#   if defined (SSE_ENABLED)
+                            if (m->printAncStates == YES || m->printSiteRates == YES)
+                                {
+                                MrBayesPrint ("%s   Non-SSE version of conditional likelihood calculator will be used for division %d\n", spacer, i+1);
+                                MrBayesPrint ("%s   due to request of reporting 'ancestral states' or 'site rates'.\n", spacer);
+                                }
+                            else
+                                {
+                                m->useSSE= YES;
+                                m->CondLikeDown = &CondLikeDown_Gen_SSE;
+                                m->CondLikeRoot = &CondLikeRoot_Gen_SSE;
+                                m->CondLikeScaler = &CondLikeScaler_Gen_SSE;
+                                m->Likelihood = &Likelihood_Gen_SSE;
+                                }
+#   endif
+                            }
+                        }
+                    else
+                        {
+                        m->CondLikeDown   = &CondLikeDown_NY98;
+                        m->CondLikeRoot   = &CondLikeRoot_NY98;
+                        m->CondLikeScaler = &CondLikeScaler_NY98;
+                        m->Likelihood     = &Likelihood_NY98;
+                        m->PosSelProbs    = &PosSelProbs;
+                        m->SiteOmegas     = &SiteOmegas;
+#   if defined (SSE_ENABLED)
+                        if (m->printAncStates == YES || m->printSiteRates == YES)
+                            {
+                            MrBayesPrint ("%s   Non-SSE version of conditional likelihood calculator will be used for division %d\n", spacer, i+1);
+                            MrBayesPrint ("%s   due to request of reporting 'ancestral states' or 'site rates'.\n", spacer);
+                            }
+                        else
+                            {
+                            m->useSSE= YES;
+                            m->CondLikeDown   = &CondLikeDown_NY98_SSE;
+                            m->CondLikeRoot   = &CondLikeRoot_NY98_SSE;
+                            m->CondLikeScaler = &CondLikeScaler_NY98_SSE;
+                            m->Likelihood     = &Likelihood_NY98_SSE;
+                            m->PosSelProbs    = &PosSelProbs_SSE;
+                            m->SiteOmegas     = &SiteOmegas_SSE;
+                            }
+#   endif
+                        }
+                    m->TiProbs = &TiProbs_Gen;
+                    if (m->nCijkParts > 1)
+                        m->TiProbs = &TiProbs_GenCov;
+                    m->CondLikeUp = &CondLikeUp_Gen;
+                    m->PrintAncStates = &PrintAncStates_Gen;
+                    m->PrintSiteRates = &PrintSiteRates_Gen;
+                    }
+                else /* if (m->nucModelId == NUCMODEL_AA) */
+                    {
+                    if (m->gibbsGamma == YES)
+                        {
+                        m->CondLikeDown = &CondLikeDown_Gen_GibbsGamma;
+                        m->CondLikeRoot = &CondLikeRoot_Gen_GibbsGamma;
+                        m->CondLikeScaler = &CondLikeScaler_Gen_GibbsGamma;
+                        m->Likelihood = &Likelihood_Gen_GibbsGamma;
+                        }
+                    else
+                        {
+                        m->CondLikeDown = &CondLikeDown_Gen;
+                        m->CondLikeRoot = &CondLikeRoot_Gen;
+                        m->CondLikeScaler = &CondLikeScaler_Gen;
+                        m->Likelihood = &Likelihood_Gen;
+#   if defined (SSE_ENABLED)
+                        if (m->printAncStates == YES || m->printSiteRates == YES)
+                            {
+                            MrBayesPrint ("%s   Non-SSE version of conditional likelihood calculator will be used for division %d\n", spacer, i+1);
+                            MrBayesPrint ("%s   due to request of reporting 'ancestral states' or 'site rates'.\n", spacer);
+                            }
+                        else
+                            {
+                            m->useSSE= YES;
+                            m->CondLikeDown = &CondLikeDown_Gen_SSE;
+                            m->CondLikeRoot = &CondLikeRoot_Gen_SSE;
+                            m->CondLikeScaler = &CondLikeScaler_Gen_SSE;
+                            m->Likelihood = &Likelihood_Gen_SSE;
+                            }
+#   endif
+                        }
+                    if (m->nCijkParts > 1)
+                        m->TiProbs = &TiProbs_GenCov;
+                    else
+                        m->TiProbs = &TiProbs_Gen;
+                    m->CondLikeUp = &CondLikeUp_Gen;
+                    m->StateCode = &StateCode_AA;
+                    m->PrintAncStates = &PrintAncStates_Gen;
+                    m->PrintSiteRates = &PrintSiteRates_Gen;
+                    }
+                }
+            }
+        else if (m->dataType == PROTEIN)
+            {
+            if (m->parsModelId == YES)
+                {
+                m->Likelihood = &Likelihood_Pars;
+                }
+            else
+                {
+                /* TODO: allow autocorrelated rates for covarion model */
+                if (m->gibbsGamma == YES)
+                    {
+                    m->CondLikeDown = &CondLikeDown_Gen_GibbsGamma;
+                    m->CondLikeRoot = &CondLikeRoot_Gen_GibbsGamma;
+                    m->CondLikeScaler = &CondLikeScaler_Gen_GibbsGamma;
+                    m->Likelihood = &Likelihood_Gen_GibbsGamma;
+                    }
+                else
+                    {
+                    m->CondLikeDown = &CondLikeDown_Gen;
+                    m->CondLikeRoot = &CondLikeRoot_Gen;
+                    m->CondLikeScaler = &CondLikeScaler_Gen;
+                    m->Likelihood = &Likelihood_Gen;
+#   if defined (SSE_ENABLED)
+                    if (m->printAncStates == YES || m->printSiteRates == YES)
+                        {
+                        MrBayesPrint ("%s   Non-SSE version of conditional likelihood calculator will be used for division %d\n", spacer, i+1);
+                        MrBayesPrint ("%s   due to request of reporting 'ancestral states' or 'site rates'.\n", spacer);
+                        }
+                    else
+                        {
+                        m->useSSE= YES;
+                        m->CondLikeDown = &CondLikeDown_Gen_SSE;
+                        m->CondLikeRoot = &CondLikeRoot_Gen_SSE;
+                        m->CondLikeScaler = &CondLikeScaler_Gen_SSE;
+                        m->Likelihood = &Likelihood_Gen_SSE;
+                        }
+#   endif
+                    }
+                if (m->correlation != NULL)
+                    {
+                    if (m->gibbsGamma == YES)
+                        {
+                        MrBayesPrint ("%s   Adgamma model cannot be used with Gibbs sampling of rate categories\n", spacer);
+                        return (ERROR);
+                        }
+                    else
+                        m->Likelihood = &Likelihood_Adgamma;
+                    }
+                if (m->numModelStates > 20 && m->nCijkParts > 1)
+                    m->TiProbs = &TiProbs_GenCov;
+                else
+                    m->TiProbs = &TiProbs_Gen;
+                m->CondLikeUp = &CondLikeUp_Gen;
+                m->StateCode = &StateCode_AA;
+                m->PrintAncStates = &PrintAncStates_Gen;
+                m->PrintSiteRates = &PrintSiteRates_Gen;
+                }
+            }
+        else if (m->dataType == RESTRICTION)
+            {
+            if (m->parsModelId == YES)
+                {
+                m->Likelihood = &Likelihood_Pars;
+                }
+            else
+                {
+                m->CondLikeDown   = &CondLikeDown_Bin;
+                m->CondLikeRoot   = &CondLikeRoot_Bin;
+                m->CondLikeScaler = &CondLikeScaler_Gen;
+                m->Likelihood     = &Likelihood_Res;
+#   if defined (SSE_ENABLED)
+                if (m->printAncStates == YES || m->printSiteRates == YES)
+                    {
+                    MrBayesPrint ("%s   Non-SSE version of conditional likelihood calculator will be used for division %d\n", spacer, i+1);
+                    MrBayesPrint ("%s   due to request of reporting 'ancestral states' or 'site rates'.\n", spacer);
+                    }
+                else
+                    {
+                    m->useSSE= YES;
+                    m->CondLikeDown   = &CondLikeDown_Bin_SSE;
+                    m->CondLikeRoot   = &CondLikeRoot_Bin_SSE;
+                    m->CondLikeScaler = &CondLikeScaler_Gen_SSE;
+                    m->Likelihood     = &Likelihood_Res_SSE;
+                    }
+#   endif
+                m->TiProbs = &TiProbs_Res;
+                m->CondLikeUp = &CondLikeUp_Bin;
+                m->StateCode = &StateCode_Std;
+                m->PrintAncStates = &PrintAncStates_Bin;
+                m->PrintSiteRates = &PrintSiteRates_Gen;
+                }
+            }
+        else if (m->dataType == STANDARD)
+            {
+            if (m->parsModelId == YES)
+                {
+                if (m->numModelStates == 2)
+                    {
+                    m->Likelihood = &Likelihood_Pars; /* this is much faster if number of states do not vary */
+                    m->numStates = 2;   /* this is needed for the parsimony calculator */
+                    }
+                else
+                    m->Likelihood = &Likelihood_ParsStd;
+                }
+            else
+                {
+                m->CondLikeDown   = &CondLikeDown_Std;
+                m->CondLikeRoot   = &CondLikeRoot_Std;
+                m->CondLikeScaler = &CondLikeScaler_Std;
+                m->Likelihood     = &Likelihood_Std;
+                m->TiProbs        = &TiProbs_Std;
+                m->CondLikeUp     = &CondLikeUp_Std;
+                m->StateCode      = &StateCode_Std;
+                m->PrintAncStates = &PrintAncStates_Std;
+                m->PrintSiteRates = &PrintSiteRates_Std;
+                }
+            }       
+        else if (m->dataType == CONTINUOUS)
+            {
+            
+            }       
+        else
+            {
+            MrBayesPrint ("%s   ERROR: Data should be one of these types!\n", spacer);
+            return ERROR;
+            }
+        
+        }
+
+    return NO_ERROR;
+}
+
+
+/* Determine number of chains and data splits to be handled by MPI processors or threads */
+int SetLocalChainsAndDataSplits(void)
+{
+#   if defined (MPI_ENABLED)
+    
+    /* tell user how many chains each processor has been assigned */
+    if (num_procs <= numGlobalChains)
+        {
+        if (numGlobalChains % num_procs != 0)
+            {
+            MrBayesPrint ("%s   The total number of chains (%d) must be evenly divisible by\n", spacer, numGlobalChains);
+            MrBayesPrint ("%s   the number of MPI processors (%d).\n", spacer, num_procs);
+            /* 
+            MrBayesPrint ("%s   The total number of chains (%d) must be evenly divisible by\n", spacer, numGlobalChains);
+            MrBayesPrint ("%s   the number of MPI processors (%d), or the number of MPI\n", spacer, num_procs);
+            MrBayesPrint ("%s   processors should be a multiple of the number of chains.\n", spacer, num_procs);
+            */
+            MrBayesPrint ("%s   Please change your MPI settings.\n", spacer, num_procs);
+            return ERROR;
+            }
+        numLocalChains = numGlobalChains / num_procs;
+        MrBayesPrint ("%s   Number of chains per MPI processor = %d\n", spacer, numLocalChains);
+        }
+    else
+        {
+        MrBayesPrint ("%s   There must be at least as many chains as MPI processors\n", spacer);
+        return (ERROR);
+        }
+        /* 
+        {
+        if (num_procs % numGlobalChains != 0)
+            {
+            MrBayesPrint ("%s   The number of MPI processors (%d) must be a multiple of the\n", spacer, num_procs);
+            MrBayesPrint ("%s   total number of chains (%d), or the total number of chains\n", spacer, numGlobalChains);
+            MrBayesPrint ("%s   should be evenly divisible by the number of MPI processsors.\n", spacer);
+            MrBayesPrint ("%s   Please change your MPI settings.\n", spacer);
+            return ERROR;
+            }
+        numLocalChains = 1;
+        // numMPIDataSplits = num_procs / numGlobalChains;
+        // MrBayesPrint ("%s   Number of MPI data splits per chain = %d\n", spacer, numMPIDataSplits);
+        }
+        */
+#   else
+
+    numLocalChains = numGlobalChains;
+
+#   endif
+
+#   if defined (THREADS_ENABLED)
+
+    if (numLocalChains > 1)
+        {
+        /* Use pthreads to divide chains and possibly do data splits */
+        }
+    else
+        {
+        /* Use pthreads for data splits */
+        }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   ShowMoveSummary: Show summary of moves that will be used in MCMC sampling
+|
+-----------------------------------------------------------------------------*/
+int ShowMoveSummary (void)
+{
+    int         i, run, chain, areRunsSame, areChainsSame, chainIndex;
+    MCMCMove    *mv;
+    MrBFlt      prob;
+    
+    /* first find out if the probabilities are different in different runs */           
+    areRunsSame = YES;
+    for (run=1; run<chainParams.numRuns; run++)
+        {
+        for (chain=0; chain<chainParams.numChains; chain++)
+            {
+            chainIndex = run*chainParams.numChains + chain;
+            for (i=0; i<numUsedMoves; i++)
+                {
+                mv = usedMoves[i];
+                if (AreDoublesEqual (mv->relProposalProb[chainIndex], mv->relProposalProb[chain], 0.000001) == NO)
+                    {
+                    areRunsSame = NO;
+                    break;
+                    }
+                }
+            if (areRunsSame == NO)
+                break;
+            }
+        if (areRunsSame == NO)
+            break;
+        }
+
+    /* now print values */
+    for (run=0; run<chainParams.numRuns; run++)
+        {
+        if (areRunsSame == YES && run >= 1)
+            break;
+
+        /* find out if chains are different within this run */
+        areChainsSame = YES;
+        for (chain=1; chain<chainParams.numChains; chain++)
+            {
+            chainIndex = run*chainParams.numChains + chain;
+            for (i=0; i<numUsedMoves; i++)
+                {
+                mv = usedMoves[i];
+                if (AreDoublesEqual (mv->relProposalProb[chainIndex], mv->relProposalProb[chainIndex-chain], 0.000001) == NO)
+                    {
+                    areChainsSame = NO;
+                    break;
+                    }
+                }
+            if (areChainsSame == NO)
+                break;
+            }
+
+        for (chain=0; chain<chainParams.numChains; chain++)
+            {
+            if (areChainsSame == YES && chain >= 1)
+                break;
+            
+            /* now we can print the values */
+            MrBayesPrint("\n");
+            if (areRunsSame == YES && areChainsSame == YES)
+                MrBayesPrint ("%s   The MCMC sampler will use the following moves:\n", spacer);
+            else if (areRunsSame == NO && areChainsSame == YES)
+                MrBayesPrint ("%s   The MCMC sampler will use the following moves for run %d:\n", spacer, run+1);
+            else if (areRunsSame == YES && areChainsSame == NO)
+                MrBayesPrint ("%s   The MCMC sampler will use the following moves for chain %d:\n", spacer, chain+1);
+            else if (areRunsSame == NO && areChainsSame == NO)
+                MrBayesPrint ("%s   The MCMC sampler will use the following moves for run %d, chain %d:\n", spacer, run+1, chain+1);
+
+            chainIndex = run*chainParams.numChains + chain;
+            MrBayesPrint ("%s      With prob.  Chain will use move\n", spacer);
+            for (i=0; i<numUsedMoves; i++)
+                {
+                mv = usedMoves[i];
+                prob = mv->cumProposalProb[chainIndex];
+                if (i > 0)
+                    prob -= usedMoves[i-1]->cumProposalProb[chainIndex];
+                if (AreDoublesEqual(prob,0.0,0.000001) == YES)
+                    continue;
+                MrBayesPrint ("%s       %6.2f %%   %s\n", spacer, 100*prob, mv->name);
+                }
+            MrBayesPrint ("\n");
+            }   /* next chain */
+        }   /* next run */
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   SetUpPartitionCounters: Set up partitions and the root of the
+|      partition frequency tree                         
+|
+|----------------------------------------------------------------------*/
+int SetUpPartitionCounters (void)
+{
+    int     i;
+    
+#   if defined (MPI_ENABLED)
+    /* we only keep partition counters on proc 0 in the MPI version */
+    if (proc_id != 0)
+        return (NO_ERROR);
+#   endif
+    nLongsNeeded = 1 + (numLocalTaxa - 1) / nBitsInALong;
+    
+    if (memAllocs[ALLOC_PFCOUNTERS] == YES)
+        {
+        MrBayesPrint ("%s   ERROR: pfcounters not free in SetUpPartitionCounters\n", spacer);
+        return ERROR;
+        }
+    partition = (BitsLong **) SafeCalloc (2*numLocalTaxa, sizeof (BitsLong *));
+    if (partition == NULL)
+        {
+        MrBayesPrint ("%s   Failed to allocate partition in SetUpPartitionCounters\n", spacer);
+        return ERROR;
+        }
+    partition[0] = (BitsLong *) SafeCalloc (2*numLocalTaxa * nLongsNeeded, sizeof(BitsLong));
+    if (partition[0] == NULL)
+        {
+        free (partition);
+        MrBayesPrint ("%s   Failed to allocate partition[0] in SetUpPartitionCounters\n", spacer);
+        return ERROR;
+        }
+    partFreqTreeRoot = (PFNODE **) SafeCalloc (numTopologies, sizeof (PFNODE *));
+    if (partFreqTreeRoot == NULL)
+        {
+        free (partition);
+        free (partition[0]);
+        MrBayesPrint ("%s   Failed to allocate partFreqTreeRoot in SetUpPartitionCounters\n", spacer);
+        return ERROR;
+        }
+    memAllocs[ALLOC_PFCOUNTERS] = YES;
+
+    for (i=1; i<2*numLocalTaxa; i++)
+        {
+        partition[i] = partition[0] + i*nLongsNeeded;
+        }
+    
+    for (i=0; i<numLocalTaxa; i++)
+        SetBit (i, partition[i]);
+
+    for (i=0; i<numTopologies; i++)
+        partFreqTreeRoot[i] = NULL;
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   SetupTermState: create matrix holding unambiguous states for
+|       terminals (used for local compression on terminal branches)
+|
+-----------------------------------------------------------------------*/
+int SetUpTermState (void)
+{
+    int         i, k, n, c, d, x=0, *termStatePtr;
+    BitsLong    *p;
+    ModelInfo   *m;
+    ModelParams *mp;
+    int         numComprChars = 0;
+
+    /* allocate space for termState and isPartAmbig */
+    if (memAllocs[ALLOC_TERMSTATE] == YES || memAllocs[ALLOC_ISPARTAMBIG] == YES)
+        {
+        MrBayesPrint ("%s   termState or isPartAmbig is not free in SetupTermState\n", spacer);
+        return ERROR;
+        }
+
+#   if defined SSE_ENABLED
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        m->numSSEChars = ((m->numChars - 1) / FLOATS_PER_VEC) + 1;
+        if (m->dataType != STANDARD && m->gibbsGamma == NO)
+            numComprChars += m->numSSEChars * FLOATS_PER_VEC;
+        else
+            numComprChars += m->numChars;
+        }
+#   else
+    numComprChars = numCompressedChars;
+#   endif
+
+    termState = (int *) SafeCalloc (numLocalTaxa * numComprChars, sizeof(int));
+    if (termState)
+        memAllocs[ALLOC_TERMSTATE] = YES;
+    else
+        {
+        MrBayesPrint ("%s   Problem allocating termState\n", spacer);
+        return (ERROR);
+        }
+    isPartAmbig = (int *) SafeCalloc (numLocalTaxa*numCurrentDivisions, sizeof(int));
+    if (isPartAmbig)
+        memAllocs[ALLOC_ISPARTAMBIG] = YES;
+    else
+        {
+        MrBayesPrint ("%s   Problem allocating isPartAmbig\n", spacer);
+        return (ERROR);
+        }
+
+    /*initialize isPartAmbig */
+    for (i=0; i<numLocalTaxa*numCurrentDivisions; i++)
+        isPartAmbig[i] = NO;
+
+    /* loop over divisions */
+    termStatePtr = termState;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        /* don't do anything for continuous data */
+        if (mp->dataType == CONTINUOUS)
+            continue;
+        
+        m->termState   = (int **) SafeCalloc (numLocalTaxa, sizeof(int *));
+        if (!m->termState)
+            {
+            MrBayesPrint("%s   Problems allocating termState pointers for division %d\n", spacer, d+1);
+            return ERROR;
+            }
+
+#   if defined SSE_ENABLED
+        if (m->dataType != STANDARD && m->gibbsGamma == NO)
+            numComprChars = m->numSSEChars * FLOATS_PER_VEC;
+        else
+            numComprChars = m->numChars;
+
+#   else
+            numComprChars = m->numChars;
+#   endif
+
+        for (i=0; i<numLocalTaxa; i++)
+            {
+            m->termState[i] = termStatePtr;
+            termStatePtr += numComprChars;
+            }
+
+        m->isPartAmbig = isPartAmbig + numLocalTaxa * d;
+
+        for (i=0; i<numLocalTaxa; i++)
+            {
+            p = m->parsSets[i];
+            for (c=0; c<m->numChars; c++)
+                {
+                for (k=n=0; k<m->numStates; k++)
+                    {
+                    if (IsBitSet(k, p))
+                        {
+                        x = k;
+                        n++;
+                        }
+                    }
+                /* find appropriate index */
+                if (n == 1)
+                    m->termState[i][c] = x * m->numModelStates;
+                else if (n == m->numStates)
+                    m->termState[i][c] = m->numStates * m->numModelStates;
+                else
+                    m->isPartAmbig[i] = YES;
+
+                p += m->nParsIntsPerSite;
+                }
+            for (; c<numComprChars; c++)
+                {
+                /* Setting to fully ambig state all padding chars */
+                m->termState[i][c] = m->numStates * m->numModelStates;
+                }
+            }
+        }
+
+    /* print the termState matrix */
+#   if  defined (DEBUG_SETUPTERMSTATE)
+    PrintTermState();
+    getchar();
+#   endif
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   SetUsedMoves: This function will extract an array of pointers to the moves
+|      that will actually be used in the MCMC sampling. It also makes sure
+|      that the parsimonyBased flag is set in the relevant model partitions
+|      if there are moves used that are based on parsimony scores
+|
+-----------------------------------------------------------------------------*/
+int SetUsedMoves (void)
+{
+    int         i, j, moveIndex, numGlobalChains;
+    MrBFlt      prob, sum, cumSum;
+
+    /* first count moves */
+    numUsedMoves = 0;
+    numGlobalChains = chainParams.numChains * chainParams.numRuns;
+    for (i=0; i<numApplicableMoves; i++)
+        {
+        prob = 0.0;
+        for (j=0; j<numGlobalChains; j++)
+            {
+            if (moves[i]->relProposalProb[j] > prob)
+                prob = moves[i]->relProposalProb[j];
+            }
+        if (prob > 0.000001)
+            numUsedMoves++;
+        }
+    
+    /* allocate space */
+    if (memAllocs[ALLOC_USEDMOVES] == YES)
+        {
+        MrBayesPrint ("%s   Memory problem: usedMoves not free in SetUsedMoves\n", spacer);
+        return (ERROR);
+        }
+    usedMoves = (MCMCMove **) SafeMalloc (numUsedMoves * sizeof (MCMCMove *));
+    if (!usedMoves)
+        {
+        MrBayesPrint ("%s   Problem allocating usedMoves\n", spacer);
+        return (ERROR);
+        }
+    memAllocs[ALLOC_USEDMOVES] = YES;
+        
+    /* set move pointers */
+    moveIndex = 0;
+    for (i=0; i<numApplicableMoves; i++)
+        {
+        prob = 0.0;
+        for (j=0; j<numGlobalChains; j++)
+            {
+            if (moves[i]->relProposalProb[j] > prob)
+                prob = moves[i]->relProposalProb[j];
+            }
+        if (prob > 0.000001)
+            usedMoves[moveIndex++] = moves[i];
+        }
+    
+    if (moveIndex != numUsedMoves)
+        {
+        MrBayesPrint ("%s   Problem finding the used moves\n", spacer);
+        return (ERROR);
+        }
+
+    /* set parsimony flag if applicable */
+    for (i=0; i<numCurrentDivisions; i++)
+        modelSettings[i].parsimonyBasedMove = NO;
+    for (i=0; i<numUsedMoves; i++)
+        {
+        if (usedMoves[i]->moveType->parsimonyBased == YES)
+            {
+            for (j=0; j<usedMoves[i]->parm->nRelParts; j++)
+                modelSettings[usedMoves[i]->parm->relParts[j]].parsimonyBasedMove = YES;
+            }       
+        }
+
+    /* set cumulative proposal probabilities */
+    for (j=0; j<numGlobalChains; j++)
+        {
+        sum = 0.0;
+        for (i=0; i<numUsedMoves; i++)
+            {
+            sum += usedMoves[i]->relProposalProb[j];
+            }
+        cumSum = 0.0;
+        for (i=0; i<numUsedMoves; i++)
+            {
+            cumSum += usedMoves[i]->relProposalProb[j];
+            usedMoves[i]->cumProposalProb[j] = cumSum / sum;
+            }
+        }
+
+    /* reset acceptance probability values */
+    for (i=0; i<numUsedMoves; i++)
+        {
+        for (j=0; j<numGlobalChains; j++)
+            {
+            usedMoves[i]->nAccepted[j] = 0;
+            usedMoves[i]->nTried[j] = 0;
+            usedMoves[i]->nTotAccepted[j] = 0;
+            usedMoves[i]->nTotTried[j] = 0;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+void ShowValuesForChain (int chn)
+{
+    int             i;
+    char            s[100];
+        
+    MrBayesPrint ("%s   Chain = %d\n", spacer, chn);
+    MrBayesPrint ("%s      numParams = %d\n", spacer, numParams);
+    MrBayesPrint ("%s      numTrees  = %d\n", spacer, numTrees);
+    MrBayesPrint ("%s      current state: %d\n", spacer, state[chn]);
+    
+    strcat (spacer, "   ");
+
+    /* tRatio */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "tRatio[%d]", i);
+        PrintParamValues (modelSettings[i].tRatio, chn, s);
+        }
+
+    /* revMat */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "revMat[%d]", i);
+        PrintParamValues (modelSettings[i].revMat, chn, s);
+        }
+
+    /* stateFreq */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "stateFreq[%d]", i);
+        PrintParamValues (modelSettings[i].stateFreq, chn, s);
+        }
+
+    /* omega */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "omega[%d]", i);
+        PrintParamValues (modelSettings[i].omega, chn, s);
+        }
+
+    /* shape */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "shape[%d]", i);
+        PrintParamValues (modelSettings[i].shape, chn, s);
+        }
+
+    /* pInvar */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "pInvar[%d]", i);
+        PrintParamValues (modelSettings[i].pInvar, chn, s);
+        }
+
+    /* correlation */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "correlation[%d]", i);
+        PrintParamValues (modelSettings[i].correlation, chn, s);
+        }
+
+    /* switchRates */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "switchRates[%d]", i);
+        PrintParamValues (modelSettings[i].switchRates, chn, s);
+        }
+
+    /* rateMult */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "rateMult[%d]", i);
+        PrintParamValues (modelSettings[i].rateMult, chn, s);
+        }
+
+    /* speciationRates */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "speciationRates[%d]", i);
+        PrintParamValues (modelSettings[i].speciationRates, chn, s);
+        }
+
+    /* extinctionRates */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "extinctionRates[%d]", i);
+        PrintParamValues (modelSettings[i].extinctionRates, chn, s);
+        }
+
+    /* fossilizationRates */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "fossilizationRates[%d]", i);
+        PrintParamValues (modelSettings[i].fossilizationRates, chn, s);
+        }
+
+    /* popSize */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        sprintf (s, "popSize[%d]", i);
+        PrintParamValues (modelSettings[i].popSize, chn, s);
+        }
+
+    /* topology */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        MrBayesPrint ("%s   topology[%d] state 0\n", spacer, i);
+        ShowTree(GetTree (modelSettings[i].topology, chn, 0));
+        MrBayesPrint ("%s   topology[%d] state 1\n", spacer, i);
+        ShowTree(GetTree (modelSettings[i].topology, chn, 1));
+        }
+        
+    /* brlens */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        MrBayesPrint ("%s   tree[%d] state 0\n", spacer, i);
+        ShowTree(GetTree (modelSettings[i].topology, chn, 0));
+        MrBayesPrint ("%s   tree[%d] state 1\n", spacer, i);
+        ShowTree(GetTree (modelSettings[i].topology, chn, 1));
+        }
+
+    spacer[strlen(spacer) - 3] = '\0';
+
+#   if  0
+    for (i=0; i<sizeOfParamValues; i++)
+        MrBayesPrint ("%4d -- %lf\n", i, paramValues[i]);
+#   endif
+}
+
+
+/* SmallestNonemptyPFNode: recursive function to smallest nonempty node in a subtree */
+PFNODE *SmallestNonemptyPFNode (PFNODE *p, int *i, int j)
+{
+    PFNODE *q;
+
+    ++j;
+    if (p == NULL)
+        return NULL;
+    
+    q = SmallestNonemptyPFNode (p->right, i, j);
+    
+    if (q != NULL)
+        {
+        return q;
+        }
+    else if (IsPFNodeEmpty (p) == NO)
+        {
+        *i = j;
+        return p;
+        }
+    else
+        {
+        return SmallestNonemptyPFNode (p->left, i, j);
+        }
+}
+
+
+/* Talloc: Allocate space for a new node in the tree keeping track of partition frequencies */
+PFNODE *Talloc (void)
+{
+    PFNODE  *temp;
+
+    temp = (PFNODE *) SafeMalloc (sizeof(PFNODE));
+    if (temp == NULL)
+        return NULL;
+
+    temp->partition = (BitsLong *) SafeCalloc (nLongsNeeded, sizeof (BitsLong));
+    if (temp->partition == NULL)
+        {
+        free (temp);
+        return NULL;
+        }
+
+    temp->count = (int *) SafeCalloc (chainParams.numRuns, sizeof (int));
+    if (temp->count == NULL)
+        {
+        free (temp->partition);
+        free (temp);
+        return NULL;
+        }
+
+    return temp; 
+}
+
+
+MrBFlt Temperature (int id)
+{
+    /* let id be number of chain in run */
+    id %= chainParams.numChains;
+    
+    if (chainParams.userDefinedTemps == YES)
+        {
+        return (chainParams.userTemps[id]);
+        }
+    else
+        {
+        return (1.0 / (1.0 + chainParams.chainTemp * id));
+        }
+}
+
+
+/* Tfree: Free space for partition frequency counter tree */
+void Tfree (PFNODE *r)
+{
+    if (r != NULL)
+        {
+        if (r->left != NULL)
+            Tfree (r->left);
+        if (r->right != NULL)
+            Tfree (r->right);
+
+        free (r->partition);
+        free (r->count);
+        free (r);
+        }
+}
+
+
+void TouchAllCijks (int chain)
+{
+    int i;
+
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        if (modelSettings[i].nCijkParts >= 1)
+            modelSettings[i].upDateCijk = YES;
+        }
+
+    return;
+    MrBayesPrint ("%d", chain); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+void TouchAllPartitions (void)
+{
+    int i;
+
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        modelSettings[i].upDateCl = YES;
+        }
+
+    return;
+}
+
+
+void TouchAllTrees (int chain)
+{
+    int         i, j;
+    Tree        *t;
+    TreeNode    *p;
+
+    for (i=0; i<numTrees; i++)
+        {
+        t = GetTreeFromIndex (i, chain, state[chain]);
+        for (j=0; j<t->nNodes; j++)
+            {
+            p = t->allDownPass[j];
+            p->upDateCl = YES;
+            p->upDateTi = YES;
+            }
+        }
+
+    for (i=0; i<numCurrentDivisions; i++)
+        modelSettings[i].upDateAll = YES;
+
+    return;
+}
+
+
+/* Touch all update flags so we recalculate likelihood from scratch */
+void TouchEverything (int chain)
+{
+    int         i, j;
+    Tree        *t;
+    TreeNode    *p;
+
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        if (modelSettings[i].nCijkParts >= 1)
+            modelSettings[i].upDateCijk = YES;
+        modelSettings[i].upDateCl = YES;
+        modelSettings[i].upDateAll = YES;
+        }
+
+    for (i=0; i<numTrees; i++)
+        {
+        t = GetTreeFromIndex (i, chain, state[chain]);
+        for (j=0; j<t->nNodes; j++)
+            {
+            p = t->allDownPass[j];
+            p->upDateCl = YES;
+            p->upDateTi = YES;
+            }
+        }
+
+    return;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   TreeLength: Calculates the tree length as the sum of the lengths
+|       of all the branches. The tree length is the expected number 
+|       of character state transformations per character over the 
+|       entire phylogenetic tree.
+|
+-------------------------------------------------------------------*/
+MrBFlt TreeLength (Param *param, int chain)
+{
+    int             i, j;
+    MrBFlt          tl;
+    Tree            *t;
+    TreeNode        *p;
+
+    if (param->paramId == BRLENS_PARSIMONY)
+        {
+        tl = 0.0;
+        for (j=0; j<param->nRelParts; j++)
+            tl += modelSettings[param->relParts[j]].parsTreeLength[2*chain+state[chain]];
+        }
+    else
+        {
+        /* get tree */
+        t = GetTree (param, chain, state[chain]);
+        
+        /* loop over all branches of the tree */
+        tl = 0.0;
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc != NULL)
+                {
+                if (p->anc->anc == NULL && t->isRooted == NO)
+                    {
+                    tl += p->length;
+                    }
+                else
+                    {
+                    tl += p->length;
+                    }
+                }
+            }
+        }
+                
+    return (tl);
+}
+
+
+/* proportion of ancestral fossils in a FBD tree */
+MrBFlt PropAncFossil (Param *param, int chain)
+{
+    int             i, m, k;
+    Tree            *t;
+    TreeNode        *p;
+    t = GetTree (param, chain, state[chain]);
+    
+    if (t->isRooted == NO)
+        return 0.0;
+    
+    /* count # of tip and ancestral fossils */
+    m = k = 0;
+    for (i = 0; i < t->nNodes -2; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL && p->nodeDepth > 0.0)
+            {
+            if (p->length > 0.0)
+                m++;
+            else
+                k++;
+            }
+        }
+    
+    if (k == 0)
+        return 0.0;
+    else
+        return (MrBFlt)k / (m+k);
+}
+
diff --git a/src/mcmc.h b/src/mcmc.h
new file mode 100644 (file)
index 0000000..f231cff
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef __MCMC_H__
+#define __MCMC_H__
+
+int     AddToPrintString (char *tempStr);
+void    AutotuneDirichlet (MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *alphaPi, MrBFlt minTuning, MrBFlt maxTuning);
+void    AutotuneMultiplier (MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *lambda, MrBFlt minTuning, MrBFlt maxTuning);
+void    AutotuneSlider (MrBFlt acceptanceRate, MrBFlt targetRate, int batch, MrBFlt *width, MrBFlt minTuning, MrBFlt maxTuning);
+int     DoMcmc (void);
+int     DoMcmcp (void);
+int     DoMcmcParm (char *parmName, char *tkn);
+int     DoSs (void);
+int     DoSsp (void);
+int     DoSsParm (char *parmName, char *tkn);
+int     ExhaustiveParsimonySearch (Tree *t, int chain, TreeInfo *tInfo);
+MrBFlt  GetParsDP (Tree *t, TreeNode *p, int chain);
+void    GetParsFP (Tree *t, TreeNode *p, int chain);
+int     GetParsimonyBrlens (Tree *t, int chain, MrBFlt *brlens);
+MrBFlt  GetParsimonyLength (Tree *t, int chain);
+void    GetParsimonySubtreeRootstate (Tree *t, TreeNode *root, int chain);
+MrBFlt  GetRate (int division, int chain);
+int     LnBirthDeathPriorPr (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt sR, MrBFlt eR, char *sS, MrBFlt sF);
+int     LnCoalescencePriorPr (Tree *t, MrBFlt *prob, MrBFlt theta, MrBFlt growth);
+MrBFlt  LnUniformPriorPr (Tree *t, MrBFlt clockRate);
+int     LnFossilizationPriorPr (Tree *t, MrBFlt clockRate, MrBFlt *prob, MrBFlt *sR, MrBFlt *eR, MrBFlt sF, MrBFlt *fR, char *sS);
+int     LogClockTreePriorRatio (Param *param, int chain, MrBFlt *lnPriorRatio);
+MrBFlt  LogDirPrior (Tree *t, ModelParams *mp, int PV);
+MrBFlt  LogOmegaPrior (MrBFlt w1, MrBFlt w2, MrBFlt w3);
+FILE    *OpenNewMBPrintFile (char *fileName);
+int     ResetScalersPartition (int *isScalerNode, Tree* t, unsigned rescaleFreq);
+int     SafeSprintf (char **target, int *targetLen, char *fmt, ...);
+int     SetFilePositions (int samplePos);
+MrBFlt  TreeLength (Param *param, int chain);
+
+#endif  /* __MCMC_H__ */
diff --git a/src/model.c b/src/model.c
new file mode 100644 (file)
index 0000000..1053f23
--- /dev/null
@@ -0,0 +1,24216 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "best.h"
+#include "command.h"
+#include "model.h"
+#include "mcmc.h"
+#include "proposal.h"
+#include "sumpt.h"
+#include "utils.h"
+#if defined(__MWERKS__)
+#include "SIOUX.h"
+#endif
+
+const char* const svnRevisionModelC = "$Rev: 1067 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+
+#undef  DEBUG_ADDDUMMYCHARS
+#undef  DEBUG_CONSTRAINTS
+#undef  DEBUG_COMPRESSDATA
+#undef  DEBUG_CPP
+
+/* local prototypes */
+int       AddDummyChars (void);
+void      AllocateCppEvents (Param *p);
+MCMCMove *AllocateMove (MoveType *moveType, Param *param);
+int       AllocateNormalParams (void);
+int       AllocateTreeParams (void);
+void      CheckCharCodingType (Matrix *m, CharInfo *ci);
+int       CheckExpandedModels (void);
+int       CompressData (void);
+int       InitializeChainTrees (Param *p, int from, int to, int isRooted);
+int       FillBrlensSubParams (Param *param, int chn, int state);
+void      FreeCppEvents (Param *p);
+void      FreeMove (MCMCMove *mv);
+void      GetPossibleAAs (int aaCode, int aa[]);
+void      GetPossibleNucs (int nucCode, int nuc[]);
+void      GetPossibleRestrictionSites (int resSiteCode, int *sites);
+int       GetUserTreeFromName (int *index, char *treeName);
+void      InitializeMcmcTrees (Param *p);
+int       IsApplicable (Param *param);
+int       IsApplicable_FiveTaxaOrMore (Param *param);
+int       IsApplicable_FourTaxaOrMore (Param *param);
+int       IsApplicable_ThreeTaxaOrMore (Param *param);
+int       IsApplicableTreeAgeMove (Param *param);
+int       IsModelSame (int whichParam, int part1, int part2, int *isApplic1, int *isApplic2);
+int       LargestMovableSubtree(Param *treeParam);
+int       NumActiveParts (void);
+int       NumInformativeHardConstraints (ModelParams *mp);
+int       NumNonExcludedChar (void);
+int       NumStates (int part);
+int       PrintCompMatrix (void);
+int       PrintMatrix (void);
+int       ProcessStdChars (RandLong *seed);
+void      SetCode (int part);
+int       SetModelParams (void);
+int       SetPopSizeParam (Param *param, int chn, int state, PolyTree *pt);
+int       SetRelaxedClockParam (Param *param, int chn, int state, PolyTree *pt);
+int       SetUpLinkTable (void);
+int       ShowMoves (int used);
+int       ShowParameters (int showStartVals, int showMoves, int showAllAvailable);
+int       UpdateCppEvolLength (int *nEvents, MrBFlt **pos, MrBFlt **rateMult, MrBFlt *evolLength, TreeNode *p, MrBFlt baseRate);
+
+/* globals */
+int             *activeParams[NUM_LINKED];              /* a table holding the parameter link status        */
+int             localOutGroup;                          /* outgroup for non-excluded taxa                   */
+Calibration     **localTaxonCalibration = NULL;         /* stores local taxon calibrations (ages)           */
+char            **localTaxonNames = NULL;               /* points to names of non-excluded taxa             */
+Model           *modelParams;                           /* holds model params                               */
+ModelInfo       *modelSettings;                         /* stores important info on model params            */
+MCMCMove        **moves;                                /* vector of pointers to applicable moves           */
+int             numApplicableMoves;                     /* number of moves applicable to model parameters   */
+int             numCurrentDivisions;                    /* number of partitions of data                     */
+int             numGlobalChains;                        /* number of global chains                          */
+int             numLocalTaxa;                           /* number of non-excluded taxa                      */
+int             numLocalChar;                           /* number of non-excluded characters                */
+int             numParams;                              /* number of parameters in model                    */
+int             numTopologies;                          /* number of topologies for one chain and state     */
+int             numTrees;                               /* number of trees for one chain and state          */
+Param           *params;                                /* vector of parameters                             */
+Param           *printParams;                           /* vector of subst model parameters to print        */
+ShowmovesParams showmovesParams;                        /* holds parameters for Showmoves command           */
+Param           *treePrintparams;                       /* vector of tree parameters to print               */
+int             setUpAnalysisSuccess;                   /* Set to YES if analysis is set without error      */
+
+/* globals used to describe and change the current model; allocated in AllocCharacters and SetPartition  */
+int         *numVars;                                   /* number of variables in setting arrays         */
+int         *activeParts;                               /* partitions changes should apply to            */
+int         *linkTable[NUM_LINKED];                     /* how parameters are linked across parts        */
+int         *tempLinkUnlink[NUM_LINKED];                /* for changing parameter linkage                */
+int         *tempLinkUnlinkVec;                         /* for changing parameter linkage                */
+MrBFlt      *tempNum;                                   /* vector of numbers used for setting arrays     */
+
+/* Aamodel parameters */
+MrBFlt          aaJones[20][20];             /* rates for Jones model                        */
+MrBFlt          aaDayhoff[20][20];           /* rates for Dayhoff model                      */
+MrBFlt          aaMtrev24[20][20];           /* rates for mtrev24 model                      */
+MrBFlt          aaMtmam[20][20];             /* rates for mtmam model                        */
+MrBFlt          aartREV[20][20];             /* rates for rtREV model                        */
+MrBFlt          aaWAG[20][20];               /* rates for WAG model                          */
+MrBFlt          aacpREV[20][20];             /* rates for aacpREV model                      */
+MrBFlt          aaVt[20][20];                /* rates for VT model                           */
+MrBFlt          aaBlosum[20][20];            /* rates for Blosum62 model                     */
+MrBFlt          aaLG[20][20];                /* rates for LG model                           */
+MrBFlt          jonesPi[20];                 /* stationary frequencies for Jones model       */
+MrBFlt          dayhoffPi[20];               /* stationary frequencies for Dayhoff model     */
+MrBFlt          mtrev24Pi[20];               /* stationary frequencies for mtrev24 model     */
+MrBFlt          mtmamPi[20];                 /* stationary frequencies for mtmam model       */
+MrBFlt          rtrevPi[20];                 /* stationary frequencies for rtREV model       */
+MrBFlt          wagPi[20];                   /* stationary frequencies for WAG model         */
+MrBFlt          cprevPi[20];                 /* stationary frequencies for aacpREV model     */
+MrBFlt          vtPi[20];                    /* stationary frequencies for VT model          */
+MrBFlt          blosPi[20];                  /* stationary frequencies for Blosum62 model    */
+MrBFlt          lgPi[20];                    /* stationary frequencies for LG model          */
+
+/* parser flags and variables */
+int         fromI, toJ, foundDash, foundComma, foundEqual, foundBeta,
+            foundAaSetting, foundExp, modelIsFixed, linkNum, foundLeftPar,
+            foundFSNum[999], foundFSTime[999], tempNumStates, isNegative;
+MrBFlt      tempStateFreqs[200], tempAaModelPrs[10];
+char        colonPr[100], clockPr[30];
+
+/* other local variables (this file) */
+MrBFlt          empiricalFreqs[200];         /* emprical base frequencies for partition                 */
+int             intValsRowSize = 0;          /* row size of intValues matrix                            */
+int             *intValues = NULL;           /* stores int values of chain parameters                   */
+Tree            **mcmcTree;                  /* pointers to trees for mcmc                              */
+int             paramValsRowSize = 0;        /* row size of paramValues matrix                          */
+MrBFlt          *paramValues = NULL;         /* stores actual values and subvalues of chain parameters  */
+int             *relevantParts = NULL;       /* partitions that are affected by this move               */
+Param           **subParamPtrs;              /* pointer to subparams for topology params                */
+int             *stateSize;                  /* # states for each compressed char                       */
+// int          foundCurly;
+// char         *plotTokenP;                 /* plotToken[CMD_STRING_LENGTH];*/
+
+
+/*-----------------------------------------------------------------------
+|
+|   AddDummyChars: Add dummy characters to relevant partitions
+|
+------------------------------------------------------------------------*/
+int AddDummyChars (void)
+{
+    int         i, j, k, d, numIncompatible, numDeleted, numStdChars, oldRowSize,
+                newRowSize, numDummyChars, newColumn, newChar, oldColumn, oldChar, 
+                isCompat, *tempChar, numIncompatibleChars;
+    BitsLong    *tempMatrix, bitsLongOne = 1;
+    CLFlt       *tempSitesOfPat;
+    ModelInfo   *m;
+    ModelParams *mp;
+    CharInfo    cinfo;
+    Matrix      matrix;
+
+    /* set pointers to NULL */
+    tempMatrix = NULL;
+    tempSitesOfPat = NULL;
+    tempChar = NULL;
+
+    /* check how many dummy characters needed in total */
+    numDummyChars = 0;
+    numStdChars = 0;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        m->numDummyChars = 0;
+
+        if (mp->dataType == RESTRICTION && !strcmp(mp->parsModel,"No"))
+            {
+            if (mp->coding & NOABSENCESITES)
+                m->numDummyChars++;
+            if (mp->coding & NOPRESENCESITES)
+                m->numDummyChars++;
+            if (mp->coding & NOSINGLETONABSENCE)
+                m->numDummyChars += numLocalTaxa;
+            if (mp->coding & NOSINGLETONPRESENCE)
+                m->numDummyChars += numLocalTaxa;
+            }
+
+        if (mp->dataType == STANDARD && !strcmp(mp->parsModel,"No"))
+            {
+            if (mp->coding & VARIABLE)
+                m->numDummyChars += 2;
+            if (mp->coding & NOSINGLETONS)
+                m->numDummyChars += 2*numLocalTaxa;
+            numStdChars += (m->numChars + m->numDummyChars);
+            }
+
+        numDummyChars += m->numDummyChars;
+        m->numChars += m->numDummyChars;
+        }
+
+    /* exit if dummy characters not needed */
+    if (numDummyChars == 0)
+        return NO_ERROR;
+
+    /* print original compressed matrix */
+#   if  defined (DEBUG_ADDDUMMYCHARS)
+    MrBayesPrint ("Compressed matrix before adding dummy characters...\n");
+    PrintCompMatrix();
+#   endif
+
+    /* set row sizes for old and new matrices */
+    oldRowSize = compMatrixRowSize;
+    compMatrixRowSize += numDummyChars;
+    newRowSize = compMatrixRowSize;
+    numCompressedChars += numDummyChars;
+
+    /* allocate space for new data */
+    tempMatrix = (BitsLong *) SafeCalloc (numLocalTaxa * newRowSize, sizeof(BitsLong));
+    tempSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    tempChar = (int *) SafeCalloc (compMatrixRowSize, sizeof(int));
+    if (!tempMatrix || !tempSitesOfPat || !tempChar)
+        {
+        MrBayesPrint ("%s   Problem allocating temporary variables in AddDummyChars\n", spacer);
+        goto errorExit;
+        }
+
+    /* initialize indices */
+    oldChar = newChar = newColumn = numDeleted = 0;
+
+    /* set up matrix struct */
+    matrix.origin = compMatrix;
+    matrix.nRows = numLocalTaxa;
+    matrix.rowSize = oldRowSize;
+
+    /* loop over divisions */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        /* insert the dummy characters first for each division */
+        if (m->numDummyChars > 0)
+            {
+            // MrBayesPrint("%s   Adding dummy characters (unobserved site patterns) for division %d\n", spacer, d+1);
+            // do not print this every time
+
+            for (k=0; k<2; k++)
+                {
+                if (((mp->coding & NOSINGLETONPRESENCE) && k == 0) || ((mp->coding & NOSINGLETONABSENCE) && k == 1))
+                    {
+                    for (i=0; i< numLocalTaxa; i++)
+                        {
+                        for (j=0; j<numLocalTaxa; j++)
+                            {
+                            if (j == i)
+                                tempMatrix[pos(j,newColumn,newRowSize)] = (bitsLongOne << k) ^ 3;
+                            else
+                                tempMatrix[pos(j,newColumn,newRowSize)] = bitsLongOne << k;
+                            }
+                        tempSitesOfPat[newChar] = 0;
+                        tempChar[newColumn] = -1;
+                        newChar++;
+                        newColumn++;
+                        }
+                    }
+                }
+
+            if (mp->coding & NOABSENCESITES)
+                {
+                for (i=0; i<numLocalTaxa; i++)
+                    tempMatrix[pos(i,newColumn,newRowSize)] = 1;
+                tempSitesOfPat[newChar] = 0;
+                tempChar[newColumn] = -1;
+                newChar++;
+                newColumn++;
+                }
+
+            if (mp->coding & NOPRESENCESITES)
+                {
+                for (i=0; i<numLocalTaxa; i++)
+                    tempMatrix[pos(i,newColumn,newRowSize)] = 2;
+                tempSitesOfPat[newChar] = 0;
+                tempChar[newColumn] = -1;
+                newChar++;
+                newColumn++;
+                }
+            }
+
+        /* add the normal characters */
+        numIncompatible = numIncompatibleChars = 0;
+        for (oldColumn=m->compMatrixStart; oldColumn<m->compMatrixStop; oldColumn++)
+            {
+            isCompat = YES;
+            /* first check if the character is supposed to be present */
+            if (m->numDummyChars > 0)
+                {
+                /* set up matrix struct */
+                matrix.column = oldColumn;
+                /* set up charinfo struct */
+                cinfo.dType = mp->dataType;
+                cinfo.cType = charInfo[origChar[oldChar]].ctype;
+                cinfo.nStates = charInfo[origChar[oldChar]].numStates;
+                CheckCharCodingType(&matrix, &cinfo);
+
+                if (mp->coding & VARIABLE)
+                    {
+                    if((mp->coding & VARIABLE) == VARIABLE && cinfo.variable == NO)
+                        {
+                        isCompat = NO;
+                        }
+                    else if((mp->coding & NOABSENCESITES) && cinfo.constant[0] == YES)
+                        {
+                        isCompat = NO;
+                        }
+                    else if((mp->coding & NOPRESENCESITES) && cinfo.constant[1] == YES)
+                        {
+                        isCompat = NO;
+                        }
+                    }
+                if (mp->coding & NOSINGLETONS)
+                    {
+                    if((mp->coding & NOSINGLETONS) == NOSINGLETONS && cinfo.informative == NO && cinfo.variable == YES)
+                        {
+                        isCompat = NO;
+                        }
+                    else if((mp->coding & NOSINGLETONABSENCE) && cinfo.singleton[0] == YES && cinfo.informative == NO)
+                        {
+                        isCompat = NO;
+                        }
+                    else if((mp->coding & NOSINGLETONPRESENCE) && cinfo.singleton[1] == YES && cinfo.informative == NO)
+                        {
+                        isCompat = NO;
+                        }
+                    }
+                }
+
+            if (isCompat == NO)
+                {
+                numIncompatible++;
+                numIncompatibleChars += (int) numSitesOfPat[oldChar];
+                oldChar++;
+                }
+            else
+                {
+                /* add character */
+                for (i=0; i<numLocalTaxa; i++)
+                    tempMatrix[pos(i,newColumn,newRowSize)] = compMatrix[pos(i,oldColumn,oldRowSize)];
+                /* set indices */
+                compCharPos[origChar[oldColumn]] = newChar;
+                compColPos[origChar[oldColumn]] = newColumn;
+                tempSitesOfPat[newChar] = numSitesOfPat[oldChar];
+                tempChar[newColumn] = origChar[oldColumn];
+                newColumn++;
+                if ((oldColumn-m->compMatrixStart+1) % m->nCharsPerSite == 0)
+                    {
+                    newChar++;
+                    oldChar++;
+                    }
+                }
+            }
+
+        /* print a warning if there are incompatible characters */
+        if (numIncompatible > 0)
+            {
+            m->numChars -= numIncompatible;
+            m->numUncompressedChars -= numIncompatibleChars;
+            numDeleted += numIncompatible;
+            if (numIncompatibleChars > 1)
+                {
+                MrBayesPrint ("%s   WARNING: There are %d characters incompatible with the specified\n", spacer, numIncompatibleChars);
+                MrBayesPrint ("%s            coding bias. These characters will be excluded.\n", spacer);
+                }
+            else
+                {
+                MrBayesPrint ("%s   WARNING: There is one character incompatible with the specified\n", spacer);
+                MrBayesPrint ("%s            coding bias. This character will be excluded.\n", spacer);
+                }
+            }
+
+        /* update division comp matrix and comp char pointers */
+        m->compCharStop = newChar;
+        m->compMatrixStop = newColumn;
+        m->compCharStart = newChar - m->numChars;
+        m->compMatrixStart = newColumn - m->nCharsPerSite * m->numChars;
+
+        }   /* next division */
+
+    /* compress matrix if necessary */
+    if (numDeleted > 0)
+        {
+        for (i=k=0; i<numLocalTaxa; i++)
+            {
+            for (j=0; j<newRowSize-numDeleted; j++)
+                {
+                tempMatrix[k++] = tempMatrix[j+i*newRowSize];
+                }
+            }
+        numCompressedChars -= numDeleted;
+        compMatrixRowSize -= numDeleted;
+        }
+
+    /* free old data, set pointers to new data */
+    free (compMatrix);
+    free (numSitesOfPat);
+    free (origChar);
+    
+    compMatrix = tempMatrix;
+    numSitesOfPat = tempSitesOfPat;
+    origChar = tempChar;
+    
+    tempMatrix = NULL;
+    tempSitesOfPat = NULL;
+    tempChar = NULL;
+    
+    /* print new compressed matrix */
+#   if  defined (DEBUG_ADDDUMMYCHARS)
+    MrBayesPrint ("After adding dummy characters...\n");
+    PrintCompMatrix();
+#   endif
+
+    return NO_ERROR;
+
+    errorExit:
+        if (tempMatrix)
+            free (tempMatrix);
+        if (tempSitesOfPat)
+            free (tempSitesOfPat);
+        if (tempChar)
+            free (tempChar);
+
+        return ERROR;   
+}
+
+
+/* Allocate space for cpp events */
+void AllocateCppEvents (Param *p)
+{
+    int     i;
+
+    p->nEvents = (int **) SafeCalloc (2*numGlobalChains, sizeof (int *));
+    p->nEvents[0] = (int *) SafeCalloc (2*numGlobalChains*(2*numLocalTaxa), sizeof (int));
+    for (i=1; i<2*numGlobalChains; i++)
+        p->nEvents[i] = p->nEvents[i-1] + (2*numLocalTaxa);
+    p->position = (MrBFlt ***) SafeCalloc (2*numGlobalChains, sizeof (MrBFlt **));
+    p->position[0] = (MrBFlt **) SafeCalloc (2*numGlobalChains*(2*numLocalTaxa), sizeof (MrBFlt *));
+    for (i=1; i<2*numGlobalChains; i++)
+        p->position[i] = p->position[i-1] + (2*numLocalTaxa);
+    p->rateMult = (MrBFlt ***) SafeCalloc (2*numGlobalChains, sizeof (MrBFlt **));
+    p->rateMult[0] = (MrBFlt **) SafeCalloc (2*numGlobalChains*(2*numLocalTaxa), sizeof (MrBFlt *));
+    for (i=1; i<2*numGlobalChains; i++)
+        p->rateMult[i] = p->rateMult[i-1] + (2*numLocalTaxa);
+
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   AllocateMove: Allocate space for and initialize one applicable move
+|
+-----------------------------------------------------------------------------*/
+MCMCMove *AllocateMove (MoveType *moveType, Param *param)
+{
+    int         i, j, nameLength;
+    char        *partitionDescriptor = "";
+    MCMCMove    *temp;
+
+    if ((temp = (MCMCMove *) SafeCalloc (1, sizeof (MCMCMove))) == NULL)
+        return (NULL);
+
+    /* calculate length */
+    if (strcmp (moveType->paramName, "") == 0)
+        nameLength = (int) (strlen (moveType->shortName) + strlen (param->name)) + 10;
+    else
+        {
+        partitionDescriptor = param->name;
+        while (*partitionDescriptor != '\0')
+            {
+            if (*partitionDescriptor == '{')
+                break;
+            partitionDescriptor++;
+            }
+        nameLength = (int) (strlen (moveType->shortName) + strlen (moveType->paramName) + strlen (partitionDescriptor)) + 10;
+        }
+    /* add length of names of subparams */
+    if (moveType->subParams == YES)
+        {
+        for (i=0; i<param->nSubParams; i++)
+            nameLength += (int)(strlen(param->subParams[i]->name)) + 1;
+        }
+
+    if ((temp->name = (char *) SafeCalloc (nameLength, sizeof (char))) == NULL)
+        {
+        free (temp);
+        return NULL;
+        }
+
+    if ((temp->nAccepted = (int *) SafeCalloc (5*numGlobalChains, sizeof (int))) == NULL)
+        {
+        free (temp->name);
+        free (temp);
+        return NULL;
+        }
+    temp->nTried       = temp->nAccepted + numGlobalChains;
+    temp->nBatches     = temp->nAccepted + 2*numGlobalChains;
+    temp->nTotAccepted = temp->nAccepted + 3*numGlobalChains;
+    temp->nTotTried    = temp->nAccepted + 4*numGlobalChains; 
+    
+    if ((temp->relProposalProb = (MrBFlt *) SafeCalloc (4*numGlobalChains, sizeof (MrBFlt))) == NULL)
+        {
+        free (temp->nAccepted);
+        free (temp->name);
+        free (temp);
+        return NULL;
+        }
+    temp->cumProposalProb = temp->relProposalProb + numGlobalChains;
+    temp->targetRate = temp->relProposalProb + 2*numGlobalChains;
+    temp->lastAcceptanceRate = temp->relProposalProb + 3*numGlobalChains;
+
+    if ((temp->tuningParam = (MrBFlt **) SafeCalloc (numGlobalChains, sizeof (MrBFlt *))) == NULL)
+        {
+        free (temp->relProposalProb);
+        free (temp->nAccepted);
+        free (temp->name);
+        free (temp);
+        return NULL;
+        }
+    if ((temp->tuningParam[0] = (MrBFlt *) SafeCalloc (moveType->numTuningParams*numGlobalChains, sizeof (MrBFlt))) == NULL)
+        {
+        free (temp->tuningParam);
+        free (temp->relProposalProb);
+        free (temp->nAccepted);
+        free (temp->name);
+        free (temp);
+        return NULL;
+        }
+    for (i=1; i<numGlobalChains; i++)
+        temp->tuningParam[i] = temp->tuningParam[0] + (i * moveType->numTuningParams);
+
+    /* set default values */
+    if (strcmp(moveType->paramName, "") != 0)
+        sprintf (temp->name, "%s(%s%s)", moveType->shortName, moveType->paramName, partitionDescriptor);
+    else
+        {
+        sprintf (temp->name, "%s(%s", moveType->shortName, param->name);
+        if (moveType->subParams == YES)
+            {
+            for (i=0; i<param->nSubParams; i++)
+                {
+                strcat(temp->name,",");
+                strcat(temp->name,param->subParams[i]->name);
+                }
+            }
+        strcat (temp->name,")");
+        }
+        
+    temp->moveType = moveType;
+    temp->moveFxn = moveType->moveFxn;
+    for (i=0; i<numGlobalChains; i++)
+        {
+        temp->relProposalProb[i] = moveType->relProposalProb;
+        temp->cumProposalProb[i] = 0.0;
+        temp->nAccepted[i] = 0;
+        temp->nTried[i] = 0;
+        temp->nBatches[i] = 0;
+        temp->nTotAccepted[i] = 0;
+        temp->nTotTried[i] = 0;
+        temp->targetRate[i] = moveType->targetRate;
+        temp->lastAcceptanceRate[i] = 0.0;
+        for (j=0; j<moveType->numTuningParams; j++)
+            temp->tuningParam[i][j] = moveType->tuningParam[j];
+        }
+    return (temp);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   AllocateNormalParams: Allocate space for normal parameters
+|
+-----------------------------------------------------------------------*/
+int AllocateNormalParams (void)
+{
+    int         i, k, nOfParams, nOfIntParams;
+    Param       *p;
+    
+    /* Count the number of param values and subvalues */
+    nOfParams = 0;
+    nOfIntParams = 0;
+    for (k=0; k<numParams; k++)
+        {
+        nOfParams += params[k].nValues;
+        nOfParams += params[k].nSubValues;
+        nOfIntParams += params[k].nIntValues;
+        }
+
+    /* Set row size and find total number of values */
+    paramValsRowSize = nOfParams;
+    intValsRowSize = nOfIntParams;
+    nOfParams *= (2 * numGlobalChains);
+    nOfIntParams *= (2 * numGlobalChains);
+
+    if (memAllocs[ALLOC_PARAMVALUES] == YES)
+        {
+        paramValues = (MrBFlt *) SafeRealloc ((void *) paramValues, nOfParams * sizeof (MrBFlt));
+        for (i=0; i<nOfParams; i++)
+            paramValues[i] = 0.0;
+        if (nOfIntParams > 0)
+            intValues = (int *) SafeRealloc ((void *) intValues, nOfIntParams * sizeof(int));
+        }
+    else
+        {
+        paramValues = (MrBFlt *) SafeCalloc (nOfParams, sizeof(MrBFlt));
+        if (nOfIntParams > 0)
+            intValues = (int *) SafeCalloc (nOfIntParams, sizeof(int));
+        else
+            intValues = NULL;
+        }
+    if (!paramValues || (nOfIntParams > 0 && !intValues))
+        {
+        MrBayesPrint ("%s   Problem allocating paramValues\n", spacer);
+        if (paramValues)
+            free (paramValues);
+        if (intValues)
+            free (intValues);
+        return ERROR;
+        }
+    else
+        memAllocs[ALLOC_PARAMVALUES] = YES;
+
+    /* set pointers to values for chain 1 state 0            */
+    /* this scheme keeps the chain and state values together */
+    nOfParams = 0;
+    nOfIntParams = 0;
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->nValues > 0)
+            p->values = paramValues + nOfParams;
+        else
+            p->values = NULL;
+        nOfParams += p->nValues;
+        if (p->nSubValues > 0)
+            p->subValues = paramValues + nOfParams;
+        else
+            p->subValues = NULL;
+        nOfParams += p->nSubValues;
+        if (p->nIntValues > 0)
+            p->intValues = intValues + nOfIntParams;
+        else
+            p->intValues = NULL;
+        nOfIntParams += p->nIntValues;
+        }
+    
+    /* allocate space for cpp events */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_CPPEVENTS)
+           AllocateCppEvents(p);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   AllocateTreeParams: Allocate space for tree parameters
+|
+-----------------------------------------------------------------------*/
+int AllocateTreeParams (void)
+{
+    int         i, j, k, n, nOfParams, nOfTrees, isRooted, numSubParamPtrs;
+    Param       *p, *q;
+
+    /* Count the number of trees and dated trees */
+    /* based on branch length parameters */
+    /*  One tree is needed for each brlen parameter.
+        A topology may apply to several trees; a topology parameter
+        contains pointers to all trees it applies to */
+    numTrees = 0;
+    numTopologies = 0;
+    for (k=0; k<numParams; k++)
+        {
+        if (params[k].paramType == P_BRLENS)
+            numTrees++;
+        else if (params[k].paramType == P_TOPOLOGY)
+            numTopologies++;
+        }
+
+    /* We need to add the trees that do not have any branch lengths */
+    /* that is, the pure parsimony model trees, and the species trees */
+    for (k=0; k<numParams; k++)
+        {
+        if (params[k].paramType == P_TOPOLOGY)
+            {
+            if (!strcmp(modelParams[params[k].relParts[0]].parsModel, "Yes"))
+                numTrees++;
+            }
+        else if (params[k].paramType == P_SPECIESTREE)
+            {
+            numTopologies++;
+            numTrees++;
+            }
+        }
+
+    /* Finally add subparam pointers for relaxed clock parameters and species trees */
+    numSubParamPtrs = 0;
+    for (k=0; k<numParams; k++)
+        {
+        if (params[k].paramType == P_TOPOLOGY && params[k].paramId == TOPOLOGY_SPECIESTREE)
+            numSubParamPtrs += 1;
+        else if (params[k].paramType == P_BRLENS)
+            numSubParamPtrs += 1;
+        else if (params[k].paramType == P_CPPEVENTS)
+            numSubParamPtrs += 3;
+        else if (params[k].paramType == P_TK02BRANCHRATES)
+            numSubParamPtrs += 2;
+        else if (params[k].paramType == P_IGRBRANCHRATES)
+            numSubParamPtrs += 2;
+        else if (params[k].paramType == P_MIXEDBRCHRATES)
+            numSubParamPtrs += 2;
+        }
+        
+    /* Allocate space for trees and subparam pointers */
+    if (memAllocs[ALLOC_MCMCTREES] == YES)
+        {
+        free (subParamPtrs);
+        free (mcmcTree);
+        subParamPtrs = NULL;
+        mcmcTree = NULL;
+        memAllocs[ALLOC_MCMCTREES] = NO;
+        }
+    subParamPtrs = (Param **) SafeCalloc (numSubParamPtrs, sizeof (Param *));
+    mcmcTree = (Tree **) SafeCalloc (numTrees * 2 * numGlobalChains, sizeof (Tree *));
+    if (!subParamPtrs || !mcmcTree)
+        {
+        if (subParamPtrs) free (subParamPtrs);
+        if (mcmcTree) free (mcmcTree);
+        subParamPtrs = NULL;
+        mcmcTree = NULL;
+        MrBayesPrint ("%s   Problem allocating mcmc trees\n", spacer);
+        return (ERROR);
+        }
+    else
+        memAllocs[ALLOC_MCMCTREES] = YES;
+
+    /* Initialize number of subparams, just in case */
+    for (k=0; k<numParams; k++)
+        params[k].nSubParams = 0;
+    
+    /* Count number of trees (brlens) for each topology or species tree */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (params[k].paramType == P_BRLENS)
+            {
+            q = modelSettings[p->relParts[0]].topology;
+            q->nSubParams++;
+            if (p->printParam == YES)
+                q->nPrintSubParams++;
+            }
+        else if (params[k].paramType == P_TOPOLOGY)
+            {
+            q = modelSettings[p->relParts[0]].speciesTree;
+            if (q != NULL)
+                q->nSubParams++;
+            }
+        }
+
+    /* Make sure there is also one subparam for a parsimony tree */
+    for (k=0; k<numParams; k++)
+        if (params[k].paramType == P_TOPOLOGY)
+            {
+            p = &params[k];
+            if (p->nSubParams == 0)
+                p->nSubParams = 1;
+            }
+
+    /* Count subparams for relaxed clock parameters */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_CPPEVENTS)
+            {
+            q = modelSettings[p->relParts[0]].cppRate;
+            q->nSubParams++;
+            q = modelSettings[p->relParts[0]].cppMultDev;
+            q->nSubParams++;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->nSubParams++;
+            }
+        else if (p->paramType == P_TK02BRANCHRATES)
+            {
+            q = modelSettings[p->relParts[0]].tk02var;
+            q->nSubParams++;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->nSubParams++;
+            }
+        else if (p->paramType == P_IGRBRANCHRATES)
+            {
+            q = modelSettings[p->relParts[0]].igrvar;
+            q->nSubParams++;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->nSubParams++;
+            }
+        else if (p->paramType == P_MIXEDBRCHRATES)
+            {
+            q = modelSettings[p->relParts[0]].mixedvar;
+            q->nSubParams++;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->nSubParams++;
+            }
+        }
+
+    /* set pointers to subparams */
+    nOfParams = 0;
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->nSubParams > 0)
+            {
+            p->subParams = subParamPtrs + nOfParams;
+            nOfParams += p->nSubParams;
+            }
+        }
+    assert (nOfParams == numSubParamPtrs);
+
+    /* Set brlens param pointers and tree values */
+    /* the scheme below keeps trees for the same state and chain together */
+    nOfTrees = 0;
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if ((p->paramType == P_BRLENS) ||
+            (p->paramType == P_TOPOLOGY && p->paramId == TOPOLOGY_PARSIMONY_UNIFORM) ||
+            (p->paramType == P_TOPOLOGY && p->paramId == TOPOLOGY_PARSIMONY_CONSTRAINED) ||
+            (p->paramType == P_SPECIESTREE))
+            {
+            /* allocate space for trees and initialize trees */
+            p->treeIndex = nOfTrees;
+            p->tree = mcmcTree + nOfTrees;
+            nOfTrees++;
+            }
+        }
+
+    /* Set topology params and associated brlen subparams */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            if (p->paramId == TOPOLOGY_PARSIMONY_UNIFORM ||
+                p->paramId == TOPOLOGY_PARSIMONY_CONSTRAINED)
+                /* pure parsimony topology case */
+                {
+                /* there is no brlen subparam */
+                /* so let subparam point to the param itself */
+                q = p->subParams[0] = p;
+                /* p->tree and p->treeIndex have been set above */
+                }
+            else
+                {
+                /* first set brlens pointers for any parsimony partitions */
+                for (i=j=0; i<p->nRelParts; i++)
+                    {
+                    if (modelSettings[p->relParts[i]].parsModelId == YES)
+                        {
+                        modelSettings[p->relParts[i]].brlens = p;
+                        }
+                    }
+
+                /* now proceed with pointer assignment */
+                q = modelSettings[p->relParts[0]].brlens;
+                n = 0;  /* number of stored subParams */
+                i = 0;  /* relevant partition number  */
+                while (i < p->nRelParts)
+                    {
+                    for (j=0; j<n; j++)
+                        if (q == p->subParams[j])
+                            break;
+                    
+                    if (j == n && q != p)   /* a new tree (brlens) for this topology */
+                        {
+                        p->subParams[n++] = q;
+                        }
+                    q = modelSettings[p->relParts[++i]].brlens;
+                    }
+                
+                p->tree = p->subParams[0]->tree;
+                p->treeIndex = p->subParams[0]->treeIndex;
+                }
+            }
+        else if (p->paramType == P_SPECIESTREE)
+            {
+            /* now proceed with pointer assignment */
+            q = modelSettings[p->relParts[0]].topology;
+            n = 0;  /* number of stored subParams */
+            i = 0;  /* relevant partition number  */
+            while (i < p->nRelParts)
+                {
+                for (j=0; j<n; j++)
+                    if (q == p->subParams[j])
+                        break;
+
+                if (j == n && q != p)   /* a new topology for this species tree */
+                    {
+                    p->subParams[n++] = q;
+                    }
+                q = modelSettings[p->relParts[++i]].topology;
+                }
+            }
+        }
+
+    /* Check for constraints */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            if (!strcmp(modelParams[p->relParts[0]].topologyPr, "Constraints"))
+                {
+                for (i=0; i<p->nSubParams; i++)
+                    {
+                    q = p->subParams[i];
+                    q->checkConstraints = YES;
+                    }
+                }
+            else
+                {
+                for (i=0; i<p->nSubParams; i++)
+                    {
+                    q = p->subParams[i];
+                    q->checkConstraints = NO;
+                    }
+                }
+            }
+        }
+
+    /* update paramId */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            if (p->nSubParams > 1)
+                {
+                if (p->paramId == TOPOLOGY_NCL_UNIFORM_HOMO)
+                    p->paramId = TOPOLOGY_NCL_UNIFORM_HETERO;
+                else if (p->paramId == TOPOLOGY_NCL_CONSTRAINED_HOMO)
+                    p->paramId = TOPOLOGY_NCL_CONSTRAINED_HETERO;
+                else if (p->paramId == TOPOLOGY_NCL_FIXED_HOMO)
+                    p->paramId = TOPOLOGY_NCL_FIXED_HETERO;
+                else
+                    {
+                    MrBayesPrint ("%s   A clock tree cannot have more than one set of branch lengths\n", spacer);
+                    printf ("nparam:%d paramid:%d",p->nSubParams,p->paramId);
+                    return (ERROR);
+                    }
+                }
+            }
+        }
+
+    /* finally initialize trees */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_BRLENS)
+            {
+            /* find type of tree */
+            if (!strcmp(modelParams[p->relParts[0]].brlensPr,"Clock"))
+                isRooted = YES;
+            else
+                isRooted = NO;
+
+            if (InitializeChainTrees (p, 0, numGlobalChains, isRooted) == ERROR)
+                return (ERROR);
+            }
+        else if (p->paramType == P_SPECIESTREE)
+            {
+            if (InitializeChainTrees (p, 0, numGlobalChains, YES) == ERROR)
+                return (ERROR);
+            }
+        }
+
+    /* now initialize subparam pointers for relaxed clock models */
+    /* use nSubParams to point to the next available subParam by first
+       resetting all nSubParams to 0 */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_CPPRATE ||
+            p->paramType == P_CPPMULTDEV ||
+            p->paramType == P_BRLENS ||
+            p->paramType == P_TK02VAR ||
+            p->paramType == P_IGRVAR ||
+            p->paramType == P_MIXEDVAR)
+            p->nSubParams = 0;
+        }
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType == P_CPPEVENTS)
+            {
+            q = modelSettings[p->relParts[0]].cppRate;
+            q->subParams[q->nSubParams++] = p;
+            q = modelSettings[p->relParts[0]].cppMultDev;
+            q->subParams[q->nSubParams++] = p;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->subParams[q->nSubParams++] = p;
+            p->treeIndex = q->treeIndex;
+            p->tree = q->tree;
+            if (p->printParam == YES)
+                q->nPrintSubParams++;
+            }
+        else if (p->paramType == P_TK02BRANCHRATES)
+            {
+            q = modelSettings[p->relParts[0]].tk02var;
+            q->subParams[q->nSubParams++] = p;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->subParams[q->nSubParams++] = p;
+            p->treeIndex = q->treeIndex;
+            p->tree = q->tree;
+            if (p->printParam == YES)
+                q->nPrintSubParams++;
+            }
+        else if (p->paramType == P_IGRBRANCHRATES)
+            {
+            q = modelSettings[p->relParts[0]].igrvar;
+            q->subParams[q->nSubParams++] = p;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->subParams[q->nSubParams++] = p;
+            p->treeIndex = q->treeIndex;
+            p->tree = q->tree;
+            if (p->printParam == YES)
+                q->nPrintSubParams++;
+            }
+        else if (p->paramType == P_MIXEDBRCHRATES)
+            {
+            q = modelSettings[p->relParts[0]].mixedvar;
+            q->subParams[q->nSubParams++] = p;
+            q = modelSettings[p->relParts[0]].brlens;
+            q->subParams[q->nSubParams++] = p;
+            p->treeIndex = q->treeIndex;
+            p->tree = q->tree;
+            if (p->printParam == YES)
+                q->nPrintSubParams++;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int AreDoublesEqual (MrBFlt x, MrBFlt y, MrBFlt tol)
+{
+    if ((x - y) < -tol || (x - y) > tol)
+        return (NO);
+    else
+        return (YES);
+}
+
+
+int ChangeNumChains (int from, int to)
+{
+    int         i, i1, j, k, m, st, nRuns, fromIndex, toIndex, run, chn, *tempIntVals, nCppEventParams, *toEvents, *fromEvents;
+    MCMCMove    **tempMoves, *fromMove, *toMove;
+    Tree        **tempTrees;
+    MrBFlt      *tempVals, **toRateMult, **toPosition, **fromRateMult, **fromPosition, *stdStateFreqsOld;
+    Param       *p, *q, *cppEventParams = NULL;
+    Tree        **oldMcmcTree, *tree;
+
+    if (from == to)
+        return (NO_ERROR);
+
+    /* set new number of chains */
+    chainParams.numChains = to;
+    nRuns = chainParams.numRuns;
+    numGlobalChains = chainParams.numRuns * chainParams.numChains;
+
+    /* Do the normal parameters */  
+    /* first save old values */
+    tempVals = paramValues;
+    paramValues = NULL;
+    tempIntVals = intValues;
+    intValues = NULL;
+    memAllocs[ALLOC_PARAMS] = NO;
+    /* .. and old cpp events parameters */
+    nCppEventParams = 0;
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_CPPEVENTS)
+            nCppEventParams++;
+        }
+    cppEventParams = (Param *) SafeCalloc (nCppEventParams, sizeof(Param));
+    for (i=0; i<nCppEventParams; i++)
+        {
+        cppEventParams[i].paramType = P_CPPEVENTS;
+        AllocateCppEvents (&cppEventParams[i]);
+        }
+    for (i=j=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_CPPEVENTS)
+            {
+            cppEventParams[j].nEvents = p->nEvents;
+            p->nEvents = NULL;
+            cppEventParams[j].position = p->position;
+            p->position = NULL;
+            cppEventParams[j].rateMult = p->rateMult;
+            p->rateMult = NULL;
+            j++;
+            }
+        }
+    if (AllocateNormalParams () == ERROR)
+        return (ERROR);
+
+    /* then fill all params */
+    FillNormalParams (&globalSeed, 0, numGlobalChains);
+    
+    /* finally overwrite with old values if present */
+    for (run=0; run<nRuns; run++)
+        {
+        for (chn=0; chn<from; chn++)
+            {
+            if (chn < to)
+                {
+                fromIndex = (run*from + chn)*2*paramValsRowSize;
+                toIndex = (run*to + chn)*2*paramValsRowSize;
+                for (i=0; i<2*paramValsRowSize; i++)
+                    paramValues[toIndex++] = tempVals[fromIndex++];
+                fromIndex = (run*from + chn)*2*intValsRowSize;
+                toIndex = (run*to + chn)*2*intValsRowSize;
+                for (i=0; i<2*intValsRowSize; i++)
+                    intValues[toIndex++] = tempIntVals[fromIndex++];
+                for (i=i1=0; i<numParams; i++)
+                    {
+                    p = &params[i];
+                    if (p->paramType == P_CPPEVENTS)
+                        {
+                        fromIndex = 2*(run*from + chn);
+                        toIndex = 2*(run*to + chn);
+                        fromEvents = cppEventParams[i1].nEvents[fromIndex];
+                        toEvents = p->nEvents[toIndex];
+                        fromPosition = cppEventParams[i1].position[fromIndex];
+                        toPosition = p->position[toIndex];
+                        fromRateMult = cppEventParams[i1].rateMult[fromIndex];
+                        toRateMult = p->rateMult[toIndex];
+                        for (j=0; j<2*numLocalTaxa; j++)
+                            {
+                            toEvents[j] = fromEvents[j];
+                            toPosition[j] = (MrBFlt *) SafeRealloc ((void *)toPosition[j], toEvents[j]*sizeof(MrBFlt));
+                            toRateMult[j] = (MrBFlt *) SafeRealloc ((void *)toRateMult[j], toEvents[j]*sizeof(MrBFlt));
+                            for (k=0; k<toEvents[j]; k++)
+                                {
+                                toPosition[j][k] = fromPosition[j][k];
+                                toRateMult[j][k] = fromRateMult[j][k];
+                                }
+                            }
+                        i1++;
+                        }
+                    }
+                assert (nCppEventParams==i1);
+                }
+            }
+        }
+    
+    /* and free up space */
+    free (tempVals);
+    if (intValsRowSize > 0)
+        free (tempIntVals);
+    for (i=0; i<nCppEventParams; i++)
+        {
+        numGlobalChains = chainParams.numRuns * from; /* Revert to the old value to clean old Cpp events in FreeCppEvents() */
+        FreeCppEvents(&cppEventParams[i]);
+        numGlobalChains = chainParams.numRuns * chainParams.numChains; /*Set to proper value again*/
+        }
+    if (nCppEventParams > 0)
+        free (cppEventParams);
+
+    /* then do the trees (they cannot be done before the parameters because otherwise FillTreeParams will overwrite
+       relaxed clock parameters that need to be saved) */
+
+    /* reallocate trees */
+    tempTrees = (Tree **) SafeCalloc (2*nRuns*from*numTrees, sizeof(Tree *));
+    for (i=0; i<2*nRuns*from*numTrees; i++)
+        tempTrees[i] = mcmcTree[i];
+    oldMcmcTree = mcmcTree;
+    mcmcTree = (Tree **) SafeRealloc ((void *)(mcmcTree), 2 * (size_t)numGlobalChains * (size_t)numTrees * sizeof(Tree*));
+    for (i=0; i<2*nRuns*to*numTrees; i++)
+        mcmcTree[i] = NULL;
+
+    /* move the old trees over */
+    for (run=0; run<nRuns; run++)
+        {
+        for (chn=0; chn<from; chn++)
+            {
+            if (chn >= to)
+                continue;
+            /*Here we move only one tree per chain/state?! Should not we move numTrees??*/
+            fromIndex = 2*(run*from + chn)  * numTrees;
+            toIndex   = 2*(run*to   + chn)  * numTrees;
+            for (k=0;k<2*numTrees;k++)
+                {
+                mcmcTree[toIndex+k]    = tempTrees[fromIndex+k];
+                tempTrees[fromIndex+k] = NULL;
+                }
+            }
+        }
+
+    /* remove any remaining old trees */
+    for (i=0; i<2*nRuns*from*numTrees; i++)
+        if (tempTrees[i] != NULL)
+            FreeTree (tempTrees[i]);
+    free (tempTrees);
+
+    /* now fill in the tree parameters */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            p->tree += (mcmcTree - oldMcmcTree);    /* calculate new address */
+            for (j=0; j<p->nSubParams; j++)
+                {
+                q = p->subParams[j];
+                assert (q->paramType==P_BRLENS);
+                q->tree += (mcmcTree - oldMcmcTree);    /* calculate new address */
+                if (to > from)
+                    for (run=0; run<nRuns; run++)
+                        {
+                        /*rename old trees because each run has more chains*/
+                        for (m=0; m<from; m++)
+                            {
+                            for (st=0; st<2; st++)
+                                {
+                                tree = GetTree (q,run*to + m, st);
+                                if (numTrees > 1)
+                                    sprintf (tree->name, "mcmc.tree%d_%d", p->treeIndex+1, run*to + m +1);
+                                else /* if (numTrees == 1) */
+                                    sprintf (tree->name, "mcmc.tree_%d", run*to + m +1);
+                                }
+                            }
+                        InitializeChainTrees (q, run*to + from, run*to + to , GetTree (q, 0, 0)->isRooted);
+                        }
+                }
+            }
+        else if (p->paramType == P_CPPEVENTS || p->paramType == P_TK02BRANCHRATES || p->paramType == P_IGRBRANCHRATES || p->paramType == P_MIXEDBRCHRATES)
+            p->tree += (mcmcTree - oldMcmcTree);
+        else
+            assert (p->paramType==P_BRLENS || p->tree==NULL);
+        }
+
+    
+    /* fill new tree parameters */
+    if (to > from)
+        {
+        for (run=0; run<nRuns; run++)
+            {
+            for (chn=from; chn<to; chn++)
+                {
+                toIndex = run*to + chn;
+                FillTreeParams (&globalSeed, toIndex, toIndex+1);
+                }
+            }
+        }
+
+    /* fix stationary frequencies for standard data */
+    if   (stdStateFreqsRowSize > 0)
+        {
+        assert (memAllocs[ALLOC_STDSTATEFREQS] == YES);
+        stdStateFreqsOld=stdStateFreqs;
+        stdStateFreqs = (MrBFlt *) SafeMalloc (2 * (size_t)stdStateFreqsRowSize * (size_t)numGlobalChains * sizeof (MrBFlt));
+        if (!stdStateFreqs)
+            {
+            MrBayesPrint ("%s   Problem reallocating stdStateFreqs\n", spacer);
+            return (ERROR);
+            }
+
+        /* set pointers */
+        for (k=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->paramType != P_PI || modelParams[p->relParts[0]].dataType != STANDARD)
+                continue;
+            p->stdStateFreqs += stdStateFreqs-stdStateFreqsOld;
+            }
+        
+        for (run=0; run<nRuns; run++)
+            {
+            /* copy old chains values*/
+            for (chn=0; chn<from; chn++)
+                {
+                if (chn >= to)
+                    break;
+
+                fromIndex = 2*(run*from + chn)*stdStateFreqsRowSize;
+                toIndex = 2*(run*to + chn)*stdStateFreqsRowSize;
+                for (k=0;k<2*stdStateFreqsRowSize;k++)
+                    {
+                    stdStateFreqs[toIndex+k]=stdStateFreqsOld[fromIndex+k];
+                    }
+                }
+            /* set new chains */
+            FillStdStateFreqs (run*to+from, run*to+to, &globalSeed);
+            }
+        free(stdStateFreqsOld);
+    }
+
+    /* Do the moves */
+    /* first allocate space and set up default moves */
+    tempMoves = moves;
+    moves = NULL;
+    memAllocs[ALLOC_MOVES] = NO;
+    SetMoves ();
+    
+    /* then overwrite with old values if present */
+    for (i=0; i<numApplicableMoves; i++)
+        {
+        toMove = moves[i];
+        fromMove = tempMoves[i];
+        for (run=0; run<nRuns; run++)
+            {
+            for (chn=0; chn<from; chn++)
+                {
+                if (chn < to)
+                    {
+                    fromIndex = run*from + chn;
+                    toIndex = run*to + chn;
+                    toMove->relProposalProb[toIndex] = fromMove->relProposalProb[fromIndex];
+                    for (j=0; j<toMove->moveType->numTuningParams; j++)
+                        {
+                        toMove->tuningParam[toIndex][j] = fromMove->tuningParam[fromIndex][j];
+                        }
+                    }
+                }
+            }
+        }
+    
+    /* and free up space */
+    for (i=0; i<numApplicableMoves; i++)
+        FreeMove (tempMoves[i]);
+    free (tempMoves);
+    
+    return (NO_ERROR);
+}
+
+
+int ChangeNumRuns (int from, int to)
+{
+    int         i, i1, j, k, n, nChains;
+    Param       *p, *q;
+    MoveType    *mvt;
+    Tree        **oldMcmcTree;
+    MrBFlt      *oldParamValues;
+    MrBFlt      *stdStateFreqsOld;
+    int         *oldintValues;
+
+    if (from == to)
+        return (NO_ERROR);
+
+#if 0
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_CPPEVENTS)
+            {
+            printf ("Trees before changing number of runs\n");
+            for (j=0; j<numGlobalChains; j++)
+                {
+                printf ("Event tree for chain %d\n", j+1);
+                for (k=0; k<2*numLocalTaxa; k++)
+                    {
+                    printf ("%d -- %d:", k, p->nEvents[2*j][k]);
+                    for (i1=0; i1<p->nEvents[2*j][k]; i1++)
+                        {
+                        if (i1 == 0)
+                            printf (" (%lf %lf,", p->position[2*j][k], p->rateMult[2*j][k]);
+                        else if (i1 == p->nEvents[2*j][k]-1)
+                            printf (" %lf %lf)", p->position[2*j][k], p->rateMult[2*j][k]);
+                        else
+                            printf (" %lf %lf,", p->position[2*j][k], p->rateMult[2*j][k]);
+                        }
+                    printf ("\n");
+                    }
+                for (k=0; k<2*numLocalTaxa; k++)
+                    {
+                    printf ("%d -- %d:", k, p->nEvents[2*j][k]);
+                    for (i1=0; i1<p->nEvents[2*j+1][k]; i1++)
+                        {
+                        if (i1 == 0)
+                            printf (" (%lf %lf,", p->position[2*j+1][k], p->rateMult[2*j+1][k]);
+                        else if (i1 == p->nEvents[2*j][k]-1)
+                            printf (" %lf %lf)", p->position[2*j+1][k], p->rateMult[2*j+1][k]);
+                        else
+                            printf (" %lf %lf,", p->position[2*j+1][k], p->rateMult[2*j+1][k]);
+                        }
+                    printf ("\n");
+                    }
+                }
+            }
+        }
+#endif
+
+    /* set new number of runs */
+    chainParams.numRuns = to;
+    nChains = chainParams.numChains;
+    numGlobalChains = chainParams.numRuns * chainParams.numChains;
+
+    /* do the trees, free tree's memory if we reduce number of trees. */
+    for (i=to*2*nChains*numTrees; i<from*2*nChains*numTrees; i++)
+        {
+        FreeTree (mcmcTree[i]);
+        }
+    oldMcmcTree = mcmcTree;
+    mcmcTree = (Tree **) SafeRealloc ((void *) mcmcTree, numTrees * 2 * numGlobalChains * sizeof (Tree *));
+    if (mcmcTree == NULL)
+        {
+        memAllocs[ALLOC_MCMCTREES] = NO;
+        MrBayesPrint ("%s   Problem reallocating mcmcTree\n", spacer);
+        return (ERROR);
+        }
+
+    for (i=from*2*nChains*numTrees; i<to*2*nChains*numTrees; i++)
+        {
+        mcmcTree[i]=NULL;
+        }  
+    /* then the cppevents parameters */
+    for (i1=0; i1<numParams; i1++)
+        {
+        p = &params[i1];
+        if (p->paramType == P_CPPEVENTS)
+            {
+            p->nEvents = (int **) SafeRealloc ((void *)p->nEvents, 2*numGlobalChains*sizeof (int *));
+            p->nEvents[0] = (int *) SafeRealloc ((void *)p->nEvents[0], 2*numGlobalChains*(2*numLocalTaxa)*sizeof (int));
+            for (i=1; i<2*numGlobalChains; i++)
+                p->nEvents[i] = p->nEvents[i-1] + (2*numLocalTaxa);
+            if (from > to)
+                {
+                for (j=numGlobalChains; j<from*nChains; j++)
+                    {
+                    for (k=0; k<2*numLocalTaxa; k++)
+                        {
+                        free (p->position[2*j+0][k]);
+                        p->position[2*j+0][k] = NULL;
+                        free (p->rateMult[2*j+0][k]);
+                        p->rateMult[2*j+0][k] = NULL;
+                        }
+                    }
+                }
+            p->position = (MrBFlt ***) SafeRealloc ((void *)p->position, 2*numGlobalChains*sizeof (MrBFlt **));
+            p->position[0] = (MrBFlt **) SafeRealloc ((void *)p->position[0], 2*numGlobalChains*(2*numLocalTaxa)*sizeof (MrBFlt *));
+            for (i=1; i<2*numGlobalChains; i++)
+                p->position[i] = p->position[i-1] + (2*numLocalTaxa);
+            p->rateMult = (MrBFlt ***) SafeRealloc ((void *)p->rateMult, 2*numGlobalChains*sizeof (MrBFlt **));
+            p->rateMult[0] = (MrBFlt **) SafeRealloc ((void *)p->rateMult[0], 2*numGlobalChains*(2*numLocalTaxa)*sizeof (MrBFlt *));
+            for (i=1; i<2*numGlobalChains; i++)
+                p->rateMult[i] = p->rateMult[i-1] + (2*numLocalTaxa);
+            if (to > from)
+                {
+                for (j=from*nChains; j<numGlobalChains; j++)
+                    {
+                    for (k=0; k<2*numLocalTaxa; k++)
+                        {
+                        p->nEvents[2*j+0][k] = 0;
+                        p->position[2*j+0][k] = NULL;
+                        p->rateMult[2*j+0][k] = NULL;
+                        p->nEvents[2*j+1][k] = 0;
+                        p->position[2*j+1][k] = NULL;
+                        p->rateMult[2*j+1][k] = NULL;
+                        }
+                    }
+                }
+            }
+        }
+    /* and finally the normal parameters */
+    oldParamValues = paramValues;
+    paramValues = (MrBFlt *) SafeRealloc ((void *) paramValues, paramValsRowSize * 2 * numGlobalChains * sizeof (MrBFlt));
+    oldintValues = intValues;
+    intValues = (int *) SafeRealloc ((void *) intValues, intValsRowSize * 2 * numGlobalChains * sizeof (int));
+    if (paramValues == NULL)
+        {
+        memAllocs[ALLOC_PARAMVALUES] = NO;
+        MrBayesPrint ("%s   Problem reallocating paramValues\n", spacer);
+        return (ERROR);
+        }
+    for (i=0; i<numParams; i++)
+        {
+        params[i].values += (paramValues - oldParamValues);
+        params[i].subValues += (paramValues - oldParamValues);
+        params[i].intValues += (intValues - oldintValues);
+        }
+
+    /* fill new chains paramiters with appropriate values */
+    if (to > from)
+        FillNormalParams (&globalSeed, from*nChains, to*nChains);
+
+    /* now fill in the tree parameters */
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_TOPOLOGY)
+            {
+            p->tree += (mcmcTree - oldMcmcTree);    /* calculate new address */
+            for (j=0; j<p->nSubParams; j++)
+                {
+                q = p->subParams[j];
+                assert (q->paramType==P_BRLENS);
+                q->tree += (mcmcTree - oldMcmcTree);    /* calculate new address */
+                InitializeChainTrees (q, from*nChains, to*nChains, GetTree (q, 0, 0)->isRooted);
+                }
+            }
+        else if (p->paramType == P_CPPEVENTS || p->paramType == P_TK02BRANCHRATES || p->paramType == P_IGRBRANCHRATES || p->paramType == P_MIXEDBRCHRATES)
+            p->tree += (mcmcTree - oldMcmcTree);
+        }
+
+    FillTreeParams (&globalSeed, from*nChains, to*nChains);
+
+    /* fix stationary frequencies for standard data */
+    if (stdStateFreqsRowSize > 0)
+        {
+        assert (memAllocs[ALLOC_STDSTATEFREQS] == YES);
+        stdStateFreqsOld=stdStateFreqs;
+        stdStateFreqs = (MrBFlt *) SafeRealloc ((void *) stdStateFreqs, stdStateFreqsRowSize * 2 * numGlobalChains * sizeof (MrBFlt));
+        if (!stdStateFreqs)
+            {
+            MrBayesPrint ("%s   Problem reallocating stdStateFreqs\n", spacer);
+            return (ERROR);
+            }
+        
+        /* set pointers */
+        for (k=n=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->paramType != P_PI || modelParams[p->relParts[0]].dataType != STANDARD)
+                continue;
+            p->stdStateFreqs += stdStateFreqs-stdStateFreqsOld;
+            }
+        
+        FillStdStateFreqs (from*nChains, to*nChains, &globalSeed);
+        }
+
+    /* do the moves */
+    for (i=0; i<numApplicableMoves; i++)
+        {
+        mvt = moves[i]->moveType;
+        moves[i]->tuningParam = (MrBFlt **) SafeRealloc ((void *) moves[i]->tuningParam, (size_t)numGlobalChains * sizeof (MrBFlt *));
+        moves[i]->tuningParam[0] = (MrBFlt *) SafeRealloc ((void *) moves[i]->tuningParam[0], (size_t)numGlobalChains * (size_t)(mvt->numTuningParams) * sizeof (MrBFlt));
+        for (j=1; j<numGlobalChains; j++)
+            moves[i]->tuningParam[j] = moves[i]->tuningParam[0] + j * mvt->numTuningParams;
+        moves[i]->relProposalProb = (MrBFlt *) SafeRealloc ((void *) moves[i]->relProposalProb, 4 * (size_t)numGlobalChains * sizeof (MrBFlt));
+        moves[i]->cumProposalProb = moves[i]->relProposalProb + numGlobalChains;
+        moves[i]->targetRate = moves[i]->relProposalProb + 2*numGlobalChains;
+        moves[i]->lastAcceptanceRate = moves[i]->relProposalProb + 3*numGlobalChains;
+        moves[i]->nAccepted = (int *) SafeRealloc ((void *) moves[i]->nAccepted, 5* (size_t)numGlobalChains * sizeof (int));
+        moves[i]->nTried = moves[i]->nAccepted + numGlobalChains;
+        moves[i]->nBatches = moves[i]->nAccepted + 2*numGlobalChains;
+        moves[i]->nTotAccepted = moves[i]->nAccepted + 3*numGlobalChains;
+        moves[i]->nTotTried    = moves[i]->nAccepted + 4*numGlobalChains;
+        /* initialize all values to default */
+        for (j=0; j<numGlobalChains; j++)
+            {
+            moves[i]->nAccepted[j] = 0;
+            moves[i]->nTried[j] = 0;
+            moves[i]->nBatches[j] = 0;
+            moves[i]->nTotAccepted[j] = 0;
+            moves[i]->nTotTried[j] = 0;
+            moves[i]->relProposalProb[j] = mvt->relProposalProb;
+            moves[i]->cumProposalProb[j] = 0.0;
+            moves[i]->lastAcceptanceRate[j] = 0.0;
+            for (k=0; k<mvt->numTuningParams; k++)
+                moves[i]->tuningParam[j][k] = mvt->tuningParam[k];
+            moves[i]->targetRate[j] = mvt->targetRate;
+            }
+        }
+
+#if 0
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        if (p->paramType == P_CPPEVENTS)
+            {
+            printf ("Trees after changing number of runs\n");
+            for (j=0; j<numGlobalChains; j++)
+                {
+                printf ("Event tree for chain %d\n", j+1);
+                for (k=0; k<2*numLocalTaxa; k++)
+                    {
+                    printf ("%d -- %d:", k, p->nEvents[2*j][k]);
+                    assert (p->nEvents[2*j] >= 0);
+                    for (i1=0; i1<p->nEvents[2*j][k]; i1++)
+                        {
+                        if (i1 == 0)
+                            printf (" (%lf %lf,", p->position[2*j][k], p->rateMult[2*j][k]);
+                        else if (i1 == p->nEvents[2*j][k]-1)
+                            printf (" %lf %lf)", p->position[2*j][k], p->rateMult[2*j][k]);
+                        else
+                            printf (" %lf %lf,", p->position[2*j][k], p->rateMult[2*j][k]);
+                        }
+                    printf ("\n");
+                    }
+                for (k=0; k<2*numLocalTaxa; k++)
+                    {
+                    printf ("%d -- %d:", k, p->nEvents[2*j+1][k]);
+                    assert (p->nEvents[2*j+1] >= 0);
+                    for (i1=0; i1<p->nEvents[2*j+1][k]; i1++)
+                        {
+                        if (i1 == 0)
+                            printf (" (%lf %lf,", p->position[2*j+1][k], p->rateMult[2*j+1][k]);
+                        else if (i1 == p->nEvents[2*j][k]-1)
+                            printf (" %lf %lf)", p->position[2*j+1][k], p->rateMult[2*j+1][k]);
+                        else
+                            printf (" %lf %lf,", p->position[2*j+1][k], p->rateMult[2*j+1][k]);
+                        }
+                    printf ("\n");
+                    }
+                }
+            }
+        }
+#endif
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------
+|
+|   CheckCharCodingType: check if character is parsimony-
+|       informative, variable, or constant
+|
+-----------------------------------------------------------*/
+void CheckCharCodingType (Matrix *m, CharInfo *ci)
+{
+    int         i, j, k, x, n1[10], n2[10], largest, smallest, numPartAmbig,
+                numConsidered, numInformative, lastInformative=0, uniqueBits,
+                newPoss, oldPoss;
+    BitsLong    combinations[2048], *tempComb, *newComb, *oldComb, bitsLongOne=1;
+
+    /* set up comb pointers */
+    oldComb = combinations;
+    newComb = oldComb + 1024;
+
+    /* set counters to 0 */
+    numPartAmbig = numConsidered = 0;
+
+    /* set variable and informative to yes */
+    ci->variable = ci->informative = YES;
+
+    /* set constant to no and state counters to 0 for all states */
+    for (i=0; i<10; i++)
+        {
+        ci->constant[i] = ci->singleton[i] = NO;
+        n1[i] = n2[i] = 0;
+        }
+
+    for (i=0; i<m->nRows; i++)
+        {
+        /* retrieve character */
+        x = (int) m->origin[m->column + i*m->rowSize];
+
+        /* add it to counters if not all ambiguous */
+        if (NBits(x) < ci->nStates)
+            {
+            numConsidered++;
+            if (NBits(x) > 1)
+                numPartAmbig++;
+            for (j=0; j<10; j++)
+                {
+                if (((bitsLongOne<<j) & x) != 0)
+                    {   
+                    n1[j]++;
+                    if (NBits(x) == 1)
+                        n2[j]++;
+                    }
+                }
+            }
+        }
+
+    /* if the ambig counter for any state is equal to the number of considered
+       states, then set constant for that state and set variable and informative to no */
+    for (i=0; i<10; i++)
+        {
+        if (n1[i] == numConsidered)
+            {
+            ci->constant[i] = YES;
+            ci->variable = ci->informative = NO;
+            }
+            else if (n1[i] == 1)
+            {
+            ci->singleton[i] = YES;
+            }
+        }
+
+    /* return if variable is no */
+    if (ci->variable == NO)
+        return;
+
+    /* the character is either (variable and uninformative) or informative */
+    
+    /* first consider unambiguous characters */
+    /* find smallest and largest unambiguous state for this character */
+    smallest = 9;
+    largest = 0;
+    for (i=0; i<10; i++)
+        {
+        if (n2[i] > 0)
+            {
+            if (i < smallest)
+                smallest = i;
+            if (i > largest)
+                largest = i;
+            }
+        }
+        
+    /* count the number of informative states in the unambiguous codings */
+    for (i=numInformative=0; i<10; i++)
+        {
+        if (ci->cType == ORD && n2[i] > 0 && i != smallest && i != largest)
+            {   
+            numInformative++;
+            lastInformative = i;
+            }
+        else if (n2[i] > 1)
+            {
+            numInformative++;
+            lastInformative = i;
+            }
+        }
+
+    /* set informative */
+    if (numInformative > 1)
+        ci->informative = YES;
+    else
+        ci->informative = NO;
+
+    
+    /* we can return now unless informative is no and numPartAmbig is not 0 */
+    if (!(numPartAmbig > 0 && ci->informative == NO))
+        return;
+
+    /* check if partially ambiguous observations make this character informative
+       after all */
+    
+    /* first set the bits for the taken states */
+    x = 0;
+    for (i=0; i<10; i++)
+        {
+        if (n2[i] > 0 && i != lastInformative)
+            x |= (bitsLongOne<<i);
+        }
+    oldPoss = 1;
+    oldComb[0] = x;
+
+    /* now go through all partambig chars and see if we can add them without
+       making the character informative */
+    for (i=0; i<m->nRows; i++)
+        {
+        x = (int) m->origin[m->column + i*m->rowSize];
+        /* if partambig */ 
+        if (NBits(x) > 1 && NBits(x) < ci->nStates)
+            {
+            /* remove lastInformative */
+            x &= !(bitsLongOne<<lastInformative);
+            /* reset newPoss */
+            newPoss = 0;
+            /* see if we can add it, store all possible combinations */
+            for (j=0; j<oldPoss; j++)
+                {
+                uniqueBits = x & (!oldComb[j]);
+                for (k=0; k<10; k++)
+                    {
+                    if (((bitsLongOne<<k) & uniqueBits) != 0)
+                        newComb[newPoss++] = oldComb[j] | (bitsLongOne<<k);
+                    }
+                }
+            /* break out if we could not add it */
+            if (newPoss == 0)
+                break;
+            
+            /* prepare for next partAmbig */
+            oldPoss = newPoss;
+            tempComb = oldComb;
+            oldComb = newComb;
+            newComb = tempComb;
+            }
+        }
+
+    if (i < m->nRows)
+        ci->informative = YES;
+
+    return;
+}
+
+
+/*-----------------------------------------------------------
+|
+|   CheckModel: check model and warn user if strange things
+|      are discovered.
+|
+-------------------------------------------------------------*/
+int CheckModel (void)
+{
+    int         i, j, k, answer;
+    Tree        *t = NULL;
+    TreeNode    *p;
+    
+    /* there should only be one calibrated tree */
+    for (i=0; i<numTrees; i++)
+        {
+        t = GetTreeFromIndex(i,0,0);
+        if (t->isCalibrated == YES)
+            break;
+        }
+    
+    if (i < numTrees)
+        {
+        if (!strcmp(modelParams[t->relParts[0]].clockRatePr, "Fixed") && AreDoublesEqual(modelParams[t->relParts[0]].clockRateFix, 1.0, 1E-6) == YES)
+            {
+            MrBayesPrint("%s   WARNING: You have calibrated the tree but the clock rate is fixed to 1.0.\n", spacer);
+            MrBayesPrint("%s      This means that time is measured in expected changes per time unit. If\n", spacer);
+            MrBayesPrint("%s      the calibrations use a different time scale, you need to modify the model\n", spacer);
+            MrBayesPrint("%s      by introducing a prior for the clock rate ('prset clockratepr').\n", spacer);
+
+            if (noWarn == NO)
+                {
+                answer = WantTo("Do you want to continue with the run regardless");
+                if (answer == YES)
+                    {
+                    MrBayesPrint("%s   Continuing with the run...\n\n", spacer);
+                    }
+                else
+                    {
+                    MrBayesPrint("%s   Stopping the run...\n\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            }
+        }
+
+    /* check coalescence model */
+    for (i=0; i<numTrees; i++)
+        {
+        t = GetTreeFromIndex(i, 0, 0);
+        if ((!strcmp(modelParams[t->relParts[0]].clockPr,"Coalescence") || !strcmp(modelParams[t->relParts[0]].clockPr,"Speciestreecoalescence"))
+            && !strcmp(modelParams[t->relParts[0]].clockRatePr, "Fixed") && AreDoublesEqual(modelParams[t->relParts[0]].clockRateFix, 1.0, 1E-6) == YES)
+            {
+            MrBayesPrint("%s   WARNING: You are using a coalescent model but the clock rate is fixed to 1.0.\n", spacer);
+            MrBayesPrint("%s      This is likely to be incorrect unless you have set the population size prior\n", spacer);
+            MrBayesPrint("%s      ('prset popsizepr') to reflect an appropriate prior on theta. \n", spacer);
+
+            if (noWarn == NO)
+                {
+                answer = WantTo("Do you want to continue with the run regardless");
+                if (answer == YES)
+                    {
+                    MrBayesPrint("%s   Continuing with the run...\n\n", spacer);
+                    }
+                else
+                    {
+                    MrBayesPrint("%s   Stopping the run...\n\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            }
+        }
+
+    /* Check consistency of best model. First we guarantee that if one topology has
+       a species tree prior, then all topologies have the same prior. Then we make
+       sure that all clock trees have a coalescence prior. */
+
+    j = 0;
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        if (!strcmp(modelParams[i].topologyPr, "Speciestree"))
+            j++;
+        }
+
+    if (j > 0)
+        {
+        if (j != numCurrentDivisions)
+            {
+            MrBayesPrint("%s   ERROR: If one gene tree has a speciestree prior then all\n", spacer);
+            MrBayesPrint("%s          gene trees must have the same prior.\n", spacer);
+            return (ERROR);
+            }
+        for (i=0; i<numTrees-1; i++)
+            {
+            t = GetTreeFromIndex(i,0,0);
+            if (strcmp(modelParams[t->relParts[0]].clockPr,"Speciestreecoalescence") != 0)
+                {
+                MrBayesPrint("%s   ERROR: All gene trees must have a speciestreecoalescence prior\n", spacer);
+                MrBayesPrint("%s          if they fold into a species tree.\n", spacer);
+                return (ERROR);
+                }
+            if (t->isCalibrated == YES)
+                {
+                for (k=0; k<t->nNodes-1; k++)
+                    {
+                    p = t->allDownPass[k];
+                    if (p->calibration != NULL)
+                        {
+                        MrBayesPrint("%s   ERROR: Gene trees cannot be individually calibrated\n", spacer);
+                        MrBayesPrint("%s          if they fold into a species tree.\n", spacer);
+                        return (ERROR);
+                        }
+                    }
+                }
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------
+|
+|   CheckExpandedModels: check data partitions that have
+|   the codon or doublet model specified
+|
+-------------------------------------------------------------*/
+int CheckExpandedModels (void)
+{
+    int             c, d, i, t, s, s1, s2, s3, whichNuc, uniqueId, numCharsInPart, 
+                    firstChar, lastChar, contiguousPart, badBreak, badExclusion,
+                    nGone, nuc1, nuc2, nuc3, foundStopCodon, posNucs1[4], posNucs2[4], posNucs3[4],
+                    oneGoodCodon, foundUnpaired, nPair, allCheckedOut;
+    char            *tempStr;
+    int             tempStrSize=100;
+    ModelParams     *mp;
+    
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    /* first, set charId to 0 for all characters */
+    for (i=0; i<numChar; i++)
+        charInfo[i].charId = 0;
+    
+    /* loop over partitions */
+    allCheckedOut = 0;
+    uniqueId = 1;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        mp = &modelParams[d];
+        
+        if (mp->dataType == DNA || mp->dataType == RNA)
+            {
+            if (!strcmp(mp->nucModel,"Codon") || !strcmp(mp->nucModel,"Protein"))
+                {
+                /* start check that the codon model is appropriate for this partition */
+                
+                /* find first character in this partition */
+                for (c=0; c<numChar; c++)
+                    {
+                    if (partitionId[c][partitionNum] == d+1)
+                        break;
+                    }
+                firstChar = c;
+                /*printf ("   first character = %d\n", firstChar);*/
+                
+                /* find last character in this partition */
+                for (c=numChar-1; c>=0; c--)
+                    {
+                    if (partitionId[c][partitionNum] == d+1)
+                        break;
+                    }
+                lastChar = c;
+                /*printf ("   last character = %d\n", lastChar);*/
+                
+                /* check that the number of characters in partition is divisible by 3 */
+                numCharsInPart = 0;
+                for (c=firstChar; c<=lastChar; c++)
+                    {
+                    if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != d+1)
+                        continue;
+                    numCharsInPart++;
+                    }
+                /*printf ("   numCharsInPart = %d\n", numCharsInPart);*/
+                if (numCharsInPart % 3 != 0)
+                    {
+                    if (numCurrentDivisions == 1)
+                        {
+                        MrBayesPrint ("%s   The number of characters is not divisible by three.\n", spacer);
+                        MrBayesPrint ("%s   You specified a %s model which requires triplets\n", spacer, mp->nucModel);
+                        MrBayesPrint ("%s   However, you have %d characters.\n", spacer, numCharsInPart);
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   The number of characters in partition %d is not\n", spacer, d+1);
+                        MrBayesPrint ("%s   divisible by three. You specified a %s model\n", spacer, mp->nucModel);
+                        MrBayesPrint ("%s   which requires triplets. \n", spacer);
+                        MrBayesPrint ("%s   However, you have %d characters in this partition\n", spacer, numCharsInPart);
+                        }
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                
+                /* check that all of the characters in the partition are contiguous */
+                contiguousPart = YES;
+                for (c=firstChar; c<=lastChar; c++)
+                    {
+                    if (charInfo[c].isExcluded == NO && partitionId[c][partitionNum] != d+1)
+                        contiguousPart = NO;
+                    }
+                if (contiguousPart == NO)
+                    {
+                    MrBayesPrint ("%s   Partition %d is not contiguous. You specified that\n", spacer, d+1);
+                    MrBayesPrint ("%s   a %s model be used for this partition. However, there\n", spacer, mp->nucModel);
+                    MrBayesPrint ("%s   is another partition that is between some of the characters\n", spacer);
+                    MrBayesPrint ("%s   in this partition. \n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                    
+                /* check that there is not a break inside a triplet of characters */
+                badBreak = NO;
+                whichNuc = 0;
+                for (c=firstChar; c<=lastChar; c++)
+                    {
+                    if (charInfo[c].isExcluded == NO)
+                        continue;
+                    whichNuc++;
+                    if (charInfo[c].bigBreakAfter == YES && whichNuc != 3)
+                        badBreak = YES;
+                    if (whichNuc == 3)
+                        whichNuc = 0;
+                    }
+                if (badBreak == YES)
+                    {
+                    MrBayesPrint ("%s   You specified a databreak inside of a coding triplet.\n", spacer);
+                    MrBayesPrint ("%s   This is a problem, as you imply that part of the codon\n", spacer);
+                    MrBayesPrint ("%s   lies in one gene and the remainder in another gene. \n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+
+                /* make certain excluded characters are in triplets but allow frameshift exclusions first in sequence */
+                badExclusion = NO;
+                whichNuc = nGone = 0;
+                for (c=firstChar; c<=lastChar; c++)
+                    if (charInfo[c].isExcluded == NO)
+                        break;
+                for (; c<=lastChar; c++)
+                    {
+                    whichNuc++;
+                    if (charInfo[c].isExcluded == YES)
+                        nGone++;
+                    if (whichNuc == 3)
+                        {
+                        if (nGone == 1 || nGone == 2)
+                            badExclusion = YES;
+                        whichNuc = nGone = 0;
+                        }
+                    }
+                if (badExclusion == YES)
+                    {
+                    MrBayesPrint ("%s   In excluding characters, you failed to remove all of the\n", spacer);
+                    MrBayesPrint ("%s   sites of at least one codon. If you exclude sites, make \n", spacer);
+                    MrBayesPrint ("%s   certain to exclude all of the sites in the codon(s). \n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                
+                /* check that there are no stop codons */
+                foundStopCodon = NO;
+                /* allow frameshifting exclusions in the beginning */
+                for (c=firstChar; c<=lastChar; c++)
+                    if (charInfo[c].isExcluded == NO)
+                        break;
+                for (; c<=lastChar; c+=3)
+                    {
+                    if (charInfo[c].isExcluded == NO)
+                        {
+                        for (t=0; t<numTaxa; t++)
+                            {
+                            if (taxaInfo[t].isDeleted == YES)
+                                continue;
+                            nuc1 = matrix[pos(t,c+0,numChar)];
+                            nuc2 = matrix[pos(t,c+1,numChar)];
+                            nuc3 = matrix[pos(t,c+2,numChar)];
+                            /*nucX is in range 0-15 to represent any possible set of states that nucleatide could be in*/
+                            GetPossibleNucs (nuc1, posNucs1);
+                            GetPossibleNucs (nuc2, posNucs2);
+                            GetPossibleNucs (nuc3, posNucs3);
+                            
+                            oneGoodCodon = NO;
+                            s = 0;
+                            for (s1=0; s1<4; s1++)
+                                {
+                                for (s2=0; s2<4; s2++)
+                                    {
+                                    for (s3=0; s3<4; s3++)
+                                        {
+                                        if (posNucs1[s1] == 1 && posNucs2[s2] == 1 && posNucs3[s3] == 1)
+                                            {
+                                            if (mp->codon[s1*16 + s2*4 + s3] != 21)
+                                                oneGoodCodon = YES;
+                                            }
+                                        s++;
+                                        }
+                                    }
+                                }
+                            if (oneGoodCodon == NO)
+                                {
+                                foundStopCodon = YES;
+                                MrBayesPrint ("%s   Stop codon: taxon %s, sites %d to %d (%c%c%c, %s code)\n", spacer, 
+                                    taxaNames[t], c+1, c+3, WhichNuc (nuc1), WhichNuc (nuc2), WhichNuc (nuc3), mp->geneticCode);
+                                }
+                            }
+                        }
+                    }               
+                if (foundStopCodon == YES)
+                    {
+                    MrBayesPrint ("%s   At least one stop codon was found. Stop codons are not\n", spacer);
+                    MrBayesPrint ("%s   allowed under the codon models.  \n", spacer);
+                    free (tempStr);
+                    return (ERROR);
+                    }
+                
+                /* everything checks out. Now we can initialize charId */
+                whichNuc = 0;
+                for (c=firstChar; c<=lastChar; c++)
+                    {
+                    whichNuc++;
+                    charInfo[c].charId = uniqueId;
+                    if (whichNuc == 3)
+                        {
+                        whichNuc = 0;
+                        uniqueId++;
+                        }
+                    }
+                
+                allCheckedOut++;
+                /* end check that the codon model is appropriate for this partition */
+                }
+            else if (!strcmp(mp->nucModel,"Doublet"))
+                {
+                /* start check that the doublet model is appropriate for this partition */
+                
+                /* Check that pairsId does not equal 0 for any of the characters in
+                   the partition. If it does, then this means that at least one 
+                   site was not appropriately paired. Remember, that pairsId is
+                   initialized 1, 2, 3, ... for the first pair, second pair, etc. 
+                   Also, check that every pair is only represented two times. */
+                foundUnpaired = NO;
+                for (c=0; c<numChar; c++)
+                    {
+                    if (partitionId[c][partitionNum] == d+1 && charInfo[c].pairsId == 0 && charInfo[c].isExcluded == NO)
+                        foundUnpaired = YES;
+                    }
+                    
+                for (c=0; c<numChar; c++)
+                    {
+                    if (partitionId[c][partitionNum] == d+1 && charInfo[c].isExcluded == NO)
+                        {
+                        nPair = 1;
+                        for (i=0; i<numChar; i++)
+                            {
+                            if (i != c && partitionId[i][partitionNum] == d+1 && charInfo[i].isExcluded == NO && charInfo[c].pairsId == charInfo[i].pairsId)
+                                nPair++;
+                            }
+                        if (nPair != 2)
+                            foundUnpaired = YES;
+                        }
+                    }
+                if (foundUnpaired == YES)
+                    {
+                    if (numCurrentDivisions == 1)
+                        {
+                        MrBayesPrint ("%s   Found unpaired nucleotide sites. The doublet model\n", spacer);
+                        MrBayesPrint ("%s   requires that all sites are paired. \n", spacer);
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Found unpaired nucleotide sites in partition %d.\n", spacer, d+1);
+                        MrBayesPrint ("%s   The doublet model requires that all sites are paired. \n", spacer);
+                        }
+                    free (tempStr);
+                    return (ERROR);
+                    }
+
+                /* everything checks out. Now we can initialize charId */
+                for (c=0; c<numChar; c++)
+                    {
+                    nuc1 = nuc2 = -1;
+                    if (partitionId[c][partitionNum] == d+1 && charInfo[c].charId == 0)
+                        {
+                        nuc1 = c;
+                        for (i=0; i<numChar; i++)
+                            {
+                            if (i != c && charInfo[i].charId == 0 && charInfo[c].pairsId == charInfo[i].pairsId)
+                                nuc2 = i;
+                            }
+                        if (nuc1 >= 0 && nuc2 >= 0)
+                            {
+                            charInfo[nuc1].charId = charInfo[nuc2].charId = uniqueId;
+                            uniqueId++;
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Weird doublet problem in partition %d.\n", spacer, d+1);
+                            free (tempStr);
+                            return (ERROR);
+                            }
+                        }
+                    }
+                    
+                allCheckedOut++;
+                /* end check that the doublet model is appropriate for this partition */
+                }
+            }
+        }
+        
+    /*
+    if (allCheckedOut > 0)
+        MrBayesPrint ("%s   Codon/Doublet models successfully checked\n", spacer);
+    */
+        
+#   if 0
+    for (c=0; c<numChar; c++)
+            printf (" %d", charId[c]);
+    printf ("\n");
+#   endif
+
+    free (tempStr);
+    return (NO_ERROR);
+}
+
+void CodingToString(int coding, char* string)
+{
+    if(coding == ALL)
+        strcpy(string, "All");
+    else if(coding == INFORMATIVE)
+        strcpy(string, "Informative");
+    else if((coding & VARIABLE) == VARIABLE)
+        {
+        if (coding == VARIABLE)
+            {
+            strcpy(string, "Variable");
+            }
+        else if (coding & NOSINGLETONABSENCE)
+            {
+            strcpy(string, "Variable|Nosingletonabsence");
+            }
+        else if (coding & NOSINGLETONPRESENCE)
+            {
+            strcpy(string, "Variable|Nosingletonpresence");
+            }
+        }
+    else if((coding & NOSINGLETONS) == NOSINGLETONS)
+        {
+        if (coding == NOSINGLETONS)
+            {
+            strcpy(string, "Nosingletons");
+            }
+        else if (coding & NOABSENCESITES)
+            {
+            strcpy(string, "Noabsencesites|Nosingletons");
+            }
+        else if (coding & NOPRESENCESITES)
+            {
+            strcpy(string, "Nopresencesites|Nosingletons");
+            }
+        }
+    else if(coding == NOABSENCESITES)
+        {
+        strcpy(string, "Noabsencesites");
+        }
+    else if(coding == NOPRESENCESITES)
+        {
+        strcpy(string, "Nopresencesites");
+        }
+    else if(coding == NOSINGLETONABSENCE)
+        {
+        strcpy(string, "Nosingletonabsence");
+        }
+    else if(coding == NOSINGLETONPRESENCE)
+        {
+        strcpy(string, "Nosingletonpresence");
+        }
+    else if(coding == (NOABSENCESITES | NOSINGLETONABSENCE))
+        {
+        strcpy(string, "Noabsencesites|Nosingletonabsence");
+        }
+    else if(coding == (NOABSENCESITES | NOSINGLETONPRESENCE))
+        {
+        strcpy(string, "Noabsencesites|Nosingletonpresence");
+        }
+    else if(coding == (NOPRESENCESITES | NOSINGLETONABSENCE))
+        {
+        strcpy(string, "Nopresencesites|Nosingletonabsence");
+        }
+    else if(coding == (NOPRESENCESITES | NOSINGLETONPRESENCE))
+        {
+        strcpy(string, "Nopresencesites|Nosingletonpresence");
+        }
+}
+
+
+/*-----------------------------------------------------------
+|
+|   CompressData: compress original data matrix
+|
+-------------------------------------------------------------*/
+int CompressData (void)
+{
+    int             a, c, d, i, j, k, t, col[3], isSame, newRow, newColumn,
+                    *isTaken, *tempSitesOfPat, *tempChar;
+    BitsLong        *tempMatrix;
+    ModelInfo       *m;
+    ModelParams     *mp;
+
+#   if defined DEBUG_COMPRESSDATA
+    if (PrintMatrix() == ERROR)
+        goto errorExit;
+    getchar();
+#   endif
+
+    /* set all pointers that will be allocated locally to NULL */
+    isTaken = NULL;
+    tempMatrix = NULL;
+    tempSitesOfPat = NULL;
+    tempChar = NULL;
+
+    /* allocate indices pointing from original to compressed matrix */
+    if (memAllocs[ALLOC_COMPCOLPOS] == YES)
+        {
+        free (compColPos);
+        compColPos = NULL;
+        memAllocs[ALLOC_COMPCOLPOS] = NO;
+        }
+    compColPos = (int *)SafeMalloc((size_t)numChar * sizeof(int));
+    if (!compColPos)
+        {
+        MrBayesPrint ("%s   Problem allocating compColPos (%d)\n", spacer, numChar * sizeof(int));
+        goto errorExit;
+        }
+    for (i=0; i<numChar; i++)
+        compColPos[i] = 0;
+    memAllocs[ALLOC_COMPCOLPOS] = YES;
+
+    if (memAllocs[ALLOC_COMPCHARPOS] == YES)
+        {
+        free (compCharPos);
+        compCharPos = NULL;
+        memAllocs[ALLOC_COMPCHARPOS] = NO;
+        }
+    compCharPos = (int *)SafeMalloc((size_t)numChar * sizeof(int));
+    if (!compCharPos)
+        {
+        MrBayesPrint ("%s   Problem allocating compCharPos (%d)\n", spacer, numChar * sizeof(int));
+        goto errorExit;
+        }
+    for (i=0; i<numChar; i++)
+        compCharPos[i] = 0;
+    memAllocs[ALLOC_COMPCHARPOS] = YES;
+
+    /* allocate space for temporary matrix, tempSitesOfPat,             */
+    /* vector keeping track of whether a character has been compressed, */
+    /* and vector indexing first original char for each compressed char */
+    tempMatrix = (BitsLong *) SafeCalloc (numLocalTaxa * numLocalChar, sizeof(BitsLong));
+    tempSitesOfPat = (int *) SafeCalloc (numLocalChar, sizeof(int));
+    isTaken = (int *) SafeCalloc (numChar, sizeof(int));
+    tempChar = (int *) SafeCalloc (numLocalChar, sizeof(int));
+    if (!tempMatrix || !tempSitesOfPat || !isTaken || !tempChar)
+        {
+        MrBayesPrint ("%s   Problem allocating temporary variables in CompressData\n", spacer);
+        goto errorExit;
+        }
+
+    /* initialize isTaken */
+    for (c=0; c<numChar; c++)
+        isTaken[c] = NO;
+
+    /* set index to first empty column in temporary matrix */
+    newColumn = 0;
+
+    /* initialize number of compressed characters */
+    numCompressedChars = 0;
+
+    /* sort and compress data */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        /* set pointers to the model params and settings for this division */
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        /* set column offset for this division in compressed matrix */
+        m->compMatrixStart = newColumn;
+
+        /* set compressed character offset for this division */
+        m->compCharStart = numCompressedChars;
+
+        /* set number of compressed characters to 0 for this division */
+        m->numChars = 0;
+
+        /* find the number of original characters per model site */
+        m->nCharsPerSite = 1;
+        if (mp->dataType == DNA || mp->dataType == RNA)
+            {   
+            if (!strcmp(mp->nucModel, "Doublet"))
+                m->nCharsPerSite = 2;
+            if (!strcmp(mp->nucModel, "Codon") || !strcmp(mp->nucModel, "Protein"))
+                m->nCharsPerSite = 3;
+            }
+        
+        /* sort and compress the characters for this division */
+        for (c=0; c<numChar; c++)
+            {
+            if (charInfo[c].isExcluded == YES || partitionId[c][partitionNum] != d+1 || isTaken[c] == YES)
+                continue;
+
+            col[0] = c;
+            isTaken[c] = YES;
+            
+            /* find additional columns if more than one character per model site      */
+            /* return error if the number of matching characters is smaller or larger */
+            /* than the actual number of characters per model site                    */
+            if (m->nCharsPerSite > 1)
+                {
+                j = 1;
+                if (charInfo[c].charId == 0)
+                    {
+                    MrBayesPrint("%s   Character %d is not properly defined\n", spacer, c+1);
+                    goto errorExit;
+                    }
+                for (i=c+1; i<numChar; i++)
+                    {
+                    if (charInfo[i].charId == charInfo[c].charId)
+                        {
+                        if (j >= m->nCharsPerSite)
+                            {
+                            MrBayesPrint("%s   Too many matches in charId (division %d char %d)\n", spacer, d, numCompressedChars);
+                            goto errorExit;
+                            }
+                        else
+                            {
+                            col[j++] = i;
+                            isTaken[i] = YES;
+                            }
+                        }
+                    }
+                if (j != m->nCharsPerSite)
+                    {
+                    MrBayesPrint ("%s   Too few matches in charId (division %d char %d)\n", spacer, d, numCompressedChars);
+                    goto errorExit;
+                    }
+                }
+            
+            /* add character to temporary matrix in column(s) at newColumn */
+            for (t=newRow=0; t<numTaxa; t++)
+                {
+                if (taxaInfo[t].isDeleted == YES)
+                    continue;
+
+                for (k=0; k<m->nCharsPerSite; k++)
+                    {
+                    tempMatrix[pos(newRow,newColumn+k,numLocalChar)] = matrix[pos(t,col[k],numChar)];
+                    }
+                newRow++;
+                }
+            
+            /* is it unique? */
+            isSame = NO;
+            if (mp->dataType != CONTINUOUS)
+                {
+                for (i=m->compMatrixStart; i<newColumn; i+=m->nCharsPerSite)
+                    {
+                    isSame = YES;
+                    for (j=0; j<numLocalTaxa; j++)
+                        {
+                        for (k=0; k<m->nCharsPerSite; k++)
+                            if (tempMatrix[pos(j,newColumn+k,numLocalChar)] != tempMatrix[pos(j,i+k,numLocalChar)])
+                                {
+                                isSame = NO;
+                                break;
+                                }
+                        if (isSame == NO)
+                            break;
+                        }
+                    if (isSame == YES)
+                        break;
+                    }
+                }
+
+            /* if subject to data augmentation, it is always unique */
+            if (!strcmp(mp->augmentData, "Yes"))
+                {
+                for (k=0; k<m->nCharsPerSite; k++)
+                    {
+                    if (charInfo[col[k]].isMissAmbig == YES)
+                        isSame = NO;
+                    }
+                }
+
+            if (isSame == NO)
+                {
+                /* if it is unique then it should be added */
+                tempSitesOfPat[numCompressedChars] = 1;
+                for (k=0; k<m->nCharsPerSite; k++)
+                    {
+                    compColPos[col[k]] = newColumn + k;
+                    compCharPos[col[k]] = numCompressedChars;
+                    tempChar[newColumn + k] = col[k];
+                    }
+                newColumn+=m->nCharsPerSite;
+                m->numChars++;
+                numCompressedChars++;
+                }
+            else
+                {
+                /* if it is not unique then simply update tempSitesOfPat     */
+                /* calculate compressed character position and put it into a */
+                /* (i points to compressed column position)                  */
+                a = m->compCharStart + ((i - m->compMatrixStart) / m->nCharsPerSite);
+                tempSitesOfPat[a]++;
+                for (k=0; k<m->nCharsPerSite; k++)
+                    {
+                    compColPos[col[k]] = i;
+                    compCharPos[col[k]] = a;
+                    /* tempChar (pointing from compressed to uncompresed) */
+                    /* can only be set for first pattern */
+                    }
+                }
+            }   /* next character */
+            
+        /* check that the partition has at least a single character */
+        if (m->numChars <= 0)
+            {
+            MrBayesPrint ("%s   You must have at least one site in a partition. Partition %d\n", spacer, d+1);
+            MrBayesPrint ("%s   has %d site patterns.\n", spacer, m->numChars);
+            goto errorExit;
+            }
+
+        m->compCharStop = m->compCharStart + m->numChars;
+        m->compMatrixStop = newColumn;
+
+        } /* next division */
+
+    compMatrixRowSize = newColumn;
+
+    /* now we know the size, so we can allocate space for the compressed matrix ... */
+    if (memAllocs[ALLOC_COMPMATRIX] == YES)
+        {
+        free (compMatrix);
+        compMatrix = NULL;
+        memAllocs[ALLOC_COMPMATRIX] = NO;
+        }
+    compMatrix = (BitsLong *) SafeCalloc (compMatrixRowSize * numLocalTaxa, sizeof(BitsLong));
+    if (!compMatrix)
+        {
+        MrBayesPrint ("%s   Problem allocating compMatrix (%d)\n", spacer, compMatrixRowSize * numLocalTaxa * sizeof(BitsLong));
+        goto errorExit;
+        }
+    memAllocs[ALLOC_COMPMATRIX] = YES;
+    
+    if (memAllocs[ALLOC_NUMSITESOFPAT] == YES)
+        {
+        free (numSitesOfPat);
+        numSitesOfPat = NULL;
+        memAllocs[ALLOC_NUMSITESOFPAT] = NO;
+        }
+    numSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!numSitesOfPat)
+        {
+        MrBayesPrint ("%s   Problem allocating numSitesOfPat (%d)\n", spacer, numCompressedChars * sizeof(MrBFlt));
+        goto errorExit;
+        }
+    memAllocs[ALLOC_NUMSITESOFPAT] = YES;
+
+    if (memAllocs[ALLOC_ORIGCHAR] == YES)
+        {
+        free (origChar);
+        origChar = NULL;
+        memAllocs[ALLOC_ORIGCHAR] = NO;
+        }
+    origChar = (int *)SafeMalloc((size_t)compMatrixRowSize * sizeof(int));
+    if (!origChar)
+        {
+        MrBayesPrint ("%s   Problem allocating origChar (%d)\n", spacer, numCompressedChars * sizeof(int));
+        goto errorExit;
+        }
+    memAllocs[ALLOC_ORIGCHAR] = YES;
+
+    /* ... and copy the data there */
+    for (i=0; i<numLocalTaxa; i++)
+        for (j=0; j<compMatrixRowSize; j++)
+            compMatrix[pos(i,j,compMatrixRowSize)] = tempMatrix[pos(i,j,numLocalChar)];
+
+    for (i=0; i<numCompressedChars; i++)
+        numSitesOfPat[i] = (CLFlt) tempSitesOfPat[i];
+
+    for (i=0; i<compMatrixRowSize; i++)
+        origChar[i] = tempChar[i];
+
+#   if defined (DEBUG_COMPRESSDATA)
+    if (PrintCompMatrix() == ERROR)
+        goto errorExit;
+    getchar();
+#   endif
+
+    /* free the temporary variables */
+    free (tempSitesOfPat);
+    free (tempMatrix);
+    free (isTaken);
+    free (tempChar);
+
+    return NO_ERROR;
+
+    errorExit:
+        if (tempMatrix)
+            free (tempMatrix);
+        if (tempSitesOfPat)
+            free (tempSitesOfPat);
+        if (isTaken)
+            free (isTaken);
+        if (tempChar)
+            free (tempChar);
+
+        return ERROR;
+}
+
+
+int DataType (int part)
+{
+    int     i;
+
+    for (i=0; i<numChar; i++)
+        {
+        if (partitionId[i][partitionNum] == part + 1)
+            break;
+        }
+
+    return (charInfo[i].charType);
+}
+
+
+int DoLink (void)
+{
+    int         i, j, newLine;
+    
+    MrBayesPrint ("%s   Linking\n", spacer);
+    
+    /* update status of linkTable */
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        newLine = YES;
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (tempLinkUnlink[j][i] == YES)
+                {
+                if (newLine == YES)
+                    {
+                    linkNum++;
+                    newLine = NO;
+                    }
+                linkTable[j][i] = linkNum;
+                }
+            }
+        }
+    
+#   if 0
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        MrBayesPrint ("%s   ", spacer);
+        for (i=0; i<numCurrentDivisions; i++)
+            MrBayesPrint ("%d", linkTable[j][i]);
+        MrBayesPrint ("\n");
+        }
+#   endif
+
+    /* reinitialize the temporary table */
+    for (j=0; j<NUM_LINKED; j++)
+        for (i=0; i<numCurrentDivisions; i++)
+            tempLinkUnlink[j][i] = NO;
+
+    /* set up parameters and moves */
+    if (SetUpAnalysis (&globalSeed) == ERROR)
+        return (ERROR);
+    
+    return (NO_ERROR);
+}
+
+
+int DoLinkParm (char *parmName, char *tkn)
+{
+    int         i, j, tempInt;
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before the model can be defined\n", spacer);
+        return (ERROR);
+        }
+        
+    if (inValidCommand == YES)
+        {
+        for (j=0; j<NUM_LINKED; j++)
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[j][i] = NO;
+        inValidCommand = NO;
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        expecting = Expecting(LEFTPAR);
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        /* initialize tempLinkUnlinkVec to no */
+        for (i=0; i<numCurrentDivisions; i++)
+            tempLinkUnlinkVec[i] = NO;
+        fromI = toJ = -1;
+        foundDash = NO;
+        expecting = Expecting(NUMBER) | Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        if (fromI != -1)
+            tempLinkUnlinkVec[fromI-1] = YES;
+        /* now copy tempLinkUnlinkVec to appropriate row of tempLinkUnlink */
+        if (!strcmp(parmName, "Tratio"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_TRATIO][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Revmat"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_REVMAT][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Omega"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_OMEGA][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Statefreq"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_PI][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Shape"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_SHAPE][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Pinvar"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_PINVAR][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Correlation"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_CORREL][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Ratemultiplier"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_RATEMULT][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Switchrates"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_SWITCH][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Topology"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_TOPOLOGY][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Brlens"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_BRLENS][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Speciationrate"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_SPECRATE][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Extinctionrate"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_EXTRATE][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Fossilizationrate")) 
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_FOSLRATE][i] = tempLinkUnlinkVec[i];
+            }                                                             
+        else if (!strcmp(parmName, "Popsize"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_POPSIZE][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Growthrate"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_GROWTH][i] = tempLinkUnlinkVec[i];
+            } 
+        else if (!strcmp(parmName, "Aamodel"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_AAMODEL][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Cpprate"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_CPPRATE][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Cppmultdev"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_CPPMULTDEV][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Cppevents"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_CPPEVENTS][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "TK02var") || !strcmp(parmName, "Bmvar"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_TK02VAR][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "TK02branchrates") || !strcmp(parmName, "Bmbranchrates"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_TK02BRANCHRATES][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Igrvar") || !strcmp(parmName, "Ibrvar"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_IGRVAR][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Igrbranchrates") || !strcmp(parmName, "Ibrbranchlens"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_IGRBRANCHRATES][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Mixedvar"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_MIXEDVAR][i] = tempLinkUnlinkVec[i];
+            }
+        else if (!strcmp(parmName, "Mixedbrchrates"))
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                tempLinkUnlink[P_MIXEDBRCHRATES][i] = tempLinkUnlinkVec[i];
+            }
+        else
+            {
+            MrBayesPrint ("%s   Couldn't find parameter %s to link\n", spacer, parmName);
+            }
+        
+        expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        foundComma = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        if (IsSame ("All", tkn) == DIFFERENT)
+            {
+            MrBayesPrint ("%s   Do not understand delimiter \"%s\"\n", spacer, tkn);
+            return (ERROR);
+            }
+        for (i=0; i<numCurrentDivisions; i++)
+            tempLinkUnlinkVec[i] = YES;
+        expecting  = Expecting(RIGHTPAR);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        sscanf (tkn, "%d", &tempInt);
+        if (tempInt > numCurrentDivisions)
+            {
+            MrBayesPrint ("%s   Partition delimiter is too large\n", spacer);
+            return (ERROR);
+            }
+        if (fromI == -1)
+            fromI = tempInt;
+        else if (fromI != -1 && toJ == -1 && foundDash == YES && foundComma == NO)
+            {
+            toJ = tempInt;
+            for (i=fromI-1; i<toJ; i++)
+                tempLinkUnlinkVec[i] = YES;
+            fromI = toJ = -1;
+            foundDash = NO;
+            }
+        else if (fromI != -1 && toJ == -1 && foundDash == NO && foundComma == YES)
+            {
+            tempLinkUnlinkVec[fromI-1] = YES;
+            fromI = tempInt;
+            foundComma = NO;
+            }
+        expecting  = Expecting(COMMA);
+        expecting |= Expecting(DASH);
+        expecting |= Expecting(RIGHTPAR);
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoLset (void)
+{
+    int         i, nApplied, lastActive=0;
+    
+    nApplied = NumActiveParts ();
+    for (i=numCurrentDivisions-1; i>=0; i--)
+        {
+        if (activeParts[i] == YES)
+            {
+            lastActive = i;
+            break;
+            }
+        }
+            
+    /* MrBayesPrint ("\n"); */
+    if (numCurrentDivisions == 1)
+        MrBayesPrint ("%s   Successfully set likelihood model parameters\n", spacer);
+    else 
+        {
+        if (nApplied == numCurrentDivisions || nApplied == 0)
+            {
+            MrBayesPrint ("%s   Successfully set likelihood model parameters to all\n", spacer);
+            MrBayesPrint ("%s      applicable data partitions \n", spacer);
+            }
+        else
+            {
+            MrBayesPrint ("%s   Successfully set likelihood model parameters to\n", spacer);
+            if (nApplied == 1)
+                MrBayesPrint ("%s   partition", spacer);
+            else
+                MrBayesPrint ("%s   partitions", spacer);
+            for (i=0; i<numCurrentDivisions; i++)
+                {
+                if (activeParts[i] == YES)
+                    {
+                    if (i == lastActive && nApplied > 1)
+                        MrBayesPrint (" and %d", i+1);
+                    else
+                        MrBayesPrint (" %d", i+1);
+                    if (nApplied > 2 && i != lastActive)
+                        MrBayesPrint (",");
+                    }
+                }
+            MrBayesPrint (" (if applicable)\n");
+            }
+        }
+
+    if (SetUpAnalysis (&globalSeed) == ERROR)
+        return (ERROR);
+    
+    return (NO_ERROR);
+}
+
+
+int DoLsetParm (char *parmName, char *tkn)
+{
+    int         i, j, tempInt, nApplied;
+    char        tempStr[100];
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before the model can be defined\n", spacer);
+        return (ERROR);
+        }
+    if (inValidCommand == YES)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            activeParts[i] = NO;
+        inValidCommand = NO;
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Applyto (Applyto) *************************************************************/
+        if (!strcmp(parmName, "Applyto"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(LEFTPAR);
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                for (i=0; i<numCurrentDivisions; i++)
+                    activeParts[i] = NO;
+                fromI = toJ = -1;
+                foundDash = NO;
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                if (fromI != -1)
+                    activeParts[fromI-1] = YES;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                foundComma = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsSame ("All", tkn) == DIFFERENT)
+                    {
+                    MrBayesPrint ("%s   Do not understand delimiter \"%s\"\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                for (i=0; i<numCurrentDivisions; i++)
+                    activeParts[i] = YES;
+                expecting  = Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt > numCurrentDivisions)
+                    {
+                    MrBayesPrint ("%s   Partition delimiter is too large\n", spacer);
+                    return (ERROR);
+                    }
+                if (fromI == -1)
+                    fromI = tempInt;
+                else if (fromI != -1 && toJ == -1 && foundDash == YES && foundComma == NO)
+                    {
+                    toJ = tempInt;
+                    for (i=fromI-1; i<toJ; i++)
+                        activeParts[i] = YES;
+                    fromI = toJ = -1;
+                    foundDash = NO;
+                    }
+                else if (fromI != -1 && toJ == -1 && foundDash == NO && foundComma == YES)
+                    {
+                    activeParts[fromI-1] = YES;
+                    fromI = tempInt;
+                    foundComma = NO;
+                    }
+                    
+                expecting  = Expecting(COMMA);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Nucmodel (nucModel) ************************************************************/
+        else if (!strcmp(parmName, "Nucmodel"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    tempInt = NO;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].nucModel, tempStr);
+                            modelParams[i].nStates = NumStates (i);
+                            
+                            /* set state frequencies back to default */
+                            strcpy(modelParams[i].stateFreqPr, "Dirichlet");
+                            strcpy(modelParams[i].stateFreqsFixType, "Equal");
+                            for (j=0; j<200; j++)
+                                {
+                                modelParams[i].stateFreqsFix[j] = 0.0;   
+                                modelParams[i].stateFreqsDir[j] = 1.0;
+                                }    
+                            tempInt = YES;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Nucmodel to %s\n", spacer, modelParams[i].nucModel);
+                            else
+                                MrBayesPrint ("%s   Setting Nucmodel to %s for partition %d\n", spacer, modelParams[i].nucModel, i+1);
+                            }
+                        }
+                    if (tempInt == YES)
+                        MrBayesPrint ("%s   Set state frequency prior to default\n", spacer);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid DNA substitution model\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Nst (nst) **********************************************************************/
+        else if (!strcmp(parmName, "Nst"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+            else if (expecting == Expecting(NUMBER) || expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            if (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA)
+                                {
+                                strcpy(modelParams[i].nst, tempStr);
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Nst to %s\n", spacer, modelParams[i].nst);
+                                else
+                                    MrBayesPrint ("%s   Setting Nst to %s for partition %d\n", spacer, modelParams[i].nst, i+1);
+                                }
+                            else {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Nst =%s unchanged ", spacer, modelParams[i].nst);
+                                else
+                                    MrBayesPrint ("%s   Nst =%s unchanged for partition %d ", spacer, modelParams[i].nst, i+1);
+                                MrBayesPrint ("because dataType is not DNA or RNA\n");
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Nst argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ncat (numGammaCats) ************************************************************/
+        else if (!strcmp(parmName, "Ngammacat"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt >= 2 && tempInt < MAX_GAMMA_CATS)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType != CONTINUOUS))
+                            {
+                            modelParams[i].numGammaCats = tempInt;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Ngammacat to %d\n", spacer, modelParams[i].numGammaCats);
+                            else
+                                MrBayesPrint ("%s   Setting Ngammacat to %d for partition %d\n", spacer, modelParams[i].numGammaCats, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Ngammacat argument (should be between 2 and %d)\n", spacer, MAX_GAMMA_CATS);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Usegibbs (useGibbs) *************************************************************/
+        else if (!strcmp(parmName, "Usegibbs"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            if (!strcmp(tempStr, "Yes"))
+                                {
+                                MrBayesPrint ("%s   Downsampling of site rates ('usegibbs = yes') disabled temporarily because of conflict with likelihood calculators\n", spacer);
+                                return (ERROR);
+                                strcpy(modelParams[i].useGibbs, "Yes");
+                                }
+                            else
+                                {
+                                strcpy(modelParams[i].useGibbs, "No");
+                                }
+
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Usegibbs to %s (if applicable)\n", spacer, modelParams[i].useGibbs);
+                            else
+                                MrBayesPrint ("%s   Setting Usegibbs to %s (if applicable) for partition %d\n", spacer, modelParams[i].useGibbs, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Usegibbs (using Gibbs sampling of discrete gamma)\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }           
+        /* set Gibbsfreq (gibbsFreq) ************************************************************/
+        else if (!strcmp(parmName, "Gibbsfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt >= 1 && tempInt <= 1000)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            modelParams[i].gibbsFreq = tempInt;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Gibbsfreq to %d\n", spacer, modelParams[i].gibbsFreq);
+                            else
+                                MrBayesPrint ("%s   Setting Gibbsfreq to %d for partition %d\n", spacer, modelParams[i].gibbsFreq, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Gibbsgammafreq argument (should be between 1 and 1000)\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set NumM10GammaCats (numM10GammaCats) ************************************************************/
+        else if (!strcmp(parmName, "NumM10GammaCats"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt >= 2 && tempInt < MAX_GAMMA_CATS)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType != CONTINUOUS))
+                            {
+                            modelParams[i].numM10GammaCats = tempInt;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting NumM10GammaCats to %d\n", spacer, modelParams[i].numM10GammaCats);
+                            else
+                                MrBayesPrint ("%s   Setting NumM10GammaCats to %d for partition %d\n", spacer, modelParams[i].numM10GammaCats, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid NumM10GammaCats argument (should be between 2 and %d)\n", spacer, MAX_GAMMA_CATS);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set NumM10BetaCats (numM10BetaCats) ************************************************************/
+        else if (!strcmp(parmName, "NumM10BetaCats"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt >= 2 && tempInt < MAX_GAMMA_CATS)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType != CONTINUOUS))
+                            {
+                            modelParams[i].numM10BetaCats = tempInt;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting NumM10BetaCats to %d\n", spacer, modelParams[i].numM10BetaCats);
+                            else
+                                MrBayesPrint ("%s   Setting NumM10BetaCats to %d for partition %d\n", spacer, modelParams[i].numM10BetaCats, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid NumM10GammaCats argument (should be between 2 and %d)\n", spacer, MAX_GAMMA_CATS);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Nbetacat (numBetaCats) *****************************************************/
+        else if (!strcmp(parmName, "Nbetacat"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt >= 2 && tempInt < MAX_GAMMA_CATS)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == STANDARD || modelParams[i].dataType == RESTRICTION))
+                            {
+                            modelParams[i].numBetaCats = tempInt;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Nbetacat to %d\n", spacer, modelParams[i].numBetaCats);
+                            else
+                                MrBayesPrint ("%s   Setting Nbetacat to %d for partition %d\n", spacer, modelParams[i].numBetaCats, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Nbetacat argument (should be between 2 and %d)\n", spacer, MAX_GAMMA_CATS);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Aamodel (aaModel) **************************************************************/
+        else if (!strcmp(parmName, "Aamodel"))
+            {
+            MrBayesPrint ("%s   Aamodel argument for lset deprecated.\n", spacer);
+            MrBayesPrint ("%s   Use 'prset aamodelpr=fixed(<aamodel>)' instead.\n", spacer);
+            return (ERROR);
+            }
+        /* set Parsmodel (useParsModel) *******************************************************/
+        else if (!strcmp(parmName, "Parsmodel"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            if (!strcmp(tempStr, "Yes"))
+                                strcpy(modelParams[i].parsModel, "Yes");
+                            else
+                                strcpy(modelParams[i].parsModel, "No");
+
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Parsmodel to %s\n", spacer, modelParams[i].parsModel);
+                            else
+                                MrBayesPrint ("%s   Setting Parsmodel to %s for partition %d\n", spacer, modelParams[i].parsModel, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for using (so-called) parsimony model\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }           
+        /* set Augment (augmentData) **********************************************************/
+        else if (!strcmp(parmName, "Augment"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                            {
+                            if (!strcmp(tempStr, "Yes"))
+                                strcpy(modelParams[i].augmentData, "Yes");
+                            else
+                                strcpy(modelParams[i].augmentData, "No");
+
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Augmentdata to %s\n", spacer, modelParams[i].augmentData);
+                            else
+                                MrBayesPrint ("%s   Setting Augmentdata to %s for partition %d\n", spacer, modelParams[i].augmentData, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for data augmentation\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }           
+        /* set Omegavar (wVarModel) ***********************************************************/
+        else if (!strcmp(parmName, "Omegavar"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].omegaVar, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Omegavar to %s\n", spacer, modelParams[i].omegaVar);
+                            else
+                                MrBayesPrint ("%s   Setting Omegavar to %s for partition %d\n", spacer, modelParams[i].omegaVar, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid omega variation argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Code (codeModel) ***************************************************************/
+        else if (!strcmp(parmName, "Code"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].geneticCode, tempStr);
+                            SetCode (i);
+                            modelParams[i].nStates = NumStates (i);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Code to %s\n", spacer, modelParams[i].geneticCode);
+                            else
+                                MrBayesPrint ("%s   Setting Code to %s for partition %d\n", spacer, modelParams[i].geneticCode, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid genetic code argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ploidy (ploidy) ***************************************************************/
+        else if (!strcmp(parmName, "Ploidy"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].ploidy, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting ploidy level to %s\n", spacer, modelParams[i].ploidy);
+                            else
+                                MrBayesPrint ("%s   Setting ploidy level to %s for partition %d\n", spacer, modelParams[i].ploidy, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid ploidy level argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Rates (ratesModel) *************************************************************/
+        else if (!strcmp(parmName, "Rates"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                            {
+                            if (!strcmp(tempStr, "Adgamma") && (modelParams[i].dataType != DNA && modelParams[i].dataType != RNA && modelParams[i].dataType != PROTEIN))
+                                {
+                                /* we won't apply an adgamma model to anything but DNA, RNA, or PROTEIN data */
+                                }
+                            else if ((!strcmp(tempStr, "Propinv") ||  !strcmp(tempStr, "Invgamma")) && (modelParams[i].dataType == STANDARD || modelParams[i].dataType == RESTRICTION))
+                                {
+                                /* we will not apply pinvar to standard or restriction site data */
+                                }
+                            else
+                                {
+                                strcpy(modelParams[i].ratesModel, tempStr);
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Rates to %s\n", spacer, modelParams[i].ratesModel);
+                                else
+                                    MrBayesPrint ("%s   Setting Rates to %s for partition %d\n", spacer, modelParams[i].ratesModel, i+1);
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Rates argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Covarion (covarionModel) *******************************************************/
+        else if (!strcmp(parmName, "Covarion"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN))
+                            {
+                            strcpy(modelParams[i].covarionModel, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Covarion to %s\n", spacer, modelParams[i].covarionModel);
+                            else
+                                MrBayesPrint ("%s   Setting Covarion to %s for partition %d\n", spacer, modelParams[i].covarionModel, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Rates argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Coding (missingType) ***********************************************************/
+        else if (!strcmp(parmName, "Coding"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                for (i=0; i<numCurrentDivisions; i++)
+                    modelParams[i].coding = ALL;
+                
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(VERTICALBAR))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == RESTRICTION || modelParams[i].dataType == STANDARD))
+                            {
+                            if(!strcmp(tempStr, "Nosingletons"))
+                                {
+                                modelParams[i].coding |= NOSINGLETONS;
+                                }
+                            else if(!strcmp(tempStr, "Variable"))
+                                {
+                                modelParams[i].coding |= VARIABLE;
+                                }
+                            else if(!strcmp(tempStr, "Informative"))
+                                {
+                                modelParams[i].coding |= INFORMATIVE;
+                                }
+                            else
+                                {
+                                if(modelParams[i].dataType != RESTRICTION)
+                                    {
+                                    MrBayesPrint ("%s   Invalid coding for standard characters: %s\n", spacer, tempStr);
+                                    return (ERROR);
+                                    }
+                                
+                                if(!strcmp(tempStr, "Noabsencesites"))
+                                    {
+                                    modelParams[i].coding |= NOABSENCESITES;
+                                    }
+                                else if(!strcmp(tempStr, "Nopresencesites"))
+                                    {
+                                    modelParams[i].coding |= NOPRESENCESITES;
+                                    }
+                                else if(!strcmp(tempStr, "Nosingletonpresence"))
+                                    {
+                                    modelParams[i].coding |= NOSINGLETONPRESENCE;
+                                    }
+                                else if(!strcmp(tempStr, "Nosingletonabsence"))
+                                    {
+                                    modelParams[i].coding |= NOSINGLETONABSENCE;
+                                    }
+                                }
+                            
+                            CodingToString(modelParams[i].coding, modelParams[i].codingString);
+                            
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Enabling Coding %s\n", spacer, tempStr);
+                            else
+                                MrBayesPrint ("%s   Enabling Coding %s for partition %d\n", spacer, tempStr, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for missing patterns\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON) | Expecting(VERTICALBAR);
+                }
+            else
+                return (ERROR);
+            }
+                
+                
+                
+                
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoPlot (void)
+{
+    int             i, n, nHeaders, burnin, len, longestHeader, whichIsX, whichIsY, numPlotted;
+    char            temp[100], **headerNames = NULL;
+    SumpFileInfo    fileInfo;
+    ParameterSample *parameterSamples;
+    
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return NO_ERROR;
+#   endif
+    
+    /* initialize values */
+    headerNames = NULL;
+    nHeaders = 0;
+    parameterSamples = NULL;
+    
+    /* tell user we are ready to go */
+    MrBayesPrint ("%s   Plotting parameters in file %s ...\n", spacer, plotParams.plotFileName);
+    
+    /* examine plot file */
+    if (ExamineSumpFile (plotParams.plotFileName, &fileInfo, &headerNames, &nHeaders) == ERROR)
+        return ERROR;
+    
+    /* Calculate burn in */
+    burnin = fileInfo.firstParamLine - fileInfo.headerLine - 1;
+    
+    /* tell the user that everything is fine */
+    MrBayesPrint ("%s   Found %d parameter lines in file \"%s\"\n", spacer, fileInfo.numRows + burnin, plotParams.plotFileName);
+    if (burnin > 0)
+        MrBayesPrint ("%s   Of the %d lines, %d of them will be summarized (starting at line %d)\n", spacer, fileInfo.numRows+burnin, fileInfo.numRows, fileInfo.firstParamLine);
+    else
+        MrBayesPrint ("%s   All %d lines will be summarized (starting at line %d)\n", spacer, fileInfo.numRows, fileInfo.firstParamLine);
+    MrBayesPrint ("%s   (Only the last set of lines will be read, in case multiple\n", spacer);
+    MrBayesPrint ("%s   parameter blocks are present in the same file.)\n", spacer);
+    
+    /* allocate space to hold parameter information */
+    if (AllocateParameterSamples (&parameterSamples, 1, fileInfo.numRows, fileInfo.numColumns) == ERROR)
+        goto errorExit;
+    
+    /* Now we read the file for real. First, rewind file pointer to beginning of file... */
+    if (ReadParamSamples (plotParams.plotFileName, &fileInfo, parameterSamples, 0) == ERROR)
+        goto errorExit;
+    
+    /* get length of longest header */
+    longestHeader = 9; /* 9 is the length of the word "parameter" (for printing table) */
+    for (i=0; i<nHeaders; i++)
+        {
+        len = (int) strlen(headerNames[i]);
+        if (len > longestHeader)
+            longestHeader = len;
+        }
+    
+    /* print x-y plot of parameter vs. generation */
+    whichIsX = -1;
+    for (i=0; i<nHeaders; i++)
+        {
+        if (IsSame (headerNames[i], "Gen") == SAME)
+            whichIsX = i;
+        }
+    
+    if (whichIsX < 0)
+        {
+        MrBayesPrint ("%s   Could not find a column labelled \"Gen\" \n", spacer);
+        goto errorExit;
+        }
+    
+    numPlotted = 0;
+    for (n=0; n<nHeaders; n++)
+        {
+        strcpy (temp, headerNames[n]);
+        whichIsY = -1;
+        if (!strcmp(plotParams.match, "Perfect"))
+            {
+            if (IsSame (temp, plotParams.parameter) == SAME)
+                whichIsY = n;
+            }
+        else if (!strcmp(plotParams.match, "All"))
+            {
+            whichIsY = n;
+            }
+        else
+            {
+            if (IsSame (temp, plotParams.parameter) == CONSISTENT_WITH)
+                whichIsY = n;
+            }
+        
+        if (whichIsY >= 0 && whichIsX != whichIsY)
+            {
+            MrBayesPrint ("\n%s   Rough trace plot of parameter %s:\n", spacer, headerNames[whichIsY]);
+            if (PrintPlot (parameterSamples[whichIsX].values[0], parameterSamples[whichIsY].values[0], fileInfo.numRows) == ERROR)
+                goto errorExit;
+            numPlotted++;
+            }
+        }
+    
+    if (numPlotted == 0)
+        {
+        MrBayesPrint ("%s   Did not find any parameters matching \"%s\" to plot\n", spacer, plotParams.parameter);
+        }
+    
+    /* free memory */
+    for (i=0; i<nHeaders; i++)
+        free (headerNames[i]);
+    free(headerNames);
+    FreeParameterSamples(parameterSamples);
+    
+    expecting = Expecting(COMMAND);
+    
+    return (NO_ERROR);
+    
+errorExit:
+    
+    /* free memory */
+    for (i=0; i<nHeaders; i++)
+        free (headerNames[i]);
+    free(headerNames);
+    FreeParameterSamples(parameterSamples);
+    
+    expecting = Expecting(COMMAND);
+    
+    return (ERROR);
+}
+
+
+int DoPlotParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        tempStr[100];
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before sumt can be used\n", spacer);
+        return (ERROR);
+        }
+    
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            expecting  = Expecting(PARAMETER);
+            expecting |= Expecting(SEMICOLON);
+            }
+        /* set Filename (plotParams.plotFileName) ***************************************************/
+        else if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (plotParams.plotFileName, tkn);
+                MrBayesPrint ("%s   Setting plot filename to %s\n", spacer, plotParams.plotFileName);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Relburnin (chainParams.relativeBurnin) ********************************************************/
+        else if (!strcmp(parmName, "Relburnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.relativeBurnin = YES;
+                    else
+                        chainParams.relativeBurnin = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Relburnin\n", spacer);
+                    return (ERROR);
+                    }
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using relative burnin (a fraction of samples discarded).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Using absolute burnin (a fixed number of samples discarded).\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burnin (chainParams.chainBurnIn) *******************************************************/
+        else if (!strcmp(parmName, "Burnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.chainBurnIn = tempI;
+                MrBayesPrint ("%s   Setting burnin to %d\n", spacer, chainParams.chainBurnIn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Burninfrac (chainParams.burninFraction) ************************************************************/
+        else if (!strcmp(parmName, "Burninfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too low (< 0.01)\n", spacer);
+                    return (ERROR);
+                    }
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too high (> 0.50)\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.burninFraction = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Parameter (plotParams.parameter) *******************************************************/
+        else if (!strcmp(parmName, "Parameter"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (plotParams.parameter, tkn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Parameter (plotParams.match) *******************************************************/
+        else if (!strcmp(parmName, "Match"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    strcpy (plotParams.match, tempStr);
+                else
+                    return (ERROR);
+                
+                MrBayesPrint ("%s   Setting plot matching to %s\n", spacer, plotParams.match);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        
+        else
+            return (ERROR);
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int DoPropset (void)
+{
+    MrBayesPrint ("%s   Successfully set proposal parameters\n", spacer);
+    
+    return (NO_ERROR);
+}
+
+
+int DoPropsetParm (char *parmName, char *tkn)
+{
+    int                 i, j, k, nMatches, tempInt;
+    MrBFlt              tempFloat;
+    static MCMCMove     *mv = NULL;
+    static MrBFlt       *theValue, theValueMin, theValueMax;
+    static int          jump, runIndex, chainIndex;
+    static char         *temp=NULL, *localTkn=NULL; /*freed at the end of the call*/
+    static char         *tempName=NULL;         /*not freed at the end of the call*/
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before proposal parameters can be changed\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* we expect a move name with possible run and chain specification as follows:
+               <move_name>$<tuning_param_name>(<run>,<chain>)=<number>   -- apply to run <run> and chain <chain>
+               <move_name>$<tuning_param_name>(,<chain>)=<number>        -- apply to chain <chain> for all runs
+               <move_name>$<tuning_param_name>(<run>,)=<number>          -- apply to all chains of run <run>
+               <move_name>$prob(<run>,<chain>)=<number>                  -- change relative proposal probability
+               <move_name>$targetrate(<run>,<chain>)=<number>            -- change target acc rate for autotuning
+
+               the parsing is complicated by the fact that the move name can look something like:
+               eTBR(Tau{all})
+               eTBR(Tau{1,4,5})
+               so we need to assemble the move name from several tokens that are parsed out separately;
+               here we receive only the first part (before the left parenthesis)
+            */
+            
+            /* copy to local move name */
+            SafeStrcpy(&tempName, tkn);
+            mv = NULL;
+            foundComma = foundEqual = NO;
+            expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+                Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+                Expecting(DOLLAR);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        if (mv == NULL)
+            {
+            /* we are still assembling the move name */
+            SafeStrcat(&tempName, tkn);
+            expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+                Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+                Expecting(DOLLAR);
+            }
+        else
+            {
+            /* we have a parameter name; now find the parameter name, case insensitive */
+            SafeStrcpy(&localTkn, tkn);
+            for (i=0; i<(int)strlen(localTkn); i++)
+                localTkn[i] = tolower(localTkn[i]);
+            nMatches = j = 0;
+            for (i=0; i<mv->moveType->numTuningParams; i++)
+                {
+                SafeStrcpy(&temp, mv->moveType->shortTuningName[i]);
+                for (k=0; k<(int)strlen(temp); k++)
+                    temp[k] = tolower(temp[k]);
+                if (strncmp(localTkn,temp,strlen(localTkn)) == 0)
+                    {
+                    j = i;
+                    nMatches++;
+                    }
+                }
+            if (strncmp(localTkn,"prob",strlen(localTkn)) == 0)
+                {
+                j = -1;
+                nMatches++;
+                }
+            else if (strncmp(localTkn,"targetrate",strlen(localTkn)) == 0)
+                {
+                j = -2;
+                nMatches++;
+                }
+            if (nMatches == 0)
+                {
+                MrBayesPrint ("%s   Could not find move parameter to change '%s'\n", spacer, localTkn);  
+                return (ERROR);
+                }
+            else if (nMatches > 1)
+                {
+                MrBayesPrint ("%s   Several move parameters matched the abbreviated name '%s'\n", spacer, localTkn);
+                return (ERROR);
+                }
+            
+            if (j == -1)
+                {
+                theValue = mv->relProposalProb;
+                theValueMin = 0.0;
+                theValueMax = 1000.0;
+                jump = 1;
+                }
+            else if (j == -2)
+                {
+                theValue = mv->targetRate;
+                theValueMin = 0.10;
+                theValueMax = 0.70;
+                jump = 1;
+                }
+            else
+                {
+                theValue = &mv->tuningParam[0][j];
+                theValueMin = mv->moveType->minimum[j];
+                theValueMax = mv->moveType->maximum[j];
+                jump = mv->moveType->numTuningParams;
+                }
+            chainIndex = -1;
+            runIndex = -1;
+            expecting = Expecting(LEFTPAR) | Expecting(EQUALSIGN);
+            }
+        }
+    else if (expecting == Expecting(LEFTCURL) || expecting == Expecting(RIGHTCURL))
+        {
+        /* we are still assembling the move name */
+        SafeStrcat (&tempName, tkn);
+        expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+            Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+            Expecting(DOLLAR);
+        }
+    else if (expecting == Expecting(DOLLAR))
+        {
+        /* we know that the name is complete now; find the move by its name, 
+           case insensitive */
+        SafeStrcpy(&localTkn, tempName);
+        j=(int)strlen(localTkn);
+        for (i=0; i<j; i++)
+            localTkn[i] = tolower(localTkn[i]);
+            
+        /* find the move */
+        nMatches = j = 0;
+        for (i=0; i<numApplicableMoves; i++)
+            {
+            mv = moves[i];
+            SafeStrcpy(&temp,mv->name);
+            for (k=0; k<(int)strlen(temp); k++)
+                temp[k] = tolower(temp[k]);
+            if (strncmp(temp,localTkn,strlen(localTkn)) == 0)
+                {
+                j = i;
+                nMatches++;
+                }
+            }
+        if (nMatches == 0)
+            {
+            MrBayesPrint ("%s   Could not find move '%s'\n", spacer, localTkn);   
+            return (ERROR);
+            }
+        else if (nMatches > 1)
+            {
+            MrBayesPrint ("%s   Several moves matched the abbreviated name '%s'\n", spacer, localTkn);   
+            return (ERROR);
+            }
+        else
+            mv = moves[j];
+
+        foundComma = foundEqual = NO;
+        expecting = Expecting(ALPHA);
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        if (mv == NULL)
+            {
+            /* we are still assembling the move name */
+            SafeStrcat (&tempName, tkn);
+            expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+                Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+                Expecting(DOLLAR);
+            }
+        else /* if (mv != NULL) */
+            {
+            /* we will be reading in run and chain indices */
+            expecting = Expecting(NUMBER) | Expecting(COMMA);
+            }
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (mv == NULL)
+            {
+            /* we are still assembling the move name */
+            SafeStrcat (&tempName, tkn);
+            expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+                Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+                Expecting(DOLLAR);
+            }
+        else if (foundEqual == YES)
+            {
+            sscanf (tkn, "%lf", &tempFloat);
+            if (tempFloat < theValueMin || tempFloat > theValueMax)
+                {
+                MrBayesPrint ("%s   The value is out of range (min = %lf; max = %lf)\n", spacer, theValueMin, theValueMax);
+                return (ERROR);
+                }
+            if (runIndex == -1 && chainIndex == -1)
+                {
+                for (i=0; i<chainParams.numRuns; i++)
+                    {
+                    for (j=0; j<chainParams.numChains; j++)
+                        {
+                        *theValue = tempFloat;
+                        theValue += jump;
+                        }
+                    }
+                }
+            else if (runIndex == -1 && chainIndex >= 0)
+                {
+                theValue += chainIndex*jump;
+                for (i=0; i<chainParams.numRuns; i++)
+                    {
+                    *theValue = tempFloat;
+                    theValue += chainParams.numChains*jump;
+                    }
+                }
+            else if (runIndex >= 0 && chainIndex == -1)
+                {
+                theValue += runIndex*chainParams.numChains*jump;
+                for (i=0; i<chainParams.numChains; i++)
+                    {
+                    *theValue = tempFloat;
+                    theValue += jump;
+                    }
+                }
+            else /* if (runIndex >= 0 && chainIndex >= 0) */
+                {
+                theValue[runIndex*chainParams.numChains*jump+chainIndex*jump] = tempFloat;
+                }
+            expecting = Expecting (PARAMETER) | Expecting(SEMICOLON);
+            }
+        else /* if (foundEqual == NO) */
+            {
+            sscanf (tkn, "%d", &tempInt);
+            if (foundComma == NO)
+                {
+                if (tempInt <= 0 || tempInt > chainParams.numRuns)
+                    {
+                    MrBayesPrint ("%s   Run index is out of range (min=1; max=%d)\n", spacer, chainParams.numRuns);
+                    return (ERROR);
+                    }
+                runIndex = tempInt - 1;
+                expecting = Expecting(COMMA);
+                }
+            else
+                {
+                if (tempInt <= 0 || tempInt > chainParams.numChains)
+                    {
+                    MrBayesPrint ("%s   Chain index is out of range (min=1; max=%d)\n", spacer, chainParams.numChains);
+                    return (ERROR);
+                    }
+                chainIndex = tempInt - 1;
+                expecting = Expecting(RIGHTPAR);
+                }
+            }
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        if (mv == NULL)
+            {
+            /* we are still assembling the move name */
+            SafeStrcat (&tempName, tkn);
+            expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+                Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+                Expecting(DOLLAR);
+            }
+        else
+            {
+            /* we will be reading in chain index, if present */
+            foundComma = YES;
+            expecting = Expecting(RIGHTPAR) | Expecting(NUMBER);
+            }
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        if (mv == NULL)
+            {
+            /* we are still assembling the move name */
+            SafeStrcat (&tempName, tkn);
+            expecting = Expecting(LEFTCURL) | Expecting(RIGHTCURL) | Expecting(COMMA) |
+                Expecting(LEFTPAR) | Expecting(RIGHTPAR) | Expecting(NUMBER) | Expecting(ALPHA) |
+                Expecting(DOLLAR);
+            }
+        else
+            expecting = Expecting(EQUALSIGN);
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        foundEqual = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else
+        return (ERROR);
+
+    SafeFree ((void **)&temp);
+    SafeFree ((void **)&localTkn);
+    return (NO_ERROR);
+}
+
+
+int DoPrset (void)
+{
+    int         i, nApplied, lastActive=0;
+
+    nApplied = NumActiveParts ();
+    for (i=numCurrentDivisions-1; i>=0; i--)
+        {
+        if (activeParts[i] == YES)
+            {
+            lastActive = i;
+            break;
+            }
+        }
+            
+    if (numCurrentDivisions == 1)
+        MrBayesPrint ("%s   Successfully set prior model parameters\n", spacer);
+    else 
+        {
+        if (nApplied == numCurrentDivisions || nApplied == 0)
+            {
+            MrBayesPrint ("%s   Successfully set prior model parameters to all\n", spacer);
+            MrBayesPrint ("%s   applicable data partitions \n", spacer);
+            }
+        else
+            {
+            MrBayesPrint ("%s   Successfully set prior model parameters to\n", spacer);
+            if (nApplied == 1)
+                MrBayesPrint ("%s   partition", spacer);
+            else
+                MrBayesPrint ("%s   partitions", spacer);
+            for (i=0; i<numCurrentDivisions; i++)
+                {
+                if (activeParts[i] == YES)
+                    {
+                    if (i == lastActive && nApplied > 1)
+                        MrBayesPrint (" and %d", i+1);
+                    else
+                        MrBayesPrint (" %d", i+1);
+                    if (nApplied > 2 && i != lastActive)
+                        MrBayesPrint (",");
+                    }
+                }
+            MrBayesPrint (" (if applicable)\n");
+            }
+        }
+    
+    if (SetUpAnalysis (&globalSeed) == ERROR)
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoPrsetParm (char *parmName, char *tkn)
+{
+    int         i, j, k, tempInt, nApplied, index, ns, flag=0;
+    MrBFlt      tempD, sum;
+    char        tempStr[100];
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before the model can be defined\n", spacer);
+        return (ERROR);
+        }
+    if (inValidCommand == YES)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            activeParts[i] = NO;
+        inValidCommand = NO;
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Applyto (Applyto) *************************************************************/
+        if (!strcmp(parmName, "Applyto"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(LEFTPAR);
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                for (i=0; i<numCurrentDivisions; i++)
+                    activeParts[i] = NO;
+                fromI = toJ = -1;
+                foundDash = NO;
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                if (fromI != -1)
+                    activeParts[fromI-1] = YES;
+#               if 0
+                for (i=0; i<numCurrentDivisions; i++)
+                    MrBayesPrint("%d ", activeParts[i]);
+                MrBayesPrint ("\n");
+#               endif
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                foundComma = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsSame ("All", tkn) == DIFFERENT)
+                    {
+                    MrBayesPrint ("%s   Do not understand delimiter \"%s\"\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                for (i=0; i<numCurrentDivisions; i++)
+                    activeParts[i] = YES;
+                expecting  = Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt > numCurrentDivisions)
+                    {
+                    MrBayesPrint ("%s   Partition delimiter is too large\n", spacer);
+                    return (ERROR);
+                    }
+                if (fromI == -1)
+                    fromI = tempInt;
+                else if (fromI != -1 && toJ == -1 && foundDash == YES && foundComma == NO)
+                    {
+                    toJ = tempInt;
+                    for (i=fromI-1; i<toJ; i++)
+                        activeParts[i] = YES;
+                    fromI = toJ = -1;
+                    foundDash = NO;
+                    }
+                else if (fromI != -1 && toJ == -1 && foundDash == NO && foundComma == YES)
+                    {
+                    activeParts[fromI-1] = YES;
+                    fromI = tempInt;
+                    foundComma = NO;
+                    }
+                    
+                expecting  = Expecting(COMMA);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Tratiopr (tRatioPr) ************************************************************/
+        else if (!strcmp(parmName, "Tratiopr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].tRatioPr, tempStr);
+                            modelParams[i].tRatioDir[0] = modelParams[i].tRatioDir[1] = 1.0;
+                            modelParams[i].tRatioFix = 1.0;
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Tratiopr argument \n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].tRatioPr,"Beta"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD > ALPHA_MAX)
+                                {
+                                MrBayesPrint ("%s   Beta parameter cannot be greater than %1.2lf\n", spacer, ALPHA_MAX);
+                                return (ERROR);
+                                }
+                            if (tempD < ALPHA_MIN)
+                                {
+                                MrBayesPrint ("%s   Beta parameter cannot be less than %1.2lf\n", spacer, ALPHA_MIN);
+                                return (ERROR);
+                                }
+                            modelParams[i].tRatioDir[numVars[i]++] = tempD;
+                            if (numVars[i] < 2)
+                                expecting = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Tratiopr to Beta(%1.2lf,%1.2lf)\n", spacer, modelParams[i].tRatioDir[0], modelParams[i].tRatioDir[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Tratiopr to Beta(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].tRatioDir[0], modelParams[i].tRatioDir[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].tRatioPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].tRatioFix = tempD;
+                            if (modelParams[i].tRatioFix > KAPPA_MAX)
+                                {
+                                MrBayesPrint ("%s   Tratio cannot be greater than %1.2lf\n", spacer, KAPPA_MAX);
+                                return (ERROR);
+                                }
+                            if (modelParams[i].tRatioFix < 0.0)
+                                {
+                                MrBayesPrint ("%s   Tratio cannot be less than %1.2lf\n", spacer, 0.0);
+                                return (ERROR);
+                                }
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Tratiopr to Fixed(%1.2lf)\n", spacer, modelParams[i].tRatioFix);
+                            else
+                                MrBayesPrint ("%s   Setting Tratiopr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].tRatioFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Revmatpr (revMatPr) ************************************************************/
+        else if (!strcmp(parmName, "Revmatpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].revMatPr, tempStr);
+                            modelParams[i].revMatDir[0] = modelParams[i].revMatDir[1] = 1.0;
+                            modelParams[i].revMatDir[2] = modelParams[i].revMatDir[3] = 1.0;
+                            modelParams[i].revMatDir[4] = modelParams[i].revMatDir[5] = 1.0;
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Revmatpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                tempNumStates = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                /* find out what type of prior is being set */
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        strcpy (tempStr,modelParams[i].revMatPr);
+                    }
+                /* find and store the number */
+                sscanf (tkn, "%lf", &tempD);
+                if (!strcmp(tempStr,"Dirichlet"))
+                    {
+                    if (tempD > ALPHA_MAX)
+                        {
+                        MrBayesPrint ("%s   Dirichlet parameter cannot be greater than %1.2lf\n", spacer, ALPHA_MAX);
+                        return (ERROR);
+                        }
+                    if (tempD < ALPHA_MIN)
+                        {
+                        MrBayesPrint ("%s   Dirichlet parameter cannot be less than %1.2lf\n", spacer, ALPHA_MIN);
+                        return (ERROR);
+                        }
+                    }
+                else if (!strcmp(tempStr,"Fixed"))
+                    {
+                    if (tempD > KAPPA_MAX)
+                        {
+                        MrBayesPrint ("%s   Rate value cannot be greater than %1.2lf\n", spacer, KAPPA_MAX);
+                        return (ERROR);
+                        }
+                    if (tempD < 0.0001)
+                        {
+                        MrBayesPrint ("%s   Rate value cannot be less than %1.2lf\n", spacer, 0.0001);
+                        return (ERROR);
+                        }
+                    }
+                tempNum[tempNumStates++] = tempD;
+                if (tempNumStates == 1 && !strcmp(tempStr,"Dirichlet"))
+                    expecting = Expecting(COMMA) | Expecting(RIGHTPAR);
+                else if (tempNumStates < 6)
+                    expecting  = Expecting(COMMA);
+                else
+                    expecting = Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].revMatPr,"Dirichlet"))
+                            {
+                            for (j=0; j<6; j++)
+                                {
+                                if (tempNumStates == 1)
+                                    modelParams[i].revMatDir[j] = tempNum[0] / (MrBFlt) 6.0;
+                                else
+                                    modelParams[i].revMatDir[j] = tempNum[j];
+                                }
+
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Revmatpr to Dirichlet(%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer, 
+                                modelParams[i].revMatDir[0], modelParams[i].revMatDir[1], modelParams[i].revMatDir[2],
+                                modelParams[i].revMatDir[3], modelParams[i].revMatDir[4], modelParams[i].revMatDir[5]);
+                            else
+                                MrBayesPrint ("%s   Setting Revmatpr to Dirichlet(%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf) for partition %d\n", spacer, 
+                                modelParams[i].revMatDir[0], modelParams[i].revMatDir[1], modelParams[i].revMatDir[2],
+                                modelParams[i].revMatDir[3], modelParams[i].revMatDir[4], modelParams[i].revMatDir[5], i+1);
+                            }
+                        else if (!strcmp(modelParams[i].revMatPr,"Fixed"))
+                            {
+                            for (j=0; j<6; j++)
+                                modelParams[i].revMatFix[j] = tempNum[j];
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Revmatpr to Fixed(%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer, 
+                                modelParams[i].revMatFix[0], modelParams[i].revMatFix[1], modelParams[i].revMatFix[2],
+                                modelParams[i].revMatFix[3], modelParams[i].revMatFix[4], modelParams[i].revMatFix[5]);
+                            else
+                                MrBayesPrint ("%s   Setting Revmatpr to Fixed(%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf) for partition %d\n", spacer, 
+                                modelParams[i].revMatFix[0], modelParams[i].revMatFix[1], modelParams[i].revMatFix[2],
+                                modelParams[i].revMatFix[3], modelParams[i].revMatFix[4], modelParams[i].revMatFix[5], i+1);
+                            }
+                        }
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Aarevmatpr (aaRevMatPr) ********************************************************/
+        else if (!strcmp(parmName, "Aarevmatpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelSettings[i].dataType == PROTEIN)
+                            {
+                            strcpy(modelParams[i].aaRevMatPr, tempStr);
+                            for (j=0; j<190; j++)
+                                modelParams[i].aaRevMatDir[j] = 1.0;
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing PROTEIN.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Aarevmatpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                tempNumStates = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                /* find out what type of prior is being set */
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && modelSettings[i].dataType == PROTEIN)
+                        strcpy (tempStr,modelParams[i].aaRevMatPr);
+                    }
+                /* find and store the number */
+                sscanf (tkn, "%lf", &tempD);
+                if (!strcmp(tempStr,"Dirichlet"))
+                    {
+                    if (tempD > ALPHA_MAX)
+                        {
+                        MrBayesPrint ("%s   Dirichlet parameter cannot be greater than %1.2lf\n", spacer, ALPHA_MAX);
+                        return (ERROR);
+                        }
+                    if (tempD < ALPHA_MIN)
+                        {
+                        MrBayesPrint ("%s   Dirichlet parameter cannot be less than %1.2lf\n", spacer, ALPHA_MIN);
+                        return (ERROR);
+                        }
+                    }
+                else if (!strcmp(tempStr,"Fixed"))
+                    {
+                    if (tempD > KAPPA_MAX)
+                        {
+                        MrBayesPrint ("%s   Rate value cannot be greater than %1.2lf\n", spacer, KAPPA_MAX);
+                        return (ERROR);
+                        }
+                    if (tempD < 0.0001)
+                        {
+                        MrBayesPrint ("%s   Rate value cannot be less than %1.2lf\n", spacer, 0.0001);
+                        return (ERROR);
+                        }
+                    }
+                tempStateFreqs[tempNumStates++] = tempD;
+                if (tempNumStates == 1 && !strcmp(tempStr,"Dirichlet"))
+                    expecting = Expecting(COMMA) | Expecting(RIGHTPAR);
+                else if (tempNumStates < 190)
+                    expecting  = Expecting(COMMA);
+                else
+                    expecting = Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType == PROTEIN)
+                        {
+                        if (!strcmp(modelParams[i].aaRevMatPr,"Dirichlet"))
+                            {
+                            for (j=0; j<190; j++)
+                                {
+                                if (tempNumStates == 1)
+                                    modelParams[i].aaRevMatDir[j] = tempStateFreqs[0] / (MrBFlt) 190.0;
+                                else
+                                    modelParams[i].aaRevMatDir[j] = tempStateFreqs[j];
+                                }
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                {
+                                for (j=0; j<190; j++)
+                                    if (AreDoublesEqual(modelParams[i].aaRevMatDir[0], modelParams[i].aaRevMatDir[j], 0.00001) == NO)
+                                        break;
+                                if (j == 190)
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Dirichlet(%1.2lf,%1.2lf,...)\n", spacer,
+                                        modelParams[i].aaRevMatDir[0], modelParams[i].aaRevMatDir[0]);
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Dirichlet(\n", spacer);
+                                    for (j=0; j<190; j++)
+                                        {
+                                        if (j % 10 == 0)
+                                            MrBayesPrint ("%s      ", spacer);
+                                        MrBayesPrint ("%1.2lf", modelParams[i].aaRevMatDir[j]);
+                                        if (j == 189)
+                                            MrBayesPrint (")\n");
+                                        else if ((j+1) % 10 == 0)
+                                            MrBayesPrint (",\n");
+                                        else
+                                            MrBayesPrint (",");
+                                        }
+                                    }
+                                }
+                            else
+                                {
+                                for (j=0; j<190; j++)
+                                    if (AreDoublesEqual(modelParams[i].aaRevMatDir[0], modelParams[i].aaRevMatDir[j], 0.00001) == NO)
+                                        break;
+                                if (j == 190)
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Dirichlet(%1.2lf,%1.2lf,...) for partition %d\n",
+                                        spacer, modelParams[i].aaRevMatDir[0], modelParams[i].aaRevMatDir[0], i+1);
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Dirichlet(\n", spacer);
+                                    for (j=0; j<190; j++)
+                                        {
+                                        if (j % 10 == 0)
+                                            MrBayesPrint ("%s      ", spacer);
+                                        MrBayesPrint ("%1.2lf", modelParams[i].aaRevMatDir[j]);
+                                        if (j == 189)
+                                            MrBayesPrint (")\n");
+                                        else if ((j+1) % 10 == 0)
+                                            MrBayesPrint (",\n");
+                                        else
+                                            MrBayesPrint (",");
+                                        }
+                                    }
+                                    MrBayesPrint ("%s      for partition %d\n", spacer, i+1);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].aaRevMatPr,"Fixed"))
+                            {
+                            for (j=0; j<190; j++)
+                                modelParams[i].aaRevMatFix[j] = tempStateFreqs[j];
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                {
+                                for (j=0; j<190; j++)
+                                    if (AreDoublesEqual(modelParams[i].aaRevMatFix[0], modelParams[i].aaRevMatFix[j], 0.00001) == NO)
+                                        break;
+                                if (j == 190)
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Fixed(%1.2lf,%1.2lf,...)\n", spacer, modelParams[i].aaRevMatFix[0],
+                                        modelParams[i].aaRevMatFix[0]);
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Fixed(\n", spacer);
+                                    for (j=0; j<190; j++)
+                                        {
+                                        if (j % 10 == 0)
+                                            MrBayesPrint ("%s      ", spacer);
+                                        MrBayesPrint ("%1.2lf", modelParams[i].aaRevMatFix[j]);
+                                        if (j == 189)
+                                            MrBayesPrint (")\n");
+                                        else if ((j+1) % 10 == 0)
+                                            MrBayesPrint (",\n");
+                                        else
+                                            MrBayesPrint (",");
+                                        }
+                                    }
+                                }
+                            else
+                                {
+                                for (j=0; j<190; j++)
+                                    if (AreDoublesEqual(modelParams[i].aaRevMatFix[0], modelParams[i].aaRevMatFix[j], 0.00001) == NO)
+                                        break;
+                                if (j == 190)
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Fixed(%1.2lf,%1.2lf,...) for partition %d\n", spacer,
+                                        modelParams[i].aaRevMatFix[0], modelParams[i].aaRevMatFix[0], i+1);
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Setting Aarevmatpr to Fixed(\n", spacer);
+                                    for (j=0; j<190; j++)
+                                        {
+                                        if (j % 10 == 0)
+                                            MrBayesPrint ("%s      ", spacer);
+                                        MrBayesPrint ("%1.2lf", modelParams[i].aaRevMatFix[j]);
+                                        if (j == 189)
+                                            MrBayesPrint (")\n");
+                                        else if ((j+1) % 10 == 0)
+                                            MrBayesPrint (",\n");
+                                        else
+                                            MrBayesPrint (",");
+                                        }
+                                    }
+                                    MrBayesPrint ("%s      for partition %d\n", spacer, i+1);
+                                }
+                            }
+                        }
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Revratepr (revSymDirPr) ****************************************************/
+        else if (!strcmp(parmName, "Revratepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == ERROR)  /* we only allow symmetric dirichlet prior, so no need to store the value */
+                    {
+                    MrBayesPrint ("%s   Invalid Revratepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        sscanf (tkn, "%lf", &tempD);
+                        if (tempD <= 0.0)
+                            {
+                            MrBayesPrint ("%s   Symmetric Dirichlet parameter must be positive\n", spacer);
+                            return (ERROR);
+                            }
+                        modelParams[i].revMatSymDir = tempD;
+                        if (nApplied == 0 && numCurrentDivisions == 1)
+                            MrBayesPrint ("%s   Setting Revratepr to Symmetric Dirichlet(%1.2lf)\n", spacer, modelParams[i].revMatSymDir);
+                        else
+                            MrBayesPrint ("%s   Setting Revratepr to Symmetric Dirichlet(%1.2lf) for partition %d\n", spacer, modelParams[i].revMatSymDir, i+1);
+                        expecting  = Expecting(RIGHTPAR);
+                        }
+                    }
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Omegapr (omegaPr) **************************************************************/
+        else if (!strcmp(parmName, "Omegapr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].omegaPr, tempStr);
+                            modelParams[i].omegaDir[0] = modelParams[i].omegaDir[1] = 1.0;
+                            modelParams[i].omegaFix = 1.0;
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Omegapr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].omegaPr,"Dirichlet"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD > ALPHA_MAX)
+                                {
+                                MrBayesPrint ("%s   Dirichlet parameter cannot be greater than %1.2lf\n", spacer, ALPHA_MAX);
+                                return (ERROR);
+                                }
+                            if (tempD < ALPHA_MIN)
+                                {
+                                MrBayesPrint ("%s   Dirichlet parameter cannot be less than %1.2lf\n", spacer, ALPHA_MIN);
+                                return (ERROR);
+                                }
+                            modelParams[i].omegaDir[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Omegapr to Dirichlet(%1.2lf,%1.2lf)\n", spacer, modelParams[i].omegaDir[0], modelParams[i].omegaDir[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Omegapr to Dirichlet(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].omegaDir[0], modelParams[i].omegaDir[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].omegaPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].omegaFix = tempD;
+                            if (modelParams[i].omegaFix > KAPPA_MAX)
+                                {
+                                MrBayesPrint ("%s   Omega ratio cannot be greater than %1.2lf\n", spacer, KAPPA_MAX);
+                                return (ERROR);
+                                }
+                            if (modelParams[i].omegaFix < 0.0)
+                                {
+                                MrBayesPrint ("%s   Omega ratio cannot be less than %1.2lf\n", spacer, 0.0);
+                                return (ERROR);
+                                }
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Omegapr to Fixed(%1.2lf)\n", spacer, modelParams[i].omegaFix);
+                            else
+                                MrBayesPrint ("%s   Setting Omegapr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].omegaFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ny98omega1pr (ny98omega1pr) ********************************************************/
+        else if (!strcmp(parmName, "Ny98omega1pr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].ny98omega1pr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data. The setting is ignored.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Ny98omega1pr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].ny98omega1pr,"Beta"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].ny98omega1Beta[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].ny98omega1Beta[0] < 0 || modelParams[i].ny98omega1Beta[1] < 0)
+                                    {
+                                    MrBayesPrint ("%s   Beta parameter should be greater than 0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Ny98omega1pr to Beta(%1.2lf,%1.2lf)\n", spacer, modelParams[i].ny98omega1Beta[0], modelParams[i].ny98omega1Beta[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Ny98omega1pr to Beta(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].ny98omega1Beta[0], modelParams[i].ny98omega1Beta[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].ny98omega1pr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].ny98omega1Fixed = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Ny98omega1pr to Fixed(%1.2lf)\n", spacer, modelParams[i].ny98omega1Fixed);
+                            else
+                                MrBayesPrint ("%s   Setting Ny98omega1pr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].ny98omega1Fixed, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ny98omega3pr (ny98omega3pr) ********************************************************/
+        else if (!strcmp(parmName, "Ny98omega3pr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].ny98omega3pr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data. The setting is ignored.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Ny98omega3pr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].ny98omega3pr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].ny98omega3Uni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].ny98omega3Uni[0] >= modelParams[i].ny98omega3Uni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Ny98omega3pr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].ny98omega3Uni[0], modelParams[i].ny98omega3Uni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Ny98omega3pr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].ny98omega3Uni[0], modelParams[i].ny98omega3Uni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].ny98omega3pr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].ny98omega3Exp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Ny98omega3pr to Exponential(%1.2lf)\n", spacer, modelParams[i].ny98omega3Exp);
+                            else
+                                MrBayesPrint ("%s   Setting Ny98omega3pr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].ny98omega3Exp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].ny98omega3pr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].ny98omega3Fixed = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Ny98omega3pr to Fixed(%1.2lf)\n", spacer, modelParams[i].ny98omega3Fixed);
+                            else
+                                MrBayesPrint ("%s   Setting Ny98omega3pr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].ny98omega3Fixed, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set M3omegapr (m3omegapr) ********************************************************/
+        else if (!strcmp(parmName, "M3omegapr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].m3omegapr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data. The setting is ignored.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid M3omegapr argument\n", spacer);
+                    return (ERROR);
+                    }
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].m3omegapr,"Exponential"))
+                            {
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting M3omegapr to Exponential\n", spacer);
+                            else
+                                MrBayesPrint ("%s   Setting M3omegapr to Exponential for partition %d\n", spacer, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                if (!strcmp(tempStr,"Exponential"))
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                else
+                    expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].m3omegapr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m3omegaFixed[numVars[i]++] = tempD;
+                            if (numVars[i] == 1 || numVars[i] == 2)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].m3omegaFixed[0] >= modelParams[i].m3omegaFixed[1] || modelParams[i].m3omegaFixed[0] >= modelParams[i].m3omegaFixed[2] || modelParams[i].m3omegaFixed[1] >= modelParams[i].m3omegaFixed[2])
+                                    {
+                                    MrBayesPrint ("%s   The three omega values must be ordered, such that omega1 < omega2 < omega3\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting M3omegapr to Fixed(%1.2lf,%1.2lf,%1.2lf)\n", spacer, modelParams[i].m3omegaFixed[0], modelParams[i].m3omegaFixed[1], modelParams[i].m3omegaFixed[2]);
+                                else
+                                    MrBayesPrint ("%s   Setting M3omegapr to Fixed(%1.2lf,%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].m3omegaFixed[0], modelParams[i].m3omegaFixed[1], modelParams[i].m3omegaFixed[2], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Codoncatfreqs (codonCatFreqPr) ********************************************************/
+        else if (!strcmp(parmName, "Codoncatfreqs"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].codonCatFreqPr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing either DNA or RNA data.\
+                            Currently there is no active partition with such data. The setting is ignored.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Omegapurpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].codonCatFreqPr,"Dirichlet"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].codonCatDir[numVars[i]++] = tempD;
+                            if (numVars[i] == 1 || numVars[i] == 2)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Codoncatfreqs prior to Dirichlet(%1.2lf,%1.2lf,%1.2lf)\n", spacer, modelParams[i].codonCatDir[0], modelParams[i].codonCatDir[1], modelParams[i].codonCatDir[2]);
+                                else
+                                    MrBayesPrint ("%s   Setting Codoncatfreqs prior to Dirichlet(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].codonCatDir[0], modelParams[i].codonCatDir[1], modelParams[i].codonCatDir[2], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].codonCatFreqPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].codonCatFreqFix[numVars[i]++] = tempD;
+                            if (numVars[i] == 1 || numVars[i] == 2)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (AreDoublesEqual (modelParams[i].codonCatFreqFix[0] + modelParams[i].codonCatFreqFix[1] + modelParams[i].codonCatFreqFix[2], (MrBFlt) 1.0, (MrBFlt) 0.001) == NO)
+                                    {
+                                    MrBayesPrint ("%s   Codon category frequencies must sum to 1\n", spacer);
+                                    return (ERROR);
+                                    }
+                                
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Codoncatfreqs prior to Fixed(%1.2lf,%1.2lf,%1.2lf)\n", spacer, modelParams[i].codonCatFreqFix[0], modelParams[i].codonCatFreqFix[1], modelParams[i].codonCatFreqFix[2]);
+                                else
+                                    MrBayesPrint ("%s   Setting Codoncatfreqs prior to Fixed(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].codonCatFreqFix[0], modelParams[i].codonCatFreqFix[1], modelParams[i].codonCatFreqFix[2], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+
+        /* set Shapepr (shapePr) **************************************************************/
+        else if (!strcmp(parmName, "Shapepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN || modelParams[i].dataType == RESTRICTION || modelParams[i].dataType == STANDARD))
+                            {
+                            strcpy(modelParams[i].shapePr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing data of at least one of following type: DNA, RNA, PROTEIN, RESTRICTION, STANDARD.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Shapepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN || modelParams[i].dataType == RESTRICTION || modelParams[i].dataType == STANDARD))
+                        {
+                        if (!strcmp(modelParams[i].shapePr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].shapeUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].shapeUni[0] >= modelParams[i].shapeUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].shapeUni[1] > MAX_SHAPE_PARAM)
+                                    {
+                                    MrBayesPrint ("%s   Upper value for uniform cannot be greater than %1.2lf\n", spacer, MAX_SHAPE_PARAM);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].shapeUni[0] < MIN_SHAPE_PARAM)
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform cannot be less than %1.2lf\n", spacer, MIN_SHAPE_PARAM);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Shapepr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].shapeUni[0], modelParams[i].shapeUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Shapepr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].shapeUni[0], modelParams[i].shapeUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].shapePr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].shapeExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Shapepr to Exponential(%1.2lf)\n", spacer, modelParams[i].shapeExp);
+                            else
+                                MrBayesPrint ("%s   Setting Shapepr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].shapeExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].shapePr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].shapeFix = tempD;
+                            if (modelParams[i].shapeFix > MAX_SHAPE_PARAM)
+                                {
+                                MrBayesPrint ("%s   Shape parameter cannot be greater than %1.2lf\n", spacer, MAX_SHAPE_PARAM);
+                                return (ERROR);
+                                }
+                            if (modelParams[i].shapeFix < MIN_SHAPE_PARAM)
+                                {
+                                MrBayesPrint ("%s   Shape parameter cannot be less than %1.2lf\n", spacer, MIN_SHAPE_PARAM);
+                                return (ERROR);
+                                }
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Shapepr to Fixed(%1.2lf)\n", spacer, modelParams[i].shapeFix);
+                            else
+                                MrBayesPrint ("%s   Setting Shapepr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].shapeFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Pinvarpr (pInvarPr) ************************************************************/
+        else if (!strcmp(parmName, "Pinvarpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN))
+                            {
+                            strcpy(modelParams[i].pInvarPr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing data of at least one of the following type: DNA, RNA, PROTEIN.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Pinvarpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN))
+                        {
+                        if (!strcmp(modelParams[i].pInvarPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].pInvarUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].pInvarUni[0] >= modelParams[i].pInvarUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].pInvarUni[1] > 1.0)
+                                    {
+                                    MrBayesPrint ("%s   Upper value for uniform should be less than or equal to 1.0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Pinvarpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].pInvarUni[0], modelParams[i].pInvarUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Pinvarpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].pInvarUni[0], modelParams[i].pInvarUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].pInvarPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD > 1.0)
+                                {
+                                MrBayesPrint ("%s   Value for Pinvar should be in the interval (0, 1)\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].pInvarFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Pinvarpr to Fixed(%1.2lf)\n", spacer, modelParams[i].pInvarFix);
+                            else
+                                MrBayesPrint ("%s   Setting Pinvarpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].pInvarFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ratecorrpr (adGammaCorPr) ******************************************************/
+        else if (!strcmp(parmName, "Ratecorrpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].adGammaCorPr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing data of at least one of the following type: DNA, RNA.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Ratecorrpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                foundDash = NO;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting = Expecting(NUMBER) | Expecting(DASH);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].adGammaCorPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (foundDash == YES)
+                            tempD *= -1.0;
+                            modelParams[i].corrUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].corrUni[0] >= modelParams[i].corrUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].corrUni[1] > 1.0)
+                                    {
+                                    MrBayesPrint ("%s   Upper value for uniform should be less than or equal to 1.0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].corrUni[0] < -1.0)
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than or equal to -1.0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Ratecorrpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].corrUni[0], modelParams[i].corrUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Ratecorrpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].corrUni[0], modelParams[i].corrUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].adGammaCorPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (foundDash == YES)
+                                tempD *= -1.0;
+                            if (tempD > 1.0 || tempD < -1.0)
+                                {
+                                MrBayesPrint ("%s   Value for Ratecorrpr should be in the interval (-1, +1)\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].corrFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Ratecorrpr to Fixed(%1.2lf)\n", spacer, modelParams[i].corrFix);
+                            else
+                                MrBayesPrint ("%s   Setting Ratecorrpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].corrFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                foundDash = NO;
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER) | Expecting(DASH);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Browncorrpr (brownCorPr) ******************************************************/
+        else if (!strcmp(parmName, "Browncorrpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType == CONTINUOUS)
+                            {
+                            strcpy(modelParams[i].brownCorPr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing CONTINUOUS data.\
+                            Currently there is no active partition with such data.\n", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Browncorrpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                foundDash = NO;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting = Expecting(NUMBER) | Expecting(DASH);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType == CONTINUOUS)
+                        {
+                        if (!strcmp(modelParams[i].brownCorPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (foundDash == YES)
+                            tempD *= -1.0;
+                            modelParams[i].brownCorrUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].brownCorrUni[0] >= modelParams[i].brownCorrUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].brownCorrUni[1] > 1.0)
+                                    {
+                                    MrBayesPrint ("%s   Upper value for uniform should be less than or equal to 1.0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (modelParams[i].brownCorrUni[0] < -1.0)
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than or equal to -1.0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Browncorrpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].brownCorrUni[0], modelParams[i].brownCorrUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Browncorrpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].brownCorrUni[0], modelParams[i].brownCorrUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].brownCorPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (foundDash == YES)
+                                tempD *= -1.0;
+                            if (tempD > 1.0 || tempD < -1.0)
+                                {
+                                MrBayesPrint ("%s   Value for Browncorrpr should be in the interval (-1, +1)\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].brownCorrFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Browncorrpr to Fixed(%1.2lf)\n", spacer, modelParams[i].brownCorrFix);
+                            else
+                                MrBayesPrint ("%s   Setting Browncorrpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].brownCorrFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                foundDash = NO;
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER) | Expecting(DASH);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ratepr (ratePr) *****************************************************************/
+        else if (!strcmp(parmName, "Ratepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                            {
+                            if (!strcmp(tempStr,"Variable"))
+                                strcpy(modelParams[i].ratePr, "Dirichlet");
+                            else
+                                strcpy(modelParams[i].ratePr, tempStr);
+                            modelParams[i].ratePrDir = 1.0;
+                            if (!strcmp(tempStr,"Variable") || !strcmp(tempStr,"Fixed"))
+                                {
+                                if (tempStr[0]=='V')
+                                    strcat (tempStr," [Dirichlet(..,1,..)]");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Ratepr to %s\n", spacer, tempStr);
+                                else
+                                    MrBayesPrint ("%s   Setting Ratepr to %s for partition %d\n", spacer, tempStr, i+1);
+                                if (tempStr[0]=='V')
+                                    strcpy (tempStr,"Variable");
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Ratepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                if (!strcmp(tempStr,"Fixed") || !strcmp(tempStr,"Variable"))
+                    expecting  = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                else
+                    expecting = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting = Expecting (NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                /* find next partition to fill in */
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    if ((activeParts[i] == YES || nApplied == 0) && numVars[i] == 0)
+                        break;
+                if (i == numCurrentDivisions)
+                    {
+                    MrBayesPrint ("%s   Could not find first ratemultiplier partition\n", spacer);
+                    return (ERROR);
+                    }
+                numVars[i] = 1;
+                /* read in the parameter */
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < ALPHA_MIN || tempD > ALPHA_MAX)
+                    {
+                    MrBayesPrint ("%s   Ratemultiplier Dirichlet parameter %lf out of range\n", spacer, tempD);
+                    return (ERROR);
+                    }
+                /* set the parameter */
+                modelParams[i].ratePrDir = tempD;               
+                /* check if all partitions have been filled in */
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && numVars[i] == 0)
+                        break;
+                    }
+                /* set expecting accordingly so that we know what should be coming next */
+                if (i == numCurrentDivisions)
+                    expecting = Expecting (RIGHTPAR);
+                else
+                    expecting = Expecting (COMMA);
+                }
+            else if (expecting == Expecting (COMMA))
+                expecting = Expecting (NUMBER);
+            else if (expecting == Expecting (RIGHTPAR))
+                {
+                /* print message */
+                for (i=j=0; i<numCurrentDivisions; i++)
+                    {
+                    if (numVars[i] == 1)
+                        {
+                        j++;
+                        if (j == 1)
+                            {
+                            MrBayesPrint ("%s   Setting Ratepr to Dirichlet(%1.2f",
+                                spacer, modelParams[i].ratePrDir);
+                            }
+                        else
+                            MrBayesPrint(",%1.2f", modelParams[i].ratePrDir);
+                        }
+                    }
+                if (numCurrentDivisions == 1)
+                    MrBayesPrint (")\n");
+                else
+                    {
+                    MrBayesPrint (") for partition");
+                    if (j > 1)
+                        MrBayesPrint ("s");
+                    for (i=k=0; i<numCurrentDivisions; i++)
+                        {
+                        if (numVars[i] == 1)
+                            {
+                            k++;
+                            if (k == j && j > 1)
+                                MrBayesPrint (", and %d", i+1);
+                            else if (k == 1)
+                                MrBayesPrint (" %d", i+1);
+                            else
+                                MrBayesPrint (", %d", i+1);
+                            }
+                        }
+                    MrBayesPrint ("\n");
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Generatepr (generatePr) *****************************************************************/
+        else if (!strcmp(parmName, "Generatepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                            {
+                            if (!strcmp(tempStr,"Variable"))
+                                strcpy(modelParams[i].generatePr, "Dirichlet");
+                            else
+                                strcpy(modelParams[i].generatePr, tempStr);
+                            modelParams[i].generatePrDir = 1.0;
+                            if (!strcmp(tempStr,"Variable") || !strcmp(tempStr,"Fixed"))
+                                {
+                                if (tempStr[0]=='V')
+                                    strcat (tempStr," [Dirichlet(..,1,..)]");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Generatepr to %s\n", spacer, tempStr);
+                                else
+                                    MrBayesPrint ("%s   Setting Generatepr to %s for partition %d\n", spacer, tempStr, i+1);
+                                if (tempStr[0]=='V')
+                                    strcpy (tempStr,"Variable");
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Generatepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                if (!strcmp(tempStr,"Fixed") || !strcmp(tempStr,"Variable"))
+                    expecting  = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                else
+                    expecting = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting = Expecting (NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                /* find next partition to fill in */
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    if ((activeParts[i] == YES || nApplied == 0) && numVars[i] == 0)
+                        break;
+                if (i == numCurrentDivisions)
+                    {
+                    MrBayesPrint ("%s   Could not find first generate multiplier partition\n", spacer);
+                    return (ERROR);
+                    }
+                numVars[i] = 1;
+                /* read in the parameter */
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < ALPHA_MIN || tempD > ALPHA_MAX)
+                    {
+                    MrBayesPrint ("%s   Generate multiplier Dirichlet parameter %lf out of range\n", spacer, tempD);
+                    return (ERROR);
+                    }
+                /* set the parameter */
+                modelParams[i].generatePrDir = tempD;
+                /* check if all partitions have been filled in */
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && numVars[i] == 0)
+                        break;
+                    }
+                /* set expecting accordingly so that we know what should be coming next */
+                if (i == numCurrentDivisions)
+                    expecting = Expecting (RIGHTPAR);
+                else
+                    expecting = Expecting (COMMA);
+                }
+            else if (expecting == Expecting (COMMA))
+                expecting = Expecting (NUMBER);
+            else if (expecting == Expecting (RIGHTPAR))
+                {
+                /* print message */
+                for (i=j=0; i<numCurrentDivisions; i++)
+                    {
+                    if (numVars[i] == 1)
+                        {
+                        j++;
+                        if (j == 1)
+                            {
+                            MrBayesPrint ("%s   Setting Generatepr to Dirichlet(%1.2f",
+                                          spacer, modelParams[i].generatePrDir);
+                            }
+                        else
+                            MrBayesPrint(",%1.2f", modelParams[i].generatePrDir);
+                        }
+                    }
+                if (numCurrentDivisions == 1)
+                    MrBayesPrint (")\n");
+                else
+                    {
+                    MrBayesPrint (") for partition");
+                    if (j > 1)
+                        MrBayesPrint ("s");
+                    for (i=k=0; i<numCurrentDivisions; i++)
+                        {
+                        if (numVars[i] == 1)
+                            {
+                            k++;
+                            if (k == j && j > 1)
+                                MrBayesPrint (", and %d", i+1);
+                            else if (k == 1)
+                                MrBayesPrint (" %d", i+1);
+                            else
+                                MrBayesPrint (", %d", i+1);
+                            }
+                        }
+                    MrBayesPrint ("\n");
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Covswitchpr (covSwitchPr) ******************************************************/
+        else if (!strcmp(parmName, "Covswitchpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN))
+                            {
+                            strcpy(modelParams[i].covSwitchPr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                        {
+                        MrBayesPrint ("%s   Warning: %s can be set only for partition containing data of at least one of the following type: DNA, RNA, PROTEIN.\
+                            Currently there is no active partition with such data. ", spacer, parmName);
+                        return (ERROR);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Covswitchpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA || modelParams[i].dataType == PROTEIN))
+                        {
+                        if (!strcmp(modelParams[i].covSwitchPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].covswitchUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].covswitchUni[0] >= modelParams[i].covswitchUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Covswitchpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].covswitchUni[0], modelParams[i].covswitchUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Covswitchpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].covswitchUni[0], modelParams[i].covswitchUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].covSwitchPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].covswitchExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Covswitchpr to Exponential(%1.2lf)\n", spacer, modelParams[i].covswitchExp);
+                            else
+                                MrBayesPrint ("%s   Setting Covswitchpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].covswitchExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].covSwitchPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].covswitchFix[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Covswitchpr to Fixed(%1.4lf,%1.4lf)\n", spacer, modelParams[i].covswitchFix[0], modelParams[i].covswitchFix[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Covswitchpr to Fixed(%1.4lf,%1.4lf) for partition %d\n", spacer, modelParams[i].covswitchFix[0], modelParams[i].covswitchFix[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Symdirihyperpr (symPiPr) ******************************************************/
+        else if (!strcmp(parmName, "Symdirihyperpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                foundBeta = NO;
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (foundBeta == NO)
+                    {
+                    /* expecting to see Uniform, Exponential, or Fixed */
+                    if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                        {
+                        nApplied = NumActiveParts ();
+                        flag = 0;
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == STANDARD || modelParams[i].dataType == RESTRICTION))
+                                {
+                                strcpy(modelParams[i].symPiPr, tempStr);
+                                flag = 1;
+                                }
+                            }
+                        if (flag == 0)
+                            {
+                            MrBayesPrint ("%s   Warning: %s can be set only for partition containing data", spacer, parmName);
+                            MrBayesPrint ("  of at least one of the following type: STANDARD, RESTRICTION.");
+                            MrBayesPrint ("Currently there is no active partition with such data. ");
+                            return (ERROR);
+                            }
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Invalid Symdirihyperpr argument\n", spacer);
+                        return (ERROR);
+                        }
+                    expecting  = Expecting(LEFTPAR);
+                    for (i=0; i<numCurrentDivisions; i++)
+                        numVars[i] = 0;
+                    foundBeta = YES;    
+                    }   
+                else
+                    {
+                    /* expecting infinity */
+                    if (IsSame("Infinity", tkn) == SAME || IsSame("Infinity", tkn) == CONSISTENT_WITH)
+                        {
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == STANDARD || modelParams[i].dataType == RESTRICTION))
+                                {
+                                if (!strcmp(modelParams[i].symPiPr, "Fixed"))
+                                    {
+                                    modelParams[i].symBetaFix = -1;
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("%s   Setting Symdirihyperpr to Beta(Infinity)\n", spacer);
+                                    else
+                                        MrBayesPrint ("%s   Setting Symdirihyperpr to Beta(Infinity) for partition %d\n", spacer, i+1);
+                                    expecting  = Expecting(RIGHTPAR);
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Problem setting Symdirihyperpr\n", spacer);
+                                    return (ERROR);
+                                    }
+                                }
+                            }
+                        expecting  = Expecting(RIGHTPAR);
+                        }
+                    }       
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == STANDARD || modelParams[i].dataType == RESTRICTION))
+                        {
+                        if (!strcmp(modelParams[i].symPiPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].symBetaFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Symdirihyperpr to Fixed(%1.2lf)\n", spacer, modelParams[i].symBetaFix);
+                            else
+                                MrBayesPrint ("%s   Setting Symdirihyperpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].symBetaFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].symPiPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].symBetaExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Symdirihyperpr to Exponential(%1.2lf)\n", spacer, modelParams[i].symBetaExp);
+                            else
+                                MrBayesPrint ("%s   Setting Symdirihyperpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].symBetaExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].symPiPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].symBetaUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)    
+                                expecting = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].symBetaUni[0] >= modelParams[i].symBetaUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Symdirihyperpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].symBetaUni[0], modelParams[i].symBetaUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Symdirihyperpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].symBetaUni[0], modelParams[i].symBetaUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Problem setting Symdirihyperpr\n", spacer);
+                            return (ERROR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Statefreqpr (stateFreqPr) ******************************************************/
+        else if (!strcmp(parmName, "Statefreqpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsSame ("Equal", tkn) == DIFFERENT && IsSame ("Empirical", tkn) == DIFFERENT)
+                    {
+                    /* the user wants to specify a dirichlet or fixed prior */
+                    if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                        {
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                                strcpy(modelParams[i].stateFreqPr, tempStr);
+                            }
+                        /* if (flag == 0)
+                            {
+                            MrBayesPrint ("%s   Warning: %s can be set only for partition containing CONTINUOUS data.\
+                            Currently there is no active partition with such data. ", spacer, parmName);
+                            return (ERROR);
+                            } */
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Invalid Statefreqpr argument\n", spacer);
+                        return (ERROR);
+                        }
+                    /* TODO: Here we set flat dirichlet parameters */
+                    expecting  = Expecting(LEFTPAR);
+                    }
+                else
+                    {
+                    /* the user wants equal or empirical state frequencies */
+                    nApplied = NumActiveParts ();
+                    if (IsSame ("Equal", tkn) == SAME || IsSame ("Equal", tkn) == CONSISTENT_WITH)
+                        {
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                                strcpy(modelParams[i].stateFreqsFixType, "Equal");
+                            }
+                        }
+                    else if (IsSame ("Empirical", tkn) == SAME || IsSame ("Empirical", tkn) == CONSISTENT_WITH)
+                        {
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                                strcpy(modelParams[i].stateFreqsFixType, "Empirical");
+                            }
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Invalid Statefreqpr delimiter\n", spacer);
+                        return (ERROR);
+                        }
+                    expecting  = Expecting(RIGHTPAR);
+                    }
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                tempNumStates = 0;
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                sscanf (tkn, "%lf", &tempD);
+                tempStateFreqs[tempNumStates++] = tempD;
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                        if (!strcmp(modelParams[i].stateFreqPr,"Fixed"))
+                            strcpy(modelParams[i].stateFreqsFixType, "User");
+                    }
+                expecting = Expecting(COMMA) | Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType != CONTINUOUS)
+                        {
+                        ns = NumStates(i);
+                        if (!strcmp(modelParams[i].stateFreqPr,"Dirichlet"))
+                            {
+                            if (tempNumStates == 1)
+                                {
+                                for (j=0; j<ns; j++)
+                                    modelParams[i].stateFreqsDir[j] = tempStateFreqs[0] / ns;
+                                MrBayesPrint ("%s   Setting Statefreqpr to Dirichlet(", spacer);
+                                for (j=0; j<ns; j++)
+                                    {
+                                    MrBayesPrint("%1.2lf", modelParams[i].stateFreqsDir[j]);
+                                    if (j == ns - 1)
+                                        MrBayesPrint (")");
+                                    else
+                                        MrBayesPrint (","); 
+                                    }   
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("\n");
+                                else
+                                    MrBayesPrint (" for partition %d\n", i+1); 
+                                modelParams[i].numDirParams = ns;
+                                }
+                            else
+                                {
+                                if (tempNumStates != ns)
+                                    {
+                                    MrBayesPrint ("%s   Found %d dirichlet parameters but expecting %d\n", spacer, tempNumStates, modelParams[i].nStates);
+                                    return (ERROR);
+                                    }
+                                else
+                                    {
+                                    modelParams[i].numDirParams = ns;
+                                    for (j=0; j<ns; j++)
+                                        modelParams[i].stateFreqsDir[j] = tempStateFreqs[j];
+                                    MrBayesPrint ("%s   Setting Statefreqpr to Dirichlet(", spacer);
+                                    for (j=0; j<ns; j++)
+                                        {
+                                        MrBayesPrint("%1.2lf", modelParams[i].stateFreqsDir[j]);
+                                        if (j == ns - 1)
+                                            MrBayesPrint (")");
+                                        else
+                                            MrBayesPrint (","); 
+                                        }   
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("\n");
+                                    else
+                                        MrBayesPrint (" for partition %d\n", i+1); 
+                                    }
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed"))
+                            {
+                            if (tempNumStates == 0)
+                                {
+                                if (!strcmp(modelParams[i].stateFreqsFixType, "Equal"))
+                                    MrBayesPrint ("%s   Setting Statefreqpr to Fixed(Equal)", spacer);
+                                else if (!strcmp(modelParams[i].stateFreqsFixType, "Empirical"))
+                                    MrBayesPrint ("%s   Setting Statefreqpr to Fixed(Empirical)", spacer);
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("\n");
+                                else
+                                    MrBayesPrint (" for partition %d\n", i+1); 
+                                }
+                            else 
+                                {
+                                if (tempNumStates == ns)
+                                    {
+                                    sum = 0.0;
+                                    for (j=0; j<ns; j++)
+                                        sum += tempStateFreqs[j];
+                                    if (AreDoublesEqual (sum, (MrBFlt) 1.0, (MrBFlt) 0.001) == NO)
+                                        {
+                                        MrBayesPrint ("%s   State frequencies do not sum to 1.0\n", spacer);
+                                        return (ERROR);
+                                        }
+                                    strcpy(modelParams[i].stateFreqsFixType, "User");
+                                    for (j=0; j<ns; j++)
+                                        modelParams[i].stateFreqsFix[j] = tempStateFreqs[j];
+                                    MrBayesPrint ("%s   Setting Statefreqpr to Fixed(", spacer);
+                                    for (j=0; j<ns; j++)
+                                        {
+                                        MrBayesPrint("%1.2lf", modelParams[i].stateFreqsFix[j]);
+                                        if (j == ns - 1)
+                                            MrBayesPrint (")");
+                                        else
+                                            MrBayesPrint (","); 
+                                        }   
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("\n");
+                                    else
+                                        MrBayesPrint (" for partition %d\n", i+1); 
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s   Found %d state frequencies but expecting %d\n", spacer, tempNumStates, modelParams[i].nStates);
+                                    return (ERROR);
+                                    }
+                                }
+                                
+                            }
+                        }
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Topologypr (topologyPr) ********************************************************/
+        else if (!strcmp(parmName, "Topologypr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                foundEqual = YES;
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (foundEqual == YES)
+                    {
+                    if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                        {
+                        /* set topology prior */
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if (activeParts[i] == YES || nApplied == 0)
+                                {
+                                strcpy(modelParams[i].topologyPr, tempStr);
+                                /* erase previous constraints, if any */
+                                for (j=0; j<numDefinedConstraints; j++)
+                                    modelParams[i].activeConstraints[j] = NO;
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Topologypr to %s\n", spacer, modelParams[i].topologyPr);
+                                else
+                                    MrBayesPrint ("%s   Setting Topologypr to %s for partition %d\n", spacer, modelParams[i].topologyPr, i+1);
+                                /* adjust branch length prior if necessary */
+                                if (strcmp(modelParams[i].topologyPr,"Fixed") != 0 && strcmp(modelParams[i].brlensPr,"Fixed") == 0)
+                                    {
+                                    MrBayesPrint ("%s   Resetting Brlenspr to default\n", spacer);
+                                    if (strcmp(modelParams[i].clockPr,"Clock") == 0)
+                                        strcpy(modelParams[i].brlensPr, "Uniform");
+                                    else
+                                        strcpy(modelParams[i].brlensPr, defaultModel.brlensPr);
+                                    }
+                                }
+                            }
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Invalid Topologypr argument\n", spacer);
+                        return (ERROR);
+                        }
+                    /* make sure we know what to do next */
+                    if (!strcmp(tempStr, "Uniform") || !strcmp(tempStr, "Speciestree"))
+                        expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    else
+                        expecting = Expecting(LEFTPAR);
+                    foundEqual = NO;
+                    }
+                else
+                    {
+                    /* find out whether we need a tree name or constraint name */
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        if (activeParts[i] == YES || nApplied == 0)
+                            break;
+
+                    if (foundDash == YES)   /* we must be collecting constraint numbers */
+                        {
+                        MrBayesPrint ("%s   Expecting a number\n", spacer);
+                        return (ERROR);
+                        }
+                    if (!strcmp(modelParams[i].topologyPr,"Constraints"))
+                        {
+                        /* find constraint number */
+                        if (CheckString (constraintNames, numDefinedConstraints, tkn, &index) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not find constraint named %s\n", spacer, tkn);
+                            return (ERROR);
+                            }
+                        tempActiveConstraints[index] = YES;
+                        expecting = Expecting(RIGHTPAR);
+                        expecting |= Expecting(COMMA);
+                        }
+                    else
+                        {
+                        /* find tree number */
+                        if (GetUserTreeFromName (&index, tkn) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set fixed topology from user tree '%s'\n", spacer, tkn);
+                            return (ERROR);
+                            }
+                        fromI = index + 1;        /* fromI is used to hold the index of the user tree, 1-based */
+                        expecting = Expecting(RIGHTPAR);
+                        }
+                    }
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                for (i=0; i<numDefinedConstraints; i++)
+                    tempActiveConstraints[i] = NO;
+                fromI = toJ = -1;
+                foundDash = foundComma = NO;
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                /* find out whether we need a tree number or constraint number */
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (activeParts[i] == YES || nApplied == 0)
+                        break;
+
+                if (!strcmp(modelParams[i].topologyPr,"Constraints"))
+                    {
+                    if (numDefinedConstraints == 0)
+                        {
+                        MrBayesPrint ("%s   No constraints have been defined\n", spacer);
+                        return (ERROR);
+                        }
+                    sscanf (tkn, "%d", &tempInt);
+                    if (tempInt > numDefinedConstraints)
+                        {
+                        MrBayesPrint ("%s   Constraint number is too large\n", spacer);
+                        return (ERROR);
+                        }
+                    if (fromI == -1)
+                        {
+                        if (foundDash == YES)
+                            {
+                            MrBayesPrint ("%s   Unexpected dash\n", spacer);
+                            return (ERROR);
+                            }
+                        fromI = tempInt;
+                        tempActiveConstraints[fromI-1] = YES;
+                        }
+                    else if (fromI != -1 && toJ == -1 && foundDash == YES && foundComma == NO)
+                        {
+                        toJ = tempInt;
+                        //for (i=fromI-1; i<toJ; i++)
+                        for (i=fromI; i<toJ; i++)
+                            tempActiveConstraints[i] = YES;
+                        fromI = toJ = -1;
+                        foundDash = NO;
+                        }
+                    else if (fromI != -1 && toJ == -1 && foundDash == NO && foundComma == YES)
+                        {
+                        fromI = tempInt;
+                        tempActiveConstraints[fromI-1] = YES;
+                        foundComma = NO;
+                        }
+                    expecting  = Expecting(COMMA);
+                    expecting |= Expecting(DASH);
+                    expecting |= Expecting(RIGHTPAR);
+                    }
+                else /* if (!strcmp(modelParams[i].topologyPr,"Fixed")) */
+                    {
+                    if (numUserTrees == 0)
+                        {
+                        MrBayesPrint ("%s   No user trees have been defined\n", spacer);
+                        return (ERROR);
+                        }
+                    sscanf (tkn, "%d", &tempInt);
+                    if (tempInt > numUserTrees)
+                        {
+                        MrBayesPrint ("%s   Tree number is too large\n", spacer);
+                        return (ERROR);
+                        }
+                    if (tempInt < 1)
+                        {
+                        MrBayesPrint ("%s   Tree number is too small\n", spacer);
+                        return (ERROR);
+                        }
+                    fromI = tempInt;
+                    expecting = Expecting(RIGHTPAR);    /* only one tree number acceptable */
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                foundComma = YES;
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                /* find out whether we need a tree number or constraint number(s) */
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (activeParts[i] == YES || nApplied == 0)
+                        break;
+
+                if (!strcmp(modelParams[i].topologyPr,"Constraints"))
+                    {
+                    /* set constraints */
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            modelParams[i].numActiveConstraints = 0;
+                            for (j=0; j<numDefinedConstraints; j++)
+                                {
+                                if (tempActiveConstraints[j] == YES)
+                                    {
+                                    modelParams[i].activeConstraints[j] = YES;
+                                    modelParams[i].numActiveConstraints++;
+                                    }
+                                else
+                                    modelParams[i].activeConstraints[j] = NO;
+                                }
+                            if (modelParams[i].numActiveConstraints == 0)
+                                {
+                                MrBayesPrint ("%s   No constraints have been defined\n", spacer);
+                                return (ERROR);
+                                }
+                            }
+                        }
+                    }
+                else /* if (!strcmp(modelParams[i].topologyPr,"Constraints")) */
+                    {
+                    /* set start tree index */
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            modelParams[i].topologyFix = fromI-1;
+                        }
+                    }
+#               if 0
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    MrBayesPrint ("%4d -- ", i+1);
+                    for (j=0; j<numDefinedConstraints; j++)
+                        MrBayesPrint (" %d", modelParams[i].activeConstraints[j]);
+                    MrBayesPrint ("\n");
+                    }
+#               endif               
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Nodeagepr (nodeAgePr) ********************************************************/
+        else if (!strcmp(parmName, "Nodeagepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].nodeAgePr, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Nodeagepr to %s\n", spacer, modelParams[i].nodeAgePr);
+                            else
+                                MrBayesPrint ("%s   Setting Nodeagepr to %s for partition %d\n", spacer, modelParams[i].nodeAgePr, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Nodeagepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Clockvarpr (clockVarPr) ********************************************************/
+        else if (!strcmp(parmName, "Clockvarpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (strcmp(tempStr, "Bm") == 0)
+                        strcpy(tempStr, "TK02");
+                    else if (strcmp(tempStr, "Ibr") == 0)
+                        strcpy(tempStr, "Igr");
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].clockVarPr, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Clockvarpr to %s\n", spacer, modelParams[i].clockVarPr);
+                            else
+                                MrBayesPrint ("%s   Setting Clockvarpr to %s for partition %d\n", spacer, modelParams[i].clockVarPr, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Clockvarpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Brlenspr (brlensPr) ************************************************************/
+        else if (!strcmp(parmName, "Brlenspr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = NO;
+                foundEqual = YES;
+                foundLeftPar = NO;
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (foundEqual == YES)
+                    {
+                    if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                        {
+                        strcpy (colonPr, tempStr);
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            if (activeParts[i] == YES || nApplied == 0)
+                                strcpy(modelParams[i].brlensPr, tempStr);
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Invalid Brlenspr argument\n", spacer);
+                        return (ERROR);
+                        }
+                    foundEqual = NO;
+                    if (!strcmp(colonPr,"Fixed"))
+                        expecting = Expecting(LEFTPAR);
+                    else
+                        expecting = Expecting(COLON);
+                    }
+                else if (foundLeftPar == YES)
+                    {
+                    /*process argument of fixed() prior*/
+                    /* find tree number */
+                    if (GetUserTreeFromName (&tempInt, tkn) == ERROR)
+                        {
+                        MrBayesPrint ("%s   Could not set fixed branch lengths from the user tree '%s'\n", spacer, tkn);
+                        return (ERROR);
+                        }
+                    fromI = tempInt + 1;        /* fromI is used to hold the index of the user tree, 1-based */
+                    expecting = Expecting(RIGHTPAR);
+                    foundLeftPar = NO;
+                    }
+                else
+                    {
+                    if (!strcmp(colonPr, "Unconstrained"))
+                        {
+                        /* have unconstrained branch lengths, which we expect to have a uniform or exponential distribution */
+                        nApplied = NumActiveParts ();
+                        if (IsSame ("Uniform", tkn) == SAME || IsSame ("Uniform", tkn) == CONSISTENT_WITH)
+                            {
+                            for (i=0; i<numCurrentDivisions; i++)
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].unconstrainedPr, "Uniform");
+                            }
+                        else if (IsSame ("Exponential", tkn) == SAME || IsSame ("Exponential", tkn) == CONSISTENT_WITH)
+                            {
+                            for (i=0; i<numCurrentDivisions; i++)
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].unconstrainedPr, "Exponential");
+                            }
+                        else if (IsSame ("GammaDirichlet", tkn) == SAME || IsSame ("GammaDirichlet", tkn) == CONSISTENT_WITH)
+                            {
+                            for (i=0; i<numCurrentDivisions; i++)
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].unconstrainedPr, "GammaDir");
+                            }
+                        else if (IsSame ("invGamDirichlet", tkn) == SAME || IsSame ("invGamDirichlet", tkn) == CONSISTENT_WITH)
+                            {
+                            for (i=0; i<numCurrentDivisions; i++)
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].unconstrainedPr, "invGamDir");
+                            }
+                        else if (IsSame ("twoExponential", tkn) == SAME || IsSame ("twoExponential", tkn) == CONSISTENT_WITH)
+                            {
+                            for (i=0; i<numCurrentDivisions; i++)
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].unconstrainedPr, "twoExp");
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Do not understand %s\n", spacer, tkn);
+                            return (ERROR);
+                            }
+                        expecting  = Expecting(LEFTPAR);
+                        }
+                    else if (!strcmp(colonPr, "Clock"))
+                        {
+                        /* otherwise we have a clock constraint and expect uniform, birthdeath, coalescence or fixed prior */
+                        nApplied = NumActiveParts ();
+                        if (IsSame ("Uniform", tkn) == SAME || IsSame ("Uniform", tkn) == CONSISTENT_WITH)
+                            {
+                            strcpy (clockPr, "Uniform");
+                            for (i=0; i<numCurrentDivisions; i++)
+                                {
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].clockPr, "Uniform");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Uniform\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Uniform for partition %d\n", spacer, i+1);
+                                }
+                            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        else if (IsSame ("Birthdeath", tkn) == SAME || IsSame ("Birthdeath", tkn) == CONSISTENT_WITH)
+                            {
+                            strcpy (clockPr, "Birthdeath");
+                            for (i=0; i<numCurrentDivisions; i++)
+                                {
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].clockPr, "Birthdeath");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Birthdeath\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Birthdeath for partition %d\n", spacer, i+1);
+                                }
+                            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        else if (IsSame ("Coalescence", tkn) == SAME || IsSame ("Coalescence", tkn) == CONSISTENT_WITH)
+                            {
+                            strcpy (clockPr, "Coalescence");
+                            for (i=0; i<numCurrentDivisions; i++)
+                                {
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].clockPr, "Coalescence");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Coalescence\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Coalescence for partition %d\n", spacer, i+1);
+                                }
+                            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        else if (IsSame ("Speciestreecoalescence", tkn) == SAME || IsSame ("Speciestreecoalescence", tkn) == CONSISTENT_WITH)
+                            {
+                            strcpy (clockPr, "Speciestreecoalescence");
+                            for (i=0; i<numCurrentDivisions; i++)
+                                {
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].clockPr, "Speciestreecoalescence");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Speciestreecoalescence\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Speciestreecoalescence for partition %d\n", spacer, i+1);
+                                }
+                            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        else if (IsSame ("Fossilization", tkn) == SAME || IsSame ("Fossilization", tkn) == CONSISTENT_WITH)
+                            {
+                            strcpy (clockPr, "Fossilization");
+                            for (i=0; i<numCurrentDivisions; i++)
+                                {
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].clockPr, "Fossilization");
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Fossilization\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Setting Brlenspr to Clock:Fossilization for partition %d\n", spacer, i+1);
+                                }
+                            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        else if (IsSame ("Fixed", tkn) == SAME || IsSame ("Fixed", tkn) == CONSISTENT_WITH)
+                            {
+                            strcpy (clockPr, "Fixed");
+                            for (i=0; i<numCurrentDivisions; i++)
+                                {
+                                if (activeParts[i] == YES || nApplied == 0)
+                                    strcpy(modelParams[i].clockPr, "Fixed");
+                                }
+                            expecting = Expecting(LEFTPAR);     /* Proceed with tree name */
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Do not understand %s\n", spacer, tkn);
+                            return (ERROR);
+                            }
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Do not understand %s\n", spacer, tkn);
+                        return (ERROR);
+                        }
+                    }
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                foundLeftPar = YES;
+                expecting  = Expecting(NUMBER);
+                if (!strcmp(colonPr,"Fixed") || (!strcmp(colonPr,"Clock") && !strcmp(clockPr,"Fixed")))
+                    {
+                    expecting |= Expecting(ALPHA);
+                    }
+                else
+                    {
+                    for (i=0; i<numCurrentDivisions; i++)
+                        numVars[i] = 0;
+                    }
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                if (!strcmp(colonPr, "Unconstrained"))
+                    {
+                    /* have unconstrained branch lengths */
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            if (!strcmp(modelParams[i].unconstrainedPr,"Uniform"))
+                                {
+                                sscanf (tkn, "%lf", &tempD);
+                                modelParams[i].brlensUni[numVars[i]++] = tempD;
+                                if (numVars[i] == 1)
+                                    expecting  = Expecting(COMMA);
+                                else
+                                    {
+                                    if (modelParams[i].brlensUni[0] > 0.000001)
+                                        {
+                                        MrBayesPrint ("%s   Lower value for uniform must equal 0.0\n", spacer);
+                                        return (ERROR);
+                                        }
+                                    if (modelParams[i].brlensUni[0] >= modelParams[i].brlensUni[1])
+                                        {
+                                        MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                        return (ERROR);
+                                        }
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].brlensUni[0], modelParams[i].brlensUni[1]);
+                                    else
+                                        MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].brlensUni[0], modelParams[i].brlensUni[1], i+1);
+                                    expecting  = Expecting(RIGHTPAR);
+                                    }
+                                }
+                            else if (!strcmp(modelParams[i].unconstrainedPr,"Exponential"))
+                                {
+                                sscanf (tkn, "%lf", &tempD);
+                                modelParams[i].brlensExp = tempD;
+                                if (modelParams[i].brlensExp <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Value for exponential must > 0.0\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:Exponential(%1.2lf)\n", spacer, modelParams[i].brlensExp);
+                                else
+                                    MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].brlensExp, i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            else if (!strcmp(modelParams[i].unconstrainedPr,"GammaDir"))
+                                {
+                                sscanf (tkn, "%lf", &tempD);
+                                modelParams[i].brlensDir[numVars[i]++] = tempD;
+                                if (numVars[i] == 1 || numVars[i] == 2 || numVars[i] == 3)
+                                    expecting  = Expecting(COMMA);
+                                else
+                                    {
+                                    if (modelParams[i].brlensDir[0] <= 0.0 || modelParams[i].brlensDir[1] <= 0.0 || modelParams[i].brlensDir[2] <= 0.0 || modelParams[i].brlensDir[3] <= 0.0)
+                                        {
+                                        MrBayesPrint ("%s   alphaT & betaT & a & c for GammaDir prior must > 0.0\n", spacer);
+                                        return (ERROR);
+                                        }
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:GammaDir(%1.2lf,%1.4lf,%1.2lf,%1.2lf)\n", spacer, modelParams[i].brlensDir[0], modelParams[i].brlensDir[1], modelParams[i].brlensDir[2], modelParams[i].brlensDir[3]);
+                                    else
+                                        MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:GammaDir(%1.2lf,%1.4lf,%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].brlensDir[0], modelParams[i].brlensDir[1], modelParams[i].brlensDir[2], modelParams[i].brlensDir[3], i+1);
+                                    expecting  = Expecting(RIGHTPAR);
+                                    }
+                                }
+                            else if (!strcmp(modelParams[i].unconstrainedPr,"invGamDir"))
+                                {
+                                sscanf (tkn, "%lf", &tempD);
+                                modelParams[i].brlensDir[numVars[i]++] = tempD;
+                                if (numVars[i] == 1 || numVars[i] == 2 || numVars[i] == 3)
+                                    expecting  = Expecting(COMMA);
+                                else
+                                    {
+                                    if (modelParams[i].brlensDir[0] <= 2.0 || modelParams[i].brlensDir[1] <= 0.0 || modelParams[i].brlensDir[2] <= 0.0 || modelParams[i].brlensDir[3] <= 0.0)
+                                        {
+                                        MrBayesPrint ("%s   alphaT must > 2.0, betaT & a & c for invGamDir prior must > 0.0\n", spacer);
+                                        return (ERROR);
+                                        }
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:invGamDir(%1.2lf,%1.4lf,%1.2lf,%1.2lf)\n", spacer, modelParams[i].brlensDir[0], modelParams[i].brlensDir[1], modelParams[i].brlensDir[2], modelParams[i].brlensDir[3]);
+                                    else
+                                        MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:invGamDir(%1.2lf,%1.4lf,%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].brlensDir[0], modelParams[i].brlensDir[1], modelParams[i].brlensDir[2], modelParams[i].brlensDir[3], i+1);
+                                    expecting  = Expecting(RIGHTPAR);
+                                    }
+                                }
+                            else if (!strcmp(modelParams[i].unconstrainedPr,"twoExp"))
+                                {
+                                    sscanf (tkn, "%lf", &tempD);
+                                    modelParams[i].brlens2Exp[numVars[i]++] = tempD;
+                                    if (numVars[i] == 1)
+                                        expecting  = Expecting(COMMA);
+                                    else
+                                    {
+                                        if (modelParams[i].brlens2Exp[0] <= 0.0 || modelParams[i].brlens2Exp[1] <= 0.0)
+                                            {
+                                            MrBayesPrint ("%s   Values for the two exponentials must > 0.0\n", spacer);
+                                            return (ERROR);
+                                            }
+                                        if (nApplied == 0 && numCurrentDivisions == 1)
+                                            MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:twoExp(%1.2lf,%1.2lf)\n", spacer, modelParams[i].brlens2Exp[0], modelParams[i].brlens2Exp[1]);
+                                        else
+                                            MrBayesPrint ("%s   Setting Brlenspr to Unconstrained:twoExp(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].brlens2Exp[0], modelParams[i].brlens2Exp[1], i+1);
+                                        expecting  = Expecting(RIGHTPAR);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                else if (!strcmp(colonPr,"Fixed") || !strcmp(colonPr,"Clock"))
+                    {
+                    sscanf (tkn, "%d", &tempInt);
+                    if (tempInt < 1 || tempInt > numUserTrees)
+                        {
+                        MrBayesPrint ("%s   Tree needs to be in the range %d to %d\n", spacer, 1, numUserTrees);
+                        return (ERROR);
+                        }
+                    fromI = tempInt;
+                    expecting = Expecting(RIGHTPAR);
+                    }
+                foundLeftPar = NO;
+                }
+            else if (expecting == Expecting(COLON))
+                {
+                expecting  = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                if (!strcmp(colonPr,"Fixed") || (!strcmp(colonPr,"Clock") && !strcmp(clockPr,"Fixed")))
+                    {
+                    /* index of a tree which set up branch lengths*/
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            modelParams[i].brlensFix = fromI-1;
+                        if (!strcmp(colonPr,"Fixed"))
+                            {
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Brlenspr to Fixed(%s)\n", spacer, userTree[fromI-1]->name);
+                            else
+                                MrBayesPrint ("%s   Setting Brlenspr to Fixed(%s) for partition %d\n", spacer, userTree[fromI-1]->name, i+1);
+                            }
+                        else
+                            {
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Brlenspr to Fixed(%s)\n", spacer, userTree[fromI-1]->name);
+                            else
+                                MrBayesPrint ("%s   Setting Brlenspr to Fixed(%s) for partition %d\n", spacer, userTree[fromI-1]->name, i+1);
+                            }
+                        }
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Speciationpr (speciationPr) *************************************************/
+        else if (!strcmp(parmName, "Speciationpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].speciationPr, tempStr);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Speciationpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].speciationPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].speciationUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].speciationUni[0] >= modelParams[i].speciationUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Speciationpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].speciationUni[0], modelParams[i].speciationUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Speciationpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].speciationUni[0], modelParams[i].speciationUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].speciationPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Exponential parameter must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].speciationExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Speciationpr to Exponential(%1.2lf)\n", spacer, modelParams[i].speciationExp);
+                            else
+                                MrBayesPrint ("%s   Setting Speciationpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].speciationExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].speciationPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Net speciation rate must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].speciationFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Speciationpr to Fixed(%1.2lf)\n", spacer, modelParams[i].speciationFix);
+                            else
+                                MrBayesPrint ("%s   Setting Speciationpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].speciationFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Extinctionpr (extinctionPr) *************************************************/
+        else if (!strcmp(parmName, "Extinctionpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].extinctionPr, tempStr);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Extinctionpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].extinctionPr,"Beta"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Beta parameter must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].extinctionBeta[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Extinctionpr to Beta(%1.2lf,%1.2lf)\n", spacer, modelParams[i].extinctionBeta[0], modelParams[i].extinctionBeta[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Extinctionpr to Beta(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].extinctionBeta[0], modelParams[i].extinctionBeta[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].extinctionPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < 0.0 || tempD >= 1.0)
+                                {
+                                MrBayesPrint ("%s   Relative extinction rate must be in range [0,1)\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].extinctionFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Extinctionpr to Fixed(%1.2lf)\n", spacer, modelParams[i].extinctionFix);
+                            else
+                                MrBayesPrint ("%s   Setting Extinctionpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].extinctionFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Fossilizationpr (fossilizationPr) */
+        else if (!strcmp(parmName, "Fossilizationpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].fossilizationPr, tempStr);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Fossilization argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].fossilizationPr,"Beta"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Beta parameter must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].fossilizationBeta[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Fossilizationpr to Beta(%1.2lf,%1.2lf)\n", spacer, modelParams[i].fossilizationBeta[0], modelParams[i].fossilizationBeta[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Fossilizationpr to Beta(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].fossilizationBeta[0], modelParams[i].fossilizationBeta[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].fossilizationPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < 0.0 || tempD > 1.0)
+                                {
+                                MrBayesPrint ("%s   Relative fossilization rate must be in the range (0,1]\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].fossilizationFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Fossilizationpr to Fixed(%1.2lf)\n", spacer, modelParams[i].fossilizationFix);
+                            else
+                                MrBayesPrint ("%s   Setting Fossilizationpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].fossilizationFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set SampleStrat (sampleStrat) ***************************************************/
+        else if (!strcmp(parmName, "Samplestrat"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].sampleStrat, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting SampleStrat to %s\n", spacer, modelParams[i].sampleStrat);
+                            else
+                                MrBayesPrint ("%s   Setting SampleStrat to %s for partition %d\n", spacer, modelParams[i].sampleStrat, i+1);
+                            if (!strcmp(modelParams[i].sampleStrat,"Random") || !strcmp(modelParams[i].sampleStrat,"Diversity"))
+                                {
+                                foundFSNum[i] = foundFSTime[i] = NO;
+                                modelParams[i].sampleFSNum = 0;
+                                numVars[i] = 0;
+                                expecting  = Expecting(NUMBER);
+                                expecting |= Expecting(PARAMETER);
+                                expecting |= Expecting(SEMICOLON);
+                                }
+                            else
+                                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Samplestrat argument\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (foundFSNum[i] == NO)
+                            {
+                            sscanf (tkn, "%d", &tempInt);
+                            if (tempInt <= 0)
+                                {
+                                MrBayesPrint ("%s   Number of fossil slice sampling events must be > 0\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].sampleFSNum = tempInt;
+                            if (memAllocs[ALLOC_SAMPLEFOSSILSLICE] == YES)
+                                {
+                                free(modelParams[i].sampleFSProb);
+                                free(modelParams[i].sampleFSTime);
+                                }
+                            modelParams[i].sampleFSTime = (MrBFlt *) SafeMalloc ((size_t)tempInt * sizeof(MrBFlt));
+                            modelParams[i].sampleFSProb = (MrBFlt *) SafeMalloc ((size_t)tempInt * sizeof(MrBFlt));
+                            memAllocs[ALLOC_SAMPLEFOSSILSLICE] = YES;
+                            foundFSNum[i] = YES;
+                            expecting  = Expecting(COLON);
+                            }
+                        else if (foundFSTime[i] == NO)
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Time of fossil slice sampling events must be > 0.\n", spacer);
+                                return (ERROR);
+                                }
+                            if (numVars[i] > 0 && modelParams[i].sampleFSTime[numVars[i]-1] < tempD)
+                                {
+                                MrBayesPrint ("%s   Time of fossil slice sampling events must be in decreasing order\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].sampleFSTime[numVars[i]] = tempD;
+                            foundFSTime[i] = YES;
+                            expecting  = Expecting(NUMBER);
+                            }
+                        else
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < 0.0 || tempD > 1.0)
+                                {
+                                MrBayesPrint ("%s   Prob of fossil slice sampling events must be in [0,1]\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].sampleFSProb[numVars[i]] = tempD;
+                            foundFSTime[i] = NO;
+                            expecting  = Expecting(COMMA);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting %d FSTime FSProb to %1.2lf %1.6lf\n", spacer, numVars[i]+1,
+                                              modelParams[i].sampleFSTime[numVars[i]], modelParams[i].sampleFSProb[numVars[i]]);
+                            else
+                                MrBayesPrint ("%s   Setting %d FSTime FSProb to %1.2lf %1.6lf for partition %d\n", spacer, numVars[i]+1,
+                                              modelParams[i].sampleFSTime[numVars[i]], modelParams[i].sampleFSProb[numVars[i]], i+1);
+                            numVars[i]++;
+                            if (numVars[i] == modelParams[i].sampleFSNum)
+                                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COLON) || expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Sampleprob (sampleProb) *****************************************************/
+        else if (!strcmp(parmName, "Sampleprob"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0))
+                        {
+                        sscanf (tkn, "%lf", &tempD);
+                        if (tempD <= 0.0 || tempD > 1.0)
+                            {
+                            MrBayesPrint ("%s   Sampleprob should be in range (0,1]\n", spacer);
+                            return (ERROR);
+                            }
+                        modelParams[i].sampleProb = tempD;
+                        if (nApplied == 0 && numCurrentDivisions == 1)
+                            MrBayesPrint ("%s   Setting Sampleprob to %1.8lf\n", spacer, modelParams[i].sampleProb);
+                        else
+                            MrBayesPrint ("%s   Setting Sampleprob to %1.8lf for partition %d\n", spacer, modelParams[i].sampleProb, i+1);
+                        }
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Treeagepr (treeAgePr) *******************************************************/
+        else if (!strcmp(parmName, "Treeagepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].treeAgePr.name, tempStr);
+                            if (!strcmp(tempStr,"Fixed"))
+                                modelParams[i].treeAgePr.prior = fixed;
+                            else if (!strcmp(tempStr,"Uniform"))
+                                modelParams[i].treeAgePr.prior = uniform;
+                            else if (!strcmp(tempStr,"Offsetexponential"))
+                                modelParams[i].treeAgePr.prior = offsetExponential;
+                            else if (!strcmp(tempStr,"Truncatednormal"))
+                                modelParams[i].treeAgePr.prior = truncatedNormal;
+                            else if (!strcmp(tempStr,"Lognormal"))
+                                modelParams[i].treeAgePr.prior = logNormal;
+                            else if (!strcmp(tempStr,"Offsetlognormal"))
+                                modelParams[i].treeAgePr.prior = offsetLogNormal;
+                            else if (!strcmp(tempStr,"Gamma"))
+                                modelParams[i].treeAgePr.prior = standardGamma;
+                            else if (!strcmp(tempStr,"Offsetgamma"))
+                                modelParams[i].treeAgePr.prior = offsetGamma;
+                            }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Treeagepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (activeParts[i] == YES || nApplied == 0)
+                        strcat(modelParams[i].treeAgePr.name, "(");
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                sprintf (tempStr, "%1.2lf", tempD);
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (numVars[i] == 0 && tempD < 0.0)
+                            {
+                            if (modelParams[i].treeAgePr.prior == uniform ||
+                                modelParams[i].treeAgePr.prior == offsetExponential ||
+                                modelParams[i].treeAgePr.prior == truncatedNormal ||
+                                modelParams[i].treeAgePr.prior == offsetLogNormal ||
+                                modelParams[i].treeAgePr.prior == offsetGamma)
+                                MrBayesPrint("%s   Minimum, offset or truncation point must be nonnegative\n", spacer);
+                            else if (modelParams[i].treeAgePr.prior == fixed)
+                                MrBayesPrint("%s   Fixed age must be nonnegative\n", spacer);
+                            else
+                                MrBayesPrint("%s   Mean must be nonnegative\n", spacer);
+                            break;
+                            }
+                        else if (numVars[i] == 1)
+                            {
+                            if (modelParams[i].treeAgePr.prior == uniform && tempD <= modelParams[i].treeAgePr.priorParams[0])
+                                {
+                                MrBayesPrint("%s   Max of uniform distribution must be larger than min\n", spacer);
+                                break;
+                                }
+                            else if ((modelParams[i].treeAgePr.prior == standardGamma || modelParams[i].treeAgePr.prior == logNormal) && tempD <= 0.0)
+                                {
+                                MrBayesPrint("%s   Standard deviation must be positive\n", spacer);
+                                break;
+                                }
+                            else if ((modelParams[i].treeAgePr.prior == offsetExponential ||
+                                      modelParams[i].treeAgePr.prior == offsetGamma ||
+                                      modelParams[i].treeAgePr.prior == offsetLogNormal) && tempD <= modelParams[i].treeAgePr.priorParams[0])
+                                {
+                                MrBayesPrint("%s   Mean must be larger than offset\n", spacer);
+                                break;
+                                }
+                            }
+                        else if (numVars[i] == 2 && tempD <= 0.0)
+                            {
+                            MrBayesPrint("%s   Standard deviation must be positive\n", spacer);
+                            break;
+                            }
+                        modelParams[i].treeAgePr.priorParams[numVars[i]++] = tempD;
+                        sprintf (tempStr, "%1.2lf", tempD);
+                        strcat(modelParams[i].treeAgePr.name, tempStr);
+                        if (modelParams[i].treeAgePr.prior == fixed || numVars[i] == 3)
+                            expecting = Expecting(RIGHTPAR);
+                        else if (numVars[i] == 1)
+                            expecting = Expecting(COMMA);
+                        else if (modelParams[i].treeAgePr.prior == standardGamma ||
+                                 modelParams[i].treeAgePr.prior == uniform ||
+                                 modelParams[i].treeAgePr.prior == offsetExponential ||
+                                 modelParams[i].treeAgePr.prior == logNormal)
+                            expecting = Expecting(RIGHTPAR);
+                        else
+                            expecting = Expecting(COMMA);
+                        }
+                    }
+                if (i < numCurrentDivisions)
+                    {
+                    /* An error occurred. Reset calibrations and bail out */
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].treeAgePr.name, "Gamma(1.00,1.00)");
+                            modelParams[i].treeAgePr.prior = standardGamma;
+                            modelParams[i].treeAgePr.priorParams[0] = 1.0;
+                            modelParams[i].treeAgePr.priorParams[1] = 1.0;
+                            modelParams[i].treeAgePr.priorParams[2] = -1.0;
+                            modelParams[i].treeAgePr.min = 0.0;
+                            modelParams[i].treeAgePr.max = POS_INFINITY;
+                            }
+                        }
+                    return (ERROR);
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (activeParts[i] == YES || nApplied == 0)
+                        strcat(modelParams[i].treeAgePr.name, ",");
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        strcat(modelParams[i].treeAgePr.name, ")");
+                        MrBayesPrint ("%s   Setting Treeagepr to %s\n", spacer, modelParams[i].treeAgePr.name);
+
+                        if (modelParams[i].treeAgePr.prior == fixed)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbFix;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioFix;
+                            modelParams[i].treeAgePr.min           = modelParams[i].treeAgePr.priorParams[0];
+                            modelParams[i].treeAgePr.max           = modelParams[i].treeAgePr.priorParams[0];
+                            }
+                        else if (modelParams[i].treeAgePr.prior == uniform)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbUniform;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioUniform;
+                            modelParams[i].treeAgePr.min           = modelParams[i].treeAgePr.priorParams[0];
+                            modelParams[i].treeAgePr.max           = modelParams[i].treeAgePr.priorParams[1];
+                            }
+                        else if (modelParams[i].treeAgePr.prior == offsetExponential)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbOffsetExponential_Param_Offset_Mean;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioOffsetExponential_Param_Offset_Mean;
+                            modelParams[i].treeAgePr.min           = modelParams[i].treeAgePr.priorParams[0];
+                            modelParams[i].treeAgePr.max           = POS_INFINITY;
+                            }
+                        else if (modelParams[i].treeAgePr.prior == truncatedNormal)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbTruncatedNormal_Param_Trunc_Mean_Sd;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioTruncatedNormal_Param_Trunc_Mean_Sd;
+                            modelParams[i].treeAgePr.min           = modelParams[i].treeAgePr.priorParams[0];
+                            modelParams[i].treeAgePr.max           = POS_INFINITY;
+                            }
+                        else if (modelParams[i].treeAgePr.prior == logNormal)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbLognormal_Param_Mean_Sd;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioLognormal_Param_Mean_Sd;
+                            modelParams[i].treeAgePr.min           = 0.0;
+                            modelParams[i].treeAgePr.max           = POS_INFINITY;
+                            }
+                        else if (modelParams[i].treeAgePr.prior == offsetLogNormal)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbOffsetLognormal_Param_Offset_Mean_Sd;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioOffsetLognormal_Param_Offset_Mean_Sd;
+                            modelParams[i].treeAgePr.min           = modelParams[i].treeAgePr.priorParams[0];
+                            modelParams[i].treeAgePr.max           = POS_INFINITY;
+                            }
+                        else if (modelParams[i].treeAgePr.prior == standardGamma)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbGamma_Param_Mean_Sd;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioGamma_Param_Mean_Sd;
+                            modelParams[i].treeAgePr.min           = 0.0;
+                            modelParams[i].treeAgePr.max           = POS_INFINITY;
+                            }
+                        else if (modelParams[i].treeAgePr.prior == offsetGamma)
+                            {
+                            modelParams[i].treeAgePr.LnPriorProb   = &LnPriorProbOffsetGamma_Param_Offset_Mean_Sd;
+                            modelParams[i].treeAgePr.LnPriorRatio  = &LnProbRatioOffsetGamma_Param_Offset_Mean_Sd;
+                            modelParams[i].treeAgePr.min           = modelParams[i].treeAgePr.priorParams[0];
+                            modelParams[i].treeAgePr.max           = POS_INFINITY;
+                            }
+                        }
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Clockratepr (clockRatePr) ****************************************************/
+        else if (!strcmp(parmName, "Clockratepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                foundDash = NO;
+                expecting = Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].clockRatePr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Clockratepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                expecting |= Expecting(DASH);   /* negative numbers possible */
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (foundDash == YES)
+                    {
+                    foundDash = NO;
+                    tempD *= -1.0;
+                    }
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].clockRatePr,"Normal"))
+                            {
+                            if (tempD <= 0.0)
+                                {
+                                if (numVars[i] == 0)
+                                    MrBayesPrint ("%s   Mean of the normal must be positive\n", spacer);
+                                else if (numVars[i] == 1)
+                                    MrBayesPrint ("%s   Standard deviation of the normal must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].clockRateNormal[numVars[i]] = tempD;
+                            numVars[i]++;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 || numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Clockratepr to Normal(%1.6lf,%1.6lf)\n", spacer, modelParams[i].clockRateNormal[0], modelParams[i].clockRateNormal[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Clockratepr to Normal(%1.6lf,%1.6lf) for partition %d\n", spacer, modelParams[i].clockRateNormal[0], modelParams[i].clockRateNormal[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].clockRatePr,"Lognormal"))
+                            {
+                            modelParams[i].clockRateLognormal[numVars[i]] = tempD;
+                            numVars[i]++;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 || numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Clockratepr to Lognormal(%1.2lf,%1.2lf)\n", spacer, modelParams[i].clockRateLognormal[0], modelParams[i].clockRateLognormal[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Clockratepr to Lognormal(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].clockRateLognormal[0], modelParams[i].clockRateLognormal[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].clockRatePr,"Exponential"))
+                            {
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Rate of the exponential must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].clockRateExp = tempD;
+                            numVars[i]++;
+                            if (nApplied == 0 || numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Clockratepr to Exponential(%1.2lf)\n", spacer, modelParams[i].clockRateExp);
+                            else
+                                MrBayesPrint ("%s   Setting Clockratepr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].clockRateExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].clockRatePr,"Gamma"))
+                            {
+                            if (tempD <= 0.0)
+                                {
+                                if (numVars[i] == 0)
+                                    MrBayesPrint ("%s   Shape of the gamma must be positive\n", spacer);
+                                else if (numVars[i] == 1)
+                                    MrBayesPrint ("%s   Rate (inverse scale) of the gamma must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].clockRateGamma[numVars[i]] = tempD;
+                            numVars[i]++;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 || numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Clockratepr to Gamma(%1.2lf,%1.2lf)\n", spacer, modelParams[i].clockRateGamma[0], modelParams[i].clockRateGamma[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Clockratepr to Gamma(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].clockRateGamma[0], modelParams[i].clockRateGamma[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].clockRatePr,"Fixed"))
+                            {
+                            if (tempD <= 0.0)
+                                {
+                                MrBayesPrint ("%s   Fixed clock rate must be positive\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].clockRateFix = tempD;
+                            numVars[i]++;
+                            if (nApplied == 0 || numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Clockratepr to Fixed(%1.6lf)\n", spacer, modelParams[i].clockRateFix);
+                            else
+                                MrBayesPrint ("%s   Setting Clockratepr to Fixed(%1.6lf) for partition %d\n", spacer, modelParams[i].clockRateFix, i+1);
+                            for (k=0; k<numGlobalChains; k++)
+                                {
+                                if (UpdateClockRate(tempD, k) == ERROR) 
+                                    return (ERROR);
+                                }
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Popsizepr (popSizePr) **************************************************************/
+        else if (!strcmp(parmName, "Popsizepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].popSizePr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Popsizepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].popSizePr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].popSizeUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                {
+                                if (tempD <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Lower value for Uniform must be a positive number\n", spacer);
+                                    return (ERROR);
+                                    }
+                                expecting  = Expecting(COMMA);
+                                }
+                            else
+                                {
+                                if (modelParams[i].popSizeUni[0] >= modelParams[i].popSizeUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for Uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Popsizepr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].popSizeUni[0], modelParams[i].popSizeUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Popsizepr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].popSizeUni[0], modelParams[i].popSizeUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].popSizePr,"Lognormal"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].popSizeLognormal[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                {
+                                expecting  = Expecting(COMMA);
+                                }
+                            else
+                                {
+                                if (modelParams[i].popSizeLognormal[1] <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Standard deviation of Lognormal must be a positive number\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Popsizepr to Lognormal(%1.2lf,%1.2lf)\n", spacer, modelParams[i].popSizeLognormal[0], modelParams[i].popSizeLognormal[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Popsizepr to Lognormal(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].popSizeLognormal[0], modelParams[i].popSizeLognormal[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].popSizePr,"Normal"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].popSizeNormal[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                {
+                                if (modelParams[i].popSizeNormal[0] <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Mean of Truncated Normal must be a positive number\n", spacer);
+                                    return (ERROR);
+                                    }
+                                expecting  = Expecting(COMMA);
+                                }
+                            else
+                                {
+                                if (modelParams[i].popSizeNormal[1] <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Standard deviation of Truncated Normal must be a positive number\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Popsizepr to Truncated Normal(%1.2lf,%1.2lf)\n", spacer, modelParams[i].popSizeNormal[0], modelParams[i].popSizeNormal[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Popsizepr to Truncated Normal(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].popSizeNormal[0], modelParams[i].popSizeNormal[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].popSizePr,"Gamma"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].popSizeGamma[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                {
+                                if (modelParams[i].popSizeGamma[0] <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Shape (alpha) of Gamma must be a positive number\n", spacer);
+                                    return (ERROR);
+                                    }
+                                expecting  = Expecting(COMMA);
+                                }
+                            else
+                                {
+                                if (modelParams[i].popSizeGamma[1] <= 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Rate (beta) of Gamma must be a positive number\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Popsizepr to Gamma(%1.2lf,%1.2lf)\n", spacer, modelParams[i].popSizeGamma[0], modelParams[i].popSizeGamma[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Popsizepr to Gamma(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].popSizeGamma[0], modelParams[i].popSizeGamma[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].popSizePr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (AreDoublesEqual(tempD, 0.0, ETA)==YES)
+                                {
+                                MrBayesPrint ("%s   Popsizepr cannot be fixed to 0.0\n", spacer);
+                                return (ERROR);
+                                }
+                            modelParams[i].popSizeFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Popsizepr to Fixed(%1.5lf)\n", spacer, modelParams[i].popSizeFix);
+                            else
+                                MrBayesPrint ("%s   Setting Popsizepr to Fixed(%1.5lf) for partition %d\n", spacer, modelParams[i].popSizeFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Popvarpr (popVarPr) **************************************************************/
+        else if (!strcmp(parmName, "Popvarpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].popVarPr, tempStr);
+                        
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Popvarpr to %s\n", spacer, modelParams[i].popVarPr);
+                            else
+                                MrBayesPrint ("%s   Setting Popvarpr to %s for partition %d\n", spacer, modelParams[i].popVarPr, i+1);
+                            }
+                        }
+                    expecting  = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Popvarpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Compound Poisson Process rate prior (cppRatePr) *********************************************************/
+        else if (!strcmp(parmName, "Cppratepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].cppRatePr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Cppratepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].cppRatePr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].cppRateExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Cppratepr to Exponential(%1.2lf)\n", spacer, modelParams[i].cppRateExp);
+                            else
+                                MrBayesPrint ("%s   Setting Cppratepr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].cppRateExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].cppRatePr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < CPPLAMBDA_MIN || tempD > CPPLAMBDA_MAX)
+                                {
+                                MrBayesPrint ("%s   CPP rate must be in the range %f - %f\n", spacer, CPPLAMBDA_MIN, CPPLAMBDA_MAX);
+                                return (ERROR);
+                                }
+                            modelParams[i].cppRateFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Cppratepr to Fixed(%1.2lf)\n", spacer, modelParams[i].cppRateFix);
+                            else
+                                MrBayesPrint ("%s   Setting Cppratepr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].cppRateFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Compound Poisson Process rate multiplier standard deviation (log scale) ***********************/
+        else if (!strcmp(parmName, "Cppmultdevpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].cppMultDevPr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Cppmultdevpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].cppMultDevPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < POSREAL_MIN || tempD > POSREAL_MAX)
+                                {
+                                MrBayesPrint ("%s   The log standard deviation of rate multipliers must be in the range %f - %f\n", spacer, POSREAL_MIN, POSREAL_MAX);
+                                return (ERROR);
+                                }
+                            modelParams[i].cppMultDevFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Cppmultdevpr to Fixed(%1.2lf)\n", spacer, modelParams[i].cppMultDevFix);
+                            else
+                                MrBayesPrint ("%s   Setting Cppmultdevpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].cppMultDevFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set prior for variance of lognormal of autocorrelated rates (tk02varPr) ***********************/
+        else if (!strcmp(parmName, "TK02varpr") || !strcmp(parmName,"Bmvarpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].tk02varPr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid TK02varpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].tk02varPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].tk02varUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].tk02varUni[0] >= modelParams[i].tk02varUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting TK02varpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].tk02varUni[0], modelParams[i].tk02varUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting TK02varpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].tk02varUni[0], modelParams[i].tk02varUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].tk02varPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].tk02varExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting TK02varpr to Exponential(%1.2lf)\n", spacer, modelParams[i].tk02varExp);
+                            else
+                                MrBayesPrint ("%s   Setting TK02varpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].tk02varExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].tk02varPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < TK02VAR_MIN || tempD > TK02VAR_MAX)
+                                {
+                                MrBayesPrint ("%s   Ratevar (nu) must be in the range %f - %f\n", spacer, TK02VAR_MIN, TK02VAR_MAX);
+                                return (ERROR);
+                                }
+                            modelParams[i].tk02varFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting TK02varpr to Fixed(%1.2lf)\n", spacer, modelParams[i].tk02varFix);
+                            else
+                                MrBayesPrint ("%s   Setting TK02varpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].tk02varFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set prior for shape of independent branch rate gamma distribution (igrvarPr) ***********************/
+        else if (!strcmp(parmName, "Igrvarpr") || !strcmp(parmName, "Ibrvarpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].igrvarPr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Igrvarpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].igrvarPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].igrvarUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].igrvarUni[0] >= modelParams[i].igrvarUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Igrvarpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].igrvarUni[0], modelParams[i].igrvarUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Igrvarpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].igrvarUni[0], modelParams[i].igrvarUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].igrvarPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].igrvarExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Igrvarpr to Exponential(%1.2lf)\n", spacer, modelParams[i].igrvarExp);
+                            else
+                                MrBayesPrint ("%s   Setting Igrvarpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].igrvarExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].igrvarPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < IGRVAR_MIN || tempD > IGRVAR_MAX)
+                                {
+                                MrBayesPrint ("%s   Igrvar must be in the range %f - %f\n", spacer, IGRVAR_MIN, IGRVAR_MAX);
+                                return (ERROR);
+                                }
+                            modelParams[i].igrvarFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Igrvarpr to Fixed(%1.2lf)\n", spacer, modelParams[i].igrvarFix);
+                            else
+                                MrBayesPrint ("%s   Setting Igrvarpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].igrvarFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set prior for variance of mixed relaxed clock model (mixedvarPr) ***********************/
+        else if (!strcmp(parmName, "Mixedvarpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].mixedvarPr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Mixedvarpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if (activeParts[i] == YES || nApplied == 0)
+                        {
+                        if (!strcmp(modelParams[i].mixedvarPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].mixedvarUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].mixedvarUni[0] >= modelParams[i].mixedvarUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Mixedvarpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].mixedvarUni[0], modelParams[i].mixedvarUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Mixedvarpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].mixedvarUni[0], modelParams[i].mixedvarUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].mixedvarPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].mixedvarExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Mixedvarpr to Exponential(%1.2lf)\n", spacer, modelParams[i].mixedvarExp);
+                            else
+                                MrBayesPrint ("%s   Setting Mixedvarpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].mixedvarExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].mixedvarPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (tempD < IGRVAR_MIN || tempD > IGRVAR_MAX || tempD < TK02VAR_MIN || tempD > TK02VAR_MAX)
+                                {
+                                MrBayesPrint ("%s   Mixedvar must be in the range %f - %f\n", spacer, IGRVAR_MIN, IGRVAR_MAX);
+                                return (ERROR);
+                                }
+                            modelParams[i].mixedvarFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Mixedvarpr to Fixed(%1.2lf)\n", spacer, modelParams[i].mixedvarFix);
+                            else
+                                MrBayesPrint ("%s   Setting Mixedvarpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].mixedvarFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Growthpr (growthPr) **************************************************************/
+        else if (!strcmp(parmName, "Growthpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                isNegative = NO;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                isNegative = NO;
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            strcpy(modelParams[i].growthPr, tempStr);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Growthpr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER) | Expecting(DASH);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                expecting  = Expecting(NUMBER);
+                isNegative = YES;
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].growthPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (isNegative == YES)
+                                tempD *= -1.0;
+                            modelParams[i].growthUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].growthUni[0] >= modelParams[i].growthUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Growthpr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].growthUni[0], modelParams[i].growthUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Growthpr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].growthUni[0], modelParams[i].growthUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].growthPr,"Normal"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (isNegative == YES)
+                                tempD *= -1.0;
+                            modelParams[i].growthNorm[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].growthNorm[1] < 0.0)
+                                    {
+                                    MrBayesPrint ("%s   Variance for normal distribution should be greater than zero\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Growthpr to Normal(%1.2lf,%1.2lf)\n", spacer, modelParams[i].growthNorm[0], modelParams[i].growthNorm[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Growthpr to Normal(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].growthNorm[0], modelParams[i].growthNorm[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].growthPr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].growthExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Growthpr to Exponential(%1.2lf)\n", spacer, modelParams[i].growthExp);
+                            else
+                                MrBayesPrint ("%s   Setting Growthpr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].growthExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].growthPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            if (isNegative == YES)
+                                tempD *= -1.0;
+                            modelParams[i].growthFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Growthpr to Fixed(%1.2lf)\n", spacer, modelParams[i].growthFix);
+                            else
+                                MrBayesPrint ("%s   Setting Growthpr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].growthFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                isNegative = NO;
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Aamodelpr (aaModelPr) **************************************************************/
+        else if (!strcmp(parmName, "Aamodelpr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                foundAaSetting = foundExp = modelIsFixed = foundDash = NO;
+                fromI = 0;
+                for (i=0; i<10; i++)
+                    tempAaModelPrs[i] = 0.0;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (foundAaSetting == NO)
+                    {
+                    if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                        {
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0))
+                                {
+                                strcpy(modelParams[i].aaModelPr, tempStr);
+                                if (!strcmp(modelParams[i].aaModelPr, "Mixed"))
+                                    {
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("%s   Setting Aamodelpr to %s\n", spacer, modelParams[i].aaModelPr);
+                                    else
+                                        MrBayesPrint ("%s   Setting Aamodelpr to %s for partition %d\n", spacer, modelParams[i].aaModelPr, i+1);
+                                    }
+                                }
+                            }
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Invalid Aamodelpr argument\n", spacer);
+                        return (ERROR);
+                        }
+                    foundAaSetting = YES;
+                    if (!strcmp(tempStr, "Fixed"))
+                        {
+                        modelIsFixed = YES;
+                        expecting = Expecting(LEFTPAR);
+                        }
+                    else
+                        {
+                        expecting = Expecting(LEFTPAR) | Expecting(PARAMETER) | Expecting(SEMICOLON);
+                        }
+                    }
+                else
+                    {
+                    if (modelIsFixed == YES)
+                        {
+                        if (IsSame ("Poisson", tkn) == SAME      || IsSame ("Poisson", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Poisson");
+                        else if (IsSame ("Equalin", tkn) == SAME || IsSame ("Equalin", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Equalin");
+                        else if (IsSame ("Jones", tkn) == SAME   || IsSame ("Jones", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Jones");
+                        else if (IsSame ("Dayhoff", tkn) == SAME || IsSame ("Dayhoff", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Dayhoff");
+                        else if (IsSame ("Mtrev", tkn) == SAME   || IsSame ("Mtrev", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Mtrev");
+                        else if (IsSame ("Mtmam", tkn) == SAME   || IsSame ("Mtmam", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Mtmam");
+                        else if (IsSame ("Wag", tkn) == SAME     || IsSame ("Wag", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Wag");
+                        else if (IsSame ("Rtrev", tkn) == SAME   || IsSame ("Rtrev", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Rtrev");
+                        else if (IsSame ("Cprev", tkn) == SAME   || IsSame ("Cprev", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Cprev");
+                        else if (IsSame ("Vt", tkn) == SAME      || IsSame ("Vt", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Vt");
+                        else if (IsSame ("Blosum", tkn) == SAME  || IsSame ("Blosum", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Blosum");
+                        else if (IsSame ("Blossum", tkn) == SAME || IsSame ("Blossum", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Blosum");
+                        else if (IsSame ("LG", tkn) == SAME      || IsSame ("LG", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "LG");
+                        else if (IsSame ("Gtr", tkn) == SAME     || IsSame ("Gtr", tkn) == CONSISTENT_WITH)
+                            strcpy (tempStr, "Gtr");
+                        else
+                            {
+                            MrBayesPrint ("%s   Invalid amino acid model\n", spacer);
+                            return (ERROR);
+                            }
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0))
+                                {
+                                if (!strcmp(modelParams[i].aaModelPr, "Fixed"))
+                                    {
+                                    strcpy(modelParams[i].aaModel, tempStr);
+                                    if (nApplied == 0 && numCurrentDivisions == 1)
+                                        MrBayesPrint ("%s   Setting Aamodelpr to Fixed(%s)\n", spacer, modelParams[i].aaModel);
+                                    else
+                                        MrBayesPrint ("%s   Setting Aamodelpr to Fixed(%s) for partition %d\n", spacer, modelParams[i].aaModel, i+1);
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s   You cannot assign an amino acid matrix for mixed models\n", spacer);
+                                    return (ERROR);
+                                    }
+                                }
+                            }
+                        expecting = Expecting(RIGHTPAR);
+                        }
+                    else
+                        {
+                        if (IsSame ("Exponential", tkn) == SAME || IsSame ("Exponential", tkn) == CONSISTENT_WITH)
+                            {
+                            foundExp = YES;
+                            expecting = Expecting(LEFTPAR);
+                            }
+                        else    
+                            {
+                            MrBayesPrint ("%s   Invalid argument \"%s\"\n", spacer, tkn);
+                            return (ERROR);
+                            }
+                        }
+
+                    }
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (fromI >= 10)
+                    {
+                    MrBayesPrint ("%s   Too many arguments in Aamodelpr\n", spacer);
+                    return (ERROR);
+                    }
+                if (modelIsFixed == NO)
+                    {
+                    if (foundExp == YES)
+                        {
+                        if (foundDash == YES)
+                            tempAaModelPrs[fromI++] = -tempD;
+                        else
+                            tempAaModelPrs[fromI++] = tempD;
+                        expecting  = Expecting(RIGHTPAR);
+                        }
+                    else
+                        {
+                        if (foundDash == YES)
+                            {
+                            MrBayesPrint ("%s   Unexpected \"-\" in Aamodelpr\n", spacer);
+                            return (ERROR);
+                            }
+                        else
+                            {
+                            if (tempD <= 0.000000000001)
+                                tempAaModelPrs[fromI++] = -1000000000;
+                            else
+                                tempAaModelPrs[fromI++] = (MrBFlt) log(tempD);
+                            }
+                        expecting  = Expecting(COMMA) | Expecting(RIGHTPAR);
+                        }
+                    foundDash = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Not expecting a number\n", spacer);
+                    return (ERROR);
+                    }
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                if (modelIsFixed == YES)
+                    expecting  = Expecting(ALPHA);
+                else
+                    {
+                    if (foundExp == YES)
+                        expecting  = Expecting(NUMBER) | Expecting(DASH);
+                    else
+                        expecting  = Expecting(NUMBER) | Expecting(ALPHA);
+                    }
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                if (modelIsFixed == YES)
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                else
+                    {
+                    if (foundExp == YES)
+                        {
+                        foundExp = NO;
+                        expecting = Expecting(COMMA) | Expecting(RIGHTPAR);
+                        }
+                    else    
+                        {
+                        if (fromI < 10)
+                            {
+                            MrBayesPrint ("%s   Too few arguments in Aamodelpr\n", spacer);
+                            return (ERROR);
+                            }
+                        nApplied = NumActiveParts ();
+                        for (i=0; i<numCurrentDivisions; i++)
+                            {
+                            if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType == PROTEIN)
+                                {
+                                if (!strcmp(modelParams[i].aaModelPr, "Fixed"))
+                                    {
+                                    MrBayesPrint ("%s   You cannot assign model prior probabilities for a fixed amino acid model\n", spacer);
+                                    return (ERROR);
+                                    }
+                                else
+                                    {
+                                    for (j=0; j<10; j++)
+                                        modelParams[i].aaModelPrProbs[j] = tempAaModelPrs[j];
+                                    }
+                                }
+                            }
+                        expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                        }
+                    }               
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                if (foundExp == YES)
+                    {
+                    foundDash = YES;
+                    expecting  = Expecting(NUMBER);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument \"%s\"\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                if (modelIsFixed == YES)
+                    {
+                    MrBayesPrint ("%s   Not expecting \"%s\"\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                else
+                    expecting  = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else
+                return (ERROR);
+            }       
+        /* set Brownscalepr (brownScalesPr) ****************************************************/
+        else if (!strcmp(parmName, "Brownscalepr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType == CONTINUOUS)
+                            {
+                            strcpy(modelParams[i].brownScalesPr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                            {
+                            MrBayesPrint ("%s   Warning: %s can be set only for partition containing CONTINUOUS data.\
+                            Currently there is no active partition with such data. ", spacer, parmName);
+                            return (ERROR);
+                            }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid Brownscalepr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && modelParams[i].dataType == CONTINUOUS)
+                        {
+                        if (!strcmp(modelParams[i].brownScalesPr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].brownScalesUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].brownScalesUni[0] >= modelParams[i].brownScalesUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brownscalepr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].brownScalesUni[0], modelParams[i].brownScalesUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Brownscalepr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].brownScalesUni[0], modelParams[i].brownScalesUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].brownScalesPr,"Gamma"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].brownScalesGamma[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting Brownscalepr to Gamma Mean=%1.2lf Var=%1.2lf\n", spacer, modelParams[i].brownScalesGamma[0], modelParams[i].brownScalesGamma[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting Brownscalepr to Gamma Mean=%1.2lf Var=%1.2lf for partition %d\n", spacer, modelParams[i].brownScalesGamma[0], modelParams[i].brownScalesGamma[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].brownScalesPr,"Gammamean"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].brownScalesGammaMean = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Brownscalepr to Gamma Mean=<char. ave.> Var=%1.2lf\n", spacer, modelParams[i].brownScalesGammaMean);
+                            else
+                                MrBayesPrint ("%s   Setting Brownscalepr to Gamma Mean=<char.ave.> Var=%1.2lf for partition %d\n", spacer, modelParams[i].brownScalesGammaMean, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].brownScalesPr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].brownScalesFix = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting Brownscalepr to Fixed(%1.2lf)\n", spacer, modelParams[i].brownScalesFix);
+                            else
+                                MrBayesPrint ("%s   Setting Brownscalepr to Fixed(%1.2lf) for partition %d\n", spacer, modelParams[i].brownScalesFix, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set M10betapr (m10betapr) ********************************************************/
+        else if (!strcmp(parmName, "M10betapr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].m10betapr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                            {
+                            MrBayesPrint ("%s   Warning: %s can be set only for partition containing data of at least one of the following type: DNA, RNA.\
+                            Currently there is no active partition with such data. ", spacer, parmName);
+                            return (ERROR);
+                            }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid M10betapr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].m10betapr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m10betaUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].m10betaUni[0] >= modelParams[i].m10betaUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting M10betapr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].m10betaUni[0], modelParams[i].m10betaUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting M10betapr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].m10betaUni[0], modelParams[i].m10betaUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].m10betapr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m10betaExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting M10betapr to Exponential(%1.2lf)\n", spacer, modelParams[i].m10betaExp);
+                            else
+                                MrBayesPrint ("%s   Setting M10betapr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].m10betaExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].m10betapr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m10betaFix[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting M10betapr to Fixed(%1.2lf,%1.2lf)\n", spacer, modelParams[i].m10betaFix[0], modelParams[i].m10betaFix[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting M10betapr to Fixed(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].m10betaFix[0], modelParams[i].m10betaFix[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set M10gammapr (m10gammapr) ********************************************************/
+        else if (!strcmp(parmName, "M10gammapr"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    flag = 0;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].m10gammapr, tempStr);
+                            flag = 1;
+                            }
+                        }
+                    if (flag == 0)
+                            {
+                            MrBayesPrint ("%s   Warning: %s can be set only for partition containing data of at least one of the following type: DNA, RNA.\
+                            Currently there is no active partition with such data. ", spacer, parmName);
+                            return (ERROR);
+                            }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid M10gammapr argument\n", spacer);
+                    return (ERROR);
+                    }
+                expecting  = Expecting(LEFTPAR);
+                for (i=0; i<numCurrentDivisions; i++)
+                    numVars[i] = 0;
+                }
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                nApplied = NumActiveParts ();
+                for (i=0; i<numCurrentDivisions; i++)
+                    {
+                    if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                        {
+                        if (!strcmp(modelParams[i].m10gammapr,"Uniform"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m10gammaUni[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (modelParams[i].m10gammaUni[0] >= modelParams[i].m10gammaUni[1])
+                                    {
+                                    MrBayesPrint ("%s   Lower value for uniform should be greater than upper value\n", spacer);
+                                    return (ERROR);
+                                    }
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting M10gammapr to Uniform(%1.2lf,%1.2lf)\n", spacer, modelParams[i].m10gammaUni[0], modelParams[i].m10gammaUni[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting M10gammapr to Uniform(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].m10gammaUni[0], modelParams[i].m10gammaUni[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].m10gammapr,"Exponential"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m10gammaExp = tempD;
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting M10gammapr to Exponential(%1.2lf)\n", spacer, modelParams[i].m10gammaExp);
+                            else
+                                MrBayesPrint ("%s   Setting M10gammapr to Exponential(%1.2lf) for partition %d\n", spacer, modelParams[i].m10gammaExp, i+1);
+                            expecting  = Expecting(RIGHTPAR);
+                            }
+                        else if (!strcmp(modelParams[i].m10gammapr,"Fixed"))
+                            {
+                            sscanf (tkn, "%lf", &tempD);
+                            modelParams[i].m10gammaFix[numVars[i]++] = tempD;
+                            if (numVars[i] == 1)
+                                expecting  = Expecting(COMMA);
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Setting M10gammapr to Fixed(%1.2lf,%1.2lf)\n", spacer, modelParams[i].m10gammaFix[0], modelParams[i].m10gammaFix[1]);
+                                else
+                                    MrBayesPrint ("%s   Setting M10gammapr to Fixed(%1.2lf,%1.2lf) for partition %d\n", spacer, modelParams[i].m10gammaFix[0], modelParams[i].m10gammaFix[1], i+1);
+                                expecting  = Expecting(RIGHTPAR);
+                                }
+                            }
+                        }
+                    }
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                expecting  = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoQuit (void)
+{
+    int         i;
+    char        tempName[100];
+    
+    /* free information for model and matrix */
+    FreeModel ();
+    FreeMatrix ();
+    
+    SafeFclose (&logFileFp);
+    logToFile = NO;
+    
+    /* check to see if any memory has not been freed */
+    for (i=0; i<NUM_ALLOCS; i++)
+        {
+        if (memAllocs[i] == YES)
+            {
+            MrBayesPrint ("   WARNING: Memory (%d) has not been freed\n", i);
+            if (mode == INTERACTIVE && quitOnError == NO)
+                {
+                MrBayesPrint ("%s   Hit return key to continue  ", spacer);
+                fflush (stdin);
+                if (fgets (tempName, 100, stdin) == NULL)
+                    {
+                    printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+                    }
+                }
+            }
+        }
+    
+    /* free modelIndicatorParams and modelElementNames */
+    for (i=0; i<203; i++)
+        free (modelElementNames[1][i]);
+    for (i=0; i<3; i++)
+        free (modelElementNames[i]);
+    free (modelElementNames);
+    free (modelIndicatorParams);
+    
+    MrBayesPrint ("   Quitting program\n\n");
+    
+    /* If we quit while reading a mrbayes block, then we need to make certain
+     that we return a NO_ERROR_QUIT so we can break out of DoExecute cleanly,
+     and dealloc "s" there. */
+    if (inMrbayesBlock == YES)
+        {
+        inMrbayesBlock = NO;
+        return (NO_ERROR_QUIT);
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int DoReport (void)
+{
+    /* TODO: smart update */
+    if (SetUpAnalysis (&globalSeed) == ERROR)
+        return (ERROR);
+    return (NO_ERROR);
+}
+
+
+int DoReportParm (char *parmName, char *tkn)
+{
+    int         i, tempInt, nApplied;
+    char        tempStr[100];
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before the report settings can be altered\n", spacer);
+        return (ERROR);
+        }
+    if (inValidCommand == YES)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            activeParts[i] = NO;
+        inValidCommand = NO;
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Applyto (Applyto) *************************************************************/
+        if (!strcmp(parmName, "Applyto"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(LEFTPAR);
+            else if (expecting == Expecting(LEFTPAR))
+                {
+                for (i=0; i<numCurrentDivisions; i++)
+                    activeParts[i] = NO;
+                fromI = toJ = -1;
+                foundDash = NO;
+                expecting = Expecting(NUMBER) | Expecting(ALPHA);
+                }
+            else if (expecting == Expecting(RIGHTPAR))
+                {
+                if (fromI != -1)
+                    activeParts[fromI-1] = YES;
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else if (expecting == Expecting(COMMA))
+                {
+                foundComma = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsSame ("All", tkn) == DIFFERENT)
+                    {
+                    MrBayesPrint ("%s   Do not understand delimiter \"%s\"\n", spacer, tkn);
+                    return (ERROR);
+                    }
+                for (i=0; i<numCurrentDivisions; i++)
+                    activeParts[i] = YES;
+                expecting  = Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempInt);
+                if (tempInt > numCurrentDivisions)
+                    {
+                    MrBayesPrint ("%s   Partition delimiter is too large\n", spacer);
+                    return (ERROR);
+                    }
+                if (fromI == -1)
+                    fromI = tempInt;
+                else if (fromI != -1 && toJ == -1 && foundDash == YES && foundComma == NO)
+                    {
+                    toJ = tempInt;
+                    for (i=fromI-1; i<toJ; i++)
+                        activeParts[i] = YES;
+                    fromI = toJ = -1;
+                    foundDash = NO;
+                    }
+                else if (fromI != -1 && toJ == -1 && foundDash == NO && foundComma == YES)
+                    {
+                    activeParts[fromI-1] = YES;
+                    fromI = tempInt;
+                    foundComma = NO;
+                    }
+                    
+                expecting  = Expecting(COMMA);
+                expecting |= Expecting(DASH);
+                expecting |= Expecting(RIGHTPAR);
+                }
+            else if (expecting == Expecting(DASH))
+                {
+                foundDash = YES;
+                expecting = Expecting(NUMBER);
+                }
+            else
+                return (ERROR);
+            }
+        /* set report format of tratio ***************************************************/
+        else if (!strcmp(parmName, "Tratio"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    tempInt = NO;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        /* check that data type is correct; we do not know yet if the user will specify
+                        a nst=2 model so we cannot check that tratio is an active parameter */
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].tratioFormat, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting transition/transversion rate ratio (tratio) format to %s\n", spacer, modelParams[i].tratioFormat);
+                            else
+                                MrBayesPrint ("%s   Setting transition/transversion rate ratio (tratio) format to %s for partition %d\n", spacer, modelParams[i].tratioFormat, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid transition/transversion rate ratio (tratio) format \n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set report format of revmat ***************************************************/
+        else if (!strcmp(parmName, "Revmat"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    tempInt = NO;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        /* check that data type is correct; we do not know yet if the user will specify
+                           a nst=6 model so we cannot check that revmat is an active parameter */
+                        if ((activeParts[i] == YES || nApplied == 0) && (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA))
+                            {
+                            strcpy(modelParams[i].revmatFormat, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting reversible rate matrix (revmat) format to %s\n", spacer, modelParams[i].revmatFormat);
+                            else
+                                MrBayesPrint ("%s   Setting reversible rate matrix (revmat) format to %s for partition %d\n", spacer, modelParams[i].revmatFormat, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid reversible rate matrix (revmat) format \n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set report format of ratemult *************************************************/
+        else if (!strcmp(parmName, "Ratemult"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    tempInt = NO;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        /* we do not know yet if the user will specify variable rates across partitions 
+                           so only check that we have more than one partition in the model */
+                        if ((activeParts[i] == YES || nApplied == 0) && numCurrentDivisions > 1)
+                            {
+                            strcpy(modelParams[i].ratemultFormat, tempStr);
+                            if (nApplied == 0 && numCurrentDivisions == 1)
+                                MrBayesPrint ("%s   Setting rate multiplier (ratemult) format to %s\n", spacer, modelParams[i].ratemultFormat);
+                            else
+                                MrBayesPrint ("%s   Setting rate multiplier (ratemult) format to %s for partition %d\n", spacer, modelParams[i].ratemultFormat, i+1);
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid rate multiplier (ratemult) format \n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set report format of tree ***************************************************/
+        else if (!strcmp(parmName, "Tree"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    tempInt = NO;
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        strcpy(modelParams[i].treeFormat, tempStr);
+                        if (nApplied == 0 && numCurrentDivisions == 1)
+                            MrBayesPrint ("%s   Setting tree report format to %s\n", spacer, modelParams[i].treeFormat);
+                        else
+                            MrBayesPrint ("%s   Setting tree report format to %s for partition %d\n", spacer, modelParams[i].treeFormat, i+1);
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid tree report format \n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set inferancstates ***********************************************************/
+        else if (!strcmp(parmName, "Ancstates"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy(modelParams[i].inferAncStates,tempStr);
+                            if (!strcmp(tempStr,"Yes"))
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Reporting ancestral states (if applicable)\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Reporting ancestral states for partition %d (if applicable)\n", spacer, i+1);
+                                }
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Not reporting ancestral states\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Not reporting ancestral states for partition %d\n", spacer, i+1);
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid ancstates option\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set inferSiteRates ***************************************************************/
+        else if (!strcmp(parmName, "Siterates"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy (modelParams[i].inferSiteRates, tempStr);
+                            if (!strcmp(tempStr,"Yes"))
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Reporting site rates (if applicable)\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Reporting site rates for partition %d (if applicable)\n", spacer, i+1);
+                                }
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Not reporting site rates\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Not reporting site rates for partition %d\n", spacer, i+1);
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid siterates option\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set inferpossel *************************************************************/
+        else if (!strcmp(parmName, "Possel"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy (modelParams[i].inferPosSel, tempStr);
+                            if (!strcmp(tempStr, "Yes"))
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Reporting positive selection (if applicable)\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Reporting positive selection for partition %d (if applicable)\n", spacer, i+1);
+                                }
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Not reporting positive selection\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Not reporting positive selection for partition %d\n", spacer, i+1);
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid possel option\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set inferSiteOmegas *************************************************************/
+        else if (!strcmp(parmName, "Siteomega"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting (ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    nApplied = NumActiveParts ();
+                    for (i=0; i<numCurrentDivisions; i++)
+                        {
+                        if (activeParts[i] == YES || nApplied == 0)
+                            {
+                            strcpy (modelParams[i].inferSiteOmegas, tempStr);
+                            if (!strcmp(tempStr, "Yes"))
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Reporting site omega values (if applicable)\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Reporting site omega values for partition %d (if applicable)\n", spacer, i+1);
+                                }
+                            else
+                                {
+                                if (nApplied == 0 && numCurrentDivisions == 1)
+                                    MrBayesPrint ("%s   Not reporting site omega values\n", spacer);
+                                else
+                                    MrBayesPrint ("%s   Not reporting site omega values for partition %d\n", spacer, i+1);
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid siteomega option\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            {
+            return (ERROR);
+            }
+        }
+
+    return (NO_ERROR);      
+}
+
+
+int DoStartvals (void)
+{
+    MrBayesPrint ("%s   Successfully set starting values\n", spacer);
+    /*
+    for (i=0; i<numParams; i++)
+        assert (IsTreeConsistent(&params[i], 0, 0) == YES);
+    */
+    return (NO_ERROR);
+}
+
+
+int DoStartvalsParm (char *parmName, char *tkn)
+{
+    int                 i, j, k, nMatches, tempInt, treeIndex, chainId, ret;
+    MrBFlt              tempFloat, *value, *subValue;
+    Tree                *theTree, *usrTree;
+    PolyTree            *thePolyTree;
+    MrBFlt              minRate, maxRate, clockRate;
+    static Param        *param = NULL;
+    static MrBFlt       *theValue, theValueMin, theValueMax;
+    static int          useSubvalues, useStdStateFreqs, useIntValues, numExpectedValues, nValuesRead, runIndex, chainIndex, foundName, foundDash;
+    static char         *temp=NULL, *tempName=NULL;
+
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before starting values can be changed\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            /* we expect a parameter name with possible run and chain specification as follows:
+               <param_name>(<run>,<chain>)=(<number>,...)   -- apply to run <run> and chain <chain>
+               <param_name>(,<chain>)=(<number>,...)        -- apply to chain <chain> for all runs
+               <param_name>(<run>,)=(<number>,...)          -- apply to run <run> for all chains
+
+               topology and branch length parameters are specified like
+               <param_name>(<run>,<chain>)=<tree_name>|<Newick_tree_spec>
+
+               parameter names will often be followed by partition specifiers like:
+               pi{all}
+               pinvar{1,4,5}
+               so we need to assemble the parameter name from several tokens that are parsed out separately;
+               here we receive only the first part (before the left curly, if present)
+            */
+            
+            /* copy to local parameter name */
+            SafeStrcpy (&tempName, tkn);
+            param = NULL;
+            runIndex = chainIndex = -1;
+            useSubvalues = NO;
+            useIntValues = NO;
+            useStdStateFreqs = NO;
+            foundComma = foundEqual = foundName = foundDash = NO;
+            expecting = Expecting(LEFTCURL) | Expecting(LEFTPAR) |  Expecting(EQUALSIGN);
+            }
+        else
+            return (ERROR);
+        }
+    else if (expecting == Expecting(ALPHA))
+        {
+        if (param == NULL)
+            {
+            /* we are still assembling the parameter name */
+            SafeStrcat (&tempName, tkn);
+            expecting = Expecting(RIGHTCURL) | Expecting(COMMA) | Expecting(LEFTPAR) | Expecting(EQUALSIGN);
+            }
+        else
+            {
+            /* we have a tree name; now find the tree based on name, case insensitive */
+            if (GetUserTreeFromName (&treeIndex, tkn) == ERROR || treeIndex == -1)
+                {
+                MrBayesPrint ("%s   Error in finding user tree\n", spacer);
+                return (ERROR);
+                }
+
+            /* set the tree parameter */
+            for (i=0; i<chainParams.numRuns; i++)
+                {
+                if (runIndex != -1 && i != runIndex)
+                    continue;
+                for (j=0; j<chainParams.numChains; j++)
+                    {
+                    if (chainIndex != -1 && j != chainIndex)
+                        continue;
+                    chainId = i*chainParams.numChains + j;
+                    if (param->paramType != P_POPSIZE)
+                        {
+                        if (param->paramType == P_TOPOLOGY || param->paramType == P_BRLENS || param->paramType == P_SPECIESTREE)
+                            {
+                            /* topology or brlens or speciestree params */
+                            theTree = GetTree (param, chainId, 0);
+                            usrTree = GetTree (param, chainId, 1); /* use as scratch space */
+                            }
+                        else
+                            {
+                            /* relaxed clock params */
+                            theTree = GetTree (modelSettings[param->relParts[0]].brlens, chainId, 0);
+                            usrTree = GetTree (modelSettings[param->relParts[0]].brlens, chainId, 1);
+                            }
+                        CopyToTreeFromTree (usrTree, theTree);
+                        if (param->paramType == P_SPECIESTREE)
+                            thePolyTree = AllocatePolyTree(numSpecies);
+                        else
+                            thePolyTree = AllocatePolyTree (numTaxa);
+                        CopyToPolyTreeFromPolyTree (thePolyTree, userTree[treeIndex]);
+                        if (param->paramType == P_SPECIESTREE)
+                            {
+                            ResetIntNodeIndices(thePolyTree);
+                            }
+                        else
+                            {
+                            PrunePolyTree (thePolyTree);
+                            ResetTipIndices(thePolyTree);
+                            }
+                        RandResolve (NULL, thePolyTree, &globalSeed, theTree->isRooted);
+                        GetPolyDownPass(thePolyTree);
+                        ResetIntNodeIndices(thePolyTree);
+                        if (param->paramType == P_SPECIESTREE)
+                            {
+                            ret=CopyToSpeciesTreeFromPolyTree (usrTree, thePolyTree);
+                            }
+                        else
+                            ret=CopyToTreeFromPolyTree (usrTree, thePolyTree);
+                        FreePolyTree (thePolyTree);
+                        if (ret==ERROR)
+                            return ERROR;
+                        }
+                    else
+                        {
+                        /* param->paramType == P_POPSIZE */
+                        theTree = GetTree (modelSettings[param->relParts[0]].speciesTree, chainId, 0);
+                        usrTree = GetTree (modelSettings[param->relParts[0]].speciesTree, chainId, 1);
+                        CopyToTreeFromTree (usrTree, theTree);
+                        thePolyTree = AllocatePolyTree(numSpecies);
+                        CopyToPolyTreeFromPolyTree (thePolyTree, userTree[treeIndex]);
+                        ResetIntNodeIndices(thePolyTree);
+                        RandResolve (NULL, thePolyTree, &globalSeed, theTree->isRooted);
+                        CopyToSpeciesTreeFromPolyTree (usrTree, thePolyTree);
+                        FreePolyTree (thePolyTree);
+                        }
+                    if (param->paramType == P_TOPOLOGY)
+                        {
+                        if (theTree->checkConstraints == YES && CheckSetConstraints (usrTree) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set the constraints for topology parameter '%s'\n", spacer, param->name);
+                            return (ERROR);
+                            }
+                        if (ResetTopologyFromTree (theTree, usrTree) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set the topology parameter '%s'\n", spacer, param->name);
+                            return (ERROR);
+                            }
+                        if (theTree->checkConstraints == YES && CheckSetConstraints (theTree)==ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set the constraints for topology parameter '%s'\n", spacer, param->name);
+                            return (ERROR);
+                            }
+                        FillTopologySubParams (param, chainId, 0, &globalSeed);
+                        //MrBayesPrint ("%s   Branch lengths and relaxed clock subparameters of a parameter '%s' are reset.\n", spacer, param->name);
+                        if (param->paramId == TOPOLOGY_SPECIESTREE)
+                            FillSpeciesTreeParams(&globalSeed, chainId, chainId+1);
+                        //assert (IsTreeConsistent(param, chainId, 0) == YES);
+                        }
+                    else if (param->paramType == P_BRLENS)
+                        {
+                        if (usrTree->allDownPass[0]->length == 0.0 && param->paramId != BRLENS_CLOCK_FOSSIL)
+                            {
+                            MrBayesPrint ("%s   User tree '%s' does not have branch lengths so it cannot be used in setting parameter '%s'\n", spacer, userTree[treeIndex]->name, param->name);
+                            return (ERROR);
+                            }
+                        if (AreTopologiesSame (theTree, usrTree) == NO)
+                            {
+                            MrBayesPrint ("%s   Topology of user tree '%s' wrong in setting parameter '%s'\n", spacer, userTree[treeIndex]->name, param->name);
+                            return (ERROR);
+                            }
+                        //assert (IsTreeConsistent(param, chainId, 0) == YES);
+                        /* reset node depths to ensure that non-dated tips have node depth 0.0 */
+                        /* if (usrTree->isClock == YES)
+                            SetNodeDepths(usrTree);  */
+                        if (ResetBrlensFromTree (theTree, usrTree) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set parameter '%s' from user tree '%s'\n", spacer, param->name, userTree[treeIndex]->name);
+                            return (ERROR);
+                            }
+                        if (theTree->isClock == YES && modelParams[theTree->relParts[0]].treeAgePr.prior == fixed)
+                            {
+                            if (!strcmp(modelParams[theTree->relParts[0]].clockPr,"Uniform")
+                                || !strcmp(modelParams[theTree->relParts[0]].clockPr,"Fossilization"))
+                                ResetRootHeight (theTree, modelParams[theTree->relParts[0]].treeAgePr.priorParams[0]);
+                            }
+                        /* the test will find suitable clock rate and ages of nodes in theTree */
+                        if (theTree->isClock == YES && IsClockSatisfied (theTree,0.001) == NO)
+                            {
+                            MrBayesPrint ("%s   Non-calibrated tips are not at the same level after setting up starting tree branch lengthes(%s) from user tree '%s'.\n",
+                                          spacer, param->name, userTree[treeIndex]->name);
+                            ShowNodes(theTree->root,0,YES);
+                            return (ERROR);
+                            }
+                        if (theTree->isCalibrated == YES && IsCalibratedClockSatisfied (theTree, &minRate,&maxRate, 0.001) == NO)
+                            {
+                            MrBayesPrint ("%s   Problem setting calibrated tree parameters\n", spacer);
+                            return (ERROR);
+                            }
+                        if (theTree->isCalibrated == YES && !strcmp(modelParams[theTree->relParts[0]].clockRatePr, "Fixed"))
+                            {
+                            clockRate = modelParams[theTree->relParts[0]].clockRateFix;
+                            if ((clockRate < minRate && AreDoublesEqual (clockRate, minRate , 0.001) == NO) || (clockRate > maxRate && AreDoublesEqual (clockRate, maxRate , 0.001) == NO))
+                                {
+                                MrBayesPrint("%s   Fixed branch lengths do not satisfy fixed clockrate\n", spacer);
+                                return (ERROR);
+                                }
+                            }
+                        theTree->fromUserTree=YES;
+                        
+                        FillBrlensSubParams (param, chainId, 0);
+                        //MrBayesPrint ("%s   Rrelaxed clock subparamiters of a parameter '%s' are reset.\n", spacer, param->name);
+                        //assert (IsTreeConsistent(param, chainId, 0) == YES);
+                        if (param->paramId == BRLENS_CLOCK_SPCOAL)
+                            FillSpeciesTreeParams(&globalSeed, chainId, chainId+1);
+                        //assert (IsTreeConsistent(param, chainId, 0) == YES);
+                        }
+                    else if (param->paramType == P_CPPEVENTS || param->paramType == P_TK02BRANCHRATES ||
+                             param->paramType == P_IGRBRANCHRATES || param->paramType == P_MIXEDBRCHRATES)
+                        {
+                        if (theTree->isCalibrated == YES && theTree->fromUserTree == NO)
+                            { /* if theTree is not set from user tree then we can not garanty that branch lenghts will stay the same
+                                 by the time we start mcmc run because of clockrate adjustment. */
+                            MrBayesPrint ("%s    Set starting values for branch lengthes first before setting starting values of relaxed parameters!\n", spacer);
+                            return (ERROR);
+                            }
+                        if (theTree->isCalibrated == NO && IsClockSatisfied (usrTree, 0.001) == NO) // user tree is not calibrated so do not check it if calibration is in place
+                            {
+                            MrBayesPrint ("%s   Branch lengths of the user tree '%s' do not satisfy clock in setting parameter '%s'\n", spacer, userTree[treeIndex], param->name);
+                            ShowNodes(usrTree->root,0,YES);
+                            return (ERROR);
+                            }
+                        if (AreTopologiesSame (theTree, usrTree) == NO)
+                            {
+                            MrBayesPrint ("%s   Topology of user tree '%s' is wrong in setting parameter '%s'\n", spacer, userTree[treeIndex]->name, param->name);
+                            return (ERROR);
+                            }
+                        if (SetRelaxedClockParam (param, chainId, 0, userTree[treeIndex]) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set parameter '%s' from user tree '%s'\n", spacer, param->name, userTree[treeIndex]->name);
+                            return (ERROR);
+                            }
+                        //assert (IsTreeConsistent(param, chainId, 0) == YES);
+                        }
+                    else if (param->paramType == P_POPSIZE)
+                        {
+                        if (AreTopologiesSame (theTree, usrTree) == NO)
+                            {
+                            MrBayesPrint ("%s   Topology of user tree '%s' is wrong in setting parameter '%s'\n", spacer, userTree[treeIndex]->name, param->name);
+                            return (ERROR);
+                            }
+                        if (SetPopSizeParam (param, chainId, 0, userTree[treeIndex]) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set parameter '%s' from user tree '%s'\n", spacer, param->name, userTree[treeIndex]->name);
+                            return (ERROR);
+                            }
+                        }
+                    else if (param->paramType == P_SPECIESTREE)
+                        {
+                        if (IsSpeciesTreeConsistent (usrTree, chainId) == NO)
+                            {
+                            MrBayesPrint ("%s   User-specified species tree '%s' is inconsistent with gene trees\n", spacer, userTree[treeIndex]->name);
+                            return (ERROR);
+                            }
+                        if (CopyToTreeFromTree (theTree, usrTree) == ERROR)
+                            {
+                            MrBayesPrint ("%s   Could not set the species tree parameter '%s'\n", spacer, param->name);
+                            return (ERROR);
+                            }
+                        //assert (IsTreeConsistent(param, chainId, 0) == YES);
+                        }
+                    }
+                }
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            }
+        }
+    else if (expecting == Expecting(LEFTCURL))
+        {
+        /* we are still assembling the parameter name */
+        SafeStrcat (&tempName, tkn);
+        expecting = Expecting(NUMBER) | Expecting(ALPHA) | Expecting(LEFTPAR) | Expecting(EQUALSIGN);
+        }
+    else if (expecting == Expecting(RIGHTCURL))
+        {
+        /* we are still assembling the parameter name */
+        SafeStrcat (&tempName, tkn);
+        foundComma = NO; /*! if there was a comma in the partition part, we should reset this variable. Otherwise we can't parse something like A{1,2}(3,4) */
+        expecting = Expecting(LEFTPAR) | Expecting(EQUALSIGN);
+        }
+    else if (expecting == Expecting(LEFTPAR))
+        {
+        if (foundEqual == NO)
+            {
+            foundName = YES;    /* we found the name */
+            /* we will be reading in run and chain indices */
+            expecting = Expecting(NUMBER) | Expecting(COMMA);
+            }
+        else
+            {
+            expecting = Expecting(NUMBER);
+            expecting |= Expecting(DASH);
+            }
+        }
+    else if (expecting == Expecting(DASH))
+        {
+        foundDash = YES;
+        expecting = Expecting(NUMBER);
+        }
+    else if (expecting == Expecting(NUMBER))
+        {
+        if (foundName == NO)
+            {
+            /* we are still assembling the parameter name */
+            SafeStrcat (&tempName, tkn);
+            expecting = Expecting(COMMA) | Expecting(LEFTPAR) | Expecting(RIGHTCURL) | Expecting(EQUALSIGN);
+            }
+        else if (foundEqual == YES)
+            {
+            theValueMin = param->min;
+            theValueMax = param->max;
+
+            /* we are reading in a parameter value */
+            if (param->paramType==P_OMEGA && nValuesRead==numExpectedValues && useSubvalues == NO)
+                {
+                /* continue with subvalues */
+                nValuesRead = 0;
+                numExpectedValues = param->nSubValues/2;
+                useSubvalues = YES;
+                theValueMin = ETA;
+                theValueMax = 1.0;
+                }
+            if (param->paramType==P_OMEGA && nValuesRead==numExpectedValues && useSubvalues == NO)
+                {
+                /* continue with subvalues */
+                nValuesRead = 0;
+                numExpectedValues = param->nSubValues/2;
+                useSubvalues = YES;
+                theValueMin = ETA;
+                theValueMax = 1.0;
+                }
+            if (param->nIntValues > 0 && nValuesRead==numExpectedValues && useIntValues == NO)
+                {
+                /* continue with intValues */
+                nValuesRead = 0;
+                numExpectedValues = param->nIntValues;
+                useIntValues = YES;
+                }
+            if (param->paramType==P_PI && modelSettings[param->relParts[0]].dataType == STANDARD && param->paramId != SYMPI_EQUAL
+                && nValuesRead==numExpectedValues && useStdStateFreqs == NO)
+                {
+                /* we have read alpha_symdir, continue with multistate char state freqs */
+                nValuesRead = 0;
+                numExpectedValues = param->nStdStateFreqs;
+                if (param->hasBinaryStd == YES)
+                    numExpectedValues -= 2 * modelSettings[param->relParts[0]].numBetaCats;
+                useStdStateFreqs = YES;
+                theValueMin = ETA;
+                theValueMax = 1.0;
+                }
+            nValuesRead++;
+            if (nValuesRead > numExpectedValues)
+                {
+                if (param->paramType == P_OMEGA)
+                    MrBayesPrint ("%s   Only %d values were expected for parameter '%s'\n", spacer, param->nValues+param->nSubValues/2, param->name);
+                else if (param->nIntValues > 0)   
+                    MrBayesPrint ("%s   Only %d values were expected for parameter '%s'\n", spacer, param->nValues+param->nIntValues, param->name);
+                else
+                    MrBayesPrint ("%s   Only %d values were expected for parameter '%s'\n", spacer, numExpectedValues, param->name);
+                return (ERROR);
+                }
+            if (useIntValues == YES)
+                sscanf (tkn, "%d", &tempInt);
+            else
+                sscanf (tkn, "%lf", &tempFloat);
+            if (foundDash == YES)
+                {
+                if (useIntValues == NO)
+                    tempFloat = -tempFloat;
+                else
+                    tempInt = -tempInt;
+                foundDash = NO;
+                }
+            if (useIntValues == NO && (tempFloat < theValueMin || tempFloat > theValueMax))
+                {
+                MrBayesPrint ("%s   The value is out of range (min = %lf; max = %lf)\n", spacer, theValueMin, theValueMax);
+                return (ERROR);
+                }
+            for (i=0; i<chainParams.numRuns; i++)
+                {
+                if (runIndex != -1 && runIndex != i)
+                    continue;
+                for (j=0; j<chainParams.numChains; j++)
+                    {
+                    if (chainIndex != -1 && chainIndex != j)
+                        continue;
+                    if (useIntValues == YES)
+                        {
+                        GetParamIntVals (param, i*chainParams.numChains+j, 0)[nValuesRead-1] = tempInt;
+                        }
+                    else
+                        {
+                        if (useSubvalues == NO && useStdStateFreqs == NO)
+                            theValue = GetParamVals (param, i*chainParams.numChains+j, 0);
+                        else if (useSubvalues == YES)
+                            theValue = GetParamSubVals (param, i*chainParams.numChains+j, 0);
+                        else if (useStdStateFreqs == YES)
+                            {
+                            theValue = GetParamStdStateFreqs (param, i*chainParams.numChains+j, 0);
+                            if (param->hasBinaryStd == YES)
+                                theValue += 2 * modelSettings[param->relParts[0]].numBetaCats;
+                            }
+                        else
+                            return (ERROR);
+                        if (param->paramType == P_CLOCKRATE)
+                            {
+                            if (UpdateClockRate(tempFloat, i*chainParams.numChains+j) == ERROR) 
+                                {
+                                return (ERROR);
+                                }
+                            }
+                        theValue[nValuesRead-1] = tempFloat;
+                        }
+                    }
+                }
+            expecting = Expecting (COMMA) | Expecting(RIGHTPAR);
+            }
+        else /* if (foundEqual == NO) */
+            {
+            sscanf (tkn, "%d", &tempInt);
+            if (foundComma == NO)
+                {
+                if (tempInt <= 0 || tempInt > chainParams.numRuns)
+                    {
+                    MrBayesPrint ("%s   Run index is out of range (min=1; max=%d)\n", spacer, chainParams.numRuns);
+                    return (ERROR);
+                    }
+                runIndex = tempInt - 1;
+                expecting = Expecting(COMMA);
+                }
+            else
+                {
+                if (tempInt <= 0 || tempInt > chainParams.numChains)
+                    {
+                    MrBayesPrint ("%s   Chain index is out of range (min=1; max=%d)\n", spacer, chainParams.numChains);
+                    return (ERROR);
+                    }
+                chainIndex = tempInt - 1;
+                foundComma = NO;
+                expecting = Expecting(RIGHTPAR);
+                }
+            }
+        }
+    else if (expecting == Expecting(COMMA))
+        {
+        if (foundEqual == YES)
+            {
+            /* we expect another parameter value */
+            expecting = Expecting(NUMBER);
+            }
+        else /* if (foundEqual == NO) */
+            {
+            /* we will be reading in chain index, if present */
+            foundComma = YES;
+            expecting = Expecting(RIGHTPAR) | Expecting(NUMBER); 
+            /* if the comma is in a list of partitions (so between { and }) we have to add the comma to the parameter name */
+            if (param == NULL && strchr(tempName, '}')==NULL && strchr(tempName, '{')!=NULL) 
+              SafeStrcat (&tempName, ",");
+            }
+        }
+    else if (expecting == Expecting(RIGHTPAR))
+        {
+        if (foundEqual == NO)
+            {
+            /* this is the end of the run and chain specification */
+            expecting = Expecting(EQUALSIGN);
+            }
+        else /* if (foundEqual == YES) */
+            {
+            /* this is the end of the parameter values */
+            if (nValuesRead != numExpectedValues)
+                {
+                MrBayesPrint ("%s   Expected %d values but only found %d values for parameter '%s'\n", spacer, numExpectedValues, nValuesRead, param->name);
+                return (ERROR);
+                }
+            /* Post processing needed for some parameters */
+            if (param->paramType == P_SHAPE || param->paramType == P_CORREL)
+                {
+                for (i=0; i<chainParams.numRuns; i++)
+                    {
+                    if (runIndex != -1 && runIndex != i)
+                        continue;
+                    for (j=0; j<chainParams.numChains; j++)
+                        {
+                        if (chainIndex != -1 && chainIndex != j)
+                            continue;
+                        value = GetParamVals(param,i*chainParams.numChains+j,0);
+                        subValue = GetParamSubVals(param,i*chainParams.numChains+j,0);
+                        if (param->paramType == P_SHAPE && !strncmp(param->name, "Alpha", 5))
+                            {
+                            if (DiscreteGamma (subValue, value[0], value[0], param->nSubValues, 0) == ERROR)
+                                return (ERROR);
+                            }
+                        else if (param->paramType == P_SHAPE && !strncmp(param->name, "Sigma", 5))
+                            {
+                            if( DiscreteLogNormal(subValue, value[0], param->nSubValues, 1) == ERROR)
+                                return (ERROR);
+                            }
+                        else if (param->paramType == P_CORREL)
+                            {
+                            if (AutodGamma (subValue, value[0], (int)(sqrt(param->nSubValues) + 0.5)) == ERROR)
+                                return (ERROR);
+                            }
+                        }
+                    }
+                }
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            }
+        }
+    else if (expecting == Expecting(EQUALSIGN))
+        {
+        foundEqual = YES;
+        foundName = YES;
+
+        /* we now know that the name is complete; try to find the parameter with this name (case insensitive) */
+        for (i=0; i<(int)strlen(tempName); i++)
+            tempName[i] = tolower(tempName[i]);
+        
+        /* first check exact matches */
+        nMatches = j = 0;
+        for (i=0; i<numParams; i++)
+            {
+            param = &params[i];
+            SafeStrcpy (&temp, param->name);
+            for (k=0; k<(int)(strlen(temp)); k++)
+                temp[k] = tolower(temp[k]);
+            if (strcmp(tempName,temp) == 0)
+                {
+                j = i;
+                nMatches++;
+                }
+            }
+        /* now check unambiguous abbreviation matches */
+        if (nMatches == 0)
+            {
+            nMatches = j = 0;
+            for (i=0; i<numParams; i++)
+                {
+                param = &params[i];
+                SafeStrcpy (&temp, param->name);
+                for (k=0; k<(int)strlen(temp); k++)
+                    temp[k] = tolower(temp[k]);
+                if (strncmp(tempName,temp,strlen(tempName)) == 0)
+                    {
+                    j = i;
+                    nMatches++;
+                    }
+                }
+            }
+
+        if (nMatches == 0)
+            {
+            extern char *tokenP;
+            MrBayesPrint ("%s   Could not find parameter '%s': ignoring values\n", spacer, tempName);
+            while (*tokenP && *tokenP++!=')') {}; 
+            expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+            return (*tokenP ? NO_ERROR:ERROR);
+            }
+        else if (nMatches > 1)
+            {
+            MrBayesPrint ("%s   Several parameters matched the abbreviated name '%s'\n", spacer, tempName);
+            return (ERROR);
+            }
+            
+        param = &params[j];
+        if (param->printParam == NO && !(param->paramType == P_TOPOLOGY && strcmp(modelParams[param->relParts[0]].topologyPr,"Fixed")!=0)
+                                    && !(param->paramType == P_CPPEVENTS)
+                                    && !(param->paramType == P_TK02BRANCHRATES)
+                                    && !(param->paramType == P_IGRBRANCHRATES)
+                                    && !(param->paramType == P_MIXEDBRCHRATES)
+                                    && !(param->paramType == P_POPSIZE && param->nValues > 1))
+            {
+            MrBayesPrint ("%s   The parameter '%s' is fixed so the starting value cannot be set\n", spacer, param->name);
+            return (ERROR);
+            }
+        if (param->paramType == P_BRLENS || param->paramType == P_TOPOLOGY || param->paramType == P_CPPEVENTS ||
+            param->paramType == P_TK02BRANCHRATES || param->paramType == P_IGRBRANCHRATES || param->paramType == P_MIXEDBRCHRATES ||
+            param->paramType == P_SPECIESTREE || (param->paramType == P_POPSIZE && param->nValues > 1))
+            {
+            /* all these parameters are set from a tree */
+            expecting = Expecting (ALPHA);
+            }
+        else
+            /* run of the mill character */
+            {
+            theValueMin = param->min;
+            theValueMax = param->max;
+            if ((param->paramType == P_PI && modelParams[param->relParts[0]].dataType != STANDARD))
+                {
+                useSubvalues = YES;
+                useIntValues = NO;
+                numExpectedValues = param->nSubValues;
+                }
+            else if (param->nValues == 0 && param->nIntValues > 0)
+                {
+                useSubvalues = NO;
+                useIntValues = YES;
+                numExpectedValues = param->nIntValues;
+                }
+            else if (param->nValues > 0)
+                {
+                useSubvalues = NO;
+                useIntValues = NO;
+                numExpectedValues = param->nValues;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Not expecting any values for parameter '%s'\n", spacer, param->name);
+                return (ERROR);
+                }
+            nValuesRead = 0;
+            expecting = Expecting(LEFTPAR);
+            }
+        }
+    else
+        return (ERROR);
+
+    SafeFree ((void **)&temp);
+    return (NO_ERROR);
+}
+
+
+int DoUnlink (void)
+{
+    int         i, j;
+    
+    MrBayesPrint ("%s   Unlinking\n", spacer);
+    
+    /* update status of linkTable */
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (tempLinkUnlink[j][i] == YES)
+                {
+                linkTable[j][i] = ++linkNum;
+                }
+            }
+        }
+    
+#   if 0
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        MrBayesPrint ("%s   ", spacer);
+        for (i=0; i<numCurrentDivisions; i++)
+            MrBayesPrint ("%d", linkTable[j][i]);
+        MrBayesPrint ("\n");
+        }
+#   endif
+
+    /* reinitialize the temporary table */
+    for (j=0; j<NUM_LINKED; j++)
+        for (i=0; i<numCurrentDivisions; i++)
+            tempLinkUnlink[j][i] = NO;
+
+    /* set up parameters and moves */
+    if (SetUpAnalysis (&globalSeed) == ERROR)
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoShowMcmcTrees (void)
+{
+    int         run, chain, chainIndex, i;
+    Tree        *t;
+
+    for (run=0; run<chainParams.numRuns; run++)
+        {
+        for (chain=0; chain<chainParams.numChains; chain++)
+            {
+            chainIndex = run*chainParams.numChains + chain;
+            for (i=0; i<numTrees; i++)
+                {
+                t = GetTreeFromIndex (i, chainIndex, 0);
+                if (t->isRooted == YES)
+                    MrBayesPrint ("\n   Tree '%s' [rooted]:\n\n", t->name);
+                else
+                    MrBayesPrint ("\n   Tree '%s' [unrooted]:\n\n", t->name);
+                if (ShowTree (t) == ERROR)
+                    return (ERROR);
+                else
+                    MrBayesPrint ("\n");
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoShowModel (void)
+{
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before the model can be defined\n", spacer);
+        return (ERROR);
+        }
+
+    if (ShowModel() == ERROR)
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int DoShowMoves (void)
+{
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before moves can be assigned\n", spacer);
+        return (ERROR);
+        }
+
+    MrBayesPrint ("%s   Moves that will be used by MCMC sampler (rel. proposal prob. > 0.0):\n\n", spacer);
+    if (ShowMoves(YES) == ERROR)
+        return (ERROR);
+
+    if (showmovesParams.allavailable == YES)
+        {
+        MrBayesPrint ("%s   Other available moves (rel. proposal prob. = 0.0):\n\n", spacer);
+        if (ShowMoves(NO) == ERROR)
+            return (ERROR);
+        }
+    else
+        MrBayesPrint ("%s   Use 'Showmoves allavailable=yes' to see a list of all available moves\n", spacer);
+
+    return (NO_ERROR);
+}
+
+
+int DoShowmovesParm (char *parmName, char *tkn)
+{
+    char    tempStr[100];
+    
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        /* set Allavailable **********************************************************/
+        if (!strcmp(parmName, "Allavailable"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        showmovesParams.allavailable = YES;
+                    else
+                        showmovesParams.allavailable = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for allavailable\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            return (ERROR);
+
+        }
+        
+    return (NO_ERROR);
+}
+
+
+int DoShowParams (void)
+{
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before model parameters can be shown\n", spacer);
+        return (ERROR);
+        }
+
+    if (ShowParameters(YES, YES, YES) == ERROR)
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   FillNormalParams: Allocate and fill in non-tree parameters
+|
+-------------------------------------------------------------------------*/
+int FillNormalParams (RandLong *seed, int fromChain, int toChain)
+{
+    int         i, j, k, chn, tempInt, *intValue;
+    MrBFlt      *bs, *value, *subValue, scaler;
+    Tree        *tree;
+    Param       *p;
+    ModelInfo   *m;
+    ModelParams *mp;
+
+    /* fill in values for nontree params for state 0 of chains */
+    for (chn=fromChain; chn<toChain; chn++)
+        {
+        for (k=0; k<numParams; k++)
+            {
+            p  = &params[k];
+            mp = &modelParams[p->relParts[0]];
+            m  = &modelSettings[p->relParts[0]];
+
+            /* find model settings and nStates, pInvar, invar cond likes */
+
+            value = GetParamVals (p, chn, 0);
+            subValue = GetParamSubVals (p, chn, 0);
+            intValue = GetParamIntVals (p, chn, 0);
+
+            if (p->paramType == P_TRATIO)
+                {
+                /* Fill in tratios **************************************************************************************/
+                if (p->paramId == TRATIO_DIR)
+                    value[0] = 1.0;
+                else if (p->paramId == TRATIO_FIX)
+                    value[0] = mp->tRatioFix;
+                }
+            else if (p->paramType == P_REVMAT)
+                {
+                /* Fill in revMat ***************************************************************************************/
+                /* rates are stored in order, AC or AR first, using the Dirichlet parameterization */
+                if (p->paramId == REVMAT_DIR)
+                    {
+                    for (j=0; j<p->nValues; j++)
+                        value[j] = 1.0 / (MrBFlt) (p->nValues);
+                    }
+                else if (p->paramId == REVMAT_FIX)
+                    {
+                    scaler = 0.0;
+                    if (m->dataType == PROTEIN)
+                        {
+                        for (j=0; j<190; j++)
+                            scaler += (value[j] = mp->aaRevMatFix[j]);
+                        for (j=0; j<190; j++)
+                            value[j] /= scaler;
+                        }
+                    else
+                        {
+                        for (j=0; j<6; j++)
+                            scaler += (value[j] = mp->revMatFix[j]);
+                        for (j=0; j<6; j++)
+                            value[j] /= scaler;
+                        }
+                    }
+                else if (p->paramId == REVMAT_MIX)
+                    {
+                    for (j=0; j<6; j++)
+                        {
+                        value[j] = 1.0 / 6.0;
+                        intValue[j] = 0;
+                        }
+                    }
+                }
+            else if (p->paramType == P_OMEGA)
+                {
+                /* Fill in omega ****************************************************************************************/
+                if (p->nValues == 1)
+                    {
+                    if (p->paramId == OMEGA_DIR)
+                        value[0] = 1.0;
+                    else if (p->paramId == OMEGA_FIX)
+                        value[0] = mp->omegaFix;
+                    }
+                else
+                    {
+                    if (!strcmp(mp->omegaVar, "Ny98"))
+                        {
+                        if (p->paramId == OMEGA_BUD || p->paramId == OMEGA_BUF || p->paramId == OMEGA_BED ||
+                            p->paramId == OMEGA_BEF || p->paramId == OMEGA_BFD || p->paramId == OMEGA_BFF)
+                            value[0] = RandomNumber(seed);
+                        else if (p->paramId == OMEGA_FUD || p->paramId == OMEGA_FUF || p->paramId == OMEGA_FED ||
+                                 p->paramId == OMEGA_FEF || p->paramId == OMEGA_FFD || p->paramId == OMEGA_FFF)
+                            value[0] = mp->ny98omega1Fixed;
+                        value[1] = 1.0;
+                        if (p->paramId == OMEGA_BUD || p->paramId == OMEGA_BUF || p->paramId == OMEGA_FUD ||
+                            p->paramId == OMEGA_FUF)
+                            value[2] = mp->ny98omega3Uni[0] + RandomNumber(seed) * (mp->ny98omega3Uni[1] - mp->ny98omega3Uni[0]);
+                        else if (p->paramId == OMEGA_BED || p->paramId == OMEGA_BEF || p->paramId == OMEGA_FED ||
+                                 p->paramId == OMEGA_FEF)
+                            value[2] =  (1.0 - (1.0/mp->ny98omega3Exp) * log(RandomNumber(seed)));
+                        else
+                            value[2] = mp->ny98omega3Fixed;
+                        if (p->paramId == OMEGA_BUD || p->paramId == OMEGA_BED || p->paramId == OMEGA_BFD || 
+                            p->paramId == OMEGA_FUD || p->paramId == OMEGA_FED || p->paramId == OMEGA_FFD) 
+                            {
+                            subValue[3] = mp->codonCatDir[0];
+                            subValue[4] = mp->codonCatDir[1];
+                            subValue[5] = mp->codonCatDir[2];
+                            DirichletRandomVariable (&subValue[3], &subValue[0], 3, seed);
+                            }
+                        else
+                            {
+                            subValue[0] = mp->codonCatFreqFix[0];
+                            subValue[1] = mp->codonCatFreqFix[1];
+                            subValue[2] = mp->codonCatFreqFix[2];
+                            subValue[3] = 0.0;
+                            subValue[4] = 0.0;
+                            subValue[5] = 0.0;
+                            }
+                        }
+                    else if (!strcmp(mp->omegaVar, "M3"))
+                        {
+                        if (p->paramId == OMEGA_FD || p->paramId == OMEGA_FF)
+                            {
+                            value[0] = mp->m3omegaFixed[0];
+                            value[1] = mp->m3omegaFixed[1];
+                            value[2] = mp->m3omegaFixed[2];
+                            }
+                        else
+                            {
+                            value[0] =  0.1;
+                            value[1] =  1.0;
+                            value[2] =  3.0;
+                            }
+                        if (p->paramId == OMEGA_ED || p->paramId == OMEGA_FD) 
+                            {
+                            subValue[3] = mp->codonCatDir[0];
+                            subValue[4] = mp->codonCatDir[1];
+                            subValue[5] = mp->codonCatDir[2];
+                            DirichletRandomVariable (&subValue[3], &subValue[0], 3, seed);
+                            }
+                        else
+                            {
+                            subValue[0] = mp->codonCatFreqFix[0];
+                            subValue[1] = mp->codonCatFreqFix[1];
+                            subValue[2] = mp->codonCatFreqFix[2];
+                            subValue[3] = 0.0;
+                            subValue[4] = 0.0;
+                            subValue[5] = 0.0;
+                            }
+                        }
+                    else if (!strcmp(mp->omegaVar, "M10"))
+                        {
+                        if (p->paramId == OMEGA_10UUB || p->paramId == OMEGA_10UEB || p->paramId == OMEGA_10UFB ||
+                            p->paramId == OMEGA_10EUB || p->paramId == OMEGA_10EEB || p->paramId == OMEGA_10EFB ||
+                            p->paramId == OMEGA_10FUB || p->paramId == OMEGA_10FEB || p->paramId == OMEGA_10FFB) 
+                            {
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 2] = mp->codonCatDir[0];
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 3] = mp->codonCatDir[1];
+                            DirichletRandomVariable (&subValue[mp->numM10BetaCats + mp->numM10GammaCats + 2], &subValue[mp->numM10BetaCats + mp->numM10GammaCats + 0], 2, seed);
+                            }
+                        else
+                            {
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 0] = mp->codonCatFreqFix[0];
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 1] = mp->codonCatFreqFix[1];
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 2] = 0.0;
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 3] = 0.0;
+                            }
+                            
+                        for (i=0; i<mp->numM10BetaCats; i++)
+                            subValue[i] = subValue[mp->numM10BetaCats + mp->numM10GammaCats + 0] / mp->numM10BetaCats;
+                        for (i=mp->numM10BetaCats; i<mp->numM10BetaCats+mp->numM10GammaCats; i++)
+                            subValue[i] = subValue[mp->numM10BetaCats + mp->numM10GammaCats + 1] / mp->numM10GammaCats;
+
+                        if (p->paramId == OMEGA_10FUB || p->paramId == OMEGA_10FUF || p->paramId == OMEGA_10FEB ||
+                            p->paramId == OMEGA_10FEF || p->paramId == OMEGA_10FFB || p->paramId == OMEGA_10FFF)
+                            {
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 4] = mp->m10betaFix[0];
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 5] = mp->m10betaFix[1];
+                            }
+                        else
+                            {
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 4] = 1.0;
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 5] = 1.0;
+                            }
+
+                        if (p->paramId == OMEGA_10UFB || p->paramId == OMEGA_10UFF || p->paramId == OMEGA_10EFB ||
+                            p->paramId == OMEGA_10EFF || p->paramId == OMEGA_10FFB || p->paramId == OMEGA_10FFF)
+                            {
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 6] = mp->m10gammaFix[0];
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 7] = mp->m10gammaFix[1];
+                            }
+                        else
+                            {
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 6] = 1.0;
+                            subValue[mp->numM10BetaCats + mp->numM10GammaCats + 7] = 1.0;
+                            }
+                            
+                        BetaBreaks (subValue[mp->numM10BetaCats + mp->numM10GammaCats + 4], subValue[mp->numM10BetaCats + mp->numM10GammaCats + 5], &value[0], mp->numM10BetaCats);
+                        if (DiscreteGamma (&value[mp->numM10BetaCats], subValue[mp->numM10BetaCats + mp->numM10GammaCats + 6],
+                                           subValue[mp->numM10BetaCats + mp->numM10GammaCats + 7], mp->numM10GammaCats, 0) == ERROR)
+                            return (ERROR);
+                        for (i=0; i<mp->numM10GammaCats; i++)
+                            value[mp->numM10BetaCats + i] += 1.0;
+                        }
+                    }
+                }
+            else if (p->paramType == P_PI)
+                {
+                /* Fill in state frequencies ****************************************************************************/
+                /* note that standard chars are mainly dealt with in ProcessStdChars in mcmc.c */
+                if (p->paramId == SYMPI_UNI || p->paramId == SYMPI_UNI_MS)
+                    value[0] = 1.0;
+                else if (p->paramId == SYMPI_EXP || p->paramId == SYMPI_EXP_MS)
+                    value[0] = 1.0;
+
+                else if (p->paramId == SYMPI_FIX || p->paramId == SYMPI_FIX_MS)
+                    value[0] = mp->symBetaFix;
+
+                else if (p->paramId == PI_DIR)
+                    {
+                    if (mp->numDirParams != mp->nStates && mp->numDirParams != 0)
+                        {
+                        MrBayesPrint ("%s   Mismatch between number of dirichlet parameters (%d) and the number of states (%d)\n", spacer, mp->numDirParams, m->numStates);
+                        return ERROR;
+                        }
+
+                    /* if user has not set dirichlet parameters, go with default */
+                    /* overall variance equals number of states */
+                    if (mp->numDirParams == 0)
+                        for (i=0; i<mp->nStates; i++)
+                            value[i] = mp->stateFreqsDir[i] = 1.0;
+                    else
+                        for (i=0; i<m->numStates; i++)
+                            value[i] = mp->stateFreqsDir[i];
+
+                    /* now fill in subvalues */
+                    for (i=0; i<m->numStates; i++)
+                        subValue[i] = 1.0 / mp->nStates;
+                    }
+
+                else if (p->paramId == PI_USER)
+                    {
+                    for (i=0; i<m->numStates; i++)
+                        subValue[i] =  mp->stateFreqsFix[i];
+                    }
+                    
+                else if (p->paramId == PI_FIXED)
+                    {
+                    if (!strcmp(mp->aaModelPr, "Fixed"))
+                        {
+                        if (!strcmp(mp->aaModel, "Jones"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = jonesPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Dayhoff"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = dayhoffPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Mtrev"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = mtrev24Pi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Mtmam"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = mtmamPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Wag"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = wagPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Rtrev"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = rtrevPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Cprev"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = cprevPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Vt"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = vtPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "Blosum"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = blosPi[i];
+                            }
+                        else if (!strcmp(mp->aaModel, "LG"))
+                            {
+                            for (i=0; i<mp->nStates; i++)
+                                subValue[i] = lgPi[i];
+                            }
+                        }
+                    }
+
+                else if (p->paramId == PI_EMPIRICAL)
+                    {
+                    if (GetEmpiricalFreqs (p->relParts, p->nRelParts) == ERROR)
+                        return (ERROR);
+                    for (i=0; i<mp->nStates; i++)
+                        subValue[i] = empiricalFreqs[i];
+                    }
+
+                else if (p->paramId == PI_EQUAL)
+                    {
+                    for (i=0; i<mp->nStates; i++)
+                        subValue[i] = 1.0 / mp->nStates;
+                    }
+                }
+            else if (p->paramType == P_SHAPE)
+                {
+                /* Fill in shape values ********************************************************************************/
+                /* first get hyperprior */
+                if (p->paramId == SHAPE_UNI)
+                    {
+                    value[0] = 1.0;
+                    if (value[0] < mp->shapeUni[0] || value[0] > mp->shapeUni[1])
+                        value[0] = mp->shapeUni[0] + (mp->shapeUni[1] - mp->shapeUni[0]) *  0.5;
+                    }
+                else if (p->paramId == SHAPE_EXP)
+                    value[0] = 1.0;  // was 100.0
+                else if (p->paramId == SHAPE_FIX)
+                    value[0] = mp->shapeFix;
+                /* now fill in rates */
+                if (!strcmp(mp->ratesModel, "LNorm"))
+                    {
+                    if (DiscreteLogNormal (subValue, value[0], mp->numGammaCats, 1) == ERROR)
+                        return (ERROR);
+                    }
+                else  /* gamma rate */
+                    {
+                    if (DiscreteGamma (subValue, value[0], value[0], mp->numGammaCats, 0) == ERROR)
+                        return (ERROR);
+                    }
+                }
+            else if (p->paramType == P_PINVAR)
+                {
+                /* Fill in pInvar ***************************************************************************************/
+                if (p->paramId == PINVAR_UNI)
+                    value[0] = 0.0;
+
+                else if (p->paramId == PINVAR_FIX)
+                    value[0] =  mp->pInvarFix;
+                }
+            else if (p->paramType == P_CORREL)
+                {
+                /* Fill in correlation parameter of adgamma model *******************************************************/
+                if (p->paramId == CORREL_UNI)
+                    value[0] = 0.0;
+
+                else if (p->paramId == CORREL_FIX)
+                    value[0] =  mp->corrFix;
+                
+                /* Fill in correlation matrices */
+                AutodGamma (subValue, value[0], mp->numGammaCats);
+                }
+            else if (p->paramType == P_SWITCH)
+                {
+                /* Fill in switchRates for covarion model ***************************************************************/
+                for (j=0; j<2; j++)
+                    {
+                    if (p->paramId == SWITCH_UNI)
+                        value[j] = RandomNumber(seed) * (mp->covswitchUni[1] - mp->covswitchUni[0]) + mp->covswitchUni[0];
+
+                    else if (p->paramId == SWITCH_EXP)
+                        value[j] = -(1.0/mp->covswitchExp) * log(RandomNumber(seed));
+
+                    else if (p->paramId == SWITCH_FIX)
+                        value[j] = mp->covswitchFix[j];
+                    }
+                }
+            else if (p->paramType == P_RATEMULT)
+                {
+                /* Fill in division rates *****************************************************************************/
+                for (j=0; j<p->nValues; j++)
+                    {
+                    value[j] = 1.0;
+                    /* fill in more info about the divisions if this is a true rate multiplier
+                       and not a base rate */
+                    if (p->nSubValues > 0)
+                        {
+                        /* num uncompressed chars */
+                        subValue[j] = (modelSettings[p->relParts[j]].numUncompressedChars);
+                        /* Dirichlet parameters */
+                        subValue[p->nValues + j] = modelParams[p->relParts[j]].ratePrDir;
+                        }
+                    }
+                }
+            else if (p->paramType == P_GENETREERATE)
+                {
+                /* Fill in division rates *****************************************************************************/
+                for (j=0; j<p->nValues; j++)
+                    {
+                    value[j] = 1.0;
+                    /* Dirichlet parameters fixed to 1.0 for now; ignored if the rate is fixed */
+                    subValue[p->nValues + j] = 1.0;
+                    /* Get number of uncompressed chars from tree */
+                    tree = GetTreeFromIndex(j, 0, 0);
+                    subValue[j] = 0.0;
+                    for (i=0; i<tree->nRelParts; i++)  /* num uncompressed chars */
+                        subValue[j] += modelSettings[tree->relParts[i]].numUncompressedChars;
+                    }
+                }
+            else if (p->paramType == P_SPECRATE)
+                {
+                /* Fill in speciation rates *****************************************************************************/
+                for (j=0; j<p->nValues; j++)
+                    {
+                    if (p->paramId == SPECRATE_FIX)
+                        value[j] = mp->speciationFix;
+                    else
+                        value[j] = 0.1;
+                    }
+                }
+            else if (p->paramType == P_EXTRATE)
+                {
+                /* Fill in extinction rates *****************************************************************************/
+                for (j=0; j<p->nValues; j++)
+                    {
+                    if (p->paramId == EXTRATE_FIX)
+                        value[j] = mp->extinctionFix;
+                    else
+                        value[j] = 0.8;
+                    }
+                }
+            else if (p->paramType == P_FOSLRATE)
+                {
+                /* Fill in fossilization rates */
+                for (j=0; j<p->nValues; j++)
+                    {
+                    if (p->paramId == FOSLRATE_FIX)
+                        value[j] = mp->fossilizationFix;
+                    else
+                        value[j] = 0.2;
+                    }
+                }
+            else if (p->paramType == P_GROWTH)
+                {
+                /* Fill in growth rate ****************************************************************************************/
+                if (p->paramId == GROWTH_FIX)
+                    value[0] = mp->growthFix;
+                else
+                    value[0] = 1.0;
+                }
+            else if (p->paramType == P_POPSIZE)
+                {
+                /* Fill in population size ****************************************************************************************/
+                for (j=0; j<p->nValues; j++)
+                    {
+                    if (p->paramId == POPSIZE_UNI)
+                        value[j] = RandomNumber(seed) * (mp->popSizeUni[1] - mp->popSizeUni[0]) + mp->popSizeUni[0];
+                    else if (p->paramId == POPSIZE_LOGNORMAL)
+                        value[j] = exp(mp->popSizeLognormal[0]);
+                    else if (p->paramId == POPSIZE_NORMAL)
+                        value[j] = mp->popSizeNormal[0];
+                    else if (p->paramId == POPSIZE_GAMMA)
+                        value[j] = mp->popSizeGamma[0] / mp->popSizeGamma[1];
+                    else if (p->paramId == POPSIZE_FIX)
+                        value[j] = mp->popSizeFix;
+                    }
+                }
+            else if (p->paramType == P_AAMODEL)
+                {
+                /* Fill in theta ****************************************************************************************/
+                if (p->paramId == AAMODEL_MIX)
+                    {
+                    /* amino acid model ID's
+                        AAMODEL_POISSON         0
+                        AAMODEL_JONES           1
+                        AAMODEL_DAY             2
+                        AAMODEL_MTREV           3
+                        AAMODEL_MTMAM           4
+                        AAMODEL_WAG             5
+                        AAMODEL_RTREV           6 
+                        AAMODEL_CPREV           7 
+                        AAMODEL_VT              8
+                        AAMODEL_BLOSUM          9 */
+
+                    /* set the amino acid model  (the meaning of the numbers is defined) */
+                    tempInt = (int)(RandomNumber(seed) * 10);
+                    value[0] = tempInt;
+                    
+                    /* we need to make certain that the aa frequencies are filled in correctly */
+                    bs = GetParamSubVals (m->stateFreq, chn, 0);
+                    if (tempInt == AAMODEL_POISSON)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] =  (1.0 / 20.0);
+                        }
+                    else if (tempInt == AAMODEL_JONES)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = jonesPi[i];
+                        }
+                    else if (tempInt == AAMODEL_DAY)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = dayhoffPi[i];
+                        }
+                    else if (tempInt == AAMODEL_MTREV)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = mtrev24Pi[i];
+                        }
+                    else if (tempInt == AAMODEL_MTMAM)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = mtmamPi[i];
+                        }
+                    else if (tempInt == AAMODEL_WAG)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = wagPi[i];
+                        }
+                    else if (tempInt == AAMODEL_RTREV)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = rtrevPi[i];
+                        }
+                    else if (tempInt == AAMODEL_CPREV)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = cprevPi[i];
+                        }
+                    else if (tempInt == AAMODEL_VT)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = vtPi[i];
+                        }
+                    else if (tempInt == AAMODEL_BLOSUM)
+                        {
+                        for (i=0; i<mp->nStates; i++)
+                            bs[i] = blosPi[i];
+                        }
+                        
+                    for (i=0; i<p->nSubValues; i++)
+                        {
+                        subValue[i] = mp->aaModelPrProbs[i];
+                        }
+                    }
+                }
+            else if (p->paramType == P_CPPRATE)
+                {
+                /* Fill in lambda (cpp rate) ********************************************************************************************/
+                if (p->paramId == CPPRATE_EXP)
+                    value[0] = -(1.0/mp->cppRateExp) * log(RandomNumber(seed));
+                else if (p->paramId == CPPRATE_FIX)
+                    value[0] = mp->cppRateFix;
+                }
+            else if (p->paramType == P_CPPMULTDEV)
+                {
+                /* Fill in log standard deviation (for relaxed clock rate multiplier) ***********************************************************/
+                if (p->paramId == CPPMULTDEV_FIX)
+                    value[0] = mp->cppMultDevFix;
+                }
+            else if (p->paramType == P_CPPEVENTS)
+                {
+                /* We fill in these when we fill in tree params **************************************************************************/
+                }
+            else if (p->paramType == P_TK02VAR)
+                {
+                /* Fill in variance of relaxed clock lognormal **************************************************************************/
+                if (p->paramId == TK02VAR_UNI)
+                    value[0] = RandomNumber(seed) * (mp->tk02varUni[1] - mp->tk02varUni[0]) + mp->tk02varUni[0];
+                else if (p->paramId == TK02VAR_EXP)
+                    value[0] = 2.0/(mp->tk02varExp);
+                else if (p->paramId == TK02VAR_FIX)
+                    value[0] = mp->tk02varFix;
+                }
+            else if (p->paramType == P_TK02BRANCHRATES)
+                {
+                /* We fill in these when we fill in tree params **************************************************************************/
+                }
+            else if (p->paramType == P_IGRVAR)
+                {
+                /* Fill in variance of relaxed clock lognormal **************************************************************************/
+                if (p->paramId == IGRVAR_UNI)
+                    value[0] = RandomNumber(seed) * (mp->igrvarUni[1] - mp->igrvarUni[0]) + mp->igrvarUni[0];
+                else if (p->paramId == IGRVAR_EXP)
+                    value[0] = 1.0/(mp->igrvarExp);
+                else if (p->paramId == IGRVAR_FIX)
+                    value[0] = mp->igrvarFix;
+                }
+            else if (p->paramType == P_IGRBRANCHRATES)
+                {
+                /* We fill in these when we fill in tree params **************************************************************************/
+                }
+            else if (p->paramType == P_MIXEDVAR)
+                {
+                /* Fill in variance of mixed relaxed clock **************************************************************************/
+                if (p->paramId == MIXEDVAR_UNI)
+                    value[0] = RandomNumber(seed) * (mp->mixedvarUni[1] - mp->mixedvarUni[0]) + mp->mixedvarUni[0];
+                else if (p->paramId == MIXEDVAR_EXP)
+                    value[0] = 1.0/(mp->mixedvarExp);
+                else if (p->paramId == MIXEDVAR_FIX)
+                    value[0] = mp->mixedvarFix;
+                }
+            else if (p->paramType == P_MIXEDBRCHRATES)
+                {
+                /* initialize the mixed relaxed clock model to TK02 or IGR */
+                intValue[0] = (RandomNumber(seed) <0.5) ? RCL_TK02 : RCL_IGR;
+                /* We fill in the rest when we fill in tree params **************************************************************************/
+                }
+            else if (p->paramType == P_CLOCKRATE)
+                {
+                /* Fill in base rate of molecular clock **************************************************************************/
+                if (p->paramId == CLOCKRATE_FIX)
+                    value[0] = mp->clockRateFix;
+                else if (p->paramId == CLOCKRATE_NORMAL)
+                    value[0] = mp->clockRateNormal[0];
+                else if (p->paramId == CLOCKRATE_LOGNORMAL)
+                    value[0] = exp(mp->clockRateLognormal[0]);
+                else if (p->paramId == CLOCKRATE_EXP)
+                    value[0] = 1.0/(mp->clockRateExp);
+                else if (p->paramId == CLOCKRATE_GAMMA)
+                    value[0] = mp->clockRateGamma[0]/mp->clockRateGamma[1];
+                }
+            }   /* next param */
+        }   /* next chain */
+
+    return NO_ERROR;
+}
+
+    
+int FillRelPartsString (Param *p, char **relPartString)
+{
+    int         i, n, filledString;
+    char        *tempStr;
+    int             tempStrSize=50;
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+        return (ERROR);
+        }
+
+    if (numCurrentDivisions == 1)
+        {
+        filledString = NO;
+        SafeStrcpy (relPartString, "");
+        }
+    else
+        {
+        filledString = YES;
+        if (p->nRelParts == numCurrentDivisions)
+            {
+            SafeStrcpy (relPartString, "{all}");
+            }
+        else
+            {
+            SafeStrcpy (relPartString, "{");
+            for (i=n=0; i<p->nRelParts; i++)
+                {
+                n++;
+                SafeSprintf (&tempStr, &tempStrSize, "%d", p->relParts[i] + 1);
+                SafeStrcat (relPartString, tempStr);
+                if (n < p->nRelParts)
+                    SafeStrcat (relPartString, ",");
+                }
+            SafeStrcat (relPartString, "}");
+            }
+        }
+    free (tempStr);
+    return (filledString);
+}
+
+
+/*--------------------------------------------------------------
+ |
+ |  FillStdStateFreqs: fills stationary frequencies for standard data divisions of chains  in range [chfrom, chto)
+ |
+ ---------------------------------------------------------------*/
+void FillStdStateFreqs (int chfrom, int chto, RandLong *seed)
+{
+    int     chn, n, i, j, k, b, c, nb, index;
+    MrBFlt  *subValue, sum, symDir[10];
+    Param   *p;
+    
+    for (chn=chfrom; chn<chto; chn++)
+        {
+        for (k=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->paramType != P_PI || modelParams[p->relParts[0]].dataType != STANDARD)
+                continue;
+            subValue = GetParamStdStateFreqs (p, chn, 0);
+            if (p->paramId == SYMPI_EQUAL)
+                {
+                for (n=index=0; n<9; n++)
+                    {
+                    for (i=0; i<p->nRelParts; i++)
+                        if (modelSettings[p->relParts[i]].isTiNeeded[n] == YES)
+                            break;
+                    if (i < p->nRelParts)
+                        {
+                        for (j=0; j<(n+2); j++)
+                            {
+                            subValue[index++] = (1.0 / (n + 2));
+                            }
+                        }
+                    }
+                for (n=9; n<13; n++)
+                    {
+                    for (i=0; i<p->nRelParts; i++)
+                        if (modelSettings[p->relParts[i]].isTiNeeded[n] == YES)
+                            break;
+                    if (i < p->nRelParts)
+                        {
+                        for (j=0; j<(n-6); j++)
+                            {
+                            subValue[index++] = (1.0 / (n - 6));
+                            }
+                        }
+                    }
+                }
+            
+            /* Deal with transition asymmetry for standard characters */
+            /* First, fill in stationary frequencies for beta categories if needed; */
+            /* discard category frequencies (assume equal) */
+            if (p->paramId == SYMPI_FIX || p->paramId == SYMPI_UNI || p->paramId == SYMPI_EXP ||
+                p->paramId == SYMPI_FIX_MS || p->paramId == SYMPI_UNI_MS || p->paramId == SYMPI_EXP_MS)
+                {
+                if (p->hasBinaryStd == YES)
+                    {
+                    nb=modelParams[p->relParts[0]].numBetaCats;
+                    BetaBreaks (p->values[0], p->values[0], subValue, nb);
+                    b = 2*nb;
+                    for (i=b-2; i>0; i-=2)
+                        {
+                        subValue[i] = subValue[i/2];
+                        }
+                    for (i=1; i<b; i+=2)
+                        {
+                        subValue[i] = (1.0 - subValue[i-1]);
+                        }
+                    subValue += (2 * nb);
+                    }
+                
+                /* Then fill in state frequencies for multistate chars, one set for each */
+                for (i=0; i<10; i++)
+                    symDir[i] = p->values[0];
+                
+                for (c=0; c<p->nSympi; c++)
+                    {
+                    /* now fill in subvalues */
+                    DirichletRandomVariable (symDir, subValue, p->sympinStates[c], seed);
+                    sum = 0.0;
+                    for (i=0; i<p->sympinStates[c]; i++)
+                        {
+                        if (subValue[i] < 0.0001)
+                            subValue[i] = 0.0001;
+                        sum += subValue[i];
+                        }
+                    for (i=0; i<modelParams[p->relParts[0]].nStates; i++)
+                        subValue[i] /= sum;
+                    subValue += p->sympinStates[c];
+                    }
+                }
+            }   /* next parameter */
+        }   /* next chain */
+}
+
+
+/* FillTopologySubParams: Fill subparams (brlens) for a topology */
+int FillTopologySubParams (Param *param, int chn, int state, RandLong *seed)
+{
+    int         i,returnVal;
+    Tree        *tree, *tree1;
+    Param       *q;
+    MrBFlt      clockRate;
+    PolyTree    *sourceTree;
+    MrBFlt      minRate,maxRate;
+
+    tree = GetTree (param, chn, state);
+    
+    for (i=1; i<param->nSubParams; i++)
+        {
+        q = param->subParams[i];
+        tree1 = GetTree (q, chn, state);
+        if (CopyToTreeFromTree(tree1, tree) == ERROR)
+            return (ERROR);
+        }
+    for (i=0; i<param->nSubParams; i++)
+        {
+        q = param->subParams[i];
+        tree = GetTree (q, chn, state);
+        if (q->paramId == BRLENS_FIXED || q->paramId == BRLENS_CLOCK_FIXED)
+            {
+            if (param->paramId == TOPOLOGY_NCL_FIXED ||
+                param->paramId == TOPOLOGY_NCL_FIXED_HOMO ||
+                param->paramId == TOPOLOGY_NCL_FIXED_HETERO ||
+                param->paramId == TOPOLOGY_CL_FIXED  ||
+                param->paramId == TOPOLOGY_RCL_FIXED ||
+                param->paramId == TOPOLOGY_CCL_FIXED ||
+                param->paramId == TOPOLOGY_RCCL_FIXED||
+                param->paramId == TOPOLOGY_FIXED)
+                {
+                sourceTree = AllocatePolyTree(numTaxa);
+                CopyToPolyTreeFromPolyTree (sourceTree, userTree[modelParams[q->relParts[0]].brlensFix]);
+                PrunePolyTree (sourceTree);
+                ResetTipIndices (sourceTree);
+                ResetIntNodeIndices (sourceTree);
+                if (tree->isRooted != sourceTree->isRooted)
+                    {
+                    MrBayesPrint("%s   Cannot set fixed branch lengths because of mismatch in rootedness", spacer);
+                    FreePolyTree (sourceTree);
+                    return (ERROR);
+                    }
+                if (CopyToTreeFromPolyTree(tree,sourceTree) == ERROR)
+                    {
+                    MrBayesPrint("%s   Problem setting fixed branch lengths", spacer);
+                    FreePolyTree (sourceTree);
+                    return (ERROR);
+                    }
+                FreePolyTree (sourceTree);
+                if (tree->isClock == YES && IsClockSatisfied(tree, 0.0001) == NO)
+                    {
+                    MrBayesPrint("%s   Fixed branch lengths do not satisfy clock", spacer);
+                    return (ERROR);
+                    }
+                if (tree->isCalibrated == YES && IsCalibratedClockSatisfied(tree,&minRate,&maxRate, 0.0001) == NO)
+                    {
+                    MrBayesPrint("%s   Fixed branch lengths do not satisfy calibrations", spacer);
+                    return (ERROR);
+                    }
+                if (tree->isCalibrated == YES && !strcmp(modelParams[tree->relParts[0]].clockRatePr, "Fixed"))
+                    {
+                    clockRate = modelParams[tree->relParts[0]].clockRateFix;
+                    if ((clockRate < minRate && AreDoublesEqual (clockRate, minRate , 0.0001) == NO) ||
+                        (clockRate > maxRate && AreDoublesEqual (clockRate, maxRate , 0.0001) == NO))
+                        {
+                        MrBayesPrint("%s   Fixed branch lengths do not satisfy fixed clockrate", spacer);
+                        return (ERROR);
+                        }
+                    }
+
+                tree->fromUserTree=YES;
+                returnVal = NO_ERROR;
+                }
+            else
+                {
+                MrBayesPrint("%s   Fixed branch lengths can only be used for a fixed topology\n", spacer);
+                return (ERROR);
+                }
+            }
+        else if (tree->isCalibrated == YES || (tree->isClock == YES && (!strcmp(modelParams[tree->relParts[0]].clockPr,"Uniform") ||
+                                                                        !strcmp(modelParams[tree->relParts[0]].clockPr,"Fossilization"))))
+            {
+            assert (tree->isClock == YES);
+            clockRate = *GetParamVals(modelSettings[tree->relParts[0]].clockRate, chn, state);
+            returnVal = InitCalibratedBrlens (tree, clockRate, seed);
+            if (IsClockSatisfied (tree,0.0001) == NO)
+                {
+                MrBayesPrint ("%s   Branch lengths of the tree does not satisfy clock\n",  spacer);
+                return (ERROR);
+                }
+            tree->fromUserTree=NO;
+            }
+        else if (tree->isClock == YES)
+            returnVal = InitClockBrlens (tree);
+        else
+            returnVal = InitBrlens (tree, 0.02);
+
+        if (returnVal == ERROR)
+            return (ERROR);
+
+        if (FillBrlensSubParams (q, chn, state) == ERROR)
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* FillBrlensSubParams: Fill any relaxed clock subparams of a brlens param */
+int FillBrlensSubParams (Param *param, int chn, int state)
+{
+    int         i, j, *nEvents;
+    MrBFlt      *brlen, *branchRate, **position, **rateMult;
+    Tree        *tree;
+    TreeNode    *p;
+    Param       *q;
+
+    tree = GetTree (param, chn, state);
+    
+    for (i=0; i<param->nSubParams; i++)
+        {
+        q = param->subParams[i];
+        if (q->paramType == P_CPPEVENTS)
+            {
+            nEvents = q->nEvents[2*chn+state];
+            position = q->position[2*chn+state];
+            rateMult = q->rateMult[2*chn+state];
+            brlen = GetParamSubVals (q, chn, state);
+            for (j=0; j<tree->nNodes-1; j++)
+                {
+                p = tree->allDownPass[j];
+                if (nEvents[p->index] != 0)
+                    {
+                    free (position[p->index]);
+                    position[p->index] = NULL;
+                    free (rateMult[p->index]);
+                    rateMult[p->index] = NULL;
+                    }
+                nEvents[p->index] = 0;
+                assert (j==tree->nNodes-2 || fabs(p->length - (p->anc->nodeDepth - p->nodeDepth)) < 0.000001);
+                brlen[p->index] = p->length;
+                }
+            }
+        else if (q->paramType == P_TK02BRANCHRATES || q->paramType == P_IGRBRANCHRATES || q->paramType == P_MIXEDBRCHRATES)
+            {
+            branchRate = GetParamVals (q, chn, state);
+            brlen = GetParamSubVals (q, chn, state);
+            for (j=0; j<tree->nNodes-1; j++)
+                {
+                p = tree->allDownPass[j];
+                assert (j==tree->nNodes-2 || fabs(p->length - (p->anc->nodeDepth - p->nodeDepth)) < 0.000001);
+                branchRate[p->index] = 1.0;
+                brlen[p->index] = p->length;
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* Note: In PruneConstraintPartitions() we can not relay on specific rootnes of a tree since different partitions
+   may theoreticly have different clock models, while constraints apply to all partitions/trees */
+int PruneConstraintPartitions()
+{
+    int             i, j, constraintId, nLongsNeeded;
+    
+    nLongsNeeded = (numLocalTaxa - 1) / nBitsInALong + 1;
+
+    for (constraintId=0; constraintId<numDefinedConstraints; constraintId++)
+        {
+        definedConstraintPruned[constraintId] = (BitsLong *) SafeRealloc ((void *)definedConstraintPruned[constraintId], nLongsNeeded*sizeof(BitsLong));
+        if (!definedConstraintPruned[constraintId])
+            {
+            MrBayesPrint ("%s   Problems allocating constraintPartition in PruneConstraintPartitions", spacer);
+            return (ERROR);
+            }
+
+        /* initialize bits in partition to add; get rid of deleted taxa in the process */
+        ClearBits(definedConstraintPruned[constraintId], nLongsNeeded);
+        for (i=j=0; i<numTaxa; i++)
+            {
+            if (taxaInfo[i].isDeleted == YES)
+                continue;
+            if (IsBitSet(i, definedConstraint[constraintId]) == YES)
+                SetBit(j, definedConstraintPruned[constraintId]);
+            j++;
+            }
+        assert (j == numLocalTaxa);
+
+        if (definedConstraintsType[constraintId] == PARTIAL)
+            {
+            definedConstraintTwoPruned[constraintId] = (BitsLong *) SafeRealloc ((void *)definedConstraintTwoPruned[constraintId], nLongsNeeded*sizeof(BitsLong));
+            if (!definedConstraintTwoPruned[constraintId])
+                {
+                MrBayesPrint ("%s   Problems allocating constraintPartition in PruneConstraintPartitions", spacer);
+                return (ERROR);
+                }
+
+            /* initialize bits in partition to add; get rid of deleted taxa in the process */
+            ClearBits(definedConstraintTwoPruned[constraintId], nLongsNeeded);
+            for (i=j=0; i<numTaxa; i++)
+                {
+                if (taxaInfo[i].isDeleted == YES)
+                    continue;
+                if (IsBitSet(i, definedConstraintTwo[constraintId]) == YES)
+                    SetBit(j, definedConstraintTwoPruned[constraintId]);
+                j++;
+                }
+            assert (j == numLocalTaxa);
+            }
+        else if (definedConstraintsType[constraintId] == NEGATIVE || (definedConstraintsType[constraintId] == HARD))
+            {
+            /* Here we create definedConstraintTwoPruned[constraintId] which is complemente of definedConstraintPruned[constraintId] */
+            definedConstraintTwoPruned[constraintId] = (BitsLong *) SafeRealloc ((void *)definedConstraintTwoPruned[constraintId], nLongsNeeded*sizeof(BitsLong));
+            if (!definedConstraintTwoPruned[constraintId])
+                {
+                MrBayesPrint ("%s   Problems allocating constraintPartition in PruneConstraintPartitions", spacer);
+                return (ERROR);
+                }
+
+            /* initialize bits in partition to add; get rid of deleted taxa in the process */
+            ClearBits(definedConstraintTwoPruned[constraintId], nLongsNeeded);
+            for (i=j=0; i<numTaxa; i++)
+                {
+                if (taxaInfo[i].isDeleted == YES)
+                    continue;
+                if (IsBitSet(i, definedConstraint[constraintId]) == NO)
+                    SetBit(j, definedConstraintTwoPruned[constraintId]);
+                j++;
+                }
+            assert (j == numLocalTaxa);         
+            }
+    }
+    
+    return NO_ERROR;
+}
+
+
+int DoesTreeSatisfyConstraints(Tree *t)
+{
+    int         i, k, numTaxa, nLongsNeeded;
+    TreeNode    *p;
+    int         CheckFirst, CheckSecond; /*Flag indicating wheather corresponding set(first/second) of partial constraint has to be checked*/
+#   if defined (DEBUG_CONSTRAINTS)
+    int         locks_count=0;
+#   endif
+
+    if (t->checkConstraints == NO)
+        return YES;
+    /* get some handy numbers */
+    numTaxa = t->nNodes - t->nIntNodes - (t->isRooted == YES ? 1 : 0);
+    nLongsNeeded = (numTaxa - 1) / nBitsInALong + 1;
+
+    if (t->bitsets == NULL)
+        {
+        AllocateTreePartitions(t);
+        }
+    else
+        {
+        ResetTreePartitions(t);  /*Inefficient function, rewrite faster version*/
+        }
+#   if defined (DEBUG_CONSTRAINTS)
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        if (p->isLocked == YES)
+            {
+            if (IsUnionEqThird (definedConstraintPruned[p->lockID], definedConstraintPruned[p->lockID], p->partition, nLongsNeeded) == NO && IsUnionEqThird (definedConstraintTwoPruned[p->lockID], definedConstraintTwoPruned[p->lockID], p->partition, nLongsNeeded) == NO)
+                {
+                printf ("DEBUG ERROR: Locked node does not represent right partition. \n");
+                return ABORT;
+                }
+            else
+                {
+                locks_count++;
+                }
+            }
+        }
+
+    if (locks_count != t->nLocks)
+        {
+        printf ("DEBUG ERROR: locks_count:%d should be locks_count:%d\n", locks_count, t->nLocks);
+        return ABORT;
+        }
+#   endif
+
+    for (k=0; k<numDefinedConstraints; k++)
+        {
+#   if defined (DEBUG_CONSTRAINTS)
+        if (t->constraints[k] == YES && definedConstraintsType[k] == HARD)
+            {
+            if (t->isRooted == YES)
+                {
+                CheckFirst = YES;
+                CheckSecond = NO; 
+                }
+            else
+                {
+                /*exactly one of next two will be YES*/
+                CheckFirst = IsBitSet(localOutGroup, definedConstraintPruned[k])==YES ? NO : YES;
+                CheckSecond = IsBitSet(localOutGroup, definedConstraintTwoPruned[k])==YES ? NO : YES;
+                assert ((CheckFirst^CheckSecond)==1);
+                }
+
+            for (i=0; i<t->nIntNodes; i++)
+                {
+                p = t->intDownPass[i];
+                if (p->anc != NULL)
+                    {
+                    if (CheckFirst==YES &&  IsPartNested(definedConstraintPruned[k], p->partition, nLongsNeeded) && IsPartNested(p->partition,definedConstraintPruned[k], nLongsNeeded))
+                        break;
+                    if (CheckSecond==YES &&  IsPartNested(definedConstraintTwoPruned[k], p->partition, nLongsNeeded) && IsPartNested(p->partition, definedConstraintTwoPruned[k], nLongsNeeded))
+                        break;
+                    }
+                }
+
+            if (i==t->nIntNodes)
+                {
+                printf ("DEBUG ERROR: Hard constraint is not satisfied. \n");
+                return ABORT;
+                //assert (0);
+                }
+            }
+#   endif
+
+        if (t->constraints[k] == NO || definedConstraintsType[k] == HARD)
+            continue;
+
+        if (definedConstraintsType[k] == PARTIAL)
+            {
+            /* alternative way
+            if (t->isRooted == NO && !IsBitSet(localOutGroup, definedConstraintPruned[k]))
+                {
+                m = FirstTaxonInPartition (constraintPartition, nLongsNeeded);
+                for (i=0; t->nodes[i].index != m; i++)
+                    ;
+                p = &t->nodes[i];
+
+                p=p->anc;
+                while (!IsPartNested(definedConstraintPruned[k], p->partition, nLongsNeeded))
+                    p=p->anc;
+
+                if (IsSectionEmpty(definedConstraintTwoPruned[k], p->partition, nLongsNeeded))
+                    continue;
+                }
+            */
+            if (t->isRooted == YES)
+                {
+                CheckFirst = YES;
+                CheckSecond = NO; /* In rooted case even if we have a node with partition fully containing second set and not containing the first set it would not satisfy the constraint */
+                }
+            else
+                {
+                if (NumBits(definedConstraintPruned[k], nLongsNeeded) == 1 || NumBits(definedConstraintTwoPruned[k], nLongsNeeded) == 1)
+                    continue;
+                /*one or two of the next two statments will be YES*/
+                CheckFirst = IsBitSet(localOutGroup, definedConstraintPruned[k])==YES ? NO : YES;
+                CheckSecond = IsBitSet(localOutGroup, definedConstraintTwoPruned[k])==YES ? NO : YES;
+                assert ((CheckFirst|CheckSecond)==1);
+                }
+            for (i=0; i<t->nIntNodes; i++)
+                {
+                p = t->intDownPass[i];
+                if (p->anc != NULL)
+                    { 
+                    if (CheckFirst== YES && IsPartNested(definedConstraintPruned[k], p->partition, nLongsNeeded) && IsSectionEmpty(definedConstraintTwoPruned[k], p->partition, nLongsNeeded))
+                        break;
+                    if (CheckSecond==YES && IsPartNested(definedConstraintTwoPruned[k], p->partition, nLongsNeeded) && IsSectionEmpty(definedConstraintPruned[k], p->partition, nLongsNeeded))
+                        break;
+                    }
+                }
+            if (i==t->nIntNodes)
+                return NO;
+            }
+        else
+            {
+            assert (definedConstraintsType[k] == NEGATIVE);
+            if (t->isRooted == YES)
+                {
+                CheckFirst = YES;
+                CheckSecond = NO; 
+                }
+            else
+                {
+                /*exactly one of next two will be YES*/
+                CheckFirst = IsBitSet(localOutGroup, definedConstraintPruned[k])==YES ? NO : YES;
+                CheckSecond = IsBitSet(localOutGroup, definedConstraintTwoPruned[k])==YES ? NO : YES;
+                assert ((CheckFirst^CheckSecond)==1);
+                }
+
+            for (i=0; i<t->nIntNodes; i++)
+                {
+                p = t->intDownPass[i];
+                if (p->anc != NULL)
+                    {
+                    if (CheckFirst==YES && AreBitfieldsEqual(definedConstraintPruned[k], p->partition, nLongsNeeded))
+                        break;
+                    if (CheckSecond==YES && AreBitfieldsEqual(definedConstraintTwoPruned[k], p->partition, nLongsNeeded))
+                        break;
+                    }
+                }
+            if (i!=t->nIntNodes)
+                return NO;
+            }
+        }
+    
+    return YES;
+}
+
+
+/*------------------------------------------------------------------
+|
+|   FillTreeParams: Fill in trees and branch lengths
+|                   
+|   Note: Should be run after FillNormalParams because
+|   clockrate needs to be set if calibrated tree needs
+|   to be filled.
+|
+------------------------------------------------------------------*/
+int FillTreeParams (RandLong *seed, int fromChain, int toChain)
+{
+    int         i, k, chn, nTaxa, tmp;
+    Param       *p, *q;
+    Tree        *tree;
+    PolyTree    *constraintTree;
+    PolyTree    *constraintTreeRef;
+
+    if (PruneConstraintPartitions() == ERROR)
+        return ERROR;
+
+    /* Build starting trees for state 0 */
+    for (chn=fromChain; chn<toChain; chn++)
+        {
+        for (k=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->paramType == P_TOPOLOGY)
+                {
+                q = p->subParams[0];
+                tree = GetTree (q, chn, 0);
+                if (tree->isRooted == YES)
+                    nTaxa = tree->nNodes - tree->nIntNodes - 1;
+                else
+                    nTaxa = tree->nNodes - tree->nIntNodes;
+                
+                /* fixed topology */
+                if (p->paramId == TOPOLOGY_NCL_FIXED ||
+                    p->paramId == TOPOLOGY_NCL_FIXED_HOMO ||
+                    p->paramId == TOPOLOGY_NCL_FIXED_HETERO ||
+                    p->paramId == TOPOLOGY_CL_FIXED  ||
+                    p->paramId == TOPOLOGY_RCL_FIXED ||
+                    p->paramId == TOPOLOGY_CCL_FIXED ||
+                    p->paramId == TOPOLOGY_RCCL_FIXED||
+                    p->paramId == TOPOLOGY_FIXED     ||
+                    p->paramId == TOPOLOGY_PARSIMONY_FIXED)
+                    {
+                    constraintTree = AllocatePolyTree (numTaxa);
+                    CopyToPolyTreeFromPolyTree (constraintTree, userTree[modelParams[p->relParts[0]].topologyFix]);
+                    PrunePolyTree (constraintTree);
+                    ResetTipIndices(constraintTree);
+                    ResetIntNodeIndices(constraintTree);
+                    RandResolve (NULL, constraintTree, seed, constraintTree->isRooted);
+                    if (tree->nIntNodes != constraintTree->nIntNodes)
+                        {
+                        if (tree->isRooted != constraintTree->isRooted)
+                            {
+                            MrBayesPrint ("%s   Could not fix topology because user tree '%s' differs in rootedness with the model tree.\n", spacer,
+                                          userTree[modelParams[p->relParts[0]].topologyFix]->name);
+                            MrBayesPrint ("%s   The user tree %s is%srooted, while expected model tree is%srooted.\n", spacer,
+                                          userTree[modelParams[p->relParts[0]].topologyFix]->name, (constraintTree->isRooted?" ":" not "), (tree->isRooted?" ":" not "));
+                            MrBayesPrint ("%s   Check brlenspr is set correctly before fixing topology.\n", spacer);
+                            }
+                        else
+                            MrBayesPrint ("%s   Could not fix topology because user tree '%s' is not fully resolved.\n",
+                                                spacer, userTree[modelParams[p->relParts[0]].topologyFix]->name);
+                        FreePolyTree (constraintTree);
+                        return (ERROR);
+                        }
+                    if (CopyToTreeFromPolyTree(tree, constraintTree) == ERROR)
+                        {
+                        MrBayesPrint ("%s   Could not fix topology according to user tree '%s'\n", spacer, userTree[modelParams[p->relParts[0]].topologyFix]->name);
+                        FreePolyTree (constraintTree);
+                        return (ERROR);
+                        }
+                    FreePolyTree (constraintTree);
+                    }
+                /* constrained topology */
+                else if (tree->nConstraints > 0)
+                    {
+                    constraintTreeRef = AllocatePolyTree (nTaxa);
+                    if (!constraintTreeRef)
+                        return (ERROR);
+                    if (BuildConstraintTree (tree, constraintTreeRef, localTaxonNames) == ERROR)
+                        {
+                        FreePolyTree (constraintTreeRef);
+                        return (ERROR);
+                        }
+                    if (AllocatePolyTreePartitions (constraintTreeRef) == ERROR)
+                        return (ERROR);
+
+                    constraintTree = AllocatePolyTree (nTaxa);
+                    if (!constraintTree)
+                        return (ERROR);
+                    if (AllocatePolyTreePartitions (constraintTree) == ERROR)
+                        return (ERROR);
+
+                    for (i=0;i<100;i++)
+                        {
+                        CopyToPolyTreeFromPolyTree(constraintTree,constraintTreeRef);
+                        tmp = RandResolve (tree, constraintTree, &globalSeed, tree->isRooted);
+                        if (tmp != NO_ERROR)
+                            {
+                            if (tmp  == ERROR)
+                                {
+                                FreePolyTree (constraintTree);
+                                return (ERROR);
+                                }
+                            else
+                                {   
+                                assert (tmp  == ABORT);
+                                continue;
+                                }
+                            }
+                   
+                        CopyToTreeFromPolyTree(tree, constraintTree);
+                        if (DoesTreeSatisfyConstraints(tree)==YES)
+                            break;
+                        }
+#   if defined (DEBUG_CONSTRAINTS)
+                    if (theTree->checkConstraints == YES && CheckConstraints (tree) == ERROR)
+                        {
+                        printf ("Error in constraints of starting tree\n");
+                        getchar();
+                        }
+#   endif
+                    FreePolyTree (constraintTree);
+                    FreePolyTree (constraintTreeRef);
+                    if (i==100)
+                        {
+                        MrBayesPrint ("%s   Could not build a starting tree satisfying all constraints\n", spacer);                     
+                        return (ERROR);
+                        }
+                    }
+                /* random topology */
+                else
+                    {
+                    if (tree->isRooted == YES)
+                        {
+                        if (BuildRandomRTopology (tree, &globalSeed) == ERROR)
+                            return (ERROR);
+                        }
+                    else
+                        {
+                        if (BuildRandomUTopology (tree, &globalSeed) == ERROR)
+                            return (ERROR);
+                        if (MoveCalculationRoot (tree, localOutGroup) == ERROR)
+                            return (ERROR);
+                        }
+                    }
+                
+                if (LabelTree (tree, localTaxonNames) == ERROR)
+                    return (ERROR);
+                if (q == p)
+                    continue;   /* this is a parsimony tree without branch lengths */
+                if (InitializeTreeCalibrations (tree) == ERROR)
+                    return (ERROR);
+                if (FillTopologySubParams(p, chn, 0, seed)== ERROR)
+                    return (ERROR);
+                }
+            }
+        }
+
+    if (numTopologies > 1 && !strcmp(modelParams[0].topologyPr,"Speciestree"))
+        {
+        if (FillSpeciesTreeParams(seed, fromChain, toChain) == ERROR)
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+void FreeCppEvents (Param *p)
+{
+    int i, j;
+    
+    if (p->paramType != P_CPPEVENTS)
+        return;
+
+    if (p->nEvents != NULL)
+        {
+        free (p->nEvents[0]);
+        free (p->nEvents);
+        for (i=0; i<numGlobalChains; i++)
+            {
+            for (j=0; j<2*numLocalTaxa; j++)
+                {
+                free (p->position[2*i][j]);
+                free (p->rateMult[2*i][j]);
+                free (p->position[2*i+1][j]);
+                free (p->rateMult[2*i+1][j]);
+                }
+            }
+        free (p->position[0]);
+        free (p->position);
+        free (p->rateMult[0]);
+        free (p->rateMult);
+        p->nEvents = NULL;
+        p->position = NULL;
+        p->rateMult = NULL;
+        }
+}
+
+
+int FreeModel (void)
+{
+    int     i;
+    Param   *p;
+    
+    if (memAllocs[ALLOC_MODEL] == YES)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            free (modelParams[i].activeConstraints);
+            if (memAllocs[ALLOC_SAMPLEFOSSILSLICE] == YES)
+                {
+                free(modelParams[i].sampleFSProb);
+                free(modelParams[i].sampleFSTime);
+                memAllocs[ALLOC_SAMPLEFOSSILSLICE] = NO;
+                }
+            }
+        free (modelParams);
+        free (modelSettings);
+        memAllocs[ALLOC_MODEL] = NO;
+        }
+    if (memAllocs[ALLOC_MOVES] == YES)
+        {
+        for (i=0; i<numApplicableMoves; i++)
+            FreeMove (moves[i]);
+        free (moves);
+        moves = NULL;
+        numApplicableMoves = 0;
+        memAllocs[ALLOC_MOVES] = NO;
+        }
+    if (memAllocs[ALLOC_COMPMATRIX] == YES)
+        {
+        free (compMatrix);
+        memAllocs[ALLOC_COMPMATRIX] = NO;
+        }
+    if (memAllocs[ALLOC_NUMSITESOFPAT] == YES)
+        {
+        free (numSitesOfPat);
+        memAllocs[ALLOC_NUMSITESOFPAT] = NO;
+        }
+    if (memAllocs[ALLOC_COMPCOLPOS] == YES)
+        {
+        free (compColPos);
+        memAllocs[ALLOC_COMPCOLPOS] = NO;
+        }
+    if (memAllocs[ALLOC_COMPCHARPOS] == YES)
+        {
+        free (compCharPos);
+        memAllocs[ALLOC_COMPCHARPOS] = NO;
+        }
+    if (memAllocs[ALLOC_ORIGCHAR] == YES)
+        {
+        free (origChar);
+        memAllocs[ALLOC_ORIGCHAR] = NO;
+        }
+    if (memAllocs[ALLOC_STDTYPE] == YES)
+        {
+        free (stdType);
+        memAllocs[ALLOC_STDTYPE] = NO;
+        }
+    if (memAllocs[ALLOC_STDSTATEFREQS] == YES)
+        {
+        free (stdStateFreqs);
+        stdStateFreqs = NULL;
+        memAllocs[ALLOC_STDSTATEFREQS] = NO;
+        }
+    if (memAllocs[ALLOC_PARAMVALUES] == YES)
+        {
+        for (i=0; i<numParams; i++)
+            {
+            p = &params[i];
+            if (p->paramType == P_CPPEVENTS)
+                FreeCppEvents(p);
+            }
+        free (paramValues);
+        paramValues = NULL;
+        free (intValues);
+        intValues = NULL;
+        paramValsRowSize = intValsRowSize = 0;
+        memAllocs[ALLOC_PARAMVALUES] = NO;
+        }
+    if (memAllocs[ALLOC_PARAMS] == YES)
+        {
+        for (i=0; i<numParams; i++)
+            {
+            SafeFree ((void **)&params[i].name);
+            if (params[i].paramHeader)
+                {
+                free (params[i].paramHeader);
+                params[i].paramHeader = NULL;
+                }
+            }
+        free (params);
+        free (relevantParts);
+        params = NULL;
+        relevantParts = NULL;
+        numParams = 0;
+        memAllocs[ALLOC_PARAMS] = NO;
+        }
+    if (memAllocs[ALLOC_MCMCTREES] == YES)
+        {
+        free (mcmcTree);
+        free (subParamPtrs);
+        mcmcTree = NULL;
+        subParamPtrs = NULL;
+        memAllocs[ALLOC_MCMCTREES] = NO;
+        }
+    if (memAllocs[ALLOC_SYMPIINDEX] == YES)
+        {
+        free (sympiIndex);
+        memAllocs[ALLOC_SYMPIINDEX] = NO;
+        }
+    if (memAllocs[ALLOC_LOCTAXANAMES] == YES)
+        {
+        free (localTaxonNames);
+        memAllocs[ALLOC_LOCTAXANAMES] = NO;
+        }
+    if (memAllocs[ALLOC_LOCALTAXONCALIBRATION] == YES)
+        {
+        free (localTaxonCalibration);
+        memAllocs[ALLOC_LOCALTAXONCALIBRATION] = NO;
+        }
+
+    return (NO_ERROR);
+}
+
+
+void FreeMove (MCMCMove *mv)
+{
+    free (mv->tuningParam[0]);
+    free (mv->tuningParam);
+    free (mv->relProposalProb);
+    free (mv->nAccepted);
+    free (mv->name);
+    free (mv);
+}
+
+
+/* Compute empirical state freq are return it in global array empiricalFreqs[] */
+int GetEmpiricalFreqs (int *relParts, int nRelParts)
+{
+    int             i, j, k, m, n, thePartition, nuc[20], ns, temp, isDNA, isProtein, firstRel;
+    MrBFlt          freqN[20], sum, sumN[20]/*, rawCounts[20]*/;
+
+    isDNA = isProtein = NO;
+    ns = 0;
+    firstRel = 0;
+    for (i=0; i<nRelParts; i++)
+        {
+        thePartition = relParts[i];
+        if (i == 0)
+            {
+            if (modelParams[thePartition].dataType == DNA || modelParams[i].dataType == RNA)
+                {
+                isDNA = YES;
+                ns = 4;
+                }
+            else if (modelParams[thePartition].dataType == PROTEIN)
+                {
+                isProtein = YES;
+                ns = 20;
+                }
+            else if (modelParams[thePartition].dataType == RESTRICTION)
+                {
+                ns = 2;
+                }
+            else
+                {
+                MrBayesPrint ("%s   Cannot get empirical state frequencies for this datatype (%d)\n", spacer, modelSettings[i].dataType);
+                return (ERROR);
+                }
+            firstRel = thePartition;
+            }
+        else
+            {
+            if (modelParams[thePartition].dataType == DNA || modelParams[i].dataType == RNA)
+                temp = 4;
+            else if (modelParams[thePartition].dataType == PROTEIN)
+                temp = 20;
+            else if (modelParams[thePartition].dataType == RESTRICTION)
+                temp = 2;
+            else
+                {
+                MrBayesPrint ("%s   Unknown data type in GetEmpiricalFreqs\n", spacer);
+                return (ERROR);
+                }
+            if (ns != temp)
+                {
+                MrBayesPrint ("%s   Averaging state frequencies over partitions with different data types\n", spacer);
+                return (ERROR);
+                }
+            }
+        }
+    if (ns == 0)
+        {
+        MrBayesPrint ("%s   Could not find a relevant partition\n", spacer);
+        return (ERROR);
+        }
+
+    for (i=0; i<200; i++)
+        empiricalFreqs[i] = 0.0;
+    
+    for (m=0; m<ns; m++)
+        freqN[m] =  1.0 / ns;
+        
+    /* for (m=0; m<ns; m++)
+       rawCounts[m] = 0.0; NEVER USED */
+        
+    for (m=0; m<ns; m++)
+        sumN[m] = 0.0;
+    for (k=0; k<nRelParts; k++)
+        {
+        thePartition = relParts[k];
+        for (i=0; i<numTaxa; i++)
+            {
+            if (taxaInfo[i].isDeleted == NO)
+                {
+                for (j=0; j<numChar; j++)
+                    {
+                    if (charInfo[j].isExcluded == NO && partitionId[j][partitionNum] - 1 == thePartition)
+                        {
+                        if (isDNA == YES)
+                            GetPossibleNucs (matrix[pos(i,j,numChar)], nuc);
+                        else if (isProtein == YES)
+                            GetPossibleAAs (matrix[pos(i,j,numChar)], nuc);
+                        else
+                            GetPossibleRestrictionSites (matrix[pos(i,j,numChar)], nuc);
+                        sum = 0.0;
+                        for (m=0; m<ns; m++)
+                            sum += freqN[m] * nuc[m];
+                        for (m=0; m<ns; m++)
+                            sumN[m] += freqN[m] * nuc[m] / sum;
+                        }
+                    }
+                }
+            }
+        }
+    sum = 0.0;
+    for (m=0; m<ns; m++)
+        sum += sumN[m];
+    for (m=0; m<ns; m++)
+        freqN[m] = sumN[m] / sum;
+
+    if (modelParams[firstRel].dataType == DNA || modelParams[firstRel].dataType == RNA)
+        {
+        if (!strcmp(modelParams[firstRel].nucModel, "4by4"))
+            {
+            for (m=0; m<ns; m++)
+                empiricalFreqs[m] = freqN[m];
+            }
+        else if (!strcmp(modelParams[firstRel].nucModel, "Doublet"))
+            {
+            i = 0;
+            for (m=0; m<ns; m++)
+                for (n=0; n<ns; n++)
+                    empiricalFreqs[i++] = freqN[m] * freqN[n];
+            }
+        else
+            {
+            if (!strcmp(modelParams[firstRel].geneticCode, "Universal"))
+                {
+                for (i=0; i<61; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Vertmt"))
+                {
+                for (i=0; i<60; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Invermt"))
+                {
+                for (i=0; i<62; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Mycoplasma"))
+                {
+                for (i=0; i<62; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Yeast"))
+                {
+                for (i=0; i<62; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Ciliate"))
+                {
+                for (i=0; i<63; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Echinoderm"))
+                {
+                for (i=0; i<62; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Euplotid"))
+                {
+                for (i=0; i<62; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            else if (!strcmp(modelParams[firstRel].geneticCode, "Metmt"))
+                {
+                for (i=0; i<62; i++)
+                    empiricalFreqs[i] = freqN[modelParams[firstRel].codonNucs[i][0]] * freqN[modelParams[firstRel].codonNucs[i][1]] * freqN[modelParams[firstRel].codonNucs[i][2]];
+                }
+            sum = 0.0;
+            for (i=0; i<64; i++)
+                sum += empiricalFreqs[i];
+            for (i=0; i<64; i++)
+                empiricalFreqs[i] /= sum;
+            
+            }
+        }
+    else
+        {
+        for (m=0; m<ns; m++)
+            empiricalFreqs[m] = freqN[m];
+        }
+        
+    return (NO_ERROR);
+}
+
+
+int GetNumDivisionChars (void)
+{
+    int         c, d, n;
+    ModelInfo   *m;
+
+    /* count number of characters in each division */
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        
+        n = 0;
+        for (c=0; c<numChar; c++)
+            {
+            if (charInfo[c].isExcluded == NO && partitionId[c][partitionNum] == d+1)
+                n++;
+            }
+        if (m->dataType == DNA || m->dataType == RNA)
+            {
+            if (m->nucModelId == NUCMODEL_DOUBLET)
+                n *= 2;
+            else if (m->nucModelId == NUCMODEL_CODON)
+                n *= 3;
+            }
+
+        m->numUncompressedChars = n;
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int *GetParamIntVals (Param *parm, int chain, int state)
+{
+    return parm->intValues + (2 * chain + state) * intValsRowSize;
+}
+
+
+MrBFlt  *GetParamStdStateFreqs (Param *parm, int chain, int state)
+{
+    return parm->stdStateFreqs + (2 * chain + state) * stdStateFreqsRowSize;
+}
+
+
+MrBFlt  *GetParamSubVals (Param *parm, int chain, int state)
+{
+    return parm->subValues + (2 * chain + state) * paramValsRowSize;
+}
+
+
+MrBFlt  *GetParamVals (Param *parm, int chain, int state)
+{
+    return parm->values + (2 * chain + state) * paramValsRowSize;
+}
+
+
+void GetPossibleAAs (int aaCode, int aa[])
+{
+    int     m;
+    
+    for (m=0; m<20; m++)
+        aa[m] = 0;
+        
+    if (aaCode > 0 && aaCode <= 20)
+        aa[aaCode-1] = 1;
+    else
+        {
+        for (m=0; m<20; m++)
+            aa[m] = 1;
+        }
+
+#   if 0
+    printf ("%2d -- ", aaCode);
+    for (m=0; m<20; m++)
+        printf ("%d", aa[m]);
+    printf ("\n");
+#   endif
+}
+
+
+void GetPossibleNucs (int nucCode, int nuc[])
+{
+    if (nucCode == 1)
+        {
+        nuc[0] = 1;
+        nuc[1] = 0;
+        nuc[2] = 0;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 2)
+        {
+        nuc[0] = 0;
+        nuc[1] = 1;
+        nuc[2] = 0;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 3)
+        {
+        nuc[0] = 1;
+        nuc[1] = 1;
+        nuc[2] = 0;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 4)
+        {
+        nuc[0] = 0;
+        nuc[1] = 0;
+        nuc[2] = 1;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 5)
+        {
+        nuc[0] = 1;
+        nuc[1] = 0;
+        nuc[2] = 1;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 6)
+        {
+        nuc[0] = 0;
+        nuc[1] = 1;
+        nuc[2] = 1;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 7)
+        {
+        nuc[0] = 1;
+        nuc[1] = 1;
+        nuc[2] = 1;
+        nuc[3] = 0;
+        }
+    else if (nucCode == 8)
+        {
+        nuc[0] = 0;
+        nuc[1] = 0;
+        nuc[2] = 0;
+        nuc[3] = 1;
+        }
+    else if (nucCode == 9)
+        {
+        nuc[0] = 1;
+        nuc[1] = 0;
+        nuc[2] = 0;
+        nuc[3] = 1;
+        }
+    else if (nucCode == 10)
+        {
+        nuc[0] = 0;
+        nuc[1] = 1;
+        nuc[2] = 0;
+        nuc[3] = 1;
+        }
+    else if (nucCode == 11)
+        {
+        nuc[0] = 1;
+        nuc[1] = 1;
+        nuc[2] = 0;
+        nuc[3] = 1;
+        }
+    else if (nucCode == 12)
+        {
+        nuc[0] = 0;
+        nuc[1] = 0;
+        nuc[2] = 1;
+        nuc[3] = 1;
+        }
+    else if (nucCode == 13)
+        {
+        nuc[0] = 1;
+        nuc[1] = 0;
+        nuc[2] = 1;
+        nuc[3] = 1;
+        }
+    else if (nucCode == 14)
+        {
+        nuc[0] = 0;
+        nuc[1] = 1;
+        nuc[2] = 1;
+        nuc[3] = 1;
+        }
+    else
+        {
+        nuc[0] = 1;
+        nuc[1] = 1;
+        nuc[2] = 1;
+        nuc[3] = 1;
+        }
+}
+
+
+void GetPossibleRestrictionSites (int resSiteCode, int *sites)
+{
+    int     m;
+    
+    for (m=0; m<2; m++)
+        sites[m] = 0;
+        
+    if (resSiteCode == 1)
+        sites[0] = 1;
+    else if (resSiteCode == 2)
+        sites[1] = 1;
+    else
+        sites[0] = sites[1] = 1;
+
+#   if 0
+    printf ("%2d -- ", aaCode);
+    for (m=0; m<20; m++)
+        printf ("%d", aa[m]);
+    printf ("\n");
+#   endif
+}
+
+
+Tree *GetTree (Param *parm, int chain, int state)
+{
+    return mcmcTree[parm->treeIndex + ((2 * chain + state) * numTrees)];
+}
+
+
+Tree *GetTreeFromIndex (int index, int chain, int state)
+{
+    return mcmcTree[index + ((2 * chain + state) * numTrees)];
+}
+
+
+/*-----------------------------------------------------------
+|
+|   GetUserTreeFromName: Do case-insensitive search for user
+|      tree, return index if match, -1 and ERROR if error
+|
+------------------------------------------------------------*/
+int GetUserTreeFromName (int *index, char *treeName)
+{
+    int     i, j, k, nMatches;
+    char    localName[100], temp[100];
+
+    (*index) = -1;  /* appropriate return if no match */
+
+    if ((int)strlen(treeName) > 99)
+        {
+        MrBayesPrint ("%s   Too many characters in tree name\n", spacer);
+        return (ERROR);
+        }
+
+    strcpy (localName, treeName);
+    for (i=0; i<(int)strlen(localName); i++)
+        localName[i] = tolower(localName[i]);
+
+    nMatches = j = 0;
+    for (i=0; i<numUserTrees; i++)
+        {
+        strcpy (temp, userTree[i]->name);
+        for (k=0; k<(int)strlen(temp); k++)
+            temp[k] = tolower(temp[k]);
+        if (strcmp(localName,temp) == 0)
+            {
+            j = i;
+            nMatches++;
+            }
+        }
+    if (nMatches==0)
+        {
+        for (i=0; i<numUserTrees; i++)
+            {
+            strcpy (temp, userTree[i]->name);
+            for (k=0; k<(int)strlen(temp); k++)
+                temp[k] = tolower(temp[k]);
+            if (strncmp(localName,temp,strlen(localName)) == 0)
+                {
+                j = i;
+                nMatches++;
+                }
+            }
+        }
+    if (nMatches == 0)
+        {
+        MrBayesPrint ("%s   Could not find tree '%s'\n", spacer, localName);  
+        return (ERROR);
+        }
+    else if (nMatches > 1)
+        {
+        MrBayesPrint ("%s   Several trees matched the abbreviated name '%s'\n", spacer, localName);
+        return (ERROR);
+        }
+    else
+        {
+        (*index) = j;
+        return (NO_ERROR);
+        }
+}
+
+
+/*----------------------------------------------------------------------
+ |
+ |   InitializeChainTrees: 'Constructor' for chain trees
+ |
+ -----------------------------------------------------------------------*/
+int InitializeChainTrees (Param *p, int from, int to, int isRooted)
+{
+    int     i, st, isCalibrated, isClock, nTaxa, numActiveHardConstraints=0;
+    Tree    *tree, **treeHandle;
+    Model   *mp;
+    
+    mp = &modelParams[p->relParts[0]];
+    
+    if (p->paramType == P_SPECIESTREE)
+        nTaxa = numSpecies;
+    else
+        nTaxa = numLocalTaxa;
+    
+    /* figure out whether the trees are clock */
+    if (!strcmp(mp->brlensPr,"Clock"))
+        isClock = YES;
+    else
+        isClock = NO;
+    
+    /* figure out whether the trees are calibrated */
+    if (!strcmp(mp->brlensPr,"Clock") && (strcmp(mp->nodeAgePr,"Calibrated") == 0 || strcmp(mp->clockRatePr,"Fixed") != 0 ||
+                                          (strcmp(mp->clockRatePr, "Fixed") == 0 && AreDoublesEqual(mp->clockRateFix, 1.0, 1E-6) == NO)))
+        isCalibrated = YES;
+    else
+        isCalibrated = NO;
+    
+    if (p->checkConstraints == YES)
+        {
+        for (i=0; i<numDefinedConstraints; i++)
+            {
+            if (mp->activeConstraints[i] == YES && definedConstraintsType[i] == HARD)
+                numActiveHardConstraints++;
+            }
+        }
+    
+    /* allocate space for and construct the trees */
+    /* NOTE: The memory allocation scheme used here must match GetTree and GetTreeFromIndex */
+    for (i=from; i<to; i++)
+        {
+        treeHandle = mcmcTree + p->treeIndex + 2*i*numTrees;
+        if (*treeHandle)
+            free(*treeHandle);
+        if ((*treeHandle = AllocateTree (nTaxa)) == NULL)
+            {
+            MrBayesPrint ("%s   Problem allocating mcmc trees\n", spacer);
+            return (ERROR);
+            }
+        treeHandle = mcmcTree + p->treeIndex + (2*i + 1)*numTrees;
+        if (*treeHandle)
+            free(*treeHandle);
+        if ((*treeHandle = AllocateTree (nTaxa)) == NULL)
+            {
+            MrBayesPrint ("%s   Problem allocating mcmc trees\n", spacer);
+            return (ERROR);
+            }
+        }
+    
+    /* initialize the trees */
+    for (i=from; i<to; i++)
+        {
+        for (st=0; st<2; st++)
+            {
+            tree = GetTree (p, i, st);
+            if (numTrees > 1)
+                sprintf (tree->name, "mcmc.tree%d_%d", p->treeIndex+1, i+1);
+            else /* if (numTrees == 1) */
+                sprintf (tree->name, "mcmc.tree_%d", i+1);
+            tree->nRelParts = p->nRelParts;
+            tree->relParts = p->relParts;
+            tree->isRooted = isRooted;
+            tree->isClock = isClock;
+            tree->isCalibrated = isCalibrated;
+            if (p->paramType == P_SPECIESTREE)
+                {
+                tree->nNodes = 2*numSpecies;
+                tree->nIntNodes = numSpecies - 1;
+                }
+            else if (tree->isRooted == YES)
+                {
+                tree->nNodes = 2*numLocalTaxa;
+                tree->nIntNodes = numLocalTaxa - 1;
+                }
+            else /* if (tree->isRooted == NO) */
+                {
+                tree->nNodes = 2*numLocalTaxa - 2;
+                tree->nIntNodes = numLocalTaxa - 2;
+                }
+            if (p->checkConstraints == YES)
+                {
+                tree->checkConstraints = YES;
+                tree->nLocks = NumInformativeHardConstraints(mp);
+                tree->nConstraints = mp->numActiveConstraints;  /* nConstraints is number of constraints to check */
+                tree->constraints = mp->activeConstraints;
+                }
+            else
+                {
+                tree->checkConstraints = NO;
+                tree->nConstraints = tree->nLocks = 0;
+                tree->constraints = NULL;
+                }
+            }
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int InitializeLinks (void)
+{
+    int         i, j;
+    
+    linkNum = 0;
+    for (i=0; i<NUM_LINKED; i++)
+        {
+        for (j=0; j<numCurrentDivisions; j++)
+            linkTable[i][j] = linkNum;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* InitializeTreeCalibrations: Set calibrations for tree nodes */
+int InitializeTreeCalibrations (Tree *t)
+{
+    int         i;
+    TreeNode    *p;
+    
+    if (t->isCalibrated == NO)
+        return (NO_ERROR);
+    
+    /* Set tip calibrations */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL && localTaxonCalibration[p->index]->prior != unconstrained)
+            {
+            p->isDated = YES;
+            p->calibration = localTaxonCalibration[p->index];
+            p->age = p->calibration->min;
+            }
+        else if (p->left == NULL && p->right == NULL)
+            {
+            p->isDated = NO;
+            p->calibration = NULL;
+            p->age = -1.0;
+            } 
+        }
+
+    /* Initialize interior calibrations */
+    if (CheckSetConstraints(t) == ERROR)
+        return (ERROR);
+
+    return (NO_ERROR);
+}
+
+
+int IsApplicable (Param *param)
+{
+    if (param == NULL)
+        return NO;
+
+    return YES;
+}
+
+
+int IsApplicable_ThreeTaxaOrMore (Param *param)
+{
+    if (LargestMovableSubtree (param) >= 3)
+        return YES;
+    else
+        return NO;
+}
+
+
+int IsApplicable_FourTaxaOrMore (Param *param)
+{
+    if (LargestMovableSubtree (param) >= 4)
+        return YES;
+    else
+        return NO;
+}
+
+
+int IsApplicable_FiveTaxaOrMore (Param *param)
+{
+    if (LargestMovableSubtree (param) >= 5)
+        return YES;
+    else
+        return NO;
+}
+
+
+int IsApplicable_TreeAgeMove (Param *param)
+{
+    Tree        *t;
+    TreeNode    *p;
+
+    if (param == NULL)
+        return NO;
+
+    if (param->paramType != P_BRLENS)
+        return NO;
+    
+    t = GetTree (param, 0, 0);
+
+    p = t->root->left;
+    if (p->isDated == NO)
+        return NO;
+    if (p->calibration->prior == fixed)
+        return NO;
+    else
+        return YES;
+}
+
+
+int IsApplicable_AncestralFossil (Param *param)
+{
+    ModelParams *mp = &modelParams[param->relParts[0]];
+
+    if (!strcmp(mp->sampleStrat, "FossilTip"))
+        return NO;
+    else if (mp->fossilizationFix == 0.0)
+        return NO;
+    else  /* fossils may be ancestors of other fossils or extant species */
+        return YES;
+}
+
+
+int IsModelSame (int whichParam, int part1, int part2, int *isApplic1, int *isApplic2)
+{
+    int         i, isSame, isFirstNucleotide, isSecondNucleotide, isFirstProtein, isSecondProtein, nDiff, temp1, temp2;
+
+    isSame = YES;
+    *isApplic1 = YES;
+    *isApplic2 = YES;
+
+    /* We cannot rely on SetModelInfo being called first so we need to be smart in figuring out model data type by looking at several model params */
+    isFirstNucleotide = isSecondNucleotide = NO;
+    if ((modelParams[part1].dataType == DNA || modelParams[part1].dataType == RNA) && strcmp(modelParams[part1].nucModel,"Protein") != 0)
+        isFirstNucleotide = YES;
+    if ((modelParams[part2].dataType == DNA || modelParams[part2].dataType == RNA) && strcmp(modelParams[part2].nucModel,"Protein") != 0)
+        isSecondNucleotide = YES;       
+    isFirstProtein = isSecondProtein = NO;
+    if (modelParams[part1].dataType == PROTEIN || ((modelParams[part1].dataType == DNA || modelParams[part1].dataType == RNA) && !strcmp(modelParams[part1].nucModel,"Protein")))
+        isFirstProtein = YES;
+    if (modelParams[part2].dataType == PROTEIN || ((modelParams[part2].dataType == DNA || modelParams[part2].dataType == RNA) && !strcmp(modelParams[part2].nucModel,"Protein")))
+        isSecondProtein = YES;      
+    
+    if (whichParam == P_TRATIO)
+        {
+        /* Check the ti/tv rate ratio for partitions 1 and 2. */
+
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and tratio does not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and tratio does not apply */
+        
+        /* Check that the data are nucleotide for both partitions 1 and 2 */
+        if (isFirstNucleotide == NO)
+            *isApplic1 = NO; /* part1 is not nucleotide data so tratio does not apply */
+        if (isSecondNucleotide == NO)
+            *isApplic2 = NO; /* part2 is not nucleotide data so tratio does not apply */
+        
+        /* check that nst=2 for both partitions */
+        if (strcmp(modelParams[part1].nst, "2"))
+            *isApplic1 = NO; /* part1 does not have nst=2 and tratio does not apply */
+        if (strcmp(modelParams[part2].nst, "2"))
+            *isApplic2 = NO; /* part2 does not have nst=2 and tratio does not apply */
+        
+        /* Check if part1 & part2 are restriction */
+        if (modelParams[part1].dataType == RESTRICTION)
+            *isApplic1 = NO;
+        if (modelParams[part2].dataType == RESTRICTION)
+            *isApplic2 = NO;
+
+        /* If Nst = 2 for both part1 and part2, we now need to check if the prior is the same for both. */
+        if (!strcmp(modelParams[part1].tRatioPr,"Beta") && !strcmp(modelParams[part2].tRatioPr,"Beta"))
+            {
+            if (AreDoublesEqual (modelParams[part1].tRatioDir[0], modelParams[part2].tRatioDir[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].tRatioDir[1], modelParams[part2].tRatioDir[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].tRatioPr,"Fixed") && !strcmp(modelParams[part2].tRatioPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].tRatioFix, modelParams[part2].tRatioFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check to see if tratio is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if tratio is inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_REVMAT)
+        {
+        /* Check the GTR rates for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and GTR rates do not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and GTR rates do not apply */
+
+        /* Check that the data are nucleotide or protein for both partitions 1 and 2 */
+        if (isFirstNucleotide == NO && isFirstProtein == NO)
+            *isApplic1 = NO; /* part1 is not nucleotide or protein data so GTR rates do not apply */
+        if (isSecondNucleotide == NO && isSecondProtein == NO)
+            *isApplic2 = NO; /* part2 is not nucleotide or protein data so GTR rates do not apply */
+
+        /* check that nst=6 or mixed for both partitions if nucleotide */
+        if (isFirstNucleotide == YES && strcmp(modelParams[part1].nst, "6") && strcmp(modelParams[part1].nst, "Mixed"))
+            *isApplic1 = NO; /* part1 does not have nst=6/Mixed and GTR rates do not apply */
+        if (isSecondNucleotide == YES && strcmp(modelParams[part2].nst, "6") && strcmp(modelParams[part2].nst, "Mixed"))
+            *isApplic2 = NO; /* part2 does not have nst=6/Mixed and GTR rates do not apply */
+            
+        /* check that model is GTR for both partitions if protein */
+        if (isFirstProtein == YES && (strcmp(modelParams[part1].aaModel,"Gtr")!=0 || strcmp(modelParams[part1].aaModelPr,"Fixed")!=0))
+            *isApplic1 = NO;
+        if (isSecondProtein == YES && (strcmp(modelParams[part2].aaModel,"Gtr")!=0 || strcmp(modelParams[part2].aaModelPr,"Fixed")!=0))
+            *isApplic2 = NO;
+
+        /* check that data type is the same for both partitions */
+        if (isFirstNucleotide == YES && isSecondNucleotide == NO)
+            isSame = NO;
+        if (isFirstProtein == YES && isSecondProtein == NO)
+            isSame = NO;
+
+        /* GTR applies to both part1 and part2. We now need to check if the prior is the same for both. */
+        if (isFirstNucleotide == YES)
+            {
+            if (strcmp(modelParams[part1].nst, modelParams[part2].nst) != 0)
+                isSame = NO;
+            if (!strcmp(modelParams[part1].nst,"Mixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].revMatSymDir, modelParams[part2].revMatSymDir, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].nst,"6") && !strcmp(modelParams[part1].revMatPr,"Dirichlet") && !strcmp(modelParams[part2].revMatPr,"Dirichlet"))
+                {
+                for (i=0; i<6; i++)
+                    {
+                    if (AreDoublesEqual (modelParams[part1].revMatDir[i], modelParams[part2].revMatDir[i], (MrBFlt) 0.00001) == NO)
+                        isSame = NO;
+                    }
+                }
+            else if (!strcmp(modelParams[part1].nst,"6") && !strcmp(modelParams[part1].revMatPr,"Fixed") && !strcmp(modelParams[part2].revMatPr,"Fixed"))
+                {
+                for (i=0; i<6; i++)
+                    {
+                    if (AreDoublesEqual (modelParams[part1].revMatFix[i], modelParams[part2].revMatFix[i], (MrBFlt) 0.00001) == NO)
+                        isSame = NO;
+                    }
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+        else /* if (isFirstProtein == YES) */
+            {
+            if (!strcmp(modelParams[part1].aaRevMatPr,"Dirichlet") && !strcmp(modelParams[part2].aaRevMatPr,"Dirichlet"))
+                {
+                for (i=0; i<190; i++)
+                    {
+                    if (AreDoublesEqual (modelParams[part1].aaRevMatDir[i], modelParams[part2].aaRevMatDir[i], (MrBFlt) 0.00001) == NO)
+                        isSame = NO;
+                    }
+                }
+            else if (!strcmp(modelParams[part1].aaRevMatPr,"Fixed") && !strcmp(modelParams[part2].aaRevMatPr,"Fixed"))
+                {
+                for (i=0; i<190; i++)
+                    {
+                    if (AreDoublesEqual (modelParams[part1].aaRevMatFix[i], modelParams[part2].aaRevMatFix[i], (MrBFlt) 0.00001) == NO)
+                        isSame = NO;
+                    }
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+
+        /* Check to see if the GTR rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if GTR rates are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_OMEGA)
+        {
+        /* Check the nonsynonymous/synonymous rate ratio for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and nonsynonymous/synonymous rate ratio does not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and nonsynonymous/synonymous rate ratio does not apply */
+        
+        /* Check that the data are nucleotide for both partitions 1 and 2 */
+        if (isFirstNucleotide == NO)
+            *isApplic1 = NO; /* part1 is not nucleotide data so a nonsynonymous/synonymous rate ratio does not apply */
+        if (isSecondNucleotide == NO)
+            *isApplic2 = NO; /* part2 is not nucleotide data so a nonsynonymous/synonymous rate ratio does not apply */
+        
+        /* Check that the model structure is the same for both. The nucmodel should be "codon". */
+        if (strcmp(modelParams[part1].nucModel, "Codon"))
+            *isApplic1 = NO; /* part1 does not have Nucmodel = Codon and nonsynonymous/synonymous rate ratio does not apply */
+        if (strcmp(modelParams[part2].nucModel, "Codon"))
+            *isApplic2 = NO; /* part2 does not have Nucmodel = Codon and nonsynonymous/synonymous rate ratio does not apply */
+        
+        /* Assuming that Nucmodel = Codon for both part1 and part2, we now need to check if the prior is the
+           same for both. */
+        if (!strcmp(modelParams[part1].omegaVar, "M3") && !strcmp(modelParams[part2].omegaVar, "M3"))
+            {
+            if (!strcmp(modelParams[part1].m3omegapr, "Exponential") && !strcmp(modelParams[part2].m3omegapr, "Exponential"))
+                {
+                }
+            else if (!strcmp(modelParams[part1].m3omegapr, "Fixed") && !strcmp(modelParams[part1].m3omegapr, "Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].m3omegaFixed[0], modelParams[part2].m3omegaFixed[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].m3omegaFixed[1], modelParams[part2].m3omegaFixed[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+            if (!strcmp(modelParams[part1].codonCatFreqPr, "Dirichlet") && !strcmp(modelParams[part2].codonCatFreqPr, "Dirichlet"))
+                {
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[0], modelParams[part2].codonCatDir[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[1], modelParams[part2].codonCatDir[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[2], modelParams[part2].codonCatDir[2], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].codonCatFreqPr, "Fixed") && !strcmp(modelParams[part1].codonCatFreqPr, "Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[0], modelParams[part2].codonCatFreqFix[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[1], modelParams[part2].codonCatFreqFix[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[2], modelParams[part2].codonCatFreqFix[2], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+        else if (!strcmp(modelParams[part1].omegaVar, "M10") && !strcmp(modelParams[part2].omegaVar, "M10"))
+            {           
+            if (!strcmp(modelParams[part1].codonCatFreqPr, "Dirichlet") && !strcmp(modelParams[part2].codonCatFreqPr, "Dirichlet"))
+                {
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[0], modelParams[part2].codonCatDir[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[1], modelParams[part2].codonCatDir[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].codonCatFreqPr, "Fixed") && !strcmp(modelParams[part1].codonCatFreqPr, "Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[0], modelParams[part2].codonCatFreqFix[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[1], modelParams[part2].codonCatFreqFix[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+        else if (!strcmp(modelParams[part1].omegaVar, "Ny98") && !strcmp(modelParams[part2].omegaVar, "Ny98"))
+            {
+            if (!strcmp(modelParams[part1].ny98omega1pr, "Beta") && !strcmp(modelParams[part2].ny98omega1pr, "Beta"))
+                {
+                if (AreDoublesEqual (modelParams[part1].ny98omega1Beta[0], modelParams[part2].ny98omega1Beta[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].ny98omega1Beta[1], modelParams[part2].ny98omega1Beta[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].ny98omega1pr, "Fixed") && !strcmp(modelParams[part1].ny98omega1pr, "Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].ny98omega1Fixed, modelParams[part2].ny98omega1Fixed, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            if (!strcmp(modelParams[part1].ny98omega3pr, "Uniform") && !strcmp(modelParams[part2].ny98omega3pr, "Uniform"))
+                {
+                if (AreDoublesEqual (modelParams[part1].ny98omega3Uni[0], modelParams[part2].ny98omega3Uni[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].ny98omega3Uni[1], modelParams[part2].ny98omega3Uni[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].ny98omega3pr, "Exponential") && !strcmp(modelParams[part1].ny98omega3pr, "Exponential"))
+                {
+                if (AreDoublesEqual (modelParams[part1].ny98omega3Exp, modelParams[part2].ny98omega3Exp, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].ny98omega3pr, "Fixed") && !strcmp(modelParams[part1].ny98omega3pr, "Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].ny98omega3Fixed, modelParams[part2].ny98omega3Fixed, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            if (!strcmp(modelParams[part1].codonCatFreqPr, "Dirichlet") && !strcmp(modelParams[part2].codonCatFreqPr, "Dirichlet"))
+                {
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[0], modelParams[part2].codonCatDir[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[1], modelParams[part2].codonCatDir[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatDir[2], modelParams[part2].codonCatDir[2], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].codonCatFreqPr, "Fixed") && !strcmp(modelParams[part1].codonCatFreqPr, "Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[0], modelParams[part2].codonCatFreqFix[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[1], modelParams[part2].codonCatFreqFix[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].codonCatFreqFix[2], modelParams[part2].codonCatFreqFix[2], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+        else if (!strcmp(modelParams[part1].omegaVar, "Equal") && !strcmp(modelParams[part2].omegaVar, "Equal"))
+            {
+            if (!strcmp(modelParams[part1].omegaPr,"Dirichlet") && !strcmp(modelParams[part2].omegaPr,"Dirichlet"))
+                {
+                if (AreDoublesEqual (modelParams[part1].omegaDir[0], modelParams[part2].omegaDir[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].omegaDir[1], modelParams[part2].omegaDir[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else if (!strcmp(modelParams[part1].omegaPr,"Fixed") && !strcmp(modelParams[part2].omegaPr,"Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].omegaFix, modelParams[part2].omegaFix, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+        
+        /* Check to see if omega is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if omega is inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_PI)
+        {
+        /* Check the state frequencies for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and state frequencies do not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and state frequencies do not apply */
+
+        /* Check that the data are not CONTINUOUS for partitions 1 and 2 */
+        if (modelParams[part1].dataType == CONTINUOUS)
+            *isApplic1 = NO; /* state frequencies do not make sense for part1 */
+        if (modelParams[part2].dataType == CONTINUOUS)
+            *isApplic2 = NO; /* state frequencies do not make sense for part2 */
+            
+        /* Now, check that the data are the same (i.e., both nucleotide or both amino acid, or whatever). */
+        if (isFirstNucleotide != isSecondNucleotide)
+            isSame = NO; /* data are not both nucleotide or both note nucleotide */
+        else if (modelParams[part1].dataType != modelParams[part2].dataType && isFirstNucleotide == NO)
+            isSame = NO; /* data are not the same */
+
+        /* Check that the model structure is the same for both partitions */
+        if (strcmp(modelParams[part1].nucModel, modelParams[part2].nucModel))
+            isSame = NO; /* the nucleotide models are different */
+        if (strcmp(modelParams[part1].covarionModel, modelParams[part2].covarionModel) && !(!strcmp(modelParams[part1].nucModel, "Codon") && !strcmp(modelParams[part2].nucModel, "Codon")))
+            isSame = NO; /* the models have different covarion struture */
+            
+        /* If both partitions have nucmodel=codon, then we also have to make certain that the same genetic code is used. */
+        if (!strcmp(modelParams[part1].nucModel, "Codon") && !strcmp(modelParams[part2].nucModel, "Codon"))
+            {
+            if (strcmp(modelParams[part1].geneticCode, modelParams[part2].geneticCode))
+                isSame = NO; /* the models have different genetic codes */
+            }
+        
+        /* Let's see if the prior is the same. */
+        if (modelParams[part1].dataType == STANDARD && modelParams[part2].dataType == STANDARD)
+            {
+            /* The data are morphological (STANDARD). The state frequencies are specified by a
+               symmetric beta distribution, the parameter of which needs to be the same to apply to both
+               partitions. Note that symPiPr = -1 is equivalent to setting the variance to 0.0. */
+            if (!strcmp(modelParams[part1].symPiPr,"Uniform") && !strcmp(modelParams[part2].symPiPr,"Uniform"))
+                {
+                if (AreDoublesEqual (modelParams[part1].symBetaUni[0], modelParams[part2].symBetaUni[0], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].symBetaUni[1], modelParams[part2].symBetaUni[1], (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (modelParams[part1].numBetaCats != modelParams[part2].numBetaCats)
+                    isSame = NO;    /* can't link because the discrete beta approximation is different */
+                }
+            else if (!strcmp(modelParams[part1].symPiPr,"Exponential") && !strcmp(modelParams[part2].symPiPr,"Exponential"))
+                {
+                if (AreDoublesEqual (modelParams[part1].symBetaExp, modelParams[part2].symBetaExp, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (modelParams[part1].numBetaCats != modelParams[part2].numBetaCats)
+                    isSame = NO;    /* can't link because the discrete beta approximation is different */
+                }
+            else if (!strcmp(modelParams[part1].symPiPr,"Fixed") && !strcmp(modelParams[part2].symPiPr,"Fixed"))
+                {
+                if (AreDoublesEqual (modelParams[part1].symBetaFix, modelParams[part2].symBetaFix, (MrBFlt) 0.00001) == NO)
+                    isSame = NO;
+                if (AreDoublesEqual (modelParams[part1].symBetaFix, (MrBFlt) -1.0, (MrBFlt) 0.00001) == NO && modelParams[part1].numBetaCats != modelParams[part2].numBetaCats)
+                    isSame = NO;    /* can't link because the discrete beta approximation is different */
+                }
+            else
+                isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+            }
+        if (modelSettings[part1].dataType == PROTEIN && modelSettings[part2].dataType == PROTEIN)
+            {
+            /* We are dealing with protein data. */
+            if (!strcmp(modelParams[part1].aaModelPr, modelParams[part2].aaModelPr))
+                {
+                if (!strcmp(modelParams[part1].aaModelPr, "Fixed"))
+                    {
+                    /* only have a single, fixed, amino acid rate matrix */
+                    if (!strcmp(modelParams[part1].aaModel, modelParams[part2].aaModel))
+                        {}
+                    else
+                        isSame = NO; /* we have different amino acid models, and the state frequencies must be different */
+                    /* if we have an equalin model or Gtr model, then we need to check the prior on the state frequencies */
+                    if (!strcmp(modelParams[part1].aaModel, "Equalin") || !strcmp(modelParams[part1].aaModel, "Gtr"))
+                        {
+                        if (!strcmp(modelParams[part1].stateFreqPr, modelParams[part2].stateFreqPr))
+                            {
+                            /* the prior form is the same */
+                            if (!strcmp(modelParams[part1].stateFreqPr, "Dirichlet")) /* both prior models must be dirichlet */
+                                {
+                                for (i=0; i<modelParams[part1].nStates; i++)
+                                    if (AreDoublesEqual (modelParams[part1].stateFreqsDir[i], modelParams[part2].stateFreqsDir[i], (MrBFlt) 0.00001) == NO)
+                                        isSame = NO; /* the dirichlet parameters are different */
+                                }
+                            else /* both prior models must be fixed */
+                                {
+                                if (!strcmp(modelParams[part1].stateFreqsFixType, modelParams[part2].stateFreqsFixType))
+                                    {
+                                    /* if (!strcmp(modelParams[part1].stateFreqsFixType, "Empirical"))
+                                        isSame = NO;     Even though it is unlikely that the empirical values for both partitions are exactly the same, we will
+                                                         allow isSame to equal YES. This means pooled base frequencies are used to determine the empirical
+                                                         base frequencies. The user can still unlink this parameter. */
+                                    if (!strcmp(modelParams[part1].stateFreqsFixType, "User"))
+                                        {
+                                        for (i=0; i<modelParams[part1].nStates; i++)
+                                            if (AreDoublesEqual (modelParams[part1].stateFreqsDir[i], modelParams[part2].stateFreqsDir[i], (MrBFlt) 0.00001) == NO)
+                                                isSame = NO; /* the user-specified base frequencies are different */
+                                        }
+                                    /* if the frequencies were both fixed to "equal", we are golden, and they are the same */
+                                    }
+                                else
+                                    isSame = NO; /* the fixed parameters must be the same. The only other possibility is that the
+                                                    user specified equal or empirical for one partition and then specified specific
+                                                    numbers (user) for the other _and_ happened to set the user values to the equal
+                                                    or empirical values. We ignore this possibility. */
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    /* averaging over models */
+                    if (linkTable[P_AAMODEL][part1] != linkTable[P_AAMODEL][part2])
+                        isSame = NO; /* the amino acid model is mixed, but independently estimated */
+                    }
+                }
+            }
+        else
+            {
+            /* Otherwise, we are dealing with RESTRICTION or NUCLEOTIDE data. The dirichlet should be the same
+               for both partitions. */
+            if (!strcmp(modelParams[part1].stateFreqPr, modelParams[part2].stateFreqPr))
+                {
+                /* the prior form is the same */
+                if (!strcmp(modelParams[part1].stateFreqPr, "Dirichlet")) /* both prior models must be dirichlet */
+                    {
+                    for (i=0; i<modelParams[part1].nStates; i++)
+                        if (AreDoublesEqual (modelParams[part1].stateFreqsDir[i], modelParams[part2].stateFreqsDir[i], (MrBFlt) 0.00001) == NO)
+                            isSame = NO; /* the dirichlet parameters are different */
+                    }
+                else /* both prior models must be fixed */
+                    {
+                    if (!strcmp(modelParams[part1].stateFreqsFixType, modelParams[part2].stateFreqsFixType))
+                        {
+                        /* if (!strcmp(modelParams[part1].stateFreqsFixType, "Empirical"))
+                            isSame = NO;     Even though it is unlikely that the empirical values for both partitions are exactly the same, we will
+                                             allow isSame to equal YES. This means pooled base frequencies are used to determine the empirical
+                                             base frequencies. The user can still unlink this parameter. */
+                        if (!strcmp(modelParams[part1].stateFreqsFixType, "User"))
+                            {
+                            for (i=0; i<modelParams[part1].nStates; i++)
+                                if (AreDoublesEqual (modelParams[part1].stateFreqsDir[i], modelParams[part2].stateFreqsDir[i], (MrBFlt) 0.00001) == NO)
+                                    isSame = NO; /* the user-specified base frequencies are different */
+                            }
+                        /* if the frequencies were both fixed to "equal", we are golden, and they are the same */
+                        }
+                    else
+                        isSame = NO; /* the fixed parameters must be the same. The only other possibility is that the
+                                        user specified equal or empirical for one partition and then specified specific
+                                        numbers (user) for the other _and_ happened to set the user values to the equal
+                                        or empirical values. We ignore this possibility. */
+                    }
+                }
+            }
+
+        /* Check to see if the state frequencies are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the state frequencies are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_SHAPE)
+        {
+        /* Check the shape parameter for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and shape parameter does not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and shape parameter does not apply */
+
+        /* Check that the data are not CONTINUOUS for partitions 1 and 2 */
+        if (modelParams[part1].dataType == CONTINUOUS)
+            *isApplic1 = NO; /* the shape parameter does not make sense for part1 */
+        if (modelParams[part2].dataType == CONTINUOUS)
+            *isApplic2 = NO; /* the shape parameter does not make sense for part2 */
+
+        /* Now, check that the data are the same (i.e., both nucleotide or both amino acid, or whatever). */
+        if (isFirstNucleotide != isSecondNucleotide)
+            isSame = NO; /* data are not both nucleotide */
+        else if (modelParams[part1].dataType != modelParams[part2].dataType && isFirstNucleotide == NO)
+            isSame = NO; /* data are not the same */
+
+        /* Let's check that the shape parameter is even relevant for the two partitions */
+        if (!strcmp(modelParams[part1].ratesModel, "Equal") || !strcmp(modelParams[part1].ratesModel, "Propinv"))
+            *isApplic1 = NO; /* the shape parameter does not make sense for part1 */
+        if (!strcmp(modelParams[part2].ratesModel, "Equal") || !strcmp(modelParams[part2].ratesModel, "Propinv"))
+            *isApplic2 = NO; /* the shape parameter does not make sense for part2 */
+        
+        /* We may have a nucleotide model. Make certain the models are not of type codon. */
+        if (!strcmp(modelParams[part1].nucModel, "Codon"))
+            *isApplic1 = NO; /* we have a codon model for part1, and a shape parameter does not apply */
+        if (!strcmp(modelParams[part2].nucModel, "Codon"))
+            *isApplic2 = NO;/* we have a codon model for part2, and a shape parameter does not apply */
+
+        /* Check that the model structure is the same for both partitions */
+        if ((!strcmp(modelParams[part1].nucModel, "4by4") || !strcmp(modelParams[part1].nucModel, "Doublet")) && !strcmp(modelParams[part2].nucModel, "Codon"))
+            isSame = NO; /* the nucleotide models are incompatible with the same shape parameter */
+        if ((!strcmp(modelParams[part2].nucModel, "4by4") || !strcmp(modelParams[part2].nucModel, "Doublet")) && !strcmp(modelParams[part1].nucModel, "Codon"))
+            isSame = NO; /* the nucleotide models are incompatible with the same shape parameter */
+        /* if (strcmp(modelParams[part1].covarionModel, modelParams[part2].covarionModel))
+            isSame = NO; */ /* the models have different covarion struture */
+        /* NOTE: Perhaps we should allow the possiblity that the shape parameter is the same for the case
+                 where one partition has a covarion model but the other does not and both datatypes are the same. */
+        
+        /* Check that the number of rate categories is the same */
+        if (modelParams[part1].numGammaCats != modelParams[part2].numGammaCats)
+            isSame = NO; /* the number of rate categories is not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check that the priors are the same. */
+        if (!strcmp(modelParams[part1].shapePr,"Uniform") && !strcmp(modelParams[part2].shapePr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].shapeUni[0], modelParams[part2].shapeUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].shapeUni[1], modelParams[part2].shapeUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].shapePr,"Exponential") && !strcmp(modelParams[part2].shapePr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].shapeExp, modelParams[part2].shapeExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].shapePr,"Fixed") && !strcmp(modelParams[part2].shapePr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].shapeFix, modelParams[part2].shapeFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+        
+        /* Check to see if the shape parameter is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the shape parameter is inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_PINVAR)
+        {
+        /* Check the proportion of invariable sites parameter for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and proportion of invariable sites parameter does not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and proportion of invariable sites parameter does not apply */
+
+        /* Check that the data are not CONTINUOUS for partitions 1 and 2 */
+        if (modelParams[part1].dataType == CONTINUOUS)
+            *isApplic1 = NO; /* the proportion of invariable sites parameter does not make sense for part1 */
+        if (modelParams[part2].dataType == CONTINUOUS)
+            *isApplic2 = NO; /* the proportion of invariable sites parameter does not make sense for part2 */
+
+        /* Now, check that the data are the same (i.e., both nucleotide or both amino acid, or whatever). */
+        if (isFirstNucleotide != isSecondNucleotide)
+            isSame = NO; /* data are not both nucleotide */
+        else if (modelParams[part1].dataType != modelParams[part2].dataType && isFirstNucleotide == NO)
+            isSame = NO; /* data are not the same */
+
+        /* Let's check that proportion of invariable sites parameter is even relevant for the two partitions */
+        if (!strcmp(modelParams[part1].ratesModel, "Equal") || !strcmp(modelParams[part1].ratesModel, "Gamma") ||
+            !strcmp(modelParams[part1].ratesModel, "LNorm") || !strcmp(modelParams[part1].ratesModel, "Adgamma"))
+            *isApplic1 = NO; /* the proportion of invariable sites parameter does not make sense for part1 */
+        if (!strcmp(modelParams[part2].ratesModel, "Equal") || !strcmp(modelParams[part2].ratesModel, "Gamma") ||
+            !strcmp(modelParams[part2].ratesModel, "LNorm") || !strcmp(modelParams[part2].ratesModel, "Adgamma"))
+            *isApplic2 = NO; /* the proportion of invariable sites parameter does not make sense for part2 */
+            
+        /* It is not sensible to have a covarion model and a proportion of invariable sites */
+        if (!strcmp(modelParams[part1].covarionModel, "Yes"))
+            *isApplic1 = NO;
+        if (!strcmp(modelParams[part2].covarionModel, "Yes"))
+            *isApplic2 = NO;
+        
+        /* We have a nucleotide model. Make certain the models are not of type codon. */
+        if (!strcmp(modelParams[part1].nucModel, "Codon"))
+            *isApplic1 = NO; /* we have a codon model for part1, and a proportion of invariable sites parameter does not apply */
+        if (!strcmp(modelParams[part2].nucModel, "Codon"))
+            *isApplic2 = NO;/* we have a codon model for part2, and a proportion of invariable sites parameter does not apply */
+
+        /* Check that the model structure is the same for both partitions */
+        if (strcmp(modelParams[part1].nucModel, modelParams[part2].nucModel))
+            isSame = NO; /* the nucleotide models are different */
+        if (strcmp(modelParams[part1].covarionModel, modelParams[part2].covarionModel))
+            isSame = NO; /* the models have different covarion struture */
+        
+        /* check the priors */
+        if (!strcmp(modelParams[part1].pInvarPr,"Uniform") && !strcmp(modelParams[part2].pInvarPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].pInvarUni[0], modelParams[part2].pInvarUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].pInvarUni[1], modelParams[part2].pInvarUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].pInvarPr,"Fixed") && !strcmp(modelParams[part2].pInvarPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].pInvarFix, modelParams[part2].pInvarFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+        
+        /* Check to see if the switching rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the switching rates are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_CORREL)
+        {
+        /* Check the autocorrelation parameter for gamma rates on partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and autocorrelation parameter does not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and autocorrelation parameter does not apply */
+
+        /* Check that the data are either DNA, RNA, or PROTEIN for partitions 1 and 2 */
+        if (modelSettings[part1].dataType != DNA && modelSettings[part1].dataType != RNA && modelSettings[part1].dataType != PROTEIN)
+            *isApplic1 = NO; /* the switching rates do not make sense for part1 */
+        if (modelSettings[part2].dataType != DNA && modelSettings[part2].dataType != RNA && modelSettings[part2].dataType != PROTEIN)
+            *isApplic2 = NO; /* the switching rates do not make sense for part2 */
+            
+        /* Now, check that the data are the same (i.e., both nucleotide or both amino acid). */
+        if (isFirstNucleotide != isSecondNucleotide)
+            isSame = NO; /* one or the other is nucleotide, so they cannot be the same */
+        else if (modelSettings[part1].dataType != modelSettings[part2].dataType && isFirstNucleotide == NO)
+            isSame = NO; /* data are not both nucleotide or both amino acid */
+
+        /* Let's check that autocorrelation parameter is even relevant for the two partitions */
+        if (strcmp(modelParams[part1].ratesModel, "Adgamma"))
+            *isApplic1 = NO; /* the autocorrelation parameter does not make sense for part1 */
+        if (strcmp(modelParams[part2].ratesModel, "Adgamma"))
+            *isApplic2 = NO; /* the autocorrelation parameter does not make sense for part2 */
+
+        /* Assuming that we have a nucleotide model, make certain the models are not of type codon. */
+        if (!strcmp(modelParams[part1].nucModel, "Codon"))
+            *isApplic1 = NO; /* we have a codon model for part1, and a autocorrelation parameter does not apply */
+        if (!strcmp(modelParams[part2].nucModel, "Codon"))
+            *isApplic2 = NO; /* we have a codon model for part2, and a autocorrelation parameter does not apply */
+        
+        /* Check that the model structure is the same for both partitions */
+        if (strcmp(modelParams[part1].nucModel, modelParams[part2].nucModel))
+            isSame = NO; /* the nucleotide models are different */
+        if (strcmp(modelParams[part1].covarionModel, modelParams[part2].covarionModel))
+            isSame = NO; /* the models have different covarion struture */
+
+        /* Check the priors for both partitions. */
+        if (!strcmp(modelParams[part1].adGammaCorPr,"Uniform") && !strcmp(modelParams[part2].adGammaCorPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].corrUni[0], modelParams[part2].corrUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].corrUni[1], modelParams[part2].corrUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].adGammaCorPr,"Fixed") && !strcmp(modelParams[part2].adGammaCorPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].corrFix, modelParams[part2].corrFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check to see if the switching rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the switching rates are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_SWITCH)
+        {
+        /* Check the covarion switching rates on partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and switching rates do not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and switching rates do not apply */
+        
+        /* Check that the data are either DNA, RNA, or PROTEIN for partitions 1 and 2 */
+        if (modelSettings[part1].dataType != DNA && modelSettings[part1].dataType != RNA && modelSettings[part1].dataType != PROTEIN)
+            *isApplic1 = NO; /* the switching rates do not make sense for part1 */
+        if (modelSettings[part2].dataType != DNA && modelSettings[part2].dataType != RNA && modelSettings[part2].dataType != PROTEIN)
+            *isApplic2 = NO; /* the switching rates do not make sense for part2 */
+            
+        /* Now, check that the data are the same (i.e., both nucleotide or both amino acid). */
+        if (isFirstNucleotide != isSecondNucleotide)
+            isSame = NO; /* one or the other is nucleotide, so they cannot be the same */
+        else if (modelSettings[part1].dataType != modelSettings[part2].dataType && isFirstNucleotide == NO)
+            isSame = NO; /* data are not both nucleotide or both amino acid */
+
+        /* Lets check that covarion model has been selected for partitions 1 and 2 */
+        if (!strcmp(modelParams[part1].covarionModel, "No"))
+            *isApplic1 = NO; /* the switching rates do not make sense for part1 */
+        if (!strcmp(modelParams[part2].covarionModel, "No"))
+            *isApplic2 = NO; /* the switching rates do not make sense for part2 */
+
+        /* If we have a nucleotide model make certain the models are not of type codon or doublet. */
+        if (!strcmp(modelParams[part1].nucModel, "Codon") || !strcmp(modelParams[part1].nucModel, "Doublet"))
+            *isApplic1 = NO; /* we have a codon model for part1, and a covarion switch parameter does not apply */
+        if (!strcmp(modelParams[part2].nucModel, "Codon") || !strcmp(modelParams[part2].nucModel, "Doublet"))
+            *isApplic2 = NO; /* we have a codon model for part2, and a covarion switch parameter does not apply */
+
+        /* Check that the priors are the same. */
+        if (!strcmp(modelParams[part1].covSwitchPr,"Uniform") && !strcmp(modelParams[part2].covSwitchPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].covswitchUni[0], modelParams[part2].covswitchUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].covswitchUni[1], modelParams[part2].covswitchUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].covSwitchPr,"Exponential") && !strcmp(modelParams[part2].covSwitchPr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].covswitchExp, modelParams[part2].covswitchExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].covSwitchPr,"Fixed") && !strcmp(modelParams[part2].covSwitchPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].covswitchFix[0], modelParams[part2].covswitchFix[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].covswitchFix[1], modelParams[part2].covswitchFix[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check to see if the switching rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the switching rates are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_RATEMULT)
+        {
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+           silly and doesn't take this information into account) and a rate multiplier is nonsensical. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+        
+        /* Check that the branch lengths are at least proportional. */
+        if (IsModelSame (P_BRLENS, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_BRLENS][part1] != linkTable[P_BRLENS][part2])
+            isSame = NO;
+
+        /* See if the rate prior is the same for the partitions */
+        if (strcmp(modelParams[part1].ratePr, modelParams[part2].ratePr) != 0)
+            isSame = NO;
+
+        /* Check to see if rate multipliers are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; 
+            
+        }
+    else if (whichParam == P_TOPOLOGY)
+        {
+        /* Check the topology for partitions 1 and 2. */
+        
+        /* If the prior is different, then the topologies cannot be the same. */
+        if (strcmp(modelParams[part1].topologyPr, modelParams[part2].topologyPr))
+            isSame = NO;
+
+        /* If both partitions have topologies constrained, then we need to make certain that the constraints are the same. */
+        /* This also guarantees that any calibrations will be the same. */
+        if (!strcmp(modelParams[part1].topologyPr, "Constraints") && !strcmp(modelParams[part2].topologyPr, "Constraints"))
+            {
+            if (modelParams[part1].numActiveConstraints != modelParams[part2].numActiveConstraints)
+                isSame = NO;
+            else
+                {
+                nDiff = 0;
+                for (i=0; i<numDefinedConstraints; i++)
+                    if (modelParams[part1].activeConstraints[i] != modelParams[part2].activeConstraints[i])
+                        nDiff++;
+                if (nDiff != 0)
+                    isSame = NO;
+                }
+            }
+        }
+    else if (whichParam == P_BRLENS)
+        {
+        /* Check the branch lengths for partitions 1 and 2. */
+
+        /* First, if the topologies are different, the same branch lengths cannot apply. */
+        if (IsModelSame (P_TOPOLOGY, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_TOPOLOGY][part1] != linkTable[P_TOPOLOGY][part2])
+            isSame = NO;
+
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+           silly and doesn't take this information into account). */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+
+        /* Check to see if the branch lengths are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+
+        /* Make sure the branch lengths have the same priors and are not unlinked */
+        if (*isApplic1 == YES && *isApplic2 == YES)
+            {
+            /* We are dealing with real branch lengths (not parsimony) for both partitions */
+            
+            /* The branch length prior should be the same */
+            if (strcmp(modelParams[part1].brlensPr, modelParams[part2].brlensPr))
+                isSame = NO;
+                
+            /* if both partitions have unconstrained brlens, then we need to check that the priors on the branch lengths are the same */
+            if (!strcmp(modelParams[part1].brlensPr, "Unconstrained") && !strcmp(modelParams[part2].brlensPr, "Unconstrained"))
+                {
+                if (strcmp(modelParams[part1].unconstrainedPr, modelParams[part2].unconstrainedPr))
+                    isSame = NO;
+                else
+                    {
+                    if (!strcmp(modelParams[part1].unconstrainedPr, "Uniform"))
+                        {
+                        if (AreDoublesEqual (modelParams[part1].brlensUni[0], modelParams[part2].brlensUni[0], (MrBFlt) 0.00001) == NO)
+                            isSame = NO;
+                        if (AreDoublesEqual (modelParams[part1].brlensUni[1], modelParams[part2].brlensUni[1], (MrBFlt) 0.00001) == NO)
+                            isSame = NO;
+                        }
+                    else if (!strcmp(modelParams[part1].unconstrainedPr, "Exponential"))
+                        {
+                        if (AreDoublesEqual (modelParams[part1].brlensExp, modelParams[part2].brlensExp, (MrBFlt) 0.00001) == NO)
+                            isSame = NO;
+                        }
+                    else if (!strcmp(modelParams[part1].unconstrainedPr, "twoExp"))
+                        {
+                            if (AreDoublesEqual (modelParams[part1].brlens2Exp[0], modelParams[part2].brlens2Exp[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].brlens2Exp[1], modelParams[part2].brlens2Exp[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                        }
+                    else
+                        {
+                        if (AreDoublesEqual (modelParams[part1].brlensDir[0], modelParams[part2].brlensDir[0], (MrBFlt) 0.00001) == NO)  
+                            isSame = NO;
+                        if (AreDoublesEqual (modelParams[part1].brlensDir[1], modelParams[part2].brlensDir[1], (MrBFlt) 0.00001) == NO) 
+                            isSame = NO;
+                        if (AreDoublesEqual (modelParams[part1].brlensDir[2], modelParams[part2].brlensDir[2], (MrBFlt) 0.00001) == NO)  
+                            isSame = NO;
+                        if (AreDoublesEqual (modelParams[part1].brlensDir[3], modelParams[part2].brlensDir[3], (MrBFlt) 0.00001) == NO) 
+                            isSame = NO;
+                        }   
+                    }
+                }
+            
+            /* if both partitions have clock brlens, then we need to check that the priors on the clock are the same */
+            if (!strcmp(modelParams[part1].brlensPr, "Clock") && !strcmp(modelParams[part2].brlensPr, "Clock"))
+                {
+                if (strcmp(modelParams[part1].clockPr, modelParams[part2].clockPr))
+                    isSame = NO;
+                else
+                    {
+                    if (!strcmp(modelParams[part1].clockPr, "Birthdeath"))
+                        {
+                        if (!strcmp(modelParams[part1].speciationPr,"Uniform") && !strcmp(modelParams[part2].speciationPr,"Uniform"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].speciationUni[0], modelParams[part2].speciationUni[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].speciationUni[1], modelParams[part2].speciationUni[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].speciationPr,"Exponential") && !strcmp(modelParams[part2].speciationPr,"Exponential"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].speciationExp, modelParams[part2].speciationExp, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].speciationPr,"Fixed") && !strcmp(modelParams[part2].speciationPr,"Fixed"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].speciationFix, modelParams[part2].speciationFix, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else
+                            isSame = NO;
+
+                        if (!strcmp(modelParams[part1].extinctionPr,"Beta") && !strcmp(modelParams[part2].extinctionPr,"Beta"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].extinctionBeta[0], modelParams[part2].extinctionBeta[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].extinctionBeta[1], modelParams[part2].extinctionBeta[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].extinctionPr,"Fixed") && !strcmp(modelParams[part2].extinctionPr,"Fixed"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].extinctionFix, modelParams[part2].extinctionFix, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else
+                            isSame = NO;
+
+                        if (AreDoublesEqual (modelParams[part1].sampleProb, modelParams[part2].sampleProb, 0.00001) == NO)
+                            isSame = NO;
+                        if (strcmp(modelParams[part1].sampleStrat,modelParams[part2].sampleStrat))
+                            isSame = NO;
+                        }
+                    else if (!strcmp(modelParams[part1].clockPr, "Coalescence") || !strcmp(modelParams[part1].clockPr, "Speciestreecoalescence"))
+                        {
+                        if (!strcmp(modelParams[part1].popSizePr,"Uniform") && !strcmp(modelParams[part2].popSizePr,"Uniform"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].popSizeUni[0], modelParams[part2].popSizeUni[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].popSizeUni[1], modelParams[part2].popSizeUni[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].popSizePr,"Lognormal") && !strcmp(modelParams[part2].popSizePr,"Lognormal"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].popSizeLognormal[0], modelParams[part2].popSizeLognormal[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].popSizeLognormal[1], modelParams[part2].popSizeLognormal[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].popSizePr,"Normal") && !strcmp(modelParams[part2].popSizePr,"Normal"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].popSizeNormal[0], modelParams[part2].popSizeNormal[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].popSizeNormal[1], modelParams[part2].popSizeNormal[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].popSizePr,"Gamma") && !strcmp(modelParams[part2].popSizePr,"Gamma"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].popSizeGamma[0], modelParams[part2].popSizeGamma[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].popSizeGamma[1], modelParams[part2].popSizeGamma[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].popSizePr,"Fixed") && !strcmp(modelParams[part2].popSizePr,"Fixed"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].popSizeFix, modelParams[part2].popSizeFix, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else
+                            isSame = NO;
+
+                        if (strcmp(modelParams[part1].ploidy, modelParams[part2].ploidy) != 0)
+                            isSame = NO;
+                        }
+                    if (strcmp(modelParams[part1].clockPr, "Uniform") == 0 && strcmp(modelParams[part1].nodeAgePr, "Calibrated") != 0)
+                        {
+                        if (modelParams[part1].treeAgePr.prior != modelParams[part2].treeAgePr.prior)
+                            isSame = NO;
+                        if (modelParams[part1].treeAgePr.prior == fixed)
+                            {
+                            if (AreDoublesEqual (modelParams[part1].treeAgePr.priorParams[0], modelParams[part2].treeAgePr.priorParams[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (modelParams[part1].treeAgePr.prior == offsetLogNormal ||
+                            modelParams[part1].treeAgePr.prior == truncatedNormal ||
+                            modelParams[part1].treeAgePr.prior == offsetGamma)
+                            {
+                            for (i=0; i<3; i++)
+                                {
+                                if (AreDoublesEqual (modelParams[part1].treeAgePr.priorParams[i], modelParams[part2].treeAgePr.priorParams[i], (MrBFlt) 0.00001) == NO)
+                                    isSame = NO;
+                                }
+                            }
+                        else
+                            {
+                            for (i=0; i<2; i++)
+                                {
+                                if (AreDoublesEqual (modelParams[part1].treeAgePr.priorParams[i], modelParams[part2].treeAgePr.priorParams[i], (MrBFlt) 0.00001) == NO)
+                                    isSame = NO;
+                                }
+                            }
+                        }
+                    else if (strcmp(modelParams[part1].clockPr, "Fossilization") == 0)
+                        {
+                        if (modelParams[part1].treeAgePr.prior != modelParams[part2].treeAgePr.prior)
+                            isSame = NO;
+                        if (modelParams[part1].treeAgePr.prior == fixed)
+                            {
+                            if (AreDoublesEqual (modelParams[part1].treeAgePr.priorParams[0], modelParams[part2].treeAgePr.priorParams[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (modelParams[part1].treeAgePr.prior == offsetLogNormal ||
+                            modelParams[part1].treeAgePr.prior == truncatedNormal ||
+                            modelParams[part1].treeAgePr.prior == offsetGamma)
+                            {
+                            for (i=0; i<3; i++)
+                                {
+                                if (AreDoublesEqual (modelParams[part1].treeAgePr.priorParams[i], modelParams[part2].treeAgePr.priorParams[i], (MrBFlt) 0.00001) == NO)
+                                    isSame = NO;
+                                }
+                            }
+                        else
+                            {
+                            for (i=0; i<2; i++)
+                                {
+                                if (AreDoublesEqual (modelParams[part1].treeAgePr.priorParams[i], modelParams[part2].treeAgePr.priorParams[i], (MrBFlt) 0.00001) == NO)
+                                    isSame = NO;
+                                }
+                            }
+                        
+                        if (!strcmp(modelParams[part1].speciationPr,"Uniform") && !strcmp(modelParams[part2].speciationPr,"Uniform"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].speciationUni[0], modelParams[part2].speciationUni[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].speciationUni[1], modelParams[part2].speciationUni[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].speciationPr,"Exponential") && !strcmp(modelParams[part2].speciationPr,"Exponential"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].speciationExp, modelParams[part2].speciationExp, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].speciationPr,"Fixed") && !strcmp(modelParams[part2].speciationPr,"Fixed"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].speciationFix, modelParams[part2].speciationFix, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else
+                            isSame = NO;
+                        
+                        if (!strcmp(modelParams[part1].extinctionPr,"Beta") && !strcmp(modelParams[part2].extinctionPr,"Beta"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].extinctionBeta[0], modelParams[part2].extinctionBeta[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].extinctionBeta[1], modelParams[part2].extinctionBeta[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].extinctionPr,"Fixed") && !strcmp(modelParams[part2].extinctionPr,"Fixed"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].extinctionFix, modelParams[part2].extinctionFix, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else
+                            isSame = NO;
+                        
+                        if (!strcmp(modelParams[part1].fossilizationPr,"Beta") && !strcmp(modelParams[part2].fossilizationPr,"Beta"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].fossilizationBeta[0], modelParams[part2].fossilizationBeta[0], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            if (AreDoublesEqual (modelParams[part1].fossilizationBeta[1], modelParams[part2].fossilizationBeta[1], (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else if (!strcmp(modelParams[part1].fossilizationPr,"Fixed") && !strcmp(modelParams[part2].fossilizationPr,"Fixed"))
+                            {
+                            if (AreDoublesEqual (modelParams[part1].fossilizationFix, modelParams[part2].fossilizationFix, (MrBFlt) 0.00001) == NO)
+                                isSame = NO;
+                            }
+                        else
+                            isSame = NO;
+                        
+                        if (AreDoublesEqual (modelParams[part1].sampleProb, modelParams[part2].sampleProb, 0.00001) == NO)
+                            isSame = NO;
+                        if (strcmp(modelParams[part1].sampleStrat,modelParams[part2].sampleStrat))
+                            isSame = NO;
+                        }
+                    }
+
+                /* if the same clock prior, we need to check calibrations */
+                if (strcmp(modelParams[part1].nodeAgePr,modelParams[part2].nodeAgePr) != 0)
+                    isSame = NO;
+                
+                /* If fixed clock brlens, check if the brlens come from the same tree */
+                if (!strcmp(modelParams[part1].clockPr, "Fixed") && !strcmp(modelParams[part2].clockPr, "Fixed"))
+                    {
+                    if (modelParams[part1].brlensFix != modelParams[part2].brlensFix)
+                        isSame = NO;
+                    }
+                }
+            /* If fixed brlens, check if the brlens come from the same tree */
+            if (!strcmp(modelParams[part1].brlensPr, "Fixed") && !strcmp(modelParams[part2].brlensPr, "Fixed"))
+                {
+                if (modelParams[part1].brlensFix != modelParams[part2].brlensFix)
+                    isSame = NO;
+                }
+            }
+        }
+    else if (whichParam == P_SPECRATE)
+        {
+        /* Check the speciation rates for partitions 1 and 2. */
+
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+           silly and doesn't take this information into account) and a speciation rate cannot be estimated. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+            
+        /* Check that the branch length prior is a clock:birthdeath or clock:fossilization for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        if (strcmp(modelParams[part1].clockPr, "Birthdeath") != 0 && strcmp(modelParams[part1].clockPr, "Fossilization") != 0)
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockPr, "Birthdeath") != 0 && strcmp(modelParams[part2].clockPr, "Fossilization") != 0)
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on the speciation rates are the same. */
+        if (!strcmp(modelParams[part1].speciationPr,"Uniform") && !strcmp(modelParams[part2].speciationPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].speciationUni[0], modelParams[part2].speciationUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].speciationUni[1], modelParams[part2].speciationUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].speciationPr,"Exponential") && !strcmp(modelParams[part2].speciationPr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].speciationExp, modelParams[part2].speciationExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].speciationPr,"Fixed") && !strcmp(modelParams[part2].speciationPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].speciationFix, modelParams[part2].speciationFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if the speciation rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_EXTRATE)
+        {
+        /* Check the extinction rates for partitions 1 and 2. */
+
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+           silly and doesn't take this information into account) and a extinction rate cannot be estimated. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+            
+        /* Check that the branch length prior is a clock:birthdeath or clock:fossilization for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        if (strcmp(modelParams[part1].clockPr, "Birthdeath")!= 0 && strcmp(modelParams[part1].clockPr, "Fossilization") != 0)
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockPr, "Birthdeath")!= 0 && strcmp(modelParams[part2].clockPr, "Fossilization") != 0)
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on the extinction rates are the same. */
+        if (!strcmp(modelParams[part1].extinctionPr,"Beta") && !strcmp(modelParams[part2].extinctionPr,"Beta"))
+            {
+            if (AreDoublesEqual (modelParams[part1].extinctionBeta[0], modelParams[part2].extinctionBeta[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].extinctionBeta[1], modelParams[part2].extinctionBeta[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].extinctionPr,"Fixed") && !strcmp(modelParams[part2].extinctionPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].extinctionFix, modelParams[part2].extinctionFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if the extinction rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_FOSLRATE)
+        {
+        /* Check the fossilization rates for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO;
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+        
+        /* Check that the branch length prior is a clock:birthdeath or clock:fossilization for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        if (strcmp(modelParams[part1].clockPr, "Fossilization") != 0)
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockPr, "Fossilization") != 0)
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on the fossilization rates are the same. */
+        if (!strcmp(modelParams[part1].fossilizationPr,"Beta") && !strcmp(modelParams[part2].fossilizationPr,"Beta"))
+            {
+            if (AreDoublesEqual (modelParams[part1].fossilizationBeta[0], modelParams[part2].fossilizationBeta[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].fossilizationBeta[1], modelParams[part2].fossilizationBeta[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].fossilizationPr,"Fixed") && !strcmp(modelParams[part2].fossilizationPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].fossilizationFix, modelParams[part2].fossilizationFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if the fossilization rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_POPSIZE)
+        {
+        /* Check population size for partitions 1 and 2. */
+
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+           silly and doesn't take this information into account) and population size cannot be estimated. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+            
+        /* Check that the branch length prior is a clock:coalescence or clock:speciestreecoalescence for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        if (strcmp(modelParams[part1].clockPr, "Coalescence") != 0 && strcmp(modelParams[part1].clockPr, "Speciestreecoalescence") != 0)
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockPr, "Coalescence") != 0 && strcmp(modelParams[part2].clockPr, "Speciestreecoalescence") != 0)
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on population size is the same. */
+        if (!strcmp(modelParams[part1].popSizePr,"Uniform") && !strcmp(modelParams[part2].popSizePr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].popSizeUni[0], modelParams[part2].popSizeUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].popSizeUni[1], modelParams[part2].popSizeUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].popSizePr,"Lognormal") && !strcmp(modelParams[part2].popSizePr,"Lognormal"))
+            {
+            if (AreDoublesEqual (modelParams[part1].popSizeLognormal[0], modelParams[part2].popSizeLognormal[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].popSizeLognormal[1], modelParams[part2].popSizeLognormal[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].popSizePr,"Normal") && !strcmp(modelParams[part2].popSizePr,"Normal"))
+            {
+            if (AreDoublesEqual (modelParams[part1].popSizeNormal[0], modelParams[part2].popSizeNormal[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].popSizeNormal[1], modelParams[part2].popSizeNormal[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].popSizePr,"Gamma") && !strcmp(modelParams[part2].popSizePr,"Gamma"))
+            {
+            if (AreDoublesEqual (modelParams[part1].popSizeGamma[0], modelParams[part2].popSizeGamma[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].popSizeGamma[1], modelParams[part2].popSizeGamma[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].popSizePr,"Fixed") && !strcmp(modelParams[part2].popSizePr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].popSizeFix, modelParams[part2].popSizeFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if population size is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_GROWTH)
+        {
+        /* Check growth rate for partitions 1 and 2. */
+
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+           silly and doesn't take this information into account) and growth rate cannot be estimated. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+            
+        /* Check that the branch length prior is a clock:coalescence for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        if (strcmp(modelParams[part1].clockPr, "Coalescence"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockPr, "Coalescence"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on growth rate is the same. */
+        if (!strcmp(modelParams[part1].growthPr,"Uniform") && !strcmp(modelParams[part2].growthPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].growthUni[0], modelParams[part2].growthUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].growthUni[1], modelParams[part2].growthUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].growthPr,"Exponential") && !strcmp(modelParams[part2].growthPr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].growthExp, modelParams[part2].growthExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].growthPr,"Fixed") && !strcmp(modelParams[part2].growthPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].growthFix, modelParams[part2].growthFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if growth rate is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; 
+        }
+    else if (whichParam == P_AAMODEL)
+        {
+        /* Check the amino acid model settings for partitions 1 and 2. */
+
+        /* Check if the model is parsimony for either partition */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; /* part1 has a parsimony model and aamodel does not apply */
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; /* part2 has a parsimony model and aamodel does not apply */
+        
+        /* Check that the data are protein for both partitions 1 and 2 */
+        if (isFirstProtein == NO)
+            *isApplic1 = NO; /* part1 is not amino acid data so tratio does not apply */
+        if (isSecondProtein == NO)
+            *isApplic2 = NO; /* part2 is not amino acid data so tratio does not apply */
+            
+        /* If the model is fixed for a partition, then it is not a free parameter and
+           we set it to isApplic = NO */
+        if (!strcmp(modelParams[part1].aaModelPr,"Fixed"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].aaModelPr,"Fixed"))
+            *isApplic2 = NO;
+
+        /* We now need to check if the prior is the same for both. */
+        if (!strcmp(modelParams[part1].aaModelPr,"Mixed") && !strcmp(modelParams[part2].aaModelPr,"Mixed"))
+            {
+            }
+        else if (!strcmp(modelParams[part1].aaModelPr,"Fixed") && !strcmp(modelParams[part2].aaModelPr,"Fixed"))
+            {
+            if (strcmp(modelParams[part1].aaModel,modelParams[part2].aaModel))
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check to see if amino acid model is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if tratio is inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_BRCORR)
+        {
+        /* Check the correlation parameter for brownian motion 1 and 2. */
+        
+        /* Check that the data are either CONTINUOUS for partitions 1 and 2 */
+        if (modelParams[part1].dataType != CONTINUOUS)
+            *isApplic1 = NO; /* the correlation parameter does not make sense for part1 */
+        if (modelParams[part2].dataType != CONTINUOUS)
+            *isApplic2 = NO; /* the correlation parameter does not make sense for part2 */
+            
+        /* Now, check that the data are the same. */
+        if (modelParams[part1].dataType != modelParams[part2].dataType)
+            isSame = NO; /* data are not both continuous */
+
+        /* Check the priors for both partitions. */
+        if (!strcmp(modelParams[part1].brownCorPr,"Uniform") && !strcmp(modelParams[part2].brownCorPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].brownCorrUni[0], modelParams[part2].brownCorrUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].brownCorrUni[1], modelParams[part2].brownCorrUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].brownCorPr,"Fixed") && !strcmp(modelParams[part2].brownCorPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].brownCorrFix, modelParams[part2].brownCorrFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check to see if the correlation parameters are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the correlation parameters are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_BRSIGMA)
+        {
+        /* Check the sigma parameter for brownian motion 1 and 2. */
+        
+        /* Check that the data are either CONTINUOUS for partitions 1 and 2 */
+        if (modelParams[part1].dataType != CONTINUOUS)
+            *isApplic1 = NO; /* the sigma parameter does not make sense for part1 */
+        if (modelParams[part2].dataType != CONTINUOUS)
+            *isApplic2 = NO; /* the sigma parameter does not make sense for part2 */
+            
+        /* Now, check that the data are the same. */
+        if (modelParams[part1].dataType != modelParams[part2].dataType)
+            isSame = NO; /* data are not both continuous */
+
+        /* Check the priors for both partitions. */
+        if (!strcmp(modelParams[part1].brownScalesPr,"Uniform") && !strcmp(modelParams[part2].brownScalesPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].brownScalesUni[0], modelParams[part2].brownScalesUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].brownScalesUni[1], modelParams[part2].brownScalesUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].brownScalesPr,"Fixed") && !strcmp(modelParams[part2].brownScalesPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].brownScalesFix, modelParams[part2].brownScalesFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].brownScalesPr,"Gamma") && !strcmp(modelParams[part2].brownScalesPr,"Gamma"))
+            {
+            if (AreDoublesEqual (modelParams[part1].brownScalesGamma[0], modelParams[part2].brownScalesGamma[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].brownScalesGamma[1], modelParams[part2].brownScalesGamma[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].brownScalesPr,"Gammamean") && !strcmp(modelParams[part2].brownScalesPr,"Gammamean"))
+            {
+            if (AreDoublesEqual (modelParams[part1].brownScalesGammaMean, modelParams[part2].brownScalesGammaMean, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO; /* the priors are not the same, so we cannot set the parameter to be equal for both partitions */
+
+        /* Check to see if the sigma parameters are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO; /* if the sigma parameters are inapplicable for either partition, then the parameter cannot be the same */
+        }
+    else if (whichParam == P_CPPRATE)
+        {
+        /* Check cpp rate for partitions 1 and 2. */
+    
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+        silly and doesn't take this information into account) and cpp rate cannot be estimated. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is cpp for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Cpp"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Cpp"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on cpp rate is the same. */
+        if (!strcmp(modelParams[part1].cppRatePr,"Exponential") && !strcmp(modelParams[part2].cppRatePr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].cppRateExp, modelParams[part2].cppRateExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].cppRatePr,"Fixed") && !strcmp(modelParams[part2].cppRatePr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].cppRateFix, modelParams[part2].cppRateFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+    
+        /* Check to see if cpp rate is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;    
+        }
+    else if (whichParam == P_CPPMULTDEV)
+        {
+        /* Check cpp multiplier deviation prior for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+        silly and doesn't take this information into account) and this parameter is inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+        
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is cpp for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Cpp"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Cpp"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on sigma is the same. */
+        if (!strcmp(modelParams[part1].cppMultDevPr,"Fixed") && !strcmp(modelParams[part2].cppMultDevPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].cppMultDevFix, modelParams[part2].cppMultDevFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if cpp multiplier sigma is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;    
+        }
+    else if (whichParam == P_CPPEVENTS)
+        {
+        /* Check cpp events for partitions 1 and 2. */
+    
+        /* Check if the model is parsimony for either partition. If so, then branch lengths do not apply (as parsimony is very
+        silly and doesn't take this information into account) and cpp events are inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is cpp for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Cpp"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Cpp"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the cpp parameter is the same */
+        if (IsModelSame (P_CPPRATE, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_CPPRATE][part1] != linkTable[P_CPPRATE][part2])
+            isSame = NO;
+    
+        /* ... and that the psigamma parameter is the same */
+        if (IsModelSame (P_CPPMULTDEV, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_CPPMULTDEV][part1] != linkTable[P_CPPRATE][part2])
+            isSame = NO;
+    
+        /* Not same if branch lengths are not the same */
+        if (IsModelSame(P_BRLENS, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_BRLENS][part1] != linkTable[P_BRLENS][part2])
+            isSame = NO;
+
+        /* Set isSame to NO if cpp events are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_TK02VAR)
+        {
+        /* Check prior for variance of rate autocorrelation for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+        silly and doesn't take this information into account) and ratevar is inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+        
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is tk02 for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "TK02"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "TK02"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on tk02 variance is the same. */
+        if (!strcmp(modelParams[part1].tk02varPr,"Uniform") && !strcmp(modelParams[part2].tk02varPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].tk02varUni[0], modelParams[part2].tk02varUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].tk02varUni[1], modelParams[part2].tk02varUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].tk02varPr,"Exponential") && !strcmp(modelParams[part2].tk02varPr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].tk02varExp, modelParams[part2].tk02varExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].tk02varPr,"Fixed") && !strcmp(modelParams[part2].tk02varPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].tk02varFix, modelParams[part2].tk02varFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if tk02 variance is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;    
+        }
+    else if (whichParam == P_TK02BRANCHRATES)
+        {
+        /* Check TK02 relaxed clock branch rates for partitions 1 and 2. */
+    
+        /* Check if the model is parsimony for either partition. If so, then branch lengths do not apply (as parsimony is very
+        silly and doesn't take this information into account) and tk02 relaxed clock branch rates are inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is tk02 for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "TK02"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "TK02"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the tk02 variance parameter is the same */
+        if (IsModelSame (P_TK02VAR, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_TK02VAR][part1] != linkTable[P_TK02VAR][part2])
+            isSame = NO;
+
+        /* Not same if branch lengths are not the same */
+        if (IsModelSame(P_BRLENS, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_BRLENS][part1] != linkTable[P_BRLENS][part2])
+            isSame = NO;
+
+        /* Set isSame to NO if tk02 branch rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_IGRVAR)
+        {
+        /* Check prior for igr shape for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+        silly and doesn't take this information into account) and igr shape is inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO; 
+        
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is igr for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Igr"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Igr"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on igr shape is the same. */
+        if (!strcmp(modelParams[part1].igrvarPr,"Uniform") && !strcmp(modelParams[part2].igrvarPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].igrvarUni[0], modelParams[part2].igrvarUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].igrvarUni[1], modelParams[part2].igrvarUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].igrvarPr,"Exponential") && !strcmp(modelParams[part2].igrvarPr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].igrvarExp, modelParams[part2].igrvarExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].igrvarPr,"Fixed") && !strcmp(modelParams[part2].igrvarPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].igrvarFix, modelParams[part2].igrvarFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if igr variance is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;    
+        }
+    else if (whichParam == P_IGRBRANCHRATES)
+        {
+        /* Check IGR relaxed clock branch rates for partitions 1 and 2. */
+    
+        /* Check if the model is parsimony for either partition. If so, then branch lengths do not apply (as parsimony is very
+        silly and doesn't take this information into account) and igr relaxed clock branch rates are inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Check that the clock rate prior is igr for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Igr"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Igr"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the igr shape parameter is the same */
+        if (IsModelSame (P_IGRVAR, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_IGRVAR][part1] != linkTable[P_IGRVAR][part2])
+            isSame = NO;
+    
+        /* Not same if branch lengths are not the same */
+        if (IsModelSame(P_BRLENS, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_BRLENS][part1] != linkTable[P_BRLENS][part2])
+            isSame = NO;
+
+        /* Set isSame to NO if igr branch rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_MIXEDVAR)
+        {
+        /* Check prior for mixed var for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition. If so, then the branch lengths cannot apply (as parsimony is very
+         silly and doesn't take this information into account) and variance is inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO;
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+        
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        
+        /* Check that the clock rate prior is mixed for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Mixed"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Mixed"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the prior on var mixed is the same. */
+        if (!strcmp(modelParams[part1].mixedvarPr,"Uniform") && !strcmp(modelParams[part2].mixedvarPr,"Uniform"))
+            {
+            if (AreDoublesEqual (modelParams[part1].mixedvarUni[0], modelParams[part2].mixedvarUni[0], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            if (AreDoublesEqual (modelParams[part1].mixedvarUni[1], modelParams[part2].mixedvarUni[1], (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].mixedvarPr,"Exponential") && !strcmp(modelParams[part2].mixedvarPr,"Exponential"))
+            {
+            if (AreDoublesEqual (modelParams[part1].mixedvarExp, modelParams[part2].mixedvarExp, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else if (!strcmp(modelParams[part1].mixedvarPr,"Fixed") && !strcmp(modelParams[part2].mixedvarPr,"Fixed"))
+            {
+            if (AreDoublesEqual (modelParams[part1].mixedvarFix, modelParams[part2].mixedvarFix, (MrBFlt) 0.00001) == NO)
+                isSame = NO;
+            }
+        else
+            isSame = NO;
+        
+        /* Check to see if variance is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_MIXEDBRCHRATES)
+        {
+        /* Check mixed relaxed clock branch rates for partitions 1 and 2. */
+        
+        /* Check if the model is parsimony for either partition. If so, then branch lengths do not apply (as parsimony is very
+         silly and doesn't take this information into account) and relaxed clock branch rates are inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO;
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+        
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+        
+        /* Check that the clock rate prior is mixed for both partitions */
+        if (strcmp(modelParams[part1].clockVarPr, "Mixed"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].clockVarPr, "Mixed"))
+            *isApplic2 = NO;
+        
+        /* Now, check that the var parameter is the same */
+        if (IsModelSame (P_MIXEDVAR, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_MIXEDVAR][part1] != linkTable[P_MIXEDVAR][part2])
+            isSame = NO;
+        
+        /* Not same if branch lengths are not the same */
+        if (IsModelSame(P_BRLENS, part1, part2, &temp1, &temp2) == NO)
+            isSame = NO;
+        if (linkTable[P_BRLENS][part1] != linkTable[P_BRLENS][part2])
+            isSame = NO;
+        
+        /* Set isSame to NO if mixed branch rates are inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_CLOCKRATE)
+        {
+        /* Check base substitution rates of clock tree for partitions 1 and 2. */
+    
+        /* Check if the model is parsimony for either partition. If so, then branch lengths do not apply (as parsimony is very
+        silly and doesn't take this information into account) and clock branch rates are inapplicable. */
+        if (!strcmp(modelParams[part1].parsModel, "Yes"))
+            *isApplic1 = NO; 
+        if (!strcmp(modelParams[part2].parsModel, "Yes"))
+            *isApplic2 = NO;
+
+        /* Check that the branch length prior is clock for both partitions. */
+        if (strcmp(modelParams[part1].brlensPr, "Clock"))
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].brlensPr, "Clock"))
+            *isApplic2 = NO;
+
+        /* Set isSame to NO if base substitution rate parameter is inapplicable for either partition. */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_SPECIESTREE)
+        {
+        /* Species tree; check that it is used in both partitions */
+        if (strcmp(modelParams[part1].topologyPr, "Speciestree") != 0)
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].topologyPr, "Speciestree") != 0)
+            *isApplic2 = NO;
+
+        /* Not same if inapplicable to either partition */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else if (whichParam == P_GENETREERATE)
+        {
+        /* Gene tree rate; check that it is used in both partitions */
+        if (strcmp(modelParams[part1].topologyPr, "Speciestree") != 0)
+            *isApplic1 = NO;
+        if (strcmp(modelParams[part2].topologyPr, "Speciestree") != 0)
+            *isApplic2 = NO;
+
+        /* Not same if inapplicable to either partition */
+        if ((*isApplic1) == NO || (*isApplic2) == NO)
+            isSame = NO;
+        }
+    else
+        {
+        MrBayesPrint ("%s   Could not find parameter in IsModelSame\n", spacer);
+        return (NO);
+        }
+    
+    return (isSame);
+}
+
+
+int LargestMovableSubtree(Param *treeParam)
+{
+    int         i, j, k, a, nLongsNeeded, numPartitions, largestSubtree;
+    BitsLong    **constraintPartition, *subtreePartition, *testPartition, *mask;
+    ModelParams *mp;
+
+    mp = &modelParams[treeParam->relParts[0]];
+
+    if (treeParam->paramType == P_SPECIESTREE)
+        return numLocalTaxa;    /* no constraints allowed in species tree; set constraints in gene trees instead */
+    
+    /* This is difficult because we cannot rely on the tree being initialized.
+       We need to retrieve the bitfields ourselves and figure out what they mean. */
+    nLongsNeeded = ((numLocalTaxa - 1) / nBitsInALong) + 1;
+    subtreePartition = (BitsLong *) SafeCalloc(3*nLongsNeeded, sizeof(BitsLong));
+    constraintPartition = (BitsLong **) SafeCalloc (numDefinedConstraints+1, sizeof(BitsLong *));
+    constraintPartition[0] = (BitsLong *) SafeCalloc ((numDefinedConstraints+1)*nLongsNeeded, sizeof(BitsLong));
+    for (i=1; i<numDefinedConstraints+1; i++)
+        constraintPartition[i] = constraintPartition[i-1] + nLongsNeeded;
+    testPartition = subtreePartition + nLongsNeeded;
+    mask = testPartition + nLongsNeeded;
+    
+    /* set mask (needed to take care of unused bits when flipping partitions) */
+    for (i=0; i<numLocalTaxa; i++)
+        SetBit (i, mask);
+    
+    /* retrieve partitions */
+    numPartitions = 0;
+    for (a=0; a<numDefinedConstraints; a++)
+        {
+        if (mp->activeConstraints[a] == NO || definedConstraintsType[a] != HARD)
+            continue;
+        
+        /* set bits in partition under consideration */
+        ClearBits(constraintPartition[numPartitions], nLongsNeeded);
+        for (i=j=0; i<numTaxa; i++)
+            {
+            if (taxaInfo[i].isDeleted == YES)
+                continue;
+            if (IsBitSet(i, definedConstraint[a]) == YES)
+                SetBit(j, constraintPartition[numPartitions]);
+            j++;
+            }
+        
+        /* make sure outgroup is outside constrained partition (marked 0) */
+        if (strcmp(mp->brlensPr,"Clock") != 0 && IsBitSet(localOutGroup, constraintPartition[numPartitions]) == YES)
+            FlipBits(constraintPartition[numPartitions], nLongsNeeded, mask);
+        
+        /* skip partition if uninformative */
+        k = NumBits(constraintPartition[numPartitions], nLongsNeeded);
+        if (k == 0 || k == 1)
+            continue;
+        
+        numPartitions++;
+        }
+    
+    /* Add all-species partition */
+    CopyBits(constraintPartition[numPartitions], mask, nLongsNeeded);
+    numPartitions++;
+    
+    /* Now we have all constraints. Calculate the movable subtree for each */
+    largestSubtree = 0;
+    for (i=0; i<numPartitions; i++)
+        {
+        CopyBits (subtreePartition, constraintPartition[i], nLongsNeeded);
+        k = 0;
+        for (j=0; j<numPartitions; j++)
+            {
+            if (j==i)
+                continue;
+            if (IsPartNested(constraintPartition[j], constraintPartition[i], nLongsNeeded))
+                {
+                k++;    /* add one for clade we are removing from subtreePartition */
+                CopyBits (testPartition, constraintPartition[j], nLongsNeeded);
+                FlipBits (testPartition, nLongsNeeded, mask);
+                for (k=0; k<nLongsNeeded; k++)
+                    subtreePartition[k] = subtreePartition[k] & testPartition[k];
+                }
+            }
+        k += NumBits (subtreePartition, nLongsNeeded);  /* add remaming free tips in subtreePartition */
+        /* add calculation root if an unrooted tree and we are dealing with the root partition */
+        if (strcmp(mp->brlensPr,"Clock") != 0 && NumBits (constraintPartition[i], nLongsNeeded) == numLocalTaxa - 1)
+            k++;
+        if (k > largestSubtree)
+            largestSubtree = k;
+        }
+
+    free(subtreePartition);
+    free(constraintPartition[0]);
+    free(constraintPartition);
+   
+    return largestSubtree;
+}
+
+
+int Link (void)
+{
+    int         i, j;
+    
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        MrBayesPrint ("%4d -- ", j+1);
+        for (i=0; i<numCurrentDivisions; i++)
+            MrBayesPrint (" %2d", tempLinkUnlink[j][i]);
+        MrBayesPrint ("\n");
+        }
+        
+    return (NO_ERROR);
+}
+
+
+int NumActiveParts (void)
+{
+    int     i, nApplied;
+    
+    nApplied = 0;
+    for (i=0; i<numCurrentDivisions; i++)
+        if (activeParts[i] == YES)
+            nApplied++;
+
+    return (nApplied);
+}
+
+
+int NumInformativeHardConstraints (ModelParams *mp)
+{
+    int             i, j, k, a, numInformativeHardConstraints, nLongsNeeded;
+    BitsLong        *constraintPartition, *mask;
+       
+    numInformativeHardConstraints = 0;
+    
+    nLongsNeeded = ((numLocalTaxa - 1) / nBitsInALong) + 1;
+    constraintPartition = (BitsLong *) SafeCalloc (2*nLongsNeeded, sizeof(BitsLong));
+    if (!constraintPartition)
+        {
+            MrBayesPrint ("%s   Problems allocating constraintPartition", spacer);
+            return ERROR;
+        }
+    mask = constraintPartition + nLongsNeeded;
+
+    /* set mask (needed to take care of unused bits when flipping partitions) */
+    for (i=0; i<numLocalTaxa; i++)
+        SetBit (i, mask);
+        
+    for (a=0; a<numDefinedConstraints; a++)
+        {
+        if (mp->activeConstraints[a] == NO || definedConstraintsType[a] != HARD)
+            continue;
+            
+        /* set bits in partition to add */
+        ClearBits(constraintPartition, nLongsNeeded);
+        for (i=j=0; i<numTaxa; i++)
+            {
+                if (taxaInfo[i].isDeleted == YES)
+                    continue;
+                if (IsBitSet(i, definedConstraint[a]) == YES)
+                    SetBit(j, constraintPartition);
+                j++;
+            }
+            
+        /* make sure outgroup is outside constrained partition (marked 0) */
+        if (strcmp(mp->brlensPr,"Clock") != 0 && IsBitSet(localOutGroup, constraintPartition) == YES)
+            FlipBits(constraintPartition, nLongsNeeded, mask);
+            
+        /* skip partition if uninformative */
+        k = NumBits(constraintPartition, nLongsNeeded);
+        if (k == 0 || k == 1)
+            continue;
+
+        numInformativeHardConstraints++;
+        }
+        
+    return numInformativeHardConstraints;
+}
+
+
+int NumNonExcludedChar (void)
+{
+    int     i, n;
+    
+    /* count number of non-excluded characters */
+    n = 0;
+    for (i=0; i<numChar; i++)
+        {
+        if (charInfo[i].isExcluded == NO)
+            {
+            n++;
+            }
+        }
+    
+    return n;
+}
+
+
+int NumStates (int part)
+{
+    if (modelParams[part].dataType == DNA || modelParams[part].dataType == RNA)
+        {
+        if (!strcmp(modelParams[part].nucModel, "4by4"))
+            return (4);
+        else if (!strcmp(modelParams[part].nucModel, "Doublet"))
+            return (16);
+        else if (!strcmp(modelParams[part].nucModel, "Protein"))
+            return (20);
+        else
+            {
+            if (!strcmp(modelParams[part].geneticCode, "Universal"))
+                return (61);
+            else if (!strcmp(modelParams[part].geneticCode, "Vertmt"))
+                return (60);
+            else if (!strcmp(modelParams[part].geneticCode, "Invermt"))
+                return (62);
+            else if (!strcmp(modelParams[part].geneticCode, "Mycoplasma"))
+                return (62);
+            else if (!strcmp(modelParams[part].geneticCode, "Yeast"))
+                return (62);
+            else if (!strcmp(modelParams[part].geneticCode, "Ciliate"))
+                return (63);
+            else if (!strcmp(modelParams[part].geneticCode, "Echinoderm"))
+                return (62);
+            else if (!strcmp(modelParams[part].geneticCode, "Euplotid"))
+                return (62);
+            else if (!strcmp(modelParams[part].geneticCode, "Metmt"))
+                return (62);
+            }
+        }
+    else if (modelParams[part].dataType == PROTEIN)
+        {
+        return (20);
+        }
+    else if (modelParams[part].dataType == RESTRICTION)
+        {
+        return (2);
+        }
+    else if (modelParams[part].dataType == STANDARD)
+        {
+        return (10);
+        }
+        
+    return (-1);
+}
+
+
+/*-----------------------------------------------------------------------
+|
+|   PrintCompMatrix: Print compressed matrix
+|
+------------------------------------------------------------------------*/
+int PrintCompMatrix (void)
+{
+    int             i, j, k, c, d;
+    ModelInfo       *m;
+    ModelParams     *mp;
+    char            tempName[100];
+    char            (*whichChar)(int);
+
+    if (!compMatrix)
+        return ERROR;
+
+    whichChar = &WhichNuc;
+    
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        m = &modelSettings[d];
+        mp = &modelParams[d];
+
+        if (mp->dataType == DNA || mp->dataType == RNA)
+            whichChar = &WhichNuc;
+        if (mp->dataType == PROTEIN)
+            whichChar = &WhichAA;
+        if (mp->dataType == RESTRICTION)
+            whichChar = &WhichRes;
+        if (mp->dataType == STANDARD)
+            whichChar = &WhichStand;
+
+        MrBayesPrint ("\nCompressed matrix for division %d\n\n", d+1);
+        
+        k = 66;
+        if (mp->dataType == CONTINUOUS)
+            k /= 4;
+
+        for (c=m->compMatrixStart; c<m->compMatrixStop; c+=k)
+            {
+            for (i=0; i<numLocalTaxa; i++)
+                {
+                strcpy (tempName, localTaxonNames[i]);
+                MrBayesPrint ("%-10.10s   ", tempName);
+                for (j=c; j<c+k; j++)
+                    {
+                    if (j >= m->compMatrixStop)
+                        break;
+                    if (mp->dataType == CONTINUOUS)
+                        MrBayesPrint ("%3d ", compMatrix[pos(i,j,compMatrixRowSize)]);
+                    else
+                        MrBayesPrint ("%c", whichChar((int)compMatrix[pos(i,j,compMatrixRowSize)]));
+                    }
+                MrBayesPrint("\n");
+                }
+            MrBayesPrint("\nNo. sites    ");
+            for (j=c; j<c+k; j++)
+                {
+                if (j >= m->compMatrixStop)
+                    break;
+                i = (int) numSitesOfPat[m->compCharStart + (0*numCompressedChars) + (j - m->compMatrixStart)/m->nCharsPerSite]; /* NOTE: We are printing the unadulterated site pat nums */
+                if (i>9)
+                    i = 'A' + i - 10;
+                else
+                    i = '0' + i;
+                if (mp->dataType == CONTINUOUS)
+                    MrBayesPrint("   %c ", i);
+                else
+                    {
+                    if ((j-m->compMatrixStart) % m->nCharsPerSite == 0)
+                        MrBayesPrint ("%c", i);
+                    else
+                        MrBayesPrint(" ");
+                    }
+                }
+            MrBayesPrint ("\nOrig. char   ");
+            for (j=c; j<c+k; j++)
+                {
+                if (j >= m->compMatrixStop)
+                    break;
+                i = origChar[j];
+                if (i>9)
+                    i = '0' + (i % 10);
+                else
+                    i = '0' +i;
+                if (mp->dataType == CONTINUOUS)
+                    MrBayesPrint("   %c ", i);
+                else
+                    MrBayesPrint ("%c", i);
+                }
+
+            if (mp->dataType == STANDARD && m->nStates != NULL)
+                {
+                MrBayesPrint ("\nNo. states   ");
+                for (j=c; j<c+k; j++)
+                    {
+                    if (j >= m->compMatrixStop)
+                        break;
+                    i = m->nStates[j-m->compCharStart];
+                    MrBayesPrint ("%d", i);
+                    }
+                MrBayesPrint ("\nCharType     ");
+                for (j=c; j<c+k; j++)
+                    {
+                    if (j >= m->compMatrixStop)
+                        break;
+                    i = m->cType[j-m->compMatrixStart];
+                    if (i == ORD)
+                        MrBayesPrint ("%c", 'O');
+                    else if (i == UNORD)
+                        MrBayesPrint ("%c", 'U');
+                    else
+                        MrBayesPrint ("%c", 'I');
+                    }
+                MrBayesPrint ("\ntiIndex      ");
+                for (j=c; j<c+k; j++)
+                    {
+                    if (j >= m->compMatrixStop)
+                        break;
+                    i = m->tiIndex[j-m->compCharStart];
+                    MrBayesPrint ("%d", i % 10);
+                    }
+                MrBayesPrint ("\nbsIndex      ");
+                for (j=c; j<c+k; j++)
+                    {
+                    if (j >= m->compMatrixStop)
+                        break;
+                    i = m->bsIndex[j-m->compCharStart];
+                    MrBayesPrint ("%d", i % 10);
+                    }
+                }
+            MrBayesPrint ("\n\n");
+            }
+        MrBayesPrint ("Press return to continue\n");
+        getchar();
+        }   /* next division */
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------------------------------
+|
+|   PrintMatrix: Print data matrix
+|
+|
+------------------------------------------------------------------------*/
+int PrintMatrix (void)
+{
+    int             i, j=0, c, printWidth, nextColumn;
+
+    if (!matrix)
+        return ERROR;
+    
+    MrBayesPrint ("\nData matrix\n\n");
+    
+    printWidth = 79;
+
+    for (c=0; c<numChar; c=j)
+        {
+        for (i=0; i<numTaxa; i++)
+            {
+            MrBayesPrint ("%-10.10s   ", taxaNames[i]);
+            j = c;
+            for (nextColumn=13; nextColumn < printWidth; nextColumn++)
+                {
+                if (j >= numChar)
+                    break;
+                if (charInfo[j].charType == CONTINUOUS && nextColumn < printWidth - 3)
+                    break;
+                if (charInfo[j].charType == CONTINUOUS)
+                    {   
+                    MrBayesPrint ("%3d ", matrix[pos(i,j,numChar)]);
+                    nextColumn += 3;
+                    }
+                else if (charInfo[j].charType == DNA || charInfo[j].charType == RNA)
+                    MrBayesPrint ("%c", WhichNuc(matrix[pos(i,j,numChar)]));
+                else if (charInfo[j].charType == PROTEIN)
+                    MrBayesPrint ("%c", WhichAA(matrix[pos(i,j,numChar)]));
+                else if (charInfo[j].charType == RESTRICTION)
+                    MrBayesPrint ("%c", WhichRes(matrix[pos(i,j,numChar)]));
+                else if (charInfo[j].charType == STANDARD)
+                    MrBayesPrint ("%c", WhichStand(matrix[pos(i,j,numChar)]));
+                j++;
+                }
+            MrBayesPrint("\n");
+            }
+        MrBayesPrint ("\n");
+        }
+
+    return NO_ERROR;
+}
+
+
+/*--------------------------------------------------------------
+|
+|   ProcessStdChars: process standard characters
+|
+---------------------------------------------------------------*/
+int ProcessStdChars (RandLong *seed)
+{
+    int             c, d, i, j, k, n, ts, index, numStandardChars, origCharPos, *bsIndex;
+    char            piHeader[30];
+    ModelInfo       *m;
+    ModelParams     *mp=NULL;
+    Param           *p;
+
+    /* set character type, no. states, ti index and bs index for standard characters */
+    /* first calculate how many standard characters we have */
+    numStandardChars = 0;
+    for (d=0; d<numCurrentDivisions; d++)
+        {
+        mp = &modelParams[d];
+        m = &modelSettings[d];
+
+        if (mp->dataType != STANDARD)
+            continue;
+
+        numStandardChars += m->numChars;
+        }
+    
+    /* return if there are no standard characters */
+    if (numStandardChars == 0)
+        return (NO_ERROR);
+
+    /* we are still here so we have standard characters and need to deal with them */
+    
+    /* first allocate space for stdType, stateSize, tiIndex, bsIndex */
+    if (memAllocs[ALLOC_STDTYPE] == YES)
+        {
+        free (stdType);
+        stdType = NULL;
+        memAllocs[ALLOC_STDTYPE] = NO;
+        }
+    stdType = (int *)SafeCalloc(4 * (size_t)numStandardChars, sizeof(int));
+    if (!stdType)
+        {
+        MrBayesPrint ("%s   Problem allocating stdType (%d ints)\n", 4 * numStandardChars);
+        return ERROR;
+        }
+    memAllocs[ALLOC_STDTYPE] = YES;
+    stateSize = stdType + numStandardChars;
+    tiIndex = stateSize + numStandardChars;
+    bsIndex = tiIndex + numStandardChars;
+
+    /* then fill in stdType and stateSize, set pointers */
+    /* also fill in isTiNeeded for each division and tiIndex for each character */
+    for (d=j=0; d<numCurrentDivisions; d++)
+        {
+        mp = &modelParams[d];
+        m = &modelSettings[d];
+        
+        if (mp->dataType != STANDARD)
+            continue;
+
+        m->cType = stdType + j;
+        m->nStates = stateSize + j;
+        m->tiIndex = tiIndex + j;
+        m->bsIndex = bsIndex + j;
+
+        m->cijkLength = 0;
+        m->nCijkParts = 0;
+        for (c=0; c<m->numChars; c++)
+            {
+            if (origChar[c+m->compMatrixStart] < 0)
+                {
+                /* this is a dummy character */
+                m->cType[c] = UNORD;
+                m->nStates[c] = 2;
+                }
+            else
+                {
+                /* this is an ordinary character */
+                m->cType[c] = charInfo[origChar[c + m->compMatrixStart]].ctype;
+                m->nStates[c] = charInfo[origChar[c + m->compMatrixStart]].numStates;
+                }
+            
+            /* check ctype settings */
+            if (m->nStates[c] < 2)
+                {
+                MrBayesPrint ("%s   WARNING: Compressed character %d (original character %d) of division %d has less \n", spacer, c+m->compCharStart,origChar[c+m->compCharStart]+1, d+1);
+                MrBayesPrint ("%s            than two observed states; it will be assumed to have two states.\n", spacer);
+                m->nStates[c] = 2;
+                }
+            if (m->nStates[c] > 6 && m->cType[c] != UNORD)
+                {
+                MrBayesPrint ("%s   Only unordered model supported for characters with more than 6 states\n", spacer);
+                return ERROR;
+                }
+            if (m->nStates[c] == 2 && m->cType[c] == ORD)
+                m->cType[c] = UNORD;
+            if (m->cType[c] == IRREV)
+                {
+                MrBayesPrint ("%s   Irreversible model not yet supported\n", spacer);
+                return ERROR;
+                }
+            
+            /* find max number of states */
+            if (m->nStates[c] > m->numModelStates)
+                m->numModelStates = m->nStates[c];
+
+            /* update Cijk info */
+            if (strcmp(mp->symPiPr,"Fixed") != 0 || AreDoublesEqual(mp->symBetaFix, -1.0, 0.00001) == NO)
+                {
+                /* Asymmetry between stationary state frequencies -- we need one cijk and eigenvalue
+                    set for each multistate character */
+                if (m->nStates[c] > 2 && (m->cType[c] == UNORD || m->cType[c] == ORD))
+                    {
+                    ts = m->nStates[c];
+                    m->cijkLength += (ts * ts * ts) + (2 * ts);
+                    m->nCijkParts++;
+                    }
+                }
+
+            /* set the ti probs needed */
+            if (m->stateFreq->nValues == 0 || m->nStates[c] == 2)
+                {
+                if (m->cType[c] == UNORD)
+                    m->isTiNeeded[m->nStates[c]-2] = YES;
+                if (m->cType[c] == ORD)
+                    m->isTiNeeded[m->nStates[c]+6] = YES;
+                if (m->cType[c] == IRREV)
+                    m->isTiNeeded[m->nStates[c]+11] = YES;
+                }
+            }
+
+        /* set ti index for each compressed character first         */
+        /* set bs index later (below)                               */
+
+        /* set base index, valid for binary chars */
+        m->tiIndex[c] = 0;
+
+        /* first adjust for unordered characters */
+        for (k=0; k<9; k++)
+            {
+            if (m->isTiNeeded [k] == NO)
+                continue;
+
+            for (c=0; c<m->numChars; c++)
+                {
+                if (m->cType[c] != UNORD || m->nStates[c] > k + 2)
+                    {
+                    m->tiIndex[c] += (k + 2) * (k + 2) * m->numGammaCats;
+                    }
+                }
+            }
+
+        /* second for ordered characters */
+        for (k=9; k<13; k++)
+            {
+            if (m->isTiNeeded [k] == NO)
+                continue;
+
+            for (c=0; c<m->numChars; c++)
+                {
+                if (m->cType[c] == IRREV || (m->cType[c] == ORD && m->nStates[c] > k - 6))
+                    {
+                    m->tiIndex[c] += (k - 6) * (k - 6) * m->numGammaCats;
+                    }
+                }
+            }
+
+        /* third for irrev characters */
+        for (k=13; k<18; k++)
+            {
+            if (m->isTiNeeded [k] == NO)
+                continue;
+
+            for (c=0; c<m->numChars; c++)
+                {
+                if (m->cType[c] == IRREV && m->nStates[c] > k - 11)
+                    {
+                    m->tiIndex[c] += (k - 11) * (k - 11) * m->numGammaCats;
+                    }
+                }
+            }
+
+        /* finally take beta cats into account in tiIndex        */
+        /* the beta cats will only be used for binary characters */
+        /* multistate characters get their ti indices reset here */
+        if (m->numBetaCats > 1 && m->isTiNeeded[0] == YES)
+            {
+            k = 4 * m->numBetaCats * m->numGammaCats;   /* offset for binary character ti probs */
+            for (c=0; c<m->numChars; c++)
+                {
+                if (m->nStates[c] > 2)
+                    {
+                    m->tiIndex[c] = k;
+                    k += m->nStates[c] * m->nStates[c] * m->numGammaCats;
+                    }
+                }
+            }
+        j += m->numChars;
+        }
+    
+    /* deal with bsIndex */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType != P_PI || modelParams[p->relParts[0]].dataType != STANDARD)
+            continue;
+        p->nSympi = 0;
+        p->hasBinaryStd = NO;
+        for (i=0; i<p->nRelParts; i++)
+            if (modelSettings[p->relParts[i]].isTiNeeded[0] == YES)
+                break;
+        if (i < p->nRelParts)
+            p->hasBinaryStd = YES;
+        if (p->paramId == SYMPI_EQUAL)
+            {
+            /* calculate the number of state frequencies needed */
+            /* also set bsIndex appropriately                   */
+            for (n=index=0; n<9; n++)
+                {
+                for (i=0; i<p->nRelParts; i++)
+                    if (modelSettings[p->relParts[i]].isTiNeeded[n] == YES)
+                        break;
+                if (i < p->nRelParts)
+                    {
+                    for (i=0; i<p->nRelParts; i++)
+                        {
+                        m = &modelSettings[p->relParts[i]];
+                        for (c=0; c<m->numChars; c++)
+                            {
+                            if (m->cType[c] != UNORD || m->nStates[c] > n + 2)
+                                {
+                                m->bsIndex[c] += (n + 2);
+                                }
+                            }
+                        }
+                    index += (n + 2);
+                    }
+                }
+            for (n=9; n<13; n++)
+                {
+                for (i=0; i<p->nRelParts; i++)
+                    if (modelSettings[p->relParts[i]].isTiNeeded[n] == YES)
+                        break;
+                if (i < p->nRelParts)
+                    {
+                    for (i=0; i<p->nRelParts; i++)
+                        {
+                        m = &modelSettings[p->relParts[i]];
+                        for (c=0; c<m->numChars; c++)
+                            {
+                            if (m->cType[c] == ORD && m->nStates[c] > n - 6)
+                                {
+                                m->bsIndex[c] += (n - 6);
+                                }
+                            }
+                        }
+                    index += (n - 6);
+                    }
+                }
+            p->nStdStateFreqs = index;
+            }
+        else
+            {
+            /* if not equal we need space for beta category frequencies */
+            index = 0;
+            if (p->hasBinaryStd == YES)
+                index += (2 * modelSettings[p->relParts[0]].numBetaCats);
+            /* as well as one set of frequencies for each multistate character */
+            for (i=0; i<p->nRelParts; i++)
+                {
+                m = &modelSettings[p->relParts[i]];
+                for (c=0; c<m->numChars; c++)
+                    {
+                    if (m->nStates[c] > 2 && (m->cType[c] == UNORD || m->cType[c] == ORD))
+                        {
+                        m->bsIndex[c] = index;
+                        index += m->nStates[c];
+                        p->nSympi++;
+                        }
+                    }
+                }
+            }
+        p->nStdStateFreqs = index;
+        }
+    
+    /* allocate space for bsIndex, sympiIndex, stdStateFreqs; then fill */
+
+    /* first count number of sympis needed */
+    for (k=n=i=0; k<numParams; k++)
+        {
+        p = &params[k];
+        n += p->nSympi;     /* nsympi calculated above */
+        }
+    
+    /* then allocate and fill in */
+    if (n > 0)
+        {
+        if (memAllocs[ALLOC_SYMPIINDEX] == YES)
+            {
+            sympiIndex = (int *) SafeRealloc ((void *) sympiIndex, 3*n * sizeof (int));
+            for (i=0; i<3*n; i++)
+                sympiIndex[i] = 0;
+            }
+        else
+            sympiIndex = (int *) SafeCalloc (3*n, sizeof (int));
+        if (!sympiIndex)
+            {
+            MrBayesPrint ("%s   Problem allocating sympiIndex\n", spacer);
+            return (ERROR);
+            }
+        else
+            memAllocs[ALLOC_SYMPIINDEX] = YES;
+        
+        /* set up sympi pointers and fill sympiIndex */
+        for (k=i=0; k<numParams; k++)
+            {
+            p = &params[k];
+            if (p->nSympi > 0)
+                {
+                p->printParam = YES;    /* print even if fixed alpha_symdir */
+                index = 0;
+                p->sympiBsIndex = sympiIndex + i;
+                p->sympinStates = sympiIndex + i + n;
+                p->sympiCType = sympiIndex + i + (2 * n);
+                for (j=0; j<p->nRelParts; j++)
+                    {                       
+                    m = &modelSettings[p->relParts[j]];
+                    for (c=0; c<m->numChars; c++)
+                        {
+                        if (m->nStates[c] > 2 && (m->cType[c] == UNORD || m->cType[c] == ORD))
+                            {
+                            p->sympinStates[index] = m->nStates[c];
+                            p->sympiBsIndex[index] = m->bsIndex[c];
+                            p->sympiCType[index] = m->cType[c];
+                            origCharPos = origChar[m->compCharStart + c];
+                            for (ts=0; ts<m->nStates[c]; ts++)
+                                {
+                                sprintf (piHeader, "\tpi_%d(%d)", origCharPos+1, ts);
+                                SafeStrcat(&p->paramHeader, piHeader);
+                                }
+                            index++;
+                            }
+                        }
+                    }
+                assert (index == p->nSympi);
+                i += p->nSympi;
+                }
+            }
+        assert (i == n);
+        }
+    
+    /* count space needed for state frequencies */
+    for (k=n=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType != P_PI || modelParams[p->relParts[0]].dataType != STANDARD)
+            continue;
+        n += p->nStdStateFreqs;
+        }
+    
+    stdStateFreqsRowSize = n;
+    
+    /* allocate space */
+    if (memAllocs[ALLOC_STDSTATEFREQS] == YES)
+        {
+        free (stdStateFreqs);
+        stdStateFreqs = NULL;
+        memAllocs[ALLOC_STDSTATEFREQS] = NO;
+        }
+    stdStateFreqs = (MrBFlt *) SafeCalloc (n * 2 * numGlobalChains, sizeof (MrBFlt));
+    if (!stdStateFreqs)
+        {
+        MrBayesPrint ("%s   Problem allocating stdStateFreqs in ProcessStdChars\n", spacer);
+        return (ERROR);
+        }
+    else
+        memAllocs[ALLOC_STDSTATEFREQS] = YES;
+    
+    /* set pointers */
+    for (k=n=0; k<numParams; k++)
+        {
+        p = &params[k];
+        if (p->paramType != P_PI || modelParams[p->relParts[0]].dataType != STANDARD)
+            continue;
+        p->stdStateFreqs = stdStateFreqs + n;
+        n += p->nStdStateFreqs;
+        }
+    
+    FillStdStateFreqs (0 , numGlobalChains, seed);
+
+    return (NO_ERROR);
+}
+
+
+int SetAARates (void)
+{
+    int         i, j;
+    MrBFlt      diff, sum, scaler;
+    
+    /* A R N D C Q E G H I L K M F P S T W Y V */
+
+    /* jones */
+    aaJones[ 0][ 0] =   0; aaJones[ 0][ 1] =  58; aaJones[ 0][ 2] =  54; aaJones[ 0][ 3] =  81; aaJones[ 0][ 4] =  56; 
+    aaJones[ 0][ 5] =  57; aaJones[ 0][ 6] = 105; aaJones[ 0][ 7] = 179; aaJones[ 0][ 8] =  27; aaJones[ 0][ 9] =  36; 
+    aaJones[ 0][10] =  30; aaJones[ 0][11] =  35; aaJones[ 0][12] =  54; aaJones[ 0][13] =  15; aaJones[ 0][14] = 194; 
+    aaJones[ 0][15] = 378; aaJones[ 0][16] = 475; aaJones[ 0][17] =   9; aaJones[ 0][18] =  11; aaJones[ 0][19] = 298; 
+    aaJones[ 1][ 0] =  58; aaJones[ 1][ 1] =   0; aaJones[ 1][ 2] =  45; aaJones[ 1][ 3] =  16; aaJones[ 1][ 4] = 113; 
+    aaJones[ 1][ 5] = 310; aaJones[ 1][ 6] =  29; aaJones[ 1][ 7] = 137; aaJones[ 1][ 8] = 328; aaJones[ 1][ 9] =  22; 
+    aaJones[ 1][10] =  38; aaJones[ 1][11] = 646; aaJones[ 1][12] =  44; aaJones[ 1][13] =   5; aaJones[ 1][14] =  74; 
+    aaJones[ 1][15] = 101; aaJones[ 1][16] =  64; aaJones[ 1][17] = 126; aaJones[ 1][18] =  20; aaJones[ 1][19] =  17; 
+    aaJones[ 2][ 0] =  54; aaJones[ 2][ 1] =  45; aaJones[ 2][ 2] =   0; aaJones[ 2][ 3] = 528; aaJones[ 2][ 4] =  34; 
+    aaJones[ 2][ 5] =  86; aaJones[ 2][ 6] =  58; aaJones[ 2][ 7] =  81; aaJones[ 2][ 8] = 391; aaJones[ 2][ 9] =  47; 
+    aaJones[ 2][10] =  12; aaJones[ 2][11] = 263; aaJones[ 2][12] =  30; aaJones[ 2][13] =  10; aaJones[ 2][14] =  15; 
+    aaJones[ 2][15] = 503; aaJones[ 2][16] = 232; aaJones[ 2][17] =   8; aaJones[ 2][18] =  70; aaJones[ 2][19] =  16; 
+    aaJones[ 3][ 0] =  81; aaJones[ 3][ 1] =  16; aaJones[ 3][ 2] = 528; aaJones[ 3][ 3] =   0; aaJones[ 3][ 4] =  10; 
+    aaJones[ 3][ 5] =  49; aaJones[ 3][ 6] = 767; aaJones[ 3][ 7] = 130; aaJones[ 3][ 8] = 112; aaJones[ 3][ 9] =  11; 
+    aaJones[ 3][10] =   7; aaJones[ 3][11] =  26; aaJones[ 3][12] =  15; aaJones[ 3][13] =   4; aaJones[ 3][14] =  15; 
+    aaJones[ 3][15] =  59; aaJones[ 3][16] =  38; aaJones[ 3][17] =   4; aaJones[ 3][18] =  46; aaJones[ 3][19] =  31; 
+    aaJones[ 4][ 0] =  56; aaJones[ 4][ 1] = 113; aaJones[ 4][ 2] =  34; aaJones[ 4][ 3] =  10; aaJones[ 4][ 4] =   0; 
+    aaJones[ 4][ 5] =   9; aaJones[ 4][ 6] =   5; aaJones[ 4][ 7] =  59; aaJones[ 4][ 8] =  69; aaJones[ 4][ 9] =  17; 
+    aaJones[ 4][10] =  23; aaJones[ 4][11] =   7; aaJones[ 4][12] =  31; aaJones[ 4][13] =  78; aaJones[ 4][14] =  14; 
+    aaJones[ 4][15] = 223; aaJones[ 4][16] =  42; aaJones[ 4][17] = 115; aaJones[ 4][18] = 209; aaJones[ 4][19] =  62; 
+    aaJones[ 5][ 0] =  57; aaJones[ 5][ 1] = 310; aaJones[ 5][ 2] =  86; aaJones[ 5][ 3] =  49; aaJones[ 5][ 4] =   9; 
+    aaJones[ 5][ 5] =   0; aaJones[ 5][ 6] = 323; aaJones[ 5][ 7] =  26; aaJones[ 5][ 8] = 597; aaJones[ 5][ 9] =   9; 
+    aaJones[ 5][10] =  72; aaJones[ 5][11] = 292; aaJones[ 5][12] =  43; aaJones[ 5][13] =   4; aaJones[ 5][14] = 164; 
+    aaJones[ 5][15] =  53; aaJones[ 5][16] =  51; aaJones[ 5][17] =  18; aaJones[ 5][18] =  24; aaJones[ 5][19] =  20; 
+    aaJones[ 6][ 0] = 105; aaJones[ 6][ 1] =  29; aaJones[ 6][ 2] =  58; aaJones[ 6][ 3] = 767; aaJones[ 6][ 4] =   5; 
+    aaJones[ 6][ 5] = 323; aaJones[ 6][ 6] =   0; aaJones[ 6][ 7] = 119; aaJones[ 6][ 8] =  26; aaJones[ 6][ 9] =  12; 
+    aaJones[ 6][10] =   9; aaJones[ 6][11] = 181; aaJones[ 6][12] =  18; aaJones[ 6][13] =   5; aaJones[ 6][14] =  18; 
+    aaJones[ 6][15] =  30; aaJones[ 6][16] =  32; aaJones[ 6][17] =  10; aaJones[ 6][18] =   7; aaJones[ 6][19] =  45; 
+    aaJones[ 7][ 0] = 179; aaJones[ 7][ 1] = 137; aaJones[ 7][ 2] =  81; aaJones[ 7][ 3] = 130; aaJones[ 7][ 4] =  59; 
+    aaJones[ 7][ 5] =  26; aaJones[ 7][ 6] = 119; aaJones[ 7][ 7] =   0; aaJones[ 7][ 8] =  23; aaJones[ 7][ 9] =   6; 
+    aaJones[ 7][10] =   6; aaJones[ 7][11] =  27; aaJones[ 7][12] =  14; aaJones[ 7][13] =   5; aaJones[ 7][14] =  24; 
+    aaJones[ 7][15] = 201; aaJones[ 7][16] =  33; aaJones[ 7][17] =  55; aaJones[ 7][18] =   8; aaJones[ 7][19] =  47; 
+    aaJones[ 8][ 0] =  27; aaJones[ 8][ 1] = 328; aaJones[ 8][ 2] = 391; aaJones[ 8][ 3] = 112; aaJones[ 8][ 4] =  69; 
+    aaJones[ 8][ 5] = 597; aaJones[ 8][ 6] =  26; aaJones[ 8][ 7] =  23; aaJones[ 8][ 8] =   0; aaJones[ 8][ 9] =  16; 
+    aaJones[ 8][10] =  56; aaJones[ 8][11] =  45; aaJones[ 8][12] =  33; aaJones[ 8][13] =  40; aaJones[ 8][14] = 115; 
+    aaJones[ 8][15] =  73; aaJones[ 8][16] =  46; aaJones[ 8][17] =   8; aaJones[ 8][18] = 573; aaJones[ 8][19] =  11; 
+    aaJones[ 9][ 0] =  36; aaJones[ 9][ 1] =  22; aaJones[ 9][ 2] =  47; aaJones[ 9][ 3] =  11; aaJones[ 9][ 4] =  17; 
+    aaJones[ 9][ 5] =   9; aaJones[ 9][ 6] =  12; aaJones[ 9][ 7] =   6; aaJones[ 9][ 8] =  16; aaJones[ 9][ 9] =   0; 
+    aaJones[ 9][10] = 229; aaJones[ 9][11] =  21; aaJones[ 9][12] = 479; aaJones[ 9][13] =  89; aaJones[ 9][14] =  10; 
+    aaJones[ 9][15] =  40; aaJones[ 9][16] = 245; aaJones[ 9][17] =   9; aaJones[ 9][18] =  32; aaJones[ 9][19] = 961; 
+    aaJones[10][ 0] =  30; aaJones[10][ 1] =  38; aaJones[10][ 2] =  12; aaJones[10][ 3] =   7; aaJones[10][ 4] =  23; 
+    aaJones[10][ 5] =  72; aaJones[10][ 6] =   9; aaJones[10][ 7] =   6; aaJones[10][ 8] =  56; aaJones[10][ 9] = 229; 
+    aaJones[10][10] =   0; aaJones[10][11] =  14; aaJones[10][12] = 388; aaJones[10][13] = 248; aaJones[10][14] = 102; 
+    aaJones[10][15] =  59; aaJones[10][16] =  25; aaJones[10][17] =  52; aaJones[10][18] =  24; aaJones[10][19] = 180; 
+    aaJones[11][ 0] =  35; aaJones[11][ 1] = 646; aaJones[11][ 2] = 263; aaJones[11][ 3] =  26; aaJones[11][ 4] =   7; 
+    aaJones[11][ 5] = 292; aaJones[11][ 6] = 181; aaJones[11][ 7] =  27; aaJones[11][ 8] =  45; aaJones[11][ 9] =  21; 
+    aaJones[11][10] =  14; aaJones[11][11] =   0; aaJones[11][12] =  65; aaJones[11][13] =   4; aaJones[11][14] =  21; 
+    aaJones[11][15] =  47; aaJones[11][16] = 103; aaJones[11][17] =  10; aaJones[11][18] =   8; aaJones[11][19] =  14; 
+    aaJones[12][ 0] =  54; aaJones[12][ 1] =  44; aaJones[12][ 2] =  30; aaJones[12][ 3] =  15; aaJones[12][ 4] =  31; 
+    aaJones[12][ 5] =  43; aaJones[12][ 6] =  18; aaJones[12][ 7] =  14; aaJones[12][ 8] =  33; aaJones[12][ 9] = 479; 
+    aaJones[12][10] = 388; aaJones[12][11] =  65; aaJones[12][12] =   0; aaJones[12][13] =  43; aaJones[12][14] =  16; 
+    aaJones[12][15] =  29; aaJones[12][16] = 226; aaJones[12][17] =  24; aaJones[12][18] =  18; aaJones[12][19] = 323; 
+    aaJones[13][ 0] =  15; aaJones[13][ 1] =   5; aaJones[13][ 2] =  10; aaJones[13][ 3] =   4; aaJones[13][ 4] =  78; 
+    aaJones[13][ 5] =   4; aaJones[13][ 6] =   5; aaJones[13][ 7] =   5; aaJones[13][ 8] =  40; aaJones[13][ 9] =  89; 
+    aaJones[13][10] = 248; aaJones[13][11] =   4; aaJones[13][12] =  43; aaJones[13][13] =   0; aaJones[13][14] =  17; 
+    aaJones[13][15] =  92; aaJones[13][16] =  12; aaJones[13][17] =  53; aaJones[13][18] = 536; aaJones[13][19] =  62; 
+    aaJones[14][ 0] = 194; aaJones[14][ 1] =  74; aaJones[14][ 2] =  15; aaJones[14][ 3] =  15; aaJones[14][ 4] =  14; 
+    aaJones[14][ 5] = 164; aaJones[14][ 6] =  18; aaJones[14][ 7] =  24; aaJones[14][ 8] = 115; aaJones[14][ 9] =  10; 
+    aaJones[14][10] = 102; aaJones[14][11] =  21; aaJones[14][12] =  16; aaJones[14][13] =  17; aaJones[14][14] =   0; 
+    aaJones[14][15] = 285; aaJones[14][16] = 118; aaJones[14][17] =   6; aaJones[14][18] =  10; aaJones[14][19] =  23; 
+    aaJones[15][ 0] = 378; aaJones[15][ 1] = 101; aaJones[15][ 2] = 503; aaJones[15][ 3] =  59; aaJones[15][ 4] = 223; 
+    aaJones[15][ 5] =  53; aaJones[15][ 6] =  30; aaJones[15][ 7] = 201; aaJones[15][ 8] =  73; aaJones[15][ 9] =  40; 
+    aaJones[15][10] =  59; aaJones[15][11] =  47; aaJones[15][12] =  29; aaJones[15][13] =  92; aaJones[15][14] = 285; 
+    aaJones[15][15] =   0; aaJones[15][16] = 477; aaJones[15][17] =  35; aaJones[15][18] =  63; aaJones[15][19] =  38; 
+    aaJones[16][ 0] = 475; aaJones[16][ 1] =  64; aaJones[16][ 2] = 232; aaJones[16][ 3] =  38; aaJones[16][ 4] =  42; 
+    aaJones[16][ 5] =  51; aaJones[16][ 6] =  32; aaJones[16][ 7] =  33; aaJones[16][ 8] =  46; aaJones[16][ 9] = 245; 
+    aaJones[16][10] =  25; aaJones[16][11] = 103; aaJones[16][12] = 226; aaJones[16][13] =  12; aaJones[16][14] = 118; 
+    aaJones[16][15] = 477; aaJones[16][16] =   0; aaJones[16][17] =  12; aaJones[16][18] =  21; aaJones[16][19] = 112; 
+    aaJones[17][ 0] =   9; aaJones[17][ 1] = 126; aaJones[17][ 2] =   8; aaJones[17][ 3] =   4; aaJones[17][ 4] = 115; 
+    aaJones[17][ 5] =  18; aaJones[17][ 6] =  10; aaJones[17][ 7] =  55; aaJones[17][ 8] =   8; aaJones[17][ 9] =   9; 
+    aaJones[17][10] =  52; aaJones[17][11] =  10; aaJones[17][12] =  24; aaJones[17][13] =  53; aaJones[17][14] =   6; 
+    aaJones[17][15] =  35; aaJones[17][16] =  12; aaJones[17][17] =   0; aaJones[17][18] =  71; aaJones[17][19] =  25; 
+    aaJones[18][ 0] =  11; aaJones[18][ 1] =  20; aaJones[18][ 2] =  70; aaJones[18][ 3] =  46; aaJones[18][ 4] = 209; 
+    aaJones[18][ 5] =  24; aaJones[18][ 6] =   7; aaJones[18][ 7] =   8; aaJones[18][ 8] = 573; aaJones[18][ 9] =  32; 
+    aaJones[18][10] =  24; aaJones[18][11] =   8; aaJones[18][12] =  18; aaJones[18][13] = 536; aaJones[18][14] =  10; 
+    aaJones[18][15] =  63; aaJones[18][16] =  21; aaJones[18][17] =  71; aaJones[18][18] =   0; aaJones[18][19] =  16; 
+    aaJones[19][ 0] = 298; aaJones[19][ 1] =  17; aaJones[19][ 2] =  16; aaJones[19][ 3] =  31; aaJones[19][ 4] =  62; 
+    aaJones[19][ 5] =  20; aaJones[19][ 6] =  45; aaJones[19][ 7] =  47; aaJones[19][ 8] =  11; aaJones[19][ 9] = 961; 
+    aaJones[19][10] = 180; aaJones[19][11] =  14; aaJones[19][12] = 323; aaJones[19][13] =  62; aaJones[19][14] =  23; 
+    aaJones[19][15] =  38; aaJones[19][16] = 112; aaJones[19][17] =  25; aaJones[19][18] =  16; aaJones[19][19] =   0;
+
+    jonesPi[ 0] = 0.076748;
+    jonesPi[ 1] = 0.051691;
+    jonesPi[ 2] = 0.042645;
+    jonesPi[ 3] = 0.051544;
+    jonesPi[ 4] = 0.019803;
+    jonesPi[ 5] = 0.040752;
+    jonesPi[ 6] = 0.061830;
+    jonesPi[ 7] = 0.073152;
+    jonesPi[ 8] = 0.022944;
+    jonesPi[ 9] = 0.053761;
+    jonesPi[10] = 0.091904;
+    jonesPi[11] = 0.058676;
+    jonesPi[12] = 0.023826;
+    jonesPi[13] = 0.040126;
+    jonesPi[14] = 0.050901;
+    jonesPi[15] = 0.068765;
+    jonesPi[16] = 0.058565;
+    jonesPi[17] = 0.014261;
+    jonesPi[18] = 0.032102;
+    jonesPi[19] = 0.066005;
+
+    /* dayhoff */
+    aaDayhoff[ 0][ 0] =   0; aaDayhoff[ 0][ 1] =  27; aaDayhoff[ 0][ 2] =  98; aaDayhoff[ 0][ 3] = 120; aaDayhoff[ 0][ 4] =  36; 
+    aaDayhoff[ 0][ 5] =  89; aaDayhoff[ 0][ 6] = 198; aaDayhoff[ 0][ 7] = 240; aaDayhoff[ 0][ 8] =  23; aaDayhoff[ 0][ 9] =  65; 
+    aaDayhoff[ 0][10] =  41; aaDayhoff[ 0][11] =  26; aaDayhoff[ 0][12] =  72; aaDayhoff[ 0][13] =  18; aaDayhoff[ 0][14] = 250; 
+    aaDayhoff[ 0][15] = 409; aaDayhoff[ 0][16] = 371; aaDayhoff[ 0][17] =   0; aaDayhoff[ 0][18] =  24; aaDayhoff[ 0][19] = 208; 
+    aaDayhoff[ 1][ 0] =  27; aaDayhoff[ 1][ 1] =   0; aaDayhoff[ 1][ 2] =  32; aaDayhoff[ 1][ 3] =   0; aaDayhoff[ 1][ 4] =  23; 
+    aaDayhoff[ 1][ 5] = 246; aaDayhoff[ 1][ 6] =   1; aaDayhoff[ 1][ 7] =   9; aaDayhoff[ 1][ 8] = 240; aaDayhoff[ 1][ 9] =  64; 
+    aaDayhoff[ 1][10] =  15; aaDayhoff[ 1][11] = 464; aaDayhoff[ 1][12] =  90; aaDayhoff[ 1][13] =  14; aaDayhoff[ 1][14] = 103; 
+    aaDayhoff[ 1][15] = 154; aaDayhoff[ 1][16] =  26; aaDayhoff[ 1][17] = 201; aaDayhoff[ 1][18] =   8; aaDayhoff[ 1][19] =  24; 
+    aaDayhoff[ 2][ 0] =  98; aaDayhoff[ 2][ 1] =  32; aaDayhoff[ 2][ 2] =   0; aaDayhoff[ 2][ 3] = 905; aaDayhoff[ 2][ 4] =   0; 
+    aaDayhoff[ 2][ 5] = 103; aaDayhoff[ 2][ 6] = 148; aaDayhoff[ 2][ 7] = 139; aaDayhoff[ 2][ 8] = 535; aaDayhoff[ 2][ 9] =  77; 
+    aaDayhoff[ 2][10] =  34; aaDayhoff[ 2][11] = 318; aaDayhoff[ 2][12] =   1; aaDayhoff[ 2][13] =  14; aaDayhoff[ 2][14] =  42; 
+    aaDayhoff[ 2][15] = 495; aaDayhoff[ 2][16] = 229; aaDayhoff[ 2][17] =  23; aaDayhoff[ 2][18] =  95; aaDayhoff[ 2][19] =  15; 
+    aaDayhoff[ 3][ 0] = 120; aaDayhoff[ 3][ 1] =   0; aaDayhoff[ 3][ 2] = 905; aaDayhoff[ 3][ 3] =   0; aaDayhoff[ 3][ 4] =   0; 
+    aaDayhoff[ 3][ 5] = 134; aaDayhoff[ 3][ 6] = 1153; aaDayhoff[ 3][ 7] = 125; aaDayhoff[ 3][ 8] =  86; aaDayhoff[ 3][ 9] =  24; 
+    aaDayhoff[ 3][10] =   0; aaDayhoff[ 3][11] =  71; aaDayhoff[ 3][12] =   0; aaDayhoff[ 3][13] =   0; aaDayhoff[ 3][14] =  13; 
+    aaDayhoff[ 3][15] =  95; aaDayhoff[ 3][16] =  66; aaDayhoff[ 3][17] =   0; aaDayhoff[ 3][18] =   0; aaDayhoff[ 3][19] =  18; 
+    aaDayhoff[ 4][ 0] =  36; aaDayhoff[ 4][ 1] =  23; aaDayhoff[ 4][ 2] =   0; aaDayhoff[ 4][ 3] =   0; aaDayhoff[ 4][ 4] =   0; 
+    aaDayhoff[ 4][ 5] =   0; aaDayhoff[ 4][ 6] =   0; aaDayhoff[ 4][ 7] =  11; aaDayhoff[ 4][ 8] =  28; aaDayhoff[ 4][ 9] =  44; 
+    aaDayhoff[ 4][10] =   0; aaDayhoff[ 4][11] =   0; aaDayhoff[ 4][12] =   0; aaDayhoff[ 4][13] =   0; aaDayhoff[ 4][14] =  19; 
+    aaDayhoff[ 4][15] = 161; aaDayhoff[ 4][16] =  16; aaDayhoff[ 4][17] =   0; aaDayhoff[ 4][18] =  96; aaDayhoff[ 4][19] =  49; 
+    aaDayhoff[ 5][ 0] =  89; aaDayhoff[ 5][ 1] = 246; aaDayhoff[ 5][ 2] = 103; aaDayhoff[ 5][ 3] = 134; aaDayhoff[ 5][ 4] =   0; 
+    aaDayhoff[ 5][ 5] =   0; aaDayhoff[ 5][ 6] = 716; aaDayhoff[ 5][ 7] =  28; aaDayhoff[ 5][ 8] = 606; aaDayhoff[ 5][ 9] =  18; 
+    aaDayhoff[ 5][10] =  73; aaDayhoff[ 5][11] = 153; aaDayhoff[ 5][12] = 114; aaDayhoff[ 5][13] =   0; aaDayhoff[ 5][14] = 153; 
+    aaDayhoff[ 5][15] =  56; aaDayhoff[ 5][16] =  53; aaDayhoff[ 5][17] =   0; aaDayhoff[ 5][18] =   0; aaDayhoff[ 5][19] =  35; 
+    aaDayhoff[ 6][ 0] = 198; aaDayhoff[ 6][ 1] =   1; aaDayhoff[ 6][ 2] = 148; aaDayhoff[ 6][ 3] = 1153; aaDayhoff[ 6][ 4] =   0; 
+    aaDayhoff[ 6][ 5] = 716; aaDayhoff[ 6][ 6] =   0; aaDayhoff[ 6][ 7] =  81; aaDayhoff[ 6][ 8] =  43; aaDayhoff[ 6][ 9] =  61; 
+    aaDayhoff[ 6][10] =  11; aaDayhoff[ 6][11] =  83; aaDayhoff[ 6][12] =  30; aaDayhoff[ 6][13] =   0; aaDayhoff[ 6][14] =  51; 
+    aaDayhoff[ 6][15] =  79; aaDayhoff[ 6][16] =  34; aaDayhoff[ 6][17] =   0; aaDayhoff[ 6][18] =  22; aaDayhoff[ 6][19] =  37; 
+    aaDayhoff[ 7][ 0] = 240; aaDayhoff[ 7][ 1] =   9; aaDayhoff[ 7][ 2] = 139; aaDayhoff[ 7][ 3] = 125; aaDayhoff[ 7][ 4] =  11; 
+    aaDayhoff[ 7][ 5] =  28; aaDayhoff[ 7][ 6] =  81; aaDayhoff[ 7][ 7] =   0; aaDayhoff[ 7][ 8] =  10; aaDayhoff[ 7][ 9] =   0; 
+    aaDayhoff[ 7][10] =   7; aaDayhoff[ 7][11] =  27; aaDayhoff[ 7][12] =  17; aaDayhoff[ 7][13] =  15; aaDayhoff[ 7][14] =  34; 
+    aaDayhoff[ 7][15] = 234; aaDayhoff[ 7][16] =  30; aaDayhoff[ 7][17] =   0; aaDayhoff[ 7][18] =   0; aaDayhoff[ 7][19] =  54; 
+    aaDayhoff[ 8][ 0] =  23; aaDayhoff[ 8][ 1] = 240; aaDayhoff[ 8][ 2] = 535; aaDayhoff[ 8][ 3] =  86; aaDayhoff[ 8][ 4] =  28; 
+    aaDayhoff[ 8][ 5] = 606; aaDayhoff[ 8][ 6] =  43; aaDayhoff[ 8][ 7] =  10; aaDayhoff[ 8][ 8] =   0; aaDayhoff[ 8][ 9] =   7; 
+    aaDayhoff[ 8][10] =  44; aaDayhoff[ 8][11] =  26; aaDayhoff[ 8][12] =   0; aaDayhoff[ 8][13] =  48; aaDayhoff[ 8][14] =  94; 
+    aaDayhoff[ 8][15] =  35; aaDayhoff[ 8][16] =  22; aaDayhoff[ 8][17] =  27; aaDayhoff[ 8][18] = 127; aaDayhoff[ 8][19] =  44; 
+    aaDayhoff[ 9][ 0] =  65; aaDayhoff[ 9][ 1] =  64; aaDayhoff[ 9][ 2] =  77; aaDayhoff[ 9][ 3] =  24; aaDayhoff[ 9][ 4] =  44; 
+    aaDayhoff[ 9][ 5] =  18; aaDayhoff[ 9][ 6] =  61; aaDayhoff[ 9][ 7] =   0; aaDayhoff[ 9][ 8] =   7; aaDayhoff[ 9][ 9] =   0; 
+    aaDayhoff[ 9][10] = 257; aaDayhoff[ 9][11] =  46; aaDayhoff[ 9][12] = 336; aaDayhoff[ 9][13] = 196; aaDayhoff[ 9][14] =  12; 
+    aaDayhoff[ 9][15] =  24; aaDayhoff[ 9][16] = 192; aaDayhoff[ 9][17] =   0; aaDayhoff[ 9][18] =  37; aaDayhoff[ 9][19] = 889; 
+    aaDayhoff[10][ 0] =  41; aaDayhoff[10][ 1] =  15; aaDayhoff[10][ 2] =  34; aaDayhoff[10][ 3] =   0; aaDayhoff[10][ 4] =   0; 
+    aaDayhoff[10][ 5] =  73; aaDayhoff[10][ 6] =  11; aaDayhoff[10][ 7] =   7; aaDayhoff[10][ 8] =  44; aaDayhoff[10][ 9] = 257; 
+    aaDayhoff[10][10] =   0; aaDayhoff[10][11] =  18; aaDayhoff[10][12] = 527; aaDayhoff[10][13] = 157; aaDayhoff[10][14] =  32; 
+    aaDayhoff[10][15] =  17; aaDayhoff[10][16] =  33; aaDayhoff[10][17] =  46; aaDayhoff[10][18] =  28; aaDayhoff[10][19] = 175; 
+    aaDayhoff[11][ 0] =  26; aaDayhoff[11][ 1] = 464; aaDayhoff[11][ 2] = 318; aaDayhoff[11][ 3] =  71; aaDayhoff[11][ 4] =   0; 
+    aaDayhoff[11][ 5] = 153; aaDayhoff[11][ 6] =  83; aaDayhoff[11][ 7] =  27; aaDayhoff[11][ 8] =  26; aaDayhoff[11][ 9] =  46; 
+    aaDayhoff[11][10] =  18; aaDayhoff[11][11] =   0; aaDayhoff[11][12] = 243; aaDayhoff[11][13] =   0; aaDayhoff[11][14] =  33; 
+    aaDayhoff[11][15] =  96; aaDayhoff[11][16] = 136; aaDayhoff[11][17] =   0; aaDayhoff[11][18] =  13; aaDayhoff[11][19] =  10; 
+    aaDayhoff[12][ 0] =  72; aaDayhoff[12][ 1] =  90; aaDayhoff[12][ 2] =   1; aaDayhoff[12][ 3] =   0; aaDayhoff[12][ 4] =   0; 
+    aaDayhoff[12][ 5] = 114; aaDayhoff[12][ 6] =  30; aaDayhoff[12][ 7] =  17; aaDayhoff[12][ 8] =   0; aaDayhoff[12][ 9] = 336; 
+    aaDayhoff[12][10] = 527; aaDayhoff[12][11] = 243; aaDayhoff[12][12] =   0; aaDayhoff[12][13] =  92; aaDayhoff[12][14] =  17; 
+    aaDayhoff[12][15] =  62; aaDayhoff[12][16] = 104; aaDayhoff[12][17] =   0; aaDayhoff[12][18] =   0; aaDayhoff[12][19] = 258; 
+    aaDayhoff[13][ 0] =  18; aaDayhoff[13][ 1] =  14; aaDayhoff[13][ 2] =  14; aaDayhoff[13][ 3] =   0; aaDayhoff[13][ 4] =   0; 
+    aaDayhoff[13][ 5] =   0; aaDayhoff[13][ 6] =   0; aaDayhoff[13][ 7] =  15; aaDayhoff[13][ 8] =  48; aaDayhoff[13][ 9] = 196; 
+    aaDayhoff[13][10] = 157; aaDayhoff[13][11] =   0; aaDayhoff[13][12] =  92; aaDayhoff[13][13] =   0; aaDayhoff[13][14] =  11; 
+    aaDayhoff[13][15] =  46; aaDayhoff[13][16] =  13; aaDayhoff[13][17] =  76; aaDayhoff[13][18] = 698; aaDayhoff[13][19] =  12; 
+    aaDayhoff[14][ 0] = 250; aaDayhoff[14][ 1] = 103; aaDayhoff[14][ 2] =  42; aaDayhoff[14][ 3] =  13; aaDayhoff[14][ 4] =  19; 
+    aaDayhoff[14][ 5] = 153; aaDayhoff[14][ 6] =  51; aaDayhoff[14][ 7] =  34; aaDayhoff[14][ 8] =  94; aaDayhoff[14][ 9] =  12; 
+    aaDayhoff[14][10] =  32; aaDayhoff[14][11] =  33; aaDayhoff[14][12] =  17; aaDayhoff[14][13] =  11; aaDayhoff[14][14] =   0; 
+    aaDayhoff[14][15] = 245; aaDayhoff[14][16] =  78; aaDayhoff[14][17] =   0; aaDayhoff[14][18] =   0; aaDayhoff[14][19] =  48; 
+    aaDayhoff[15][ 0] = 409; aaDayhoff[15][ 1] = 154; aaDayhoff[15][ 2] = 495; aaDayhoff[15][ 3] =  95; aaDayhoff[15][ 4] = 161; 
+    aaDayhoff[15][ 5] =  56; aaDayhoff[15][ 6] =  79; aaDayhoff[15][ 7] = 234; aaDayhoff[15][ 8] =  35; aaDayhoff[15][ 9] =  24; 
+    aaDayhoff[15][10] =  17; aaDayhoff[15][11] =  96; aaDayhoff[15][12] =  62; aaDayhoff[15][13] =  46; aaDayhoff[15][14] = 245; 
+    aaDayhoff[15][15] =   0; aaDayhoff[15][16] = 550; aaDayhoff[15][17] =  75; aaDayhoff[15][18] =  34; aaDayhoff[15][19] =  30; 
+    aaDayhoff[16][ 0] = 371; aaDayhoff[16][ 1] =  26; aaDayhoff[16][ 2] = 229; aaDayhoff[16][ 3] =  66; aaDayhoff[16][ 4] =  16; 
+    aaDayhoff[16][ 5] =  53; aaDayhoff[16][ 6] =  34; aaDayhoff[16][ 7] =  30; aaDayhoff[16][ 8] =  22; aaDayhoff[16][ 9] = 192; 
+    aaDayhoff[16][10] =  33; aaDayhoff[16][11] = 136; aaDayhoff[16][12] = 104; aaDayhoff[16][13] =  13; aaDayhoff[16][14] =  78; 
+    aaDayhoff[16][15] = 550; aaDayhoff[16][16] =   0; aaDayhoff[16][17] =   0; aaDayhoff[16][18] =  42; aaDayhoff[16][19] = 157; 
+    aaDayhoff[17][ 0] =   0; aaDayhoff[17][ 1] = 201; aaDayhoff[17][ 2] =  23; aaDayhoff[17][ 3] =   0; aaDayhoff[17][ 4] =   0; 
+    aaDayhoff[17][ 5] =   0; aaDayhoff[17][ 6] =   0; aaDayhoff[17][ 7] =   0; aaDayhoff[17][ 8] =  27; aaDayhoff[17][ 9] =   0; 
+    aaDayhoff[17][10] =  46; aaDayhoff[17][11] =   0; aaDayhoff[17][12] =   0; aaDayhoff[17][13] =  76; aaDayhoff[17][14] =   0; 
+    aaDayhoff[17][15] =  75; aaDayhoff[17][16] =   0; aaDayhoff[17][17] =   0; aaDayhoff[17][18] =  61; aaDayhoff[17][19] =   0; 
+    aaDayhoff[18][ 0] =  24; aaDayhoff[18][ 1] =   8; aaDayhoff[18][ 2] =  95; aaDayhoff[18][ 3] =   0; aaDayhoff[18][ 4] =  96; 
+    aaDayhoff[18][ 5] =   0; aaDayhoff[18][ 6] =  22; aaDayhoff[18][ 7] =   0; aaDayhoff[18][ 8] = 127; aaDayhoff[18][ 9] =  37; 
+    aaDayhoff[18][10] =  28; aaDayhoff[18][11] =  13; aaDayhoff[18][12] =   0; aaDayhoff[18][13] = 698; aaDayhoff[18][14] =   0; 
+    aaDayhoff[18][15] =  34; aaDayhoff[18][16] =  42; aaDayhoff[18][17] =  61; aaDayhoff[18][18] =   0; aaDayhoff[18][19] =  28; 
+    aaDayhoff[19][ 0] = 208; aaDayhoff[19][ 1] =  24; aaDayhoff[19][ 2] =  15; aaDayhoff[19][ 3] =  18; aaDayhoff[19][ 4] =  49; 
+    aaDayhoff[19][ 5] =  35; aaDayhoff[19][ 6] =  37; aaDayhoff[19][ 7] =  54; aaDayhoff[19][ 8] =  44; aaDayhoff[19][ 9] = 889; 
+    aaDayhoff[19][10] = 175; aaDayhoff[19][11] =  10; aaDayhoff[19][12] = 258; aaDayhoff[19][13] =  12; aaDayhoff[19][14] =  48; 
+    aaDayhoff[19][15] =  30; aaDayhoff[19][16] = 157; aaDayhoff[19][17] =   0; aaDayhoff[19][18] =  28; aaDayhoff[19][19] =   0;
+
+    dayhoffPi[ 0] = 0.087127;
+    dayhoffPi[ 1] = 0.040904;
+    dayhoffPi[ 2] = 0.040432;
+    dayhoffPi[ 3] = 0.046872;
+    dayhoffPi[ 4] = 0.033474;
+    dayhoffPi[ 5] = 0.038255;
+    dayhoffPi[ 6] = 0.049530;
+    dayhoffPi[ 7] = 0.088612;
+    dayhoffPi[ 8] = 0.033618;
+    dayhoffPi[ 9] = 0.036886;
+    dayhoffPi[10] = 0.085357;
+    dayhoffPi[11] = 0.080482;
+    dayhoffPi[12] = 0.014753;
+    dayhoffPi[13] = 0.039772;
+    dayhoffPi[14] = 0.050680;
+    dayhoffPi[15] = 0.069577;
+    dayhoffPi[16] = 0.058542;
+    dayhoffPi[17] = 0.010494;
+    dayhoffPi[18] = 0.029916;
+    dayhoffPi[19] = 0.064718;
+
+    /* mtrev24 */
+    aaMtrev24[ 0][ 0] =   0.00; aaMtrev24[ 0][ 1] =  23.18; aaMtrev24[ 0][ 2] =  26.95; aaMtrev24[ 0][ 3] =  17.67; aaMtrev24[ 0][ 4] =  59.93;
+    aaMtrev24[ 0][ 5] =   1.90; aaMtrev24[ 0][ 6] =   9.77; aaMtrev24[ 0][ 7] = 120.71; aaMtrev24[ 0][ 8] =  13.90; aaMtrev24[ 0][ 9] =  96.49;
+    aaMtrev24[ 0][10] =  25.46; aaMtrev24[ 0][11] =   8.36; aaMtrev24[ 0][12] = 141.88; aaMtrev24[ 0][13] =   6.37; aaMtrev24[ 0][14] =  54.31;
+    aaMtrev24[ 0][15] = 387.86; aaMtrev24[ 0][16] = 480.72; aaMtrev24[ 0][17] =   1.90; aaMtrev24[ 0][18] =   6.48; aaMtrev24[ 0][19] = 195.06;
+    aaMtrev24[ 1][ 0] =  23.18; aaMtrev24[ 1][ 1] =   0.00; aaMtrev24[ 1][ 2] =  13.24; aaMtrev24[ 1][ 3] =   1.90; aaMtrev24[ 1][ 4] = 103.33;
+    aaMtrev24[ 1][ 5] = 220.99; aaMtrev24[ 1][ 6] =   1.90; aaMtrev24[ 1][ 7] =  23.03; aaMtrev24[ 1][ 8] = 165.23; aaMtrev24[ 1][ 9] =   1.90;
+    aaMtrev24[ 1][10] =  15.58; aaMtrev24[ 1][11] = 141.40; aaMtrev24[ 1][12] =   1.90; aaMtrev24[ 1][13] =   4.69; aaMtrev24[ 1][14] =  23.64;
+    aaMtrev24[ 1][15] =   6.04; aaMtrev24[ 1][16] =   2.08; aaMtrev24[ 1][17] =  21.95; aaMtrev24[ 1][18] =   1.90; aaMtrev24[ 1][19] =   7.64;
+    aaMtrev24[ 2][ 0] =  26.95; aaMtrev24[ 2][ 1] =  13.24; aaMtrev24[ 2][ 2] =   0.00; aaMtrev24[ 2][ 3] = 794.38; aaMtrev24[ 2][ 4] =  58.94;
+    aaMtrev24[ 2][ 5] = 173.56; aaMtrev24[ 2][ 6] =  63.05; aaMtrev24[ 2][ 7] =  53.30; aaMtrev24[ 2][ 8] = 496.13; aaMtrev24[ 2][ 9] =  27.10;
+    aaMtrev24[ 2][10] =  15.16; aaMtrev24[ 2][11] = 608.70; aaMtrev24[ 2][12] =  65.41; aaMtrev24[ 2][13] =  15.20; aaMtrev24[ 2][14] =  73.31;
+    aaMtrev24[ 2][15] = 494.39; aaMtrev24[ 2][16] = 238.46; aaMtrev24[ 2][17] =  10.68; aaMtrev24[ 2][18] = 191.36; aaMtrev24[ 2][19] =   1.90;
+    aaMtrev24[ 3][ 0] =  17.67; aaMtrev24[ 3][ 1] =   1.90; aaMtrev24[ 3][ 2] = 794.38; aaMtrev24[ 3][ 3] =   0.00; aaMtrev24[ 3][ 4] =   1.90;
+    aaMtrev24[ 3][ 5] =  55.28; aaMtrev24[ 3][ 6] = 583.55; aaMtrev24[ 3][ 7] =  56.77; aaMtrev24[ 3][ 8] = 113.99; aaMtrev24[ 3][ 9] =   4.34;
+    aaMtrev24[ 3][10] =   1.90; aaMtrev24[ 3][11] =   2.31; aaMtrev24[ 3][12] =   1.90; aaMtrev24[ 3][13] =   4.98; aaMtrev24[ 3][14] =  13.43;
+    aaMtrev24[ 3][15] =  69.02; aaMtrev24[ 3][16] =  28.01; aaMtrev24[ 3][17] =  19.86; aaMtrev24[ 3][18] =  21.21; aaMtrev24[ 3][19] =   1.90;
+    aaMtrev24[ 4][ 0] =  59.93; aaMtrev24[ 4][ 1] = 103.33; aaMtrev24[ 4][ 2] =  58.94; aaMtrev24[ 4][ 3] =   1.90; aaMtrev24[ 4][ 4] =   0.00;
+    aaMtrev24[ 4][ 5] =  75.24; aaMtrev24[ 4][ 6] =   1.90; aaMtrev24[ 4][ 7] =  30.71; aaMtrev24[ 4][ 8] = 141.49; aaMtrev24[ 4][ 9] =  62.73;
+    aaMtrev24[ 4][10] =  25.65; aaMtrev24[ 4][11] =   1.90; aaMtrev24[ 4][12] =   6.18; aaMtrev24[ 4][13] =  70.80; aaMtrev24[ 4][14] =  31.26;
+    aaMtrev24[ 4][15] = 277.05; aaMtrev24[ 4][16] = 179.97; aaMtrev24[ 4][17] =  33.60; aaMtrev24[ 4][18] = 254.77; aaMtrev24[ 4][19] =   1.90;
+    aaMtrev24[ 5][ 0] =   1.90; aaMtrev24[ 5][ 1] = 220.99; aaMtrev24[ 5][ 2] = 173.56; aaMtrev24[ 5][ 3] =  55.28; aaMtrev24[ 5][ 4] =  75.24;
+    aaMtrev24[ 5][ 5] =   0.00; aaMtrev24[ 5][ 6] = 313.56; aaMtrev24[ 5][ 7] =   6.75; aaMtrev24[ 5][ 8] = 582.40; aaMtrev24[ 5][ 9] =   8.34;
+    aaMtrev24[ 5][10] =  39.70; aaMtrev24[ 5][11] = 465.58; aaMtrev24[ 5][12] =  47.37; aaMtrev24[ 5][13] =  19.11; aaMtrev24[ 5][14] = 137.29;
+    aaMtrev24[ 5][15] =  54.11; aaMtrev24[ 5][16] =  94.93; aaMtrev24[ 5][17] =   1.90; aaMtrev24[ 5][18] =  38.82; aaMtrev24[ 5][19] =  19.00;
+    aaMtrev24[ 6][ 0] =   9.77; aaMtrev24[ 6][ 1] =   1.90; aaMtrev24[ 6][ 2] =  63.05; aaMtrev24[ 6][ 3] = 583.55; aaMtrev24[ 6][ 4] =   1.90;
+    aaMtrev24[ 6][ 5] = 313.56; aaMtrev24[ 6][ 6] =   0.00; aaMtrev24[ 6][ 7] =  28.28; aaMtrev24[ 6][ 8] =  49.12; aaMtrev24[ 6][ 9] =   3.31;
+    aaMtrev24[ 6][10] =   1.90; aaMtrev24[ 6][11] = 313.86; aaMtrev24[ 6][12] =   1.90; aaMtrev24[ 6][13] =   2.67; aaMtrev24[ 6][14] =  12.83;
+    aaMtrev24[ 6][15] =  54.71; aaMtrev24[ 6][16] =  14.82; aaMtrev24[ 6][17] =   1.90; aaMtrev24[ 6][18] =  13.12; aaMtrev24[ 6][19] =  21.14;
+    aaMtrev24[ 7][ 0] = 120.71; aaMtrev24[ 7][ 1] =  23.03; aaMtrev24[ 7][ 2] =  53.30; aaMtrev24[ 7][ 3] =  56.77; aaMtrev24[ 7][ 4] =  30.71;
+    aaMtrev24[ 7][ 5] =   6.75; aaMtrev24[ 7][ 6] =  28.28; aaMtrev24[ 7][ 7] =   0.00; aaMtrev24[ 7][ 8] =   1.90; aaMtrev24[ 7][ 9] =   5.98;
+    aaMtrev24[ 7][10] =   2.41; aaMtrev24[ 7][11] =  22.73; aaMtrev24[ 7][12] =   1.90; aaMtrev24[ 7][13] =   1.90; aaMtrev24[ 7][14] =   1.90;
+    aaMtrev24[ 7][15] = 125.93; aaMtrev24[ 7][16] =  11.17; aaMtrev24[ 7][17] =  10.92; aaMtrev24[ 7][18] =   3.21; aaMtrev24[ 7][19] =   2.53;
+    aaMtrev24[ 8][ 0] =  13.90; aaMtrev24[ 8][ 1] = 165.23; aaMtrev24[ 8][ 2] = 496.13; aaMtrev24[ 8][ 3] = 113.99; aaMtrev24[ 8][ 4] = 141.49;
+    aaMtrev24[ 8][ 5] = 582.40; aaMtrev24[ 8][ 6] =  49.12; aaMtrev24[ 8][ 7] =   1.90; aaMtrev24[ 8][ 8] =   0.00; aaMtrev24[ 8][ 9] =  12.26;
+    aaMtrev24[ 8][10] =  11.49; aaMtrev24[ 8][11] = 127.67; aaMtrev24[ 8][12] =  11.97; aaMtrev24[ 8][13] =  48.16; aaMtrev24[ 8][14] =  60.97;
+    aaMtrev24[ 8][15] =  77.46; aaMtrev24[ 8][16] =  44.78; aaMtrev24[ 8][17] =   7.08; aaMtrev24[ 8][18] = 670.14; aaMtrev24[ 8][19] =   1.90;
+    aaMtrev24[ 9][ 0] =  96.49; aaMtrev24[ 9][ 1] =   1.90; aaMtrev24[ 9][ 2] =  27.10; aaMtrev24[ 9][ 3] =   4.34; aaMtrev24[ 9][ 4] =  62.73;
+    aaMtrev24[ 9][ 5] =   8.34; aaMtrev24[ 9][ 6] =   3.31; aaMtrev24[ 9][ 7] =   5.98; aaMtrev24[ 9][ 8] =  12.26; aaMtrev24[ 9][ 9] =   0.00;
+    aaMtrev24[ 9][10] = 329.09; aaMtrev24[ 9][11] =  19.57; aaMtrev24[ 9][12] = 517.98; aaMtrev24[ 9][13] =  84.67; aaMtrev24[ 9][14] =  20.63;
+    aaMtrev24[ 9][15] =  47.70; aaMtrev24[ 9][16] = 368.43; aaMtrev24[ 9][17] =   1.90; aaMtrev24[ 9][18] =  25.01; aaMtrev24[ 9][19] =1222.94;
+    aaMtrev24[10][ 0] =  25.46; aaMtrev24[10][ 1] =  15.58; aaMtrev24[10][ 2] =  15.16; aaMtrev24[10][ 3] =   1.90; aaMtrev24[10][ 4] =  25.65;
+    aaMtrev24[10][ 5] =  39.70; aaMtrev24[10][ 6] =   1.90; aaMtrev24[10][ 7] =   2.41; aaMtrev24[10][ 8] =  11.49; aaMtrev24[10][ 9] = 329.09;
+    aaMtrev24[10][10] =   0.00; aaMtrev24[10][11] =  14.88; aaMtrev24[10][12] = 537.53; aaMtrev24[10][13] = 216.06; aaMtrev24[10][14] =  40.10;
+    aaMtrev24[10][15] =  73.61; aaMtrev24[10][16] = 126.40; aaMtrev24[10][17] =  32.44; aaMtrev24[10][18] =  44.15; aaMtrev24[10][19] =  91.67;
+    aaMtrev24[11][ 0] =   8.36; aaMtrev24[11][ 1] = 141.40; aaMtrev24[11][ 2] = 608.70; aaMtrev24[11][ 3] =   2.31; aaMtrev24[11][ 4] =   1.90;
+    aaMtrev24[11][ 5] = 465.58; aaMtrev24[11][ 6] = 313.86; aaMtrev24[11][ 7] =  22.73; aaMtrev24[11][ 8] = 127.67; aaMtrev24[11][ 9] =  19.57;
+    aaMtrev24[11][10] =  14.88; aaMtrev24[11][11] =   0.00; aaMtrev24[11][12] =  91.37; aaMtrev24[11][13] =   6.44; aaMtrev24[11][14] =  50.10;
+    aaMtrev24[11][15] = 105.79; aaMtrev24[11][16] = 136.33; aaMtrev24[11][17] =  24.00; aaMtrev24[11][18] =  51.17; aaMtrev24[11][19] =   1.90;
+    aaMtrev24[12][ 0] = 141.88; aaMtrev24[12][ 1] =   1.90; aaMtrev24[12][ 2] =  65.41; aaMtrev24[12][ 3] =   1.90; aaMtrev24[12][ 4] =   6.18;
+    aaMtrev24[12][ 5] =  47.37; aaMtrev24[12][ 6] =   1.90; aaMtrev24[12][ 7] =   1.90; aaMtrev24[12][ 8] =  11.97; aaMtrev24[12][ 9] = 517.98;
+    aaMtrev24[12][10] = 537.53; aaMtrev24[12][11] =  91.37; aaMtrev24[12][12] =   0.00; aaMtrev24[12][13] =  90.82; aaMtrev24[12][14] =  18.84;
+    aaMtrev24[12][15] = 111.16; aaMtrev24[12][16] = 528.17; aaMtrev24[12][17] =  21.71; aaMtrev24[12][18] =  39.96; aaMtrev24[12][19] = 387.54;
+    aaMtrev24[13][ 0] =   6.37; aaMtrev24[13][ 1] =   4.69; aaMtrev24[13][ 2] =  15.20; aaMtrev24[13][ 3] =   4.98; aaMtrev24[13][ 4] =  70.80;
+    aaMtrev24[13][ 5] =  19.11; aaMtrev24[13][ 6] =   2.67; aaMtrev24[13][ 7] =   1.90; aaMtrev24[13][ 8] =  48.16; aaMtrev24[13][ 9] =  84.67;
+    aaMtrev24[13][10] = 216.06; aaMtrev24[13][11] =   6.44; aaMtrev24[13][12] =  90.82; aaMtrev24[13][13] =   0.00; aaMtrev24[13][14] =  17.31;
+    aaMtrev24[13][15] =  64.29; aaMtrev24[13][16] =  33.85; aaMtrev24[13][17] =   7.84; aaMtrev24[13][18] = 465.58; aaMtrev24[13][19] =   6.35;
+    aaMtrev24[14][ 0] =  54.31; aaMtrev24[14][ 1] =  23.64; aaMtrev24[14][ 2] =  73.31; aaMtrev24[14][ 3] =  13.43; aaMtrev24[14][ 4] =  31.26;
+    aaMtrev24[14][ 5] = 137.29; aaMtrev24[14][ 6] =  12.83; aaMtrev24[14][ 7] =   1.90; aaMtrev24[14][ 8] =  60.97; aaMtrev24[14][ 9] =  20.63;
+    aaMtrev24[14][10] =  40.10; aaMtrev24[14][11] =  50.10; aaMtrev24[14][12] =  18.84; aaMtrev24[14][13] =  17.31; aaMtrev24[14][14] =   0.00;
+    aaMtrev24[14][15] = 169.90; aaMtrev24[14][16] = 128.22; aaMtrev24[14][17] =   4.21; aaMtrev24[14][18] =  16.21; aaMtrev24[14][19] =   8.23;
+    aaMtrev24[15][ 0] = 387.86; aaMtrev24[15][ 1] =   6.04; aaMtrev24[15][ 2] = 494.39; aaMtrev24[15][ 3] =  69.02; aaMtrev24[15][ 4] = 277.05;
+    aaMtrev24[15][ 5] =  54.11; aaMtrev24[15][ 6] =  54.71; aaMtrev24[15][ 7] = 125.93; aaMtrev24[15][ 8] =  77.46; aaMtrev24[15][ 9] =  47.70;
+    aaMtrev24[15][10] =  73.61; aaMtrev24[15][11] = 105.79; aaMtrev24[15][12] = 111.16; aaMtrev24[15][13] =  64.29; aaMtrev24[15][14] = 169.90;
+    aaMtrev24[15][15] =   0.00; aaMtrev24[15][16] = 597.21; aaMtrev24[15][17] =  38.58; aaMtrev24[15][18] =  64.92; aaMtrev24[15][19] =   1.90;
+    aaMtrev24[16][ 0] = 480.72; aaMtrev24[16][ 1] =   2.08; aaMtrev24[16][ 2] = 238.46; aaMtrev24[16][ 3] =  28.01; aaMtrev24[16][ 4] = 179.97;
+    aaMtrev24[16][ 5] =  94.93; aaMtrev24[16][ 6] =  14.82; aaMtrev24[16][ 7] =  11.17; aaMtrev24[16][ 8] =  44.78; aaMtrev24[16][ 9] = 368.43;
+    aaMtrev24[16][10] = 126.40; aaMtrev24[16][11] = 136.33; aaMtrev24[16][12] = 528.17; aaMtrev24[16][13] =  33.85; aaMtrev24[16][14] = 128.22;
+    aaMtrev24[16][15] = 597.21; aaMtrev24[16][16] =   0.00; aaMtrev24[16][17] =   9.99; aaMtrev24[16][18] =  38.73; aaMtrev24[16][19] = 204.54;
+    aaMtrev24[17][ 0] =   1.90; aaMtrev24[17][ 1] =  21.95; aaMtrev24[17][ 2] =  10.68; aaMtrev24[17][ 3] =  19.86; aaMtrev24[17][ 4] =  33.60;
+    aaMtrev24[17][ 5] =   1.90; aaMtrev24[17][ 6] =   1.90; aaMtrev24[17][ 7] =  10.92; aaMtrev24[17][ 8] =   7.08; aaMtrev24[17][ 9] =   1.90;
+    aaMtrev24[17][10] =  32.44; aaMtrev24[17][11] =  24.00; aaMtrev24[17][12] =  21.71; aaMtrev24[17][13] =   7.84; aaMtrev24[17][14] =   4.21;
+    aaMtrev24[17][15] =  38.58; aaMtrev24[17][16] =   9.99; aaMtrev24[17][17] =   0.00; aaMtrev24[17][18] =  26.25; aaMtrev24[17][19] =   5.37;
+    aaMtrev24[18][ 0] =   6.48; aaMtrev24[18][ 1] =   1.90; aaMtrev24[18][ 2] = 191.36; aaMtrev24[18][ 3] =  21.21; aaMtrev24[18][ 4] = 254.77;
+    aaMtrev24[18][ 5] =  38.82; aaMtrev24[18][ 6] =  13.12; aaMtrev24[18][ 7] =   3.21; aaMtrev24[18][ 8] = 670.14; aaMtrev24[18][ 9] =  25.01;
+    aaMtrev24[18][10] =  44.15; aaMtrev24[18][11] =  51.17; aaMtrev24[18][12] =  39.96; aaMtrev24[18][13] = 465.58; aaMtrev24[18][14] =  16.21;
+    aaMtrev24[18][15] =  64.92; aaMtrev24[18][16] =  38.73; aaMtrev24[18][17] =  26.25; aaMtrev24[18][18] =   0.00; aaMtrev24[18][19] =   1.90;
+    aaMtrev24[19][ 0] = 195.06; aaMtrev24[19][ 1] =   7.64; aaMtrev24[19][ 2] =   1.90; aaMtrev24[19][ 3] =   1.90; aaMtrev24[19][ 4] =   1.90;
+    aaMtrev24[19][ 5] =  19.00; aaMtrev24[19][ 6] =  21.14; aaMtrev24[19][ 7] =   2.53; aaMtrev24[19][ 8] =   1.90; aaMtrev24[19][ 9] =1222.94;
+    aaMtrev24[19][10] =  91.67; aaMtrev24[19][11] =   1.90; aaMtrev24[19][12] = 387.54; aaMtrev24[19][13] =   6.35; aaMtrev24[19][14] =   8.23;
+    aaMtrev24[19][15] =   1.90; aaMtrev24[19][16] = 204.54; aaMtrev24[19][17] =   5.37; aaMtrev24[19][18] =   1.90; aaMtrev24[19][19] =   0.00;
+
+    mtrev24Pi[ 0] = 0.072;
+    mtrev24Pi[ 1] = 0.019;
+    mtrev24Pi[ 2] = 0.039;
+    mtrev24Pi[ 3] = 0.019;
+    mtrev24Pi[ 4] = 0.006;
+    mtrev24Pi[ 5] = 0.025;
+    mtrev24Pi[ 6] = 0.024;
+    mtrev24Pi[ 7] = 0.056;
+    mtrev24Pi[ 8] = 0.028;
+    mtrev24Pi[ 9] = 0.088;
+    mtrev24Pi[10] = 0.168;
+    mtrev24Pi[11] = 0.023;
+    mtrev24Pi[12] = 0.054;
+    mtrev24Pi[13] = 0.061;
+    mtrev24Pi[14] = 0.054;
+    mtrev24Pi[15] = 0.072;
+    mtrev24Pi[16] = 0.086;
+    mtrev24Pi[17] = 0.029;
+    mtrev24Pi[18] = 0.033;
+    mtrev24Pi[19] = 0.043;
+    
+    /* mtmam */
+    aaMtmam[ 0][ 0] =   0; aaMtmam[ 0][ 1] =  32; aaMtmam[ 0][ 2] =   2; aaMtmam[ 0][ 3] =  11; aaMtmam[ 0][ 4] =   0;
+    aaMtmam[ 0][ 5] =   0; aaMtmam[ 0][ 6] =   0; aaMtmam[ 0][ 7] =  78; aaMtmam[ 0][ 8] =   8; aaMtmam[ 0][ 9] =  75;
+    aaMtmam[ 0][10] =  21; aaMtmam[ 0][11] =   0; aaMtmam[ 0][12] =  76; aaMtmam[ 0][13] =   0; aaMtmam[ 0][14] =  53;
+    aaMtmam[ 0][15] = 342; aaMtmam[ 0][16] = 681; aaMtmam[ 0][17] =   5; aaMtmam[ 0][18] =   0; aaMtmam[ 0][19] = 398;
+    aaMtmam[ 1][ 0] =  32; aaMtmam[ 1][ 1] =   0; aaMtmam[ 1][ 2] =   4; aaMtmam[ 1][ 3] =   0; aaMtmam[ 1][ 4] = 186;
+    aaMtmam[ 1][ 5] = 246; aaMtmam[ 1][ 6] =   0; aaMtmam[ 1][ 7] =  18; aaMtmam[ 1][ 8] = 232; aaMtmam[ 1][ 9] =   0;
+    aaMtmam[ 1][10] =   6; aaMtmam[ 1][11] =  50; aaMtmam[ 1][12] =   0; aaMtmam[ 1][13] =   0; aaMtmam[ 1][14] =   9;
+    aaMtmam[ 1][15] =   3; aaMtmam[ 1][16] =   0; aaMtmam[ 1][17] =  16; aaMtmam[ 1][18] =   0; aaMtmam[ 1][19] =   0;
+    aaMtmam[ 2][ 0] =   2; aaMtmam[ 2][ 1] =   4; aaMtmam[ 2][ 2] =   0; aaMtmam[ 2][ 3] = 864; aaMtmam[ 2][ 4] =   0;
+    aaMtmam[ 2][ 5] =   8; aaMtmam[ 2][ 6] =   0; aaMtmam[ 2][ 7] =  47; aaMtmam[ 2][ 8] = 458; aaMtmam[ 2][ 9] =  19;
+    aaMtmam[ 2][10] =   0; aaMtmam[ 2][11] = 408; aaMtmam[ 2][12] =  21; aaMtmam[ 2][13] =   6; aaMtmam[ 2][14] =  33;
+    aaMtmam[ 2][15] = 446; aaMtmam[ 2][16] = 110; aaMtmam[ 2][17] =   6; aaMtmam[ 2][18] = 156; aaMtmam[ 2][19] =   0;
+    aaMtmam[ 3][ 0] =  11; aaMtmam[ 3][ 1] =   0; aaMtmam[ 3][ 2] = 864; aaMtmam[ 3][ 3] =   0; aaMtmam[ 3][ 4] =   0;
+    aaMtmam[ 3][ 5] =  49; aaMtmam[ 3][ 6] = 569; aaMtmam[ 3][ 7] =  79; aaMtmam[ 3][ 8] =  11; aaMtmam[ 3][ 9] =   0;
+    aaMtmam[ 3][10] =   0; aaMtmam[ 3][11] =   0; aaMtmam[ 3][12] =   0; aaMtmam[ 3][13] =   5; aaMtmam[ 3][14] =   2;
+    aaMtmam[ 3][15] =  16; aaMtmam[ 3][16] =   0; aaMtmam[ 3][17] =   0; aaMtmam[ 3][18] =   0; aaMtmam[ 3][19] =  10;
+    aaMtmam[ 4][ 0] =   0; aaMtmam[ 4][ 1] = 186; aaMtmam[ 4][ 2] =   0; aaMtmam[ 4][ 3] =   0; aaMtmam[ 4][ 4] =   0;
+    aaMtmam[ 4][ 5] =   0; aaMtmam[ 4][ 6] =   0; aaMtmam[ 4][ 7] =   0; aaMtmam[ 4][ 8] = 305; aaMtmam[ 4][ 9] =  41;
+    aaMtmam[ 4][10] =  27; aaMtmam[ 4][11] =   0; aaMtmam[ 4][12] =   0; aaMtmam[ 4][13] =   7; aaMtmam[ 4][14] =   0;
+    aaMtmam[ 4][15] = 347; aaMtmam[ 4][16] = 114; aaMtmam[ 4][17] =  65; aaMtmam[ 4][18] = 530; aaMtmam[ 4][19] =   0;
+    aaMtmam[ 5][ 0] =   0; aaMtmam[ 5][ 1] = 246; aaMtmam[ 5][ 2] =   8; aaMtmam[ 5][ 3] =  49; aaMtmam[ 5][ 4] =   0;
+    aaMtmam[ 5][ 5] =   0; aaMtmam[ 5][ 6] = 274; aaMtmam[ 5][ 7] =   0; aaMtmam[ 5][ 8] = 550; aaMtmam[ 5][ 9] =   0;
+    aaMtmam[ 5][10] =  20; aaMtmam[ 5][11] = 242; aaMtmam[ 5][12] =  22; aaMtmam[ 5][13] =   0; aaMtmam[ 5][14] =  51;
+    aaMtmam[ 5][15] =  30; aaMtmam[ 5][16] =   0; aaMtmam[ 5][17] =   0; aaMtmam[ 5][18] =  54; aaMtmam[ 5][19] =  33;
+    aaMtmam[ 6][ 0] =   0; aaMtmam[ 6][ 1] =   0; aaMtmam[ 6][ 2] =   0; aaMtmam[ 6][ 3] = 569; aaMtmam[ 6][ 4] =   0;
+    aaMtmam[ 6][ 5] = 274; aaMtmam[ 6][ 6] =   0; aaMtmam[ 6][ 7] =  22; aaMtmam[ 6][ 8] =  22; aaMtmam[ 6][ 9] =   0;
+    aaMtmam[ 6][10] =   0; aaMtmam[ 6][11] = 215; aaMtmam[ 6][12] =   0; aaMtmam[ 6][13] =   0; aaMtmam[ 6][14] =   0;
+    aaMtmam[ 6][15] =  21; aaMtmam[ 6][16] =   4; aaMtmam[ 6][17] =   0; aaMtmam[ 6][18] =   0; aaMtmam[ 6][19] =  20;
+    aaMtmam[ 7][ 0] =  78; aaMtmam[ 7][ 1] =  18; aaMtmam[ 7][ 2] =  47; aaMtmam[ 7][ 3] =  79; aaMtmam[ 7][ 4] =   0;
+    aaMtmam[ 7][ 5] =   0; aaMtmam[ 7][ 6] =  22; aaMtmam[ 7][ 7] =   0; aaMtmam[ 7][ 8] =   0; aaMtmam[ 7][ 9] =   0;
+    aaMtmam[ 7][10] =   0; aaMtmam[ 7][11] =   0; aaMtmam[ 7][12] =   0; aaMtmam[ 7][13] =   0; aaMtmam[ 7][14] =   0;
+    aaMtmam[ 7][15] = 112; aaMtmam[ 7][16] =   0; aaMtmam[ 7][17] =   0; aaMtmam[ 7][18] =   1; aaMtmam[ 7][19] =   5;
+    aaMtmam[ 8][ 0] =   8; aaMtmam[ 8][ 1] = 232; aaMtmam[ 8][ 2] = 458; aaMtmam[ 8][ 3] =  11; aaMtmam[ 8][ 4] = 305;
+    aaMtmam[ 8][ 5] = 550; aaMtmam[ 8][ 6] =  22; aaMtmam[ 8][ 7] =   0; aaMtmam[ 8][ 8] =   0; aaMtmam[ 8][ 9] =   0;
+    aaMtmam[ 8][10] =  26; aaMtmam[ 8][11] =   0; aaMtmam[ 8][12] =   0; aaMtmam[ 8][13] =   0; aaMtmam[ 8][14] =  53;
+    aaMtmam[ 8][15] =  20; aaMtmam[ 8][16] =   1; aaMtmam[ 8][17] =   0; aaMtmam[ 8][18] =1525; aaMtmam[ 8][19] =   0;
+    aaMtmam[ 9][ 0] =  75; aaMtmam[ 9][ 1] =   0; aaMtmam[ 9][ 2] =  19; aaMtmam[ 9][ 3] =   0; aaMtmam[ 9][ 4] =  41;
+    aaMtmam[ 9][ 5] =   0; aaMtmam[ 9][ 6] =   0; aaMtmam[ 9][ 7] =   0; aaMtmam[ 9][ 8] =   0; aaMtmam[ 9][ 9] =   0;
+    aaMtmam[ 9][10] = 232; aaMtmam[ 9][11] =   6; aaMtmam[ 9][12] = 378; aaMtmam[ 9][13] =  57; aaMtmam[ 9][14] =   5;
+    aaMtmam[ 9][15] =   0; aaMtmam[ 9][16] = 360; aaMtmam[ 9][17] =   0; aaMtmam[ 9][18] =  16; aaMtmam[ 9][19] =2220;
+    aaMtmam[10][ 0] =  21; aaMtmam[10][ 1] =   6; aaMtmam[10][ 2] =   0; aaMtmam[10][ 3] =   0; aaMtmam[10][ 4] =  27;
+    aaMtmam[10][ 5] =  20; aaMtmam[10][ 6] =   0; aaMtmam[10][ 7] =   0; aaMtmam[10][ 8] =  26; aaMtmam[10][ 9] = 232;
+    aaMtmam[10][10] =   0; aaMtmam[10][11] =   4; aaMtmam[10][12] = 609; aaMtmam[10][13] = 246; aaMtmam[10][14] =  43;
+    aaMtmam[10][15] =  74; aaMtmam[10][16] =  34; aaMtmam[10][17] =  12; aaMtmam[10][18] =  25; aaMtmam[10][19] = 100;
+    aaMtmam[11][ 0] =   0; aaMtmam[11][ 1] =  50; aaMtmam[11][ 2] = 408; aaMtmam[11][ 3] =   0; aaMtmam[11][ 4] =   0;
+    aaMtmam[11][ 5] = 242; aaMtmam[11][ 6] = 215; aaMtmam[11][ 7] =   0; aaMtmam[11][ 8] =   0; aaMtmam[11][ 9] =   6;
+    aaMtmam[11][10] =   4; aaMtmam[11][11] =   0; aaMtmam[11][12] =  59; aaMtmam[11][13] =   0; aaMtmam[11][14] =  18;
+    aaMtmam[11][15] =  65; aaMtmam[11][16] =  50; aaMtmam[11][17] =   0; aaMtmam[11][18] =  67; aaMtmam[11][19] =   0;
+    aaMtmam[12][ 0] =  76; aaMtmam[12][ 1] =   0; aaMtmam[12][ 2] =  21; aaMtmam[12][ 3] =   0; aaMtmam[12][ 4] =   0;
+    aaMtmam[12][ 5] =  22; aaMtmam[12][ 6] =   0; aaMtmam[12][ 7] =   0; aaMtmam[12][ 8] =   0; aaMtmam[12][ 9] = 378;
+    aaMtmam[12][10] = 609; aaMtmam[12][11] =  59; aaMtmam[12][12] =   0; aaMtmam[12][13] =  11; aaMtmam[12][14] =   0;
+    aaMtmam[12][15] =  47; aaMtmam[12][16] = 691; aaMtmam[12][17] =  13; aaMtmam[12][18] =   0; aaMtmam[12][19] = 832;
+    aaMtmam[13][ 0] =   0; aaMtmam[13][ 1] =   0; aaMtmam[13][ 2] =   6; aaMtmam[13][ 3] =   5; aaMtmam[13][ 4] =   7;
+    aaMtmam[13][ 5] =   0; aaMtmam[13][ 6] =   0; aaMtmam[13][ 7] =   0; aaMtmam[13][ 8] =   0; aaMtmam[13][ 9] =  57;
+    aaMtmam[13][10] = 246; aaMtmam[13][11] =   0; aaMtmam[13][12] =  11; aaMtmam[13][13] =   0; aaMtmam[13][14] =  17;
+    aaMtmam[13][15] =  90; aaMtmam[13][16] =   8; aaMtmam[13][17] =   0; aaMtmam[13][18] = 682; aaMtmam[13][19] =   6;
+    aaMtmam[14][ 0] =  53; aaMtmam[14][ 1] =   9; aaMtmam[14][ 2] =  33; aaMtmam[14][ 3] =   2; aaMtmam[14][ 4] =   0;
+    aaMtmam[14][ 5] =  51; aaMtmam[14][ 6] =   0; aaMtmam[14][ 7] =   0; aaMtmam[14][ 8] =  53; aaMtmam[14][ 9] =   5;
+    aaMtmam[14][10] =  43; aaMtmam[14][11] =  18; aaMtmam[14][12] =   0; aaMtmam[14][13] =  17; aaMtmam[14][14] =   0;
+    aaMtmam[14][15] = 202; aaMtmam[14][16] =  78; aaMtmam[14][17] =   7; aaMtmam[14][18] =   8; aaMtmam[14][19] =   0;
+    aaMtmam[15][ 0] = 342; aaMtmam[15][ 1] =   3; aaMtmam[15][ 2] = 446; aaMtmam[15][ 3] =  16; aaMtmam[15][ 4] = 347;
+    aaMtmam[15][ 5] =  30; aaMtmam[15][ 6] =  21; aaMtmam[15][ 7] = 112; aaMtmam[15][ 8] =  20; aaMtmam[15][ 9] =   0;
+    aaMtmam[15][10] =  74; aaMtmam[15][11] =  65; aaMtmam[15][12] =  47; aaMtmam[15][13] =  90; aaMtmam[15][14] = 202;
+    aaMtmam[15][15] =   0; aaMtmam[15][16] = 614; aaMtmam[15][17] =  17; aaMtmam[15][18] = 107; aaMtmam[15][19] =   0;
+    aaMtmam[16][ 0] = 681; aaMtmam[16][ 1] =   0; aaMtmam[16][ 2] = 110; aaMtmam[16][ 3] =   0; aaMtmam[16][ 4] = 114;
+    aaMtmam[16][ 5] =   0; aaMtmam[16][ 6] =   4; aaMtmam[16][ 7] =   0; aaMtmam[16][ 8] =   1; aaMtmam[16][ 9] = 360;
+    aaMtmam[16][10] =  34; aaMtmam[16][11] =  50; aaMtmam[16][12] = 691; aaMtmam[16][13] =   8; aaMtmam[16][14] =  78;
+    aaMtmam[16][15] = 614; aaMtmam[16][16] =   0; aaMtmam[16][17] =   0; aaMtmam[16][18] =   0; aaMtmam[16][19] = 237;
+    aaMtmam[17][ 0] =   5; aaMtmam[17][ 1] =  16; aaMtmam[17][ 2] =   6; aaMtmam[17][ 3] =   0; aaMtmam[17][ 4] =  65;
+    aaMtmam[17][ 5] =   0; aaMtmam[17][ 6] =   0; aaMtmam[17][ 7] =   0; aaMtmam[17][ 8] =   0; aaMtmam[17][ 9] =   0;
+    aaMtmam[17][10] =  12; aaMtmam[17][11] =   0; aaMtmam[17][12] =  13; aaMtmam[17][13] =   0; aaMtmam[17][14] =   7;
+    aaMtmam[17][15] =  17; aaMtmam[17][16] =   0; aaMtmam[17][17] =   0; aaMtmam[17][18] =  14; aaMtmam[17][19] =   0;
+    aaMtmam[18][ 0] =   0; aaMtmam[18][ 1] =   0; aaMtmam[18][ 2] = 156; aaMtmam[18][ 3] =   0; aaMtmam[18][ 4] = 530;
+    aaMtmam[18][ 5] =  54; aaMtmam[18][ 6] =   0; aaMtmam[18][ 7] =   1; aaMtmam[18][ 8] =1525; aaMtmam[18][ 9] =  16;
+    aaMtmam[18][10] =  25; aaMtmam[18][11] =  67; aaMtmam[18][12] =   0; aaMtmam[18][13] = 682; aaMtmam[18][14] =   8;
+    aaMtmam[18][15] = 107; aaMtmam[18][16] =   0; aaMtmam[18][17] =  14; aaMtmam[18][18] =   0; aaMtmam[18][19] =   0;
+    aaMtmam[19][ 0] = 398; aaMtmam[19][ 1] =   0; aaMtmam[19][ 2] =   0; aaMtmam[19][ 3] =  10; aaMtmam[19][ 4] =   0;
+    aaMtmam[19][ 5] =  33; aaMtmam[19][ 6] =  20; aaMtmam[19][ 7] =   5; aaMtmam[19][ 8] =   0; aaMtmam[19][ 9] =2220;
+    aaMtmam[19][10] = 100; aaMtmam[19][11] =   0; aaMtmam[19][12] = 832; aaMtmam[19][13] =   6; aaMtmam[19][14] =   0;
+    aaMtmam[19][15] =   0; aaMtmam[19][16] = 237; aaMtmam[19][17] =   0; aaMtmam[19][18] =   0; aaMtmam[19][19] =   0;
+
+    mtmamPi[ 0] = 0.0692;
+    mtmamPi[ 1] = 0.0184;
+    mtmamPi[ 2] = 0.0400;
+    mtmamPi[ 3] = 0.0186;
+    mtmamPi[ 4] = 0.0065;
+    mtmamPi[ 5] = 0.0238;
+    mtmamPi[ 6] = 0.0236;
+    mtmamPi[ 7] = 0.0557;
+    mtmamPi[ 8] = 0.0277;
+    mtmamPi[ 9] = 0.0905;
+    mtmamPi[10] = 0.1675;
+    mtmamPi[11] = 0.0221;
+    mtmamPi[12] = 0.0561;
+    mtmamPi[13] = 0.0611;
+    mtmamPi[14] = 0.0536;
+    mtmamPi[15] = 0.0725;
+    mtmamPi[16] = 0.0870;
+    mtmamPi[17] = 0.0293;
+    mtmamPi[18] = 0.0340;
+    mtmamPi[19] = 0.0428;
+    
+    /* rtRev */
+    aartREV[ 0][ 0] =   0; aartREV[ 1][ 0] =  34; aartREV[ 2][ 0] =  51; aartREV[ 3][ 0] =  10; aartREV[ 4][ 0] = 439;
+    aartREV[ 5][ 0] =  32; aartREV[ 6][ 0] =  81; aartREV[ 7][ 0] = 135; aartREV[ 8][ 0] =  30; aartREV[ 9][ 0] =   1;
+    aartREV[10][ 0] =  45; aartREV[11][ 0] =  38; aartREV[12][ 0] = 235; aartREV[13][ 0] =   1; aartREV[14][ 0] =  97;
+    aartREV[15][ 0] = 460; aartREV[16][ 0] = 258; aartREV[17][ 0] =   5; aartREV[18][ 0] =  55; aartREV[19][ 0] = 197;
+    aartREV[ 0][ 1] =  34; aartREV[ 1][ 1] =   0; aartREV[ 2][ 1] =  35; aartREV[ 3][ 1] =  30; aartREV[ 4][ 1] =  92;
+    aartREV[ 5][ 1] = 221; aartREV[ 6][ 1] =  10; aartREV[ 7][ 1] =  41; aartREV[ 8][ 1] =  90; aartREV[ 9][ 1] =  24;
+    aartREV[10][ 1] =  18; aartREV[11][ 1] = 593; aartREV[12][ 1] =  57; aartREV[13][ 1] =   7; aartREV[14][ 1] =  24;
+    aartREV[15][ 1] = 102; aartREV[16][ 1] =  64; aartREV[17][ 1] =  13; aartREV[18][ 1] =  47; aartREV[19][ 1] =  29;
+    aartREV[ 0][ 2] =  51; aartREV[ 1][ 2] =  35; aartREV[ 2][ 2] =   0; aartREV[ 3][ 2] = 384; aartREV[ 4][ 2] = 128;
+    aartREV[ 5][ 2] = 236; aartREV[ 6][ 2] =  79; aartREV[ 7][ 2] =  94; aartREV[ 8][ 2] = 320; aartREV[ 9][ 2] =  35;
+    aartREV[10][ 2] =  15; aartREV[11][ 2] = 123; aartREV[12][ 2] =   1; aartREV[13][ 2] =  49; aartREV[14][ 2] =  33;
+    aartREV[15][ 2] = 294; aartREV[16][ 2] = 148; aartREV[17][ 2] =  16; aartREV[18][ 2] =  28; aartREV[19][ 2] =  21;
+    aartREV[ 0][ 3] =  10; aartREV[ 1][ 3] =  30; aartREV[ 2][ 3] = 384; aartREV[ 3][ 3] =   0; aartREV[ 4][ 3] =   1;
+    aartREV[ 5][ 3] =  78; aartREV[ 6][ 3] = 542; aartREV[ 7][ 3] =  61; aartREV[ 8][ 3] =  91; aartREV[ 9][ 3] =   1;
+    aartREV[10][ 3] =   5; aartREV[11][ 3] =  20; aartREV[12][ 3] =   1; aartREV[13][ 3] =   1; aartREV[14][ 3] =  55;
+    aartREV[15][ 3] = 136; aartREV[16][ 3] =  55; aartREV[17][ 3] =   1; aartREV[18][ 3] =   1; aartREV[19][ 3] =   6;
+    aartREV[ 0][ 4] = 439; aartREV[ 1][ 4] =  92; aartREV[ 2][ 4] = 128; aartREV[ 3][ 4] =   1; aartREV[ 4][ 4] =   0;
+    aartREV[ 5][ 4] =  70; aartREV[ 6][ 4] =   1; aartREV[ 7][ 4] =  48; aartREV[ 8][ 4] = 124; aartREV[ 9][ 4] = 104;
+    aartREV[10][ 4] = 110; aartREV[11][ 4] =  16; aartREV[12][ 4] = 156; aartREV[13][ 4] =  70; aartREV[14][ 4] =   1;
+    aartREV[15][ 4] =  75; aartREV[16][ 4] = 117; aartREV[17][ 4] =  55; aartREV[18][ 4] = 131; aartREV[19][ 4] = 295;
+    aartREV[ 0][ 5] =  32; aartREV[ 1][ 5] = 221; aartREV[ 2][ 5] = 236; aartREV[ 3][ 5] =  78; aartREV[ 4][ 5] =  70;
+    aartREV[ 5][ 5] =   0; aartREV[ 6][ 5] = 372; aartREV[ 7][ 5] =  18; aartREV[ 8][ 5] = 387; aartREV[ 9][ 5] =  33;
+    aartREV[10][ 5] =  54; aartREV[11][ 5] = 309; aartREV[12][ 5] = 158; aartREV[13][ 5] =   1; aartREV[14][ 5] =  68;
+    aartREV[15][ 5] = 225; aartREV[16][ 5] = 146; aartREV[17][ 5] =  10; aartREV[18][ 5] =  45; aartREV[19][ 5] =  36;
+    aartREV[ 0][ 6] =  81; aartREV[ 1][ 6] =  10; aartREV[ 2][ 6] =  79; aartREV[ 3][ 6] = 542; aartREV[ 4][ 6] =   1;
+    aartREV[ 5][ 6] = 372; aartREV[ 6][ 6] =   0; aartREV[ 7][ 6] =  70; aartREV[ 8][ 6] =  34; aartREV[ 9][ 6] =   1;
+    aartREV[10][ 6] =  21; aartREV[11][ 6] = 141; aartREV[12][ 6] =   1; aartREV[13][ 6] =   1; aartREV[14][ 6] =  52;
+    aartREV[15][ 6] =  95; aartREV[16][ 6] =  82; aartREV[17][ 6] =  17; aartREV[18][ 6] =   1; aartREV[19][ 6] =  35;
+    aartREV[ 0][ 7] = 135; aartREV[ 1][ 7] =  41; aartREV[ 2][ 7] =  94; aartREV[ 3][ 7] =  61; aartREV[ 4][ 7] =  48;
+    aartREV[ 5][ 7] =  18; aartREV[ 6][ 7] =  70; aartREV[ 7][ 7] =   0; aartREV[ 8][ 7] =  68; aartREV[ 9][ 7] =   1;
+    aartREV[10][ 7] =   3; aartREV[11][ 7] =  30; aartREV[12][ 7] =  37; aartREV[13][ 7] =   7; aartREV[14][ 7] =  17;
+    aartREV[15][ 7] = 152; aartREV[16][ 7] =   7; aartREV[17][ 7] =  23; aartREV[18][ 7] =  21; aartREV[19][ 7] =   3;
+    aartREV[ 0][ 8] =  30; aartREV[ 1][ 8] =  90; aartREV[ 2][ 8] = 320; aartREV[ 3][ 8] =  91; aartREV[ 4][ 8] = 124;
+    aartREV[ 5][ 8] = 387; aartREV[ 6][ 8] =  34; aartREV[ 7][ 8] =  68; aartREV[ 8][ 8] =   0; aartREV[ 9][ 8] =  34;
+    aartREV[10][ 8] =  51; aartREV[11][ 8] =  76; aartREV[12][ 8] = 116; aartREV[13][ 8] = 141; aartREV[14][ 8] =  44;
+    aartREV[15][ 8] = 183; aartREV[16][ 8] =  49; aartREV[17][ 8] =  48; aartREV[18][ 8] = 307; aartREV[19][ 8] =   1;
+    aartREV[ 0][ 9] =   1; aartREV[ 1][ 9] =  24; aartREV[ 2][ 9] =  35; aartREV[ 3][ 9] =   1; aartREV[ 4][ 9] = 104;
+    aartREV[ 5][ 9] =  33; aartREV[ 6][ 9] =   1; aartREV[ 7][ 9] =   1; aartREV[ 8][ 9] =  34; aartREV[ 9][ 9] =   0;
+    aartREV[10][ 9] = 385; aartREV[11][ 9] =  34; aartREV[12][ 9] = 375; aartREV[13][ 9] =  64; aartREV[14][ 9] =  10;
+    aartREV[15][ 9] =   4; aartREV[16][ 9] =  72; aartREV[17][ 9] =  39; aartREV[18][ 9] =  26; aartREV[19][ 9] =1048;
+    aartREV[ 0][10] =  45; aartREV[ 1][10] =  18; aartREV[ 2][10] =  15; aartREV[ 3][10] =   5; aartREV[ 4][10] = 110;
+    aartREV[ 5][10] =  54; aartREV[ 6][10] =  21; aartREV[ 7][10] =   3; aartREV[ 8][10] =  51; aartREV[ 9][10] = 385;
+    aartREV[10][10] =   0; aartREV[11][10] =  23; aartREV[12][10] = 581; aartREV[13][10] = 179; aartREV[14][10] =  22;
+    aartREV[15][10] =  24; aartREV[16][10] =  25; aartREV[17][10] =  47; aartREV[18][10] =  64; aartREV[19][10] = 112;
+    aartREV[ 0][11] =  38; aartREV[ 1][11] = 593; aartREV[ 2][11] = 123; aartREV[ 3][11] =  20; aartREV[ 4][11] =  16;
+    aartREV[ 5][11] = 309; aartREV[ 6][11] = 141; aartREV[ 7][11] =  30; aartREV[ 8][11] =  76; aartREV[ 9][11] =  34;
+    aartREV[10][11] =  23; aartREV[11][11] =   0; aartREV[12][11] = 134; aartREV[13][11] =  14; aartREV[14][11] =  43;
+    aartREV[15][11] =  77; aartREV[16][11] = 110; aartREV[17][11] =   6; aartREV[18][11] =   1; aartREV[19][11] =  19;
+    aartREV[ 0][12] = 235; aartREV[ 1][12] =  57; aartREV[ 2][12] =   1; aartREV[ 3][12] =   1; aartREV[ 4][12] = 156;
+    aartREV[ 5][12] = 158; aartREV[ 6][12] =   1; aartREV[ 7][12] =  37; aartREV[ 8][12] = 116; aartREV[ 9][12] = 375;
+    aartREV[10][12] = 581; aartREV[11][12] = 134; aartREV[12][12] =   0; aartREV[13][12] = 247; aartREV[14][12] =   1;
+    aartREV[15][12] =   1; aartREV[16][12] = 131; aartREV[17][12] = 111; aartREV[18][12] =  74; aartREV[19][12] = 236;
+    aartREV[ 0][13] =   1; aartREV[ 1][13] =   7; aartREV[ 2][13] =  49; aartREV[ 3][13] =   1; aartREV[ 4][13] =  70;
+    aartREV[ 5][13] =   1; aartREV[ 6][13] =   1; aartREV[ 7][13] =   7; aartREV[ 8][13] = 141; aartREV[ 9][13] =  64;
+    aartREV[10][13] = 179; aartREV[11][13] =  14; aartREV[12][13] = 247; aartREV[13][13] =   0; aartREV[14][13] =  11;
+    aartREV[15][13] =  20; aartREV[16][13] =  69; aartREV[17][13] = 182; aartREV[18][13] =1017; aartREV[19][13] =  92;
+    aartREV[ 0][14] =  97; aartREV[ 1][14] =  24; aartREV[ 2][14] =  33; aartREV[ 3][14] =  55; aartREV[ 4][14] =   1;
+    aartREV[ 5][14] =  68; aartREV[ 6][14] =  52; aartREV[ 7][14] =  17; aartREV[ 8][14] =  44; aartREV[ 9][14] =  10;
+    aartREV[10][14] =  22; aartREV[11][14] =  43; aartREV[12][14] =   1; aartREV[13][14] =  11; aartREV[14][14] =   0;
+    aartREV[15][14] = 134; aartREV[16][14] =  62; aartREV[17][14] =   9; aartREV[18][14] =  14; aartREV[19][14] =  25;
+    aartREV[ 0][15] = 460; aartREV[ 1][15] = 102; aartREV[ 2][15] = 294; aartREV[ 3][15] = 136; aartREV[ 4][15] =  75;
+    aartREV[ 5][15] = 225; aartREV[ 6][15] =  95; aartREV[ 7][15] = 152; aartREV[ 8][15] = 183; aartREV[ 9][15] =   4;
+    aartREV[10][15] =  24; aartREV[11][15] =  77; aartREV[12][15] =   1; aartREV[13][15] =  20; aartREV[14][15] = 134;
+    aartREV[15][15] =   0; aartREV[16][15] = 671; aartREV[17][15] =  14; aartREV[18][15] =  31; aartREV[19][15] =  39;
+    aartREV[ 0][16] = 258; aartREV[ 1][16] =  64; aartREV[ 2][16] = 148; aartREV[ 3][16] =  55; aartREV[ 4][16] = 117;
+    aartREV[ 5][16] = 146; aartREV[ 6][16] =  82; aartREV[ 7][16] =   7; aartREV[ 8][16] =  49; aartREV[ 9][16] =  72;
+    aartREV[10][16] =  25; aartREV[11][16] = 110; aartREV[12][16] = 131; aartREV[13][16] =  69; aartREV[14][16] =  62;
+    aartREV[15][16] = 671; aartREV[16][16] =   0; aartREV[17][16] =   1; aartREV[18][16] =  34; aartREV[19][16] = 196;
+    aartREV[ 0][17] =   5; aartREV[ 1][17] =  13; aartREV[ 2][17] =  16; aartREV[ 3][17] =   1; aartREV[ 4][17] =  55;
+    aartREV[ 5][17] =  10; aartREV[ 6][17] =  17; aartREV[ 7][17] =  23; aartREV[ 8][17] =  48; aartREV[ 9][17] =  39;
+    aartREV[10][17] =  47; aartREV[11][17] =   6; aartREV[12][17] = 111; aartREV[13][17] = 182; aartREV[14][17] =   9;
+    aartREV[15][17] =  14; aartREV[16][17] =   1; aartREV[17][17] =   0; aartREV[18][17] = 176; aartREV[19][17] =  26;
+    aartREV[ 0][18] =  55; aartREV[ 1][18] =  47; aartREV[ 2][18] =  28; aartREV[ 3][18] =   1; aartREV[ 4][18] = 131;
+    aartREV[ 5][18] =  45; aartREV[ 6][18] =   1; aartREV[ 7][18] =  21; aartREV[ 8][18] = 307; aartREV[ 9][18] =  26;
+    aartREV[10][18] =  64; aartREV[11][18] =   1; aartREV[12][18] =  74; aartREV[13][18] =1017; aartREV[14][18] =  14;
+    aartREV[15][18] =  31; aartREV[16][18] =  34; aartREV[17][18] = 176; aartREV[18][18] =   0; aartREV[19][18] =  59;
+    aartREV[ 0][19] = 197; aartREV[ 1][19] =  29; aartREV[ 2][19] =  21; aartREV[ 3][19] =   6; aartREV[ 4][19] = 295;
+    aartREV[ 5][19] =  36; aartREV[ 6][19] =  35; aartREV[ 7][19] =   3; aartREV[ 8][19] =   1; aartREV[ 9][19] =1048;
+    aartREV[10][19] = 112; aartREV[11][19] =  19; aartREV[12][19] = 236; aartREV[13][19] =  92; aartREV[14][19] =  25;
+    aartREV[15][19] =  39; aartREV[16][19] = 196; aartREV[17][19] =  26; aartREV[18][19] =  59; aartREV[19][19] =   0;
+    rtrevPi[ 0] = 0.0646;
+    rtrevPi[ 1] = 0.0453;
+    rtrevPi[ 2] = 0.0376;
+    rtrevPi[ 3] = 0.0422;
+    rtrevPi[ 4] = 0.0114;
+    rtrevPi[ 5] = 0.0606;
+    rtrevPi[ 6] = 0.0607;
+    rtrevPi[ 7] = 0.0639;
+    rtrevPi[ 8] = 0.0273;
+    rtrevPi[ 9] = 0.0679;
+    rtrevPi[10] = 0.1018;
+    rtrevPi[11] = 0.0751;
+    rtrevPi[12] = 0.0150;
+    rtrevPi[13] = 0.0287;
+    rtrevPi[14] = 0.0681;
+    rtrevPi[15] = 0.0488;
+    rtrevPi[16] = 0.0622;
+    rtrevPi[17] = 0.0251;
+    rtrevPi[18] = 0.0318;
+    rtrevPi[19] = 0.0619;
+    
+    /* wag */
+    aaWAG[ 0][ 0] = 0.0000000; aaWAG[ 1][ 0] = 0.5515710; aaWAG[ 2][ 0] = 0.5098480; aaWAG[ 3][ 0] = 0.7389980; aaWAG[ 4][ 0] = 1.0270400; 
+    aaWAG[ 5][ 0] = 0.9085980; aaWAG[ 6][ 0] = 1.5828500; aaWAG[ 7][ 0] = 1.4167200; aaWAG[ 8][ 0] = 0.3169540; aaWAG[ 9][ 0] = 0.1933350; 
+    aaWAG[10][ 0] = 0.3979150; aaWAG[11][ 0] = 0.9062650; aaWAG[12][ 0] = 0.8934960; aaWAG[13][ 0] = 0.2104940; aaWAG[14][ 0] = 1.4385500; 
+    aaWAG[15][ 0] = 3.3707900; aaWAG[16][ 0] = 2.1211100; aaWAG[17][ 0] = 0.1131330; aaWAG[18][ 0] = 0.2407350; aaWAG[19][ 0] = 2.0060100;
+    aaWAG[ 0][ 1] = 0.5515710; aaWAG[ 1][ 1] = 0.0000000; aaWAG[ 2][ 1] = 0.6353460; aaWAG[ 3][ 1] = 0.1473040; aaWAG[ 4][ 1] = 0.5281910;  
+    aaWAG[ 5][ 1] = 3.0355000; aaWAG[ 6][ 1] = 0.4391570; aaWAG[ 7][ 1] = 0.5846650; aaWAG[ 8][ 1] = 2.1371500; aaWAG[ 9][ 1] = 0.1869790;  
+    aaWAG[10][ 1] = 0.4976710; aaWAG[11][ 1] = 5.3514200; aaWAG[12][ 1] = 0.6831620; aaWAG[13][ 1] = 0.1027110; aaWAG[14][ 1] = 0.6794890;  
+    aaWAG[15][ 1] = 1.2241900; aaWAG[16][ 1] = 0.5544130; aaWAG[17][ 1] = 1.1639200; aaWAG[18][ 1] = 0.3815330; aaWAG[19][ 1] = 0.2518490;
+    aaWAG[ 0][ 2] = 0.5098480; aaWAG[ 1][ 2] = 0.6353460; aaWAG[ 2][ 2] = 0.0000000; aaWAG[ 3][ 2] = 5.4294200; aaWAG[ 4][ 2] = 0.2652560;  
+    aaWAG[ 5][ 2] = 1.5436400; aaWAG[ 6][ 2] = 0.9471980; aaWAG[ 7][ 2] = 1.1255600; aaWAG[ 8][ 2] = 3.9562900; aaWAG[ 9][ 2] = 0.5542360;  
+    aaWAG[10][ 2] = 0.1315280; aaWAG[11][ 2] = 3.0120100; aaWAG[12][ 2] = 0.1982210; aaWAG[13][ 2] = 0.0961621; aaWAG[14][ 2] = 0.1950810;  
+    aaWAG[15][ 2] = 3.9742300; aaWAG[16][ 2] = 2.0300600; aaWAG[17][ 2] = 0.0719167; aaWAG[18][ 2] = 1.0860000; aaWAG[19][ 2] = 0.1962460;
+    aaWAG[ 0][ 3] = 0.7389980; aaWAG[ 1][ 3] = 0.1473040; aaWAG[ 2][ 3] = 5.4294200; aaWAG[ 3][ 3] = 0.0000000; aaWAG[ 4][ 3] = 0.0302949;  
+    aaWAG[ 5][ 3] = 0.6167830; aaWAG[ 6][ 3] = 6.1741600; aaWAG[ 7][ 3] = 0.8655840; aaWAG[ 8][ 3] = 0.9306760; aaWAG[ 9][ 3] = 0.0394370;  
+    aaWAG[10][ 3] = 0.0848047; aaWAG[11][ 3] = 0.4798550; aaWAG[12][ 3] = 0.1037540; aaWAG[13][ 3] = 0.0467304; aaWAG[14][ 3] = 0.4239840;  
+    aaWAG[15][ 3] = 1.0717600; aaWAG[16][ 3] = 0.3748660; aaWAG[17][ 3] = 0.1297670; aaWAG[18][ 3] = 0.3257110; aaWAG[19][ 3] = 0.1523350;
+    aaWAG[ 0][ 4] = 1.0270400; aaWAG[ 1][ 4] = 0.5281910; aaWAG[ 2][ 4] = 0.2652560; aaWAG[ 3][ 4] = 0.0302949; aaWAG[ 4][ 4] = 0.0000000;  
+    aaWAG[ 5][ 4] = 0.0988179; aaWAG[ 6][ 4] = 0.0213520; aaWAG[ 7][ 4] = 0.3066740; aaWAG[ 8][ 4] = 0.2489720; aaWAG[ 9][ 4] = 0.1701350;  
+    aaWAG[10][ 4] = 0.3842870; aaWAG[11][ 4] = 0.0740339; aaWAG[12][ 4] = 0.3904820; aaWAG[13][ 4] = 0.3980200; aaWAG[14][ 4] = 0.1094040;  
+    aaWAG[15][ 4] = 1.4076600; aaWAG[16][ 4] = 0.5129840; aaWAG[17][ 4] = 0.7170700; aaWAG[18][ 4] = 0.5438330; aaWAG[19][ 4] = 1.0021400;
+    aaWAG[ 0][ 5] = 0.9085980; aaWAG[ 1][ 5] = 3.0355000; aaWAG[ 2][ 5] = 1.5436400; aaWAG[ 3][ 5] = 0.6167830; aaWAG[ 4][ 5] = 0.0988179;  
+    aaWAG[ 5][ 5] = 0.0000000; aaWAG[ 6][ 5] = 5.4694700; aaWAG[ 7][ 5] = 0.3300520; aaWAG[ 8][ 5] = 4.2941100; aaWAG[ 9][ 5] = 0.1139170;  
+    aaWAG[10][ 5] = 0.8694890; aaWAG[11][ 5] = 3.8949000; aaWAG[12][ 5] = 1.5452600; aaWAG[13][ 5] = 0.0999208; aaWAG[14][ 5] = 0.9333720;  
+    aaWAG[15][ 5] = 1.0288700; aaWAG[16][ 5] = 0.8579280; aaWAG[17][ 5] = 0.2157370; aaWAG[18][ 5] = 0.2277100; aaWAG[19][ 5] = 0.3012810;
+    aaWAG[ 0][ 6] = 1.5828500; aaWAG[ 1][ 6] = 0.4391570; aaWAG[ 2][ 6] = 0.9471980; aaWAG[ 3][ 6] = 6.1741600; aaWAG[ 4][ 6] = 0.0213520;  
+    aaWAG[ 5][ 6] = 5.4694700; aaWAG[ 6][ 6] = 0.0000000; aaWAG[ 7][ 6] = 0.5677170; aaWAG[ 8][ 6] = 0.5700250; aaWAG[ 9][ 6] = 0.1273950;  
+    aaWAG[10][ 6] = 0.1542630; aaWAG[11][ 6] = 2.5844300; aaWAG[12][ 6] = 0.3151240; aaWAG[13][ 6] = 0.0811339; aaWAG[14][ 6] = 0.6823550;  
+    aaWAG[15][ 6] = 0.7049390; aaWAG[16][ 6] = 0.8227650; aaWAG[17][ 6] = 0.1565570; aaWAG[18][ 6] = 0.1963030; aaWAG[19][ 6] = 0.5887310;
+    aaWAG[ 0][ 7] = 1.4167200; aaWAG[ 1][ 7] = 0.5846650; aaWAG[ 2][ 7] = 1.1255600; aaWAG[ 3][ 7] = 0.8655840; aaWAG[ 4][ 7] = 0.3066740;  
+    aaWAG[ 5][ 7] = 0.3300520; aaWAG[ 6][ 7] = 0.5677170; aaWAG[ 7][ 7] = 0.0000000; aaWAG[ 8][ 7] = 0.2494100; aaWAG[ 9][ 7] = 0.0304501;  
+    aaWAG[10][ 7] = 0.0613037; aaWAG[11][ 7] = 0.3735580; aaWAG[12][ 7] = 0.1741000; aaWAG[13][ 7] = 0.0499310; aaWAG[14][ 7] = 0.2435700;  
+    aaWAG[15][ 7] = 1.3418200; aaWAG[16][ 7] = 0.2258330; aaWAG[17][ 7] = 0.3369830; aaWAG[18][ 7] = 0.1036040; aaWAG[19][ 7] = 0.1872470;
+    aaWAG[ 0][ 8] = 0.3169540; aaWAG[ 1][ 8] = 2.1371500; aaWAG[ 2][ 8] = 3.9562900; aaWAG[ 3][ 8] = 0.9306760; aaWAG[ 4][ 8] = 0.2489720;  
+    aaWAG[ 5][ 8] = 4.2941100; aaWAG[ 6][ 8] = 0.5700250; aaWAG[ 7][ 8] = 0.2494100; aaWAG[ 8][ 8] = 0.0000000; aaWAG[ 9][ 8] = 0.1381900;  
+    aaWAG[10][ 8] = 0.4994620; aaWAG[11][ 8] = 0.8904320; aaWAG[12][ 8] = 0.4041410; aaWAG[13][ 8] = 0.6793710; aaWAG[14][ 8] = 0.6961980;  
+    aaWAG[15][ 8] = 0.7401690; aaWAG[16][ 8] = 0.4733070; aaWAG[17][ 8] = 0.2625690; aaWAG[18][ 8] = 3.8734400; aaWAG[19][ 8] = 0.1183580;
+    aaWAG[ 0][ 9] = 0.1933350; aaWAG[ 1][ 9] = 0.1869790; aaWAG[ 2][ 9] = 0.5542360; aaWAG[ 3][ 9] = 0.0394370; aaWAG[ 4][ 9] = 0.1701350;  
+    aaWAG[ 5][ 9] = 0.1139170; aaWAG[ 6][ 9] = 0.1273950; aaWAG[ 7][ 9] = 0.0304501; aaWAG[ 8][ 9] = 0.1381900; aaWAG[ 9][ 9] = 0.0000000;  
+    aaWAG[10][ 9] = 3.1709700; aaWAG[11][ 9] = 0.3238320; aaWAG[12][ 9] = 4.2574600; aaWAG[13][ 9] = 1.0594700; aaWAG[14][ 9] = 0.0999288;  
+    aaWAG[15][ 9] = 0.3194400; aaWAG[16][ 9] = 1.4581600; aaWAG[17][ 9] = 0.2124830; aaWAG[18][ 9] = 0.4201700; aaWAG[19][ 9] = 7.8213000;
+    aaWAG[ 0][10] = 0.3979150; aaWAG[ 1][10] = 0.4976710; aaWAG[ 2][10] = 0.1315280; aaWAG[ 3][10] = 0.0848047; aaWAG[ 4][10] = 0.3842870;  
+    aaWAG[ 5][10] = 0.8694890; aaWAG[ 6][10] = 0.1542630; aaWAG[ 7][10] = 0.0613037; aaWAG[ 8][10] = 0.4994620; aaWAG[ 9][10] = 3.1709700;  
+    aaWAG[10][10] = 0.0000000; aaWAG[11][10] = 0.2575550; aaWAG[12][10] = 4.8540200; aaWAG[13][10] = 2.1151700; aaWAG[14][10] = 0.4158440;  
+    aaWAG[15][10] = 0.3447390; aaWAG[16][10] = 0.3266220; aaWAG[17][10] = 0.6653090; aaWAG[18][10] = 0.3986180; aaWAG[19][10] = 1.8003400;
+    aaWAG[ 0][11] = 0.9062650; aaWAG[ 1][11] = 5.3514200; aaWAG[ 2][11] = 3.0120100; aaWAG[ 3][11] = 0.4798550; aaWAG[ 4][11] = 0.0740339;  
+    aaWAG[ 5][11] = 3.8949000; aaWAG[ 6][11] = 2.5844300; aaWAG[ 7][11] = 0.3735580; aaWAG[ 8][11] = 0.8904320; aaWAG[ 9][11] = 0.3238320;  
+    aaWAG[10][11] = 0.2575550; aaWAG[11][11] = 0.0000000; aaWAG[12][11] = 0.9342760; aaWAG[13][11] = 0.0888360; aaWAG[14][11] = 0.5568960;  
+    aaWAG[15][11] = 0.9671300; aaWAG[16][11] = 1.3869800; aaWAG[17][11] = 0.1375050; aaWAG[18][11] = 0.1332640; aaWAG[19][11] = 0.3054340;
+    aaWAG[ 0][12] = 0.8934960; aaWAG[ 1][12] = 0.6831620; aaWAG[ 2][12] = 0.1982210; aaWAG[ 3][12] = 0.1037540; aaWAG[ 4][12] = 0.3904820;  
+    aaWAG[ 5][12] = 1.5452600; aaWAG[ 6][12] = 0.3151240; aaWAG[ 7][12] = 0.1741000; aaWAG[ 8][12] = 0.4041410; aaWAG[ 9][12] = 4.2574600;  
+    aaWAG[10][12] = 4.8540200; aaWAG[11][12] = 0.9342760; aaWAG[12][12] = 0.0000000; aaWAG[13][12] = 1.1906300; aaWAG[14][12] = 0.1713290;  
+    aaWAG[15][12] = 0.4939050; aaWAG[16][12] = 1.5161200; aaWAG[17][12] = 0.5157060; aaWAG[18][12] = 0.4284370; aaWAG[19][12] = 2.0584500;
+    aaWAG[ 0][13] = 0.2104940; aaWAG[ 1][13] = 0.1027110; aaWAG[ 2][13] = 0.0961621; aaWAG[ 3][13] = 0.0467304; aaWAG[ 4][13] = 0.3980200;  
+    aaWAG[ 5][13] = 0.0999208; aaWAG[ 6][13] = 0.0811339; aaWAG[ 7][13] = 0.0499310; aaWAG[ 8][13] = 0.6793710; aaWAG[ 9][13] = 1.0594700;  
+    aaWAG[10][13] = 2.1151700; aaWAG[11][13] = 0.0888360; aaWAG[12][13] = 1.1906300; aaWAG[13][13] = 0.0000000; aaWAG[14][13] = 0.1614440;  
+    aaWAG[15][13] = 0.5459310; aaWAG[16][13] = 0.1719030; aaWAG[17][13] = 1.5296400; aaWAG[18][13] = 6.4542800; aaWAG[19][13] = 0.6498920;
+    aaWAG[ 0][14] = 1.4385500; aaWAG[ 1][14] = 0.6794890; aaWAG[ 2][14] = 0.1950810; aaWAG[ 3][14] = 0.4239840; aaWAG[ 4][14] = 0.1094040;  
+    aaWAG[ 5][14] = 0.9333720; aaWAG[ 6][14] = 0.6823550; aaWAG[ 7][14] = 0.2435700; aaWAG[ 8][14] = 0.6961980; aaWAG[ 9][14] = 0.0999288;  
+    aaWAG[10][14] = 0.4158440; aaWAG[11][14] = 0.5568960; aaWAG[12][14] = 0.1713290; aaWAG[13][14] = 0.1614440; aaWAG[14][14] = 0.0000000;  
+    aaWAG[15][14] = 1.6132800; aaWAG[16][14] = 0.7953840; aaWAG[17][14] = 0.1394050; aaWAG[18][14] = 0.2160460; aaWAG[19][14] = 0.3148870;
+    aaWAG[ 0][15] = 3.3707900; aaWAG[ 1][15] = 1.2241900; aaWAG[ 2][15] = 3.9742300; aaWAG[ 3][15] = 1.0717600; aaWAG[ 4][15] = 1.4076600;  
+    aaWAG[ 5][15] = 1.0288700; aaWAG[ 6][15] = 0.7049390; aaWAG[ 7][15] = 1.3418200; aaWAG[ 8][15] = 0.7401690; aaWAG[ 9][15] = 0.3194400;  
+    aaWAG[10][15] = 0.3447390; aaWAG[11][15] = 0.9671300; aaWAG[12][15] = 0.4939050; aaWAG[13][15] = 0.5459310; aaWAG[14][15] = 1.6132800;  
+    aaWAG[15][15] = 0.0000000; aaWAG[16][15] = 4.3780200; aaWAG[17][15] = 0.5237420; aaWAG[18][15] = 0.7869930; aaWAG[19][15] = 0.2327390;
+    aaWAG[ 0][16] = 2.1211100; aaWAG[ 1][16] = 0.5544130; aaWAG[ 2][16] = 2.0300600; aaWAG[ 3][16] = 0.3748660; aaWAG[ 4][16] = 0.5129840;  
+    aaWAG[ 5][16] = 0.8579280; aaWAG[ 6][16] = 0.8227650; aaWAG[ 7][16] = 0.2258330; aaWAG[ 8][16] = 0.4733070; aaWAG[ 9][16] = 1.4581600;  
+    aaWAG[10][16] = 0.3266220; aaWAG[11][16] = 1.3869800; aaWAG[12][16] = 1.5161200; aaWAG[13][16] = 0.1719030; aaWAG[14][16] = 0.7953840;  
+    aaWAG[15][16] = 4.3780200; aaWAG[16][16] = 0.0000000; aaWAG[17][16] = 0.1108640; aaWAG[18][16] = 0.2911480; aaWAG[19][16] = 1.3882300;
+    aaWAG[ 0][17] = 0.1131330; aaWAG[ 1][17] = 1.1639200; aaWAG[ 2][17] = 0.0719167; aaWAG[ 3][17] = 0.1297670; aaWAG[ 4][17] = 0.7170700;  
+    aaWAG[ 5][17] = 0.2157370; aaWAG[ 6][17] = 0.1565570; aaWAG[ 7][17] = 0.3369830; aaWAG[ 8][17] = 0.2625690; aaWAG[ 9][17] = 0.2124830;  
+    aaWAG[10][17] = 0.6653090; aaWAG[11][17] = 0.1375050; aaWAG[12][17] = 0.5157060; aaWAG[13][17] = 1.5296400; aaWAG[14][17] = 0.1394050;  
+    aaWAG[15][17] = 0.5237420; aaWAG[16][17] = 0.1108640; aaWAG[17][17] = 0.0000000; aaWAG[18][17] = 2.4853900; aaWAG[19][17] = 0.3653690;
+    aaWAG[ 0][18] = 0.2407350; aaWAG[ 1][18] = 0.3815330; aaWAG[ 2][18] = 1.0860000; aaWAG[ 3][18] = 0.3257110; aaWAG[ 4][18] = 0.5438330;  
+    aaWAG[ 5][18] = 0.2277100; aaWAG[ 6][18] = 0.1963030; aaWAG[ 7][18] = 0.1036040; aaWAG[ 8][18] = 3.8734400; aaWAG[ 9][18] = 0.4201700;  
+    aaWAG[10][18] = 0.3986180; aaWAG[11][18] = 0.1332640; aaWAG[12][18] = 0.4284370; aaWAG[13][18] = 6.4542800; aaWAG[14][18] = 0.2160460;  
+    aaWAG[15][18] = 0.7869930; aaWAG[16][18] = 0.2911480; aaWAG[17][18] = 2.4853900; aaWAG[18][18] = 0.0000000; aaWAG[19][18] = 0.3147300;
+    aaWAG[ 0][19] = 2.0060100; aaWAG[ 1][19] = 0.2518490; aaWAG[ 2][19] = 0.1962460; aaWAG[ 3][19] = 0.1523350; aaWAG[ 4][19] = 1.0021400;  
+    aaWAG[ 5][19] = 0.3012810; aaWAG[ 6][19] = 0.5887310; aaWAG[ 7][19] = 0.1872470; aaWAG[ 8][19] = 0.1183580; aaWAG[ 9][19] = 7.8213000;  
+    aaWAG[10][19] = 1.8003400; aaWAG[11][19] = 0.3054340; aaWAG[12][19] = 2.0584500; aaWAG[13][19] = 0.6498920; aaWAG[14][19] = 0.3148870;  
+    aaWAG[15][19] = 0.2327390; aaWAG[16][19] = 1.3882300; aaWAG[17][19] = 0.3653690; aaWAG[18][19] = 0.3147300; aaWAG[19][19] = 0.0000000;
+    wagPi[ 0] = 0.08662790;
+    wagPi[ 1] = 0.04397200;
+    wagPi[ 2] = 0.03908940;
+    wagPi[ 3] = 0.05704510;
+    wagPi[ 4] = 0.01930780;
+    wagPi[ 5] = 0.03672810;
+    wagPi[ 6] = 0.05805890;
+    wagPi[ 7] = 0.08325180;
+    wagPi[ 8] = 0.02443130;
+    wagPi[ 9] = 0.04846600;
+    wagPi[10] = 0.08620970;
+    wagPi[11] = 0.06202860;
+    wagPi[12] = 0.01950273;
+    wagPi[13] = 0.03843190;
+    wagPi[14] = 0.04576310;
+    wagPi[15] = 0.06951790;
+    wagPi[16] = 0.06101270;
+    wagPi[17] = 0.01438590;
+    wagPi[18] = 0.03527420;
+    wagPi[19] = 0.07089560;
+
+    /* cpRev */
+    aacpREV[ 0][ 0] =    0; aacpREV[ 0][ 1] =  105; aacpREV[ 0][ 2] =  227; aacpREV[ 0][ 3] =  175; aacpREV[ 0][ 4] =  669; 
+    aacpREV[ 0][ 5] =  157; aacpREV[ 0][ 6] =  499; aacpREV[ 0][ 7] =  665; aacpREV[ 0][ 8] =   66; aacpREV[ 0][ 9] =  145; 
+    aacpREV[ 0][10] =  197; aacpREV[ 0][11] =  236; aacpREV[ 0][12] =  185; aacpREV[ 0][13] =   68; aacpREV[ 0][14] =  490; 
+    aacpREV[ 0][15] = 2440; aacpREV[ 0][16] = 1340; aacpREV[ 0][17] =   14; aacpREV[ 0][18] =   56; aacpREV[ 0][19] =  968; 
+    aacpREV[ 1][ 0] =  105; aacpREV[ 1][ 1] =    0; aacpREV[ 1][ 2] =  357; aacpREV[ 1][ 3] =   43; aacpREV[ 1][ 4] =  823; 
+    aacpREV[ 1][ 5] = 1745; aacpREV[ 1][ 6] =  152; aacpREV[ 1][ 7] =  243; aacpREV[ 1][ 8] =  715; aacpREV[ 1][ 9] =  136; 
+    aacpREV[ 1][10] =  203; aacpREV[ 1][11] = 4482; aacpREV[ 1][12] =  125; aacpREV[ 1][13] =   53; aacpREV[ 1][14] =   87; 
+    aacpREV[ 1][15] =  385; aacpREV[ 1][16] =  314; aacpREV[ 1][17] =  230; aacpREV[ 1][18] =  323; aacpREV[ 1][19] =   92; 
+    aacpREV[ 2][ 0] =  227; aacpREV[ 2][ 1] =  357; aacpREV[ 2][ 2] =    0; aacpREV[ 2][ 3] = 4435; aacpREV[ 2][ 4] =  538; 
+    aacpREV[ 2][ 5] =  768; aacpREV[ 2][ 6] = 1055; aacpREV[ 2][ 7] =  653; aacpREV[ 2][ 8] = 1405; aacpREV[ 2][ 9] =  168; 
+    aacpREV[ 2][10] =  113; aacpREV[ 2][11] = 2430; aacpREV[ 2][12] =   61; aacpREV[ 2][13] =   97; aacpREV[ 2][14] =  173; 
+    aacpREV[ 2][15] = 2085; aacpREV[ 2][16] = 1393; aacpREV[ 2][17] =   40; aacpREV[ 2][18] =  754; aacpREV[ 2][19] =   83; 
+    aacpREV[ 3][ 0] =  175; aacpREV[ 3][ 1] =   43; aacpREV[ 3][ 2] = 4435; aacpREV[ 3][ 3] =    0; aacpREV[ 3][ 4] =   10; 
+    aacpREV[ 3][ 5] =  400; aacpREV[ 3][ 6] = 3691; aacpREV[ 3][ 7] =  431; aacpREV[ 3][ 8] =  331; aacpREV[ 3][ 9] =   10; 
+    aacpREV[ 3][10] =   10; aacpREV[ 3][11] =  412; aacpREV[ 3][12] =   47; aacpREV[ 3][13] =   22; aacpREV[ 3][14] =  170; 
+    aacpREV[ 3][15] =  590; aacpREV[ 3][16] =  266; aacpREV[ 3][17] =   18; aacpREV[ 3][18] =  281; aacpREV[ 3][19] =   75; 
+    aacpREV[ 4][ 0] =  669; aacpREV[ 4][ 1] =  823; aacpREV[ 4][ 2] =  538; aacpREV[ 4][ 3] =   10; aacpREV[ 4][ 4] =    0; 
+    aacpREV[ 4][ 5] =   10; aacpREV[ 4][ 6] =   10; aacpREV[ 4][ 7] =  303; aacpREV[ 4][ 8] =  441; aacpREV[ 4][ 9] =  280; 
+    aacpREV[ 4][10] =  396; aacpREV[ 4][11] =   48; aacpREV[ 4][12] =  159; aacpREV[ 4][13] =  726; aacpREV[ 4][14] =  285; 
+    aacpREV[ 4][15] = 2331; aacpREV[ 4][16] =  576; aacpREV[ 4][17] =  435; aacpREV[ 4][18] = 1466; aacpREV[ 4][19] =  592; 
+    aacpREV[ 5][ 0] =  157; aacpREV[ 5][ 1] = 1745; aacpREV[ 5][ 2] =  768; aacpREV[ 5][ 3] =  400; aacpREV[ 5][ 4] =   10; 
+    aacpREV[ 5][ 5] =    0; aacpREV[ 5][ 6] = 3122; aacpREV[ 5][ 7] =  133; aacpREV[ 5][ 8] = 1269; aacpREV[ 5][ 9] =   92; 
+    aacpREV[ 5][10] =  286; aacpREV[ 5][11] = 3313; aacpREV[ 5][12] =  202; aacpREV[ 5][13] =   10; aacpREV[ 5][14] =  323; 
+    aacpREV[ 5][15] =  396; aacpREV[ 5][16] =  241; aacpREV[ 5][17] =   53; aacpREV[ 5][18] =  391; aacpREV[ 5][19] =   54; 
+    aacpREV[ 6][ 0] =  499; aacpREV[ 6][ 1] =  152; aacpREV[ 6][ 2] = 1055; aacpREV[ 6][ 3] = 3691; aacpREV[ 6][ 4] =   10; 
+    aacpREV[ 6][ 5] = 3122; aacpREV[ 6][ 6] =    0; aacpREV[ 6][ 7] =  379; aacpREV[ 6][ 8] =  162; aacpREV[ 6][ 9] =  148; 
+    aacpREV[ 6][10] =   82; aacpREV[ 6][11] = 2629; aacpREV[ 6][12] =  113; aacpREV[ 6][13] =  145; aacpREV[ 6][14] =  185; 
+    aacpREV[ 6][15] =  568; aacpREV[ 6][16] =  369; aacpREV[ 6][17] =   63; aacpREV[ 6][18] =  142; aacpREV[ 6][19] =  200; 
+    aacpREV[ 7][ 0] =  665; aacpREV[ 7][ 1] =  243; aacpREV[ 7][ 2] =  653; aacpREV[ 7][ 3] =  431; aacpREV[ 7][ 4] =  303; 
+    aacpREV[ 7][ 5] =  133; aacpREV[ 7][ 6] =  379; aacpREV[ 7][ 7] =    0; aacpREV[ 7][ 8] =   19; aacpREV[ 7][ 9] =   40; 
+    aacpREV[ 7][10] =   20; aacpREV[ 7][11] =  263; aacpREV[ 7][12] =   21; aacpREV[ 7][13] =   25; aacpREV[ 7][14] =   28; 
+    aacpREV[ 7][15] =  691; aacpREV[ 7][16] =   92; aacpREV[ 7][17] =   82; aacpREV[ 7][18] =   10; aacpREV[ 7][19] =   91; 
+    aacpREV[ 8][ 0] =   66; aacpREV[ 8][ 1] =  715; aacpREV[ 8][ 2] = 1405; aacpREV[ 8][ 3] =  331; aacpREV[ 8][ 4] =  441; 
+    aacpREV[ 8][ 5] = 1269; aacpREV[ 8][ 6] =  162; aacpREV[ 8][ 7] =   19; aacpREV[ 8][ 8] =    0; aacpREV[ 8][ 9] =   29; 
+    aacpREV[ 8][10] =   66; aacpREV[ 8][11] =  305; aacpREV[ 8][12] =   10; aacpREV[ 8][13] =  127; aacpREV[ 8][14] =  152; 
+    aacpREV[ 8][15] =  303; aacpREV[ 8][16] =   32; aacpREV[ 8][17] =   69; aacpREV[ 8][18] = 1971; aacpREV[ 8][19] =   25; 
+    aacpREV[ 9][ 0] =  145; aacpREV[ 9][ 1] =  136; aacpREV[ 9][ 2] =  168; aacpREV[ 9][ 3] =   10; aacpREV[ 9][ 4] =  280; 
+    aacpREV[ 9][ 5] =   92; aacpREV[ 9][ 6] =  148; aacpREV[ 9][ 7] =   40; aacpREV[ 9][ 8] =   29; aacpREV[ 9][ 9] =    0; 
+    aacpREV[ 9][10] = 1745; aacpREV[ 9][11] =  345; aacpREV[ 9][12] = 1772; aacpREV[ 9][13] =  454; aacpREV[ 9][14] =  117; 
+    aacpREV[ 9][15] =  216; aacpREV[ 9][16] = 1040; aacpREV[ 9][17] =   42; aacpREV[ 9][18] =   89; aacpREV[ 9][19] = 4797; 
+    aacpREV[10][ 0] =  197; aacpREV[10][ 1] =  203; aacpREV[10][ 2] =  113; aacpREV[10][ 3] =   10; aacpREV[10][ 4] =  396; 
+    aacpREV[10][ 5] =  286; aacpREV[10][ 6] =   82; aacpREV[10][ 7] =   20; aacpREV[10][ 8] =   66; aacpREV[10][ 9] = 1745; 
+    aacpREV[10][10] =    0; aacpREV[10][11] =  218; aacpREV[10][12] = 1351; aacpREV[10][13] = 1268; aacpREV[10][14] =  219; 
+    aacpREV[10][15] =  516; aacpREV[10][16] =  156; aacpREV[10][17] =  159; aacpREV[10][18] =  189; aacpREV[10][19] =  865; 
+    aacpREV[11][ 0] =  236; aacpREV[11][ 1] = 4482; aacpREV[11][ 2] = 2430; aacpREV[11][ 3] =  412; aacpREV[11][ 4] =   48; 
+    aacpREV[11][ 5] = 3313; aacpREV[11][ 6] = 2629; aacpREV[11][ 7] =  263; aacpREV[11][ 8] =  305; aacpREV[11][ 9] =  345; 
+    aacpREV[11][10] =  218; aacpREV[11][11] =    0; aacpREV[11][12] =  193; aacpREV[11][13] =   72; aacpREV[11][14] =  302; 
+    aacpREV[11][15] =  868; aacpREV[11][16] =  918; aacpREV[11][17] =   10; aacpREV[11][18] =  247; aacpREV[11][19] =  249; 
+    aacpREV[12][ 0] =  185; aacpREV[12][ 1] =  125; aacpREV[12][ 2] =   61; aacpREV[12][ 3] =   47; aacpREV[12][ 4] =  159; 
+    aacpREV[12][ 5] =  202; aacpREV[12][ 6] =  113; aacpREV[12][ 7] =   21; aacpREV[12][ 8] =   10; aacpREV[12][ 9] = 1772; 
+    aacpREV[12][10] = 1351; aacpREV[12][11] =  193; aacpREV[12][12] =    0; aacpREV[12][13] =  327; aacpREV[12][14] =  100; 
+    aacpREV[12][15] =   93; aacpREV[12][16] =  645; aacpREV[12][17] =   86; aacpREV[12][18] =  215; aacpREV[12][19] =  475; 
+    aacpREV[13][ 0] =   68; aacpREV[13][ 1] =   53; aacpREV[13][ 2] =   97; aacpREV[13][ 3] =   22; aacpREV[13][ 4] =  726; 
+    aacpREV[13][ 5] =   10; aacpREV[13][ 6] =  145; aacpREV[13][ 7] =   25; aacpREV[13][ 8] =  127; aacpREV[13][ 9] =  454; 
+    aacpREV[13][10] = 1268; aacpREV[13][11] =   72; aacpREV[13][12] =  327; aacpREV[13][13] =    0; aacpREV[13][14] =   43; 
+    aacpREV[13][15] =  487; aacpREV[13][16] =  148; aacpREV[13][17] =  468; aacpREV[13][18] = 2370; aacpREV[13][19] =  317; 
+    aacpREV[14][ 0] =  490; aacpREV[14][ 1] =   87; aacpREV[14][ 2] =  173; aacpREV[14][ 3] =  170; aacpREV[14][ 4] =  285; 
+    aacpREV[14][ 5] =  323; aacpREV[14][ 6] =  185; aacpREV[14][ 7] =   28; aacpREV[14][ 8] =  152; aacpREV[14][ 9] =  117; 
+    aacpREV[14][10] =  219; aacpREV[14][11] =  302; aacpREV[14][12] =  100; aacpREV[14][13] =   43; aacpREV[14][14] =    0; 
+    aacpREV[14][15] = 1202; aacpREV[14][16] =  260; aacpREV[14][17] =   49; aacpREV[14][18] =   97; aacpREV[14][19] =  122; 
+    aacpREV[15][ 0] = 2440; aacpREV[15][ 1] =  385; aacpREV[15][ 2] = 2085; aacpREV[15][ 3] =  590; aacpREV[15][ 4] = 2331; 
+    aacpREV[15][ 5] =  396; aacpREV[15][ 6] =  568; aacpREV[15][ 7] =  691; aacpREV[15][ 8] =  303; aacpREV[15][ 9] =  216; 
+    aacpREV[15][10] =  516; aacpREV[15][11] =  868; aacpREV[15][12] =   93; aacpREV[15][13] =  487; aacpREV[15][14] = 1202; 
+    aacpREV[15][15] =    0; aacpREV[15][16] = 2151; aacpREV[15][17] =   73; aacpREV[15][18] =  522; aacpREV[15][19] =  167; 
+    aacpREV[16][ 0] = 1340; aacpREV[16][ 1] =  314; aacpREV[16][ 2] = 1393; aacpREV[16][ 3] =  266; aacpREV[16][ 4] =  576; 
+    aacpREV[16][ 5] =  241; aacpREV[16][ 6] =  369; aacpREV[16][ 7] =   92; aacpREV[16][ 8] =   32; aacpREV[16][ 9] = 1040; 
+    aacpREV[16][10] =  156; aacpREV[16][11] =  918; aacpREV[16][12] =  645; aacpREV[16][13] =  148; aacpREV[16][14] =  260; 
+    aacpREV[16][15] = 2151; aacpREV[16][16] =    0; aacpREV[16][17] =   29; aacpREV[16][18] =   71; aacpREV[16][19] =  760; 
+    aacpREV[17][ 0] =   14; aacpREV[17][ 1] =  230; aacpREV[17][ 2] =   40; aacpREV[17][ 3] =   18; aacpREV[17][ 4] =  435; 
+    aacpREV[17][ 5] =   53; aacpREV[17][ 6] =   63; aacpREV[17][ 7] =   82; aacpREV[17][ 8] =   69; aacpREV[17][ 9] =   42; 
+    aacpREV[17][10] =  159; aacpREV[17][11] =   10; aacpREV[17][12] =   86; aacpREV[17][13] =  468; aacpREV[17][14] =   49; 
+    aacpREV[17][15] =   73; aacpREV[17][16] =   29; aacpREV[17][17] =    0; aacpREV[17][18] =  346; aacpREV[17][19] =   10; 
+    aacpREV[18][ 0] =   56; aacpREV[18][ 1] =  323; aacpREV[18][ 2] =  754; aacpREV[18][ 3] =  281; aacpREV[18][ 4] = 1466; 
+    aacpREV[18][ 5] =  391; aacpREV[18][ 6] =  142; aacpREV[18][ 7] =   10; aacpREV[18][ 8] = 1971; aacpREV[18][ 9] =   89; 
+    aacpREV[18][10] =  189; aacpREV[18][11] =  247; aacpREV[18][12] =  215; aacpREV[18][13] = 2370; aacpREV[18][14] =   97; 
+    aacpREV[18][15] =  522; aacpREV[18][16] =   71; aacpREV[18][17] =  346; aacpREV[18][18] =    0; aacpREV[18][19] =  119; 
+    aacpREV[19][ 0] =  968; aacpREV[19][ 1] =   92; aacpREV[19][ 2] =   83; aacpREV[19][ 3] =   75; aacpREV[19][ 4] =  592; 
+    aacpREV[19][ 5] =   54; aacpREV[19][ 6] =  200; aacpREV[19][ 7] =   91; aacpREV[19][ 8] =   25; aacpREV[19][ 9] = 4797; 
+    aacpREV[19][10] =  865; aacpREV[19][11] =  249; aacpREV[19][12] =  475; aacpREV[19][13] =  317; aacpREV[19][14] =  122; 
+    aacpREV[19][15] =  167; aacpREV[19][16] =  760; aacpREV[19][17] =   10; aacpREV[19][18] =  119; aacpREV[19][19] =    0;
+
+    cprevPi[0] = 0.076;
+    cprevPi[1] = 0.062;
+    cprevPi[2] = 0.041;
+    cprevPi[3] = 0.037;
+    cprevPi[4] = 0.009;
+    cprevPi[5] = 0.038;
+    cprevPi[6] = 0.049;
+    cprevPi[7] = 0.084;
+    cprevPi[8] = 0.025;
+    cprevPi[9] = 0.081;
+    cprevPi[10] = 0.101;
+    cprevPi[11] = 0.050;
+    cprevPi[12] = 0.022;
+    cprevPi[13] = 0.051;
+    cprevPi[14] = 0.043;
+    cprevPi[15] = 0.062;
+    cprevPi[16] = 0.054;
+    cprevPi[17] = 0.018;
+    cprevPi[18] = 0.031;
+    cprevPi[19] = 0.066;
+    
+    /* VT model */
+    aaVt[ 0][ 0] = 0.000000; aaVt[ 0][ 1] = 0.233108; aaVt[ 0][ 2] = 0.199097; aaVt[ 0][ 3] = 0.265145; aaVt[ 0][ 4] = 0.227333; 
+    aaVt[ 0][ 5] = 0.310084; aaVt[ 0][ 6] = 0.567957; aaVt[ 0][ 7] = 0.876213; aaVt[ 0][ 8] = 0.078692; aaVt[ 0][ 9] = 0.222972; 
+    aaVt[ 0][10] = 0.424630; aaVt[ 0][11] = 0.393245; aaVt[ 0][12] = 0.211550; aaVt[ 0][13] = 0.116646; aaVt[ 0][14] = 0.399143; 
+    aaVt[ 0][15] = 1.817198; aaVt[ 0][16] = 0.877877; aaVt[ 0][17] = 0.030309; aaVt[ 0][18] = 0.087061; aaVt[ 0][19] = 1.230985; 
+    aaVt[ 1][ 0] = 0.233108; aaVt[ 1][ 1] = 0.000000; aaVt[ 1][ 2] = 0.210797; aaVt[ 1][ 3] = 0.105191; aaVt[ 1][ 4] = 0.031726; 
+    aaVt[ 1][ 5] = 0.493763; aaVt[ 1][ 6] = 0.255240; aaVt[ 1][ 7] = 0.156945; aaVt[ 1][ 8] = 0.213164; aaVt[ 1][ 9] = 0.081510; 
+    aaVt[ 1][10] = 0.192364; aaVt[ 1][11] = 1.755838; aaVt[ 1][12] = 0.087930; aaVt[ 1][13] = 0.042569; aaVt[ 1][14] = 0.128480; 
+    aaVt[ 1][15] = 0.292327; aaVt[ 1][16] = 0.204109; aaVt[ 1][17] = 0.046417; aaVt[ 1][18] = 0.097010; aaVt[ 1][19] = 0.113146; 
+    aaVt[ 2][ 0] = 0.199097; aaVt[ 2][ 1] = 0.210797; aaVt[ 2][ 2] = 0.000000; aaVt[ 2][ 3] = 0.883422; aaVt[ 2][ 4] = 0.027495; 
+    aaVt[ 2][ 5] = 0.275700; aaVt[ 2][ 6] = 0.270417; aaVt[ 2][ 7] = 0.362028; aaVt[ 2][ 8] = 0.290006; aaVt[ 2][ 9] = 0.087225; 
+    aaVt[ 2][10] = 0.069245; aaVt[ 2][11] = 0.503060; aaVt[ 2][12] = 0.057420; aaVt[ 2][13] = 0.039769; aaVt[ 2][14] = 0.083956; 
+    aaVt[ 2][15] = 0.847049; aaVt[ 2][16] = 0.471268; aaVt[ 2][17] = 0.010459; aaVt[ 2][18] = 0.093268; aaVt[ 2][19] = 0.049824; 
+    aaVt[ 3][ 0] = 0.265145; aaVt[ 3][ 1] = 0.105191; aaVt[ 3][ 2] = 0.883422; aaVt[ 3][ 3] = 0.000000; aaVt[ 3][ 4] = 0.010313; 
+    aaVt[ 3][ 5] = 0.205842; aaVt[ 3][ 6] = 1.599461; aaVt[ 3][ 7] = 0.311718; aaVt[ 3][ 8] = 0.134252; aaVt[ 3][ 9] = 0.011720; 
+    aaVt[ 3][10] = 0.060863; aaVt[ 3][11] = 0.261101; aaVt[ 3][12] = 0.012182; aaVt[ 3][13] = 0.016577; aaVt[ 3][14] = 0.160063; 
+    aaVt[ 3][15] = 0.461519; aaVt[ 3][16] = 0.178197; aaVt[ 3][17] = 0.011393; aaVt[ 3][18] = 0.051664; aaVt[ 3][19] = 0.048769; 
+    aaVt[ 4][ 0] = 0.227333; aaVt[ 4][ 1] = 0.031726; aaVt[ 4][ 2] = 0.027495; aaVt[ 4][ 3] = 0.010313; aaVt[ 4][ 4] = 0.000000; 
+    aaVt[ 4][ 5] = 0.004315; aaVt[ 4][ 6] = 0.005321; aaVt[ 4][ 7] = 0.050876; aaVt[ 4][ 8] = 0.016695; aaVt[ 4][ 9] = 0.046398; 
+    aaVt[ 4][10] = 0.091709; aaVt[ 4][11] = 0.004067; aaVt[ 4][12] = 0.023690; aaVt[ 4][13] = 0.051127; aaVt[ 4][14] = 0.011137; 
+    aaVt[ 4][15] = 0.175270; aaVt[ 4][16] = 0.079511; aaVt[ 4][17] = 0.007732; aaVt[ 4][18] = 0.042823; aaVt[ 4][19] = 0.163831; 
+    aaVt[ 5][ 0] = 0.310084; aaVt[ 5][ 1] = 0.493763; aaVt[ 5][ 2] = 0.275700; aaVt[ 5][ 3] = 0.205842; aaVt[ 5][ 4] = 0.004315; 
+    aaVt[ 5][ 5] = 0.000000; aaVt[ 5][ 6] = 0.960976; aaVt[ 5][ 7] = 0.128660; aaVt[ 5][ 8] = 0.315521; aaVt[ 5][ 9] = 0.054602; 
+    aaVt[ 5][10] = 0.243530; aaVt[ 5][11] = 0.738208; aaVt[ 5][12] = 0.120801; aaVt[ 5][13] = 0.026235; aaVt[ 5][14] = 0.156570; 
+    aaVt[ 5][15] = 0.358017; aaVt[ 5][16] = 0.248992; aaVt[ 5][17] = 0.021248; aaVt[ 5][18] = 0.062544; aaVt[ 5][19] = 0.112027; 
+    aaVt[ 6][ 0] = 0.567957; aaVt[ 6][ 1] = 0.255240; aaVt[ 6][ 2] = 0.270417; aaVt[ 6][ 3] = 1.599461; aaVt[ 6][ 4] = 0.005321; 
+    aaVt[ 6][ 5] = 0.960976; aaVt[ 6][ 6] = 0.000000; aaVt[ 6][ 7] = 0.250447; aaVt[ 6][ 8] = 0.104458; aaVt[ 6][ 9] = 0.046589; 
+    aaVt[ 6][10] = 0.151924; aaVt[ 6][11] = 0.888630; aaVt[ 6][12] = 0.058643; aaVt[ 6][13] = 0.028168; aaVt[ 6][14] = 0.205134; 
+    aaVt[ 6][15] = 0.406035; aaVt[ 6][16] = 0.321028; aaVt[ 6][17] = 0.018844; aaVt[ 6][18] = 0.055200; aaVt[ 6][19] = 0.205868; 
+    aaVt[ 7][ 0] = 0.876213; aaVt[ 7][ 1] = 0.156945; aaVt[ 7][ 2] = 0.362028; aaVt[ 7][ 3] = 0.311718; aaVt[ 7][ 4] = 0.050876; 
+    aaVt[ 7][ 5] = 0.128660; aaVt[ 7][ 6] = 0.250447; aaVt[ 7][ 7] = 0.000000; aaVt[ 7][ 8] = 0.058131; aaVt[ 7][ 9] = 0.051089; 
+    aaVt[ 7][10] = 0.087056; aaVt[ 7][11] = 0.193243; aaVt[ 7][12] = 0.046560; aaVt[ 7][13] = 0.050143; aaVt[ 7][14] = 0.124492; 
+    aaVt[ 7][15] = 0.612843; aaVt[ 7][16] = 0.136266; aaVt[ 7][17] = 0.023990; aaVt[ 7][18] = 0.037568; aaVt[ 7][19] = 0.082579; 
+    aaVt[ 8][ 0] = 0.078692; aaVt[ 8][ 1] = 0.213164; aaVt[ 8][ 2] = 0.290006; aaVt[ 8][ 3] = 0.134252; aaVt[ 8][ 4] = 0.016695; 
+    aaVt[ 8][ 5] = 0.315521; aaVt[ 8][ 6] = 0.104458; aaVt[ 8][ 7] = 0.058131; aaVt[ 8][ 8] = 0.000000; aaVt[ 8][ 9] = 0.020039; 
+    aaVt[ 8][10] = 0.103552; aaVt[ 8][11] = 0.153323; aaVt[ 8][12] = 0.021157; aaVt[ 8][13] = 0.079807; aaVt[ 8][14] = 0.078892; 
+    aaVt[ 8][15] = 0.167406; aaVt[ 8][16] = 0.101117; aaVt[ 8][17] = 0.020009; aaVt[ 8][18] = 0.286027; aaVt[ 8][19] = 0.068575; 
+    aaVt[ 9][ 0] = 0.222972; aaVt[ 9][ 1] = 0.081510; aaVt[ 9][ 2] = 0.087225; aaVt[ 9][ 3] = 0.011720; aaVt[ 9][ 4] = 0.046398; 
+    aaVt[ 9][ 5] = 0.054602; aaVt[ 9][ 6] = 0.046589; aaVt[ 9][ 7] = 0.051089; aaVt[ 9][ 8] = 0.020039; aaVt[ 9][ 9] = 0.000000; 
+    aaVt[ 9][10] = 2.089890; aaVt[ 9][11] = 0.093181; aaVt[ 9][12] = 0.493845; aaVt[ 9][13] = 0.321020; aaVt[ 9][14] = 0.054797; 
+    aaVt[ 9][15] = 0.081567; aaVt[ 9][16] = 0.376588; aaVt[ 9][17] = 0.034954; aaVt[ 9][18] = 0.086237; aaVt[ 9][19] = 3.654430; 
+    aaVt[10][ 0] = 0.424630; aaVt[10][ 1] = 0.192364; aaVt[10][ 2] = 0.069245; aaVt[10][ 3] = 0.060863; aaVt[10][ 4] = 0.091709; 
+    aaVt[10][ 5] = 0.243530; aaVt[10][ 6] = 0.151924; aaVt[10][ 7] = 0.087056; aaVt[10][ 8] = 0.103552; aaVt[10][ 9] = 2.089890; 
+    aaVt[10][10] = 0.000000; aaVt[10][11] = 0.201204; aaVt[10][12] = 1.105667; aaVt[10][13] = 0.946499; aaVt[10][14] = 0.169784; 
+    aaVt[10][15] = 0.214977; aaVt[10][16] = 0.243227; aaVt[10][17] = 0.083439; aaVt[10][18] = 0.189842; aaVt[10][19] = 1.337571; 
+    aaVt[11][ 0] = 0.393245; aaVt[11][ 1] = 1.755838; aaVt[11][ 2] = 0.503060; aaVt[11][ 3] = 0.261101; aaVt[11][ 4] = 0.004067; 
+    aaVt[11][ 5] = 0.738208; aaVt[11][ 6] = 0.888630; aaVt[11][ 7] = 0.193243; aaVt[11][ 8] = 0.153323; aaVt[11][ 9] = 0.093181; 
+    aaVt[11][10] = 0.201204; aaVt[11][11] = 0.000000; aaVt[11][12] = 0.096474; aaVt[11][13] = 0.038261; aaVt[11][14] = 0.212302; 
+    aaVt[11][15] = 0.400072; aaVt[11][16] = 0.446646; aaVt[11][17] = 0.023321; aaVt[11][18] = 0.068689; aaVt[11][19] = 0.144587; 
+    aaVt[12][ 0] = 0.211550; aaVt[12][ 1] = 0.087930; aaVt[12][ 2] = 0.057420; aaVt[12][ 3] = 0.012182; aaVt[12][ 4] = 0.023690; 
+    aaVt[12][ 5] = 0.120801; aaVt[12][ 6] = 0.058643; aaVt[12][ 7] = 0.046560; aaVt[12][ 8] = 0.021157; aaVt[12][ 9] = 0.493845; 
+    aaVt[12][10] = 1.105667; aaVt[12][11] = 0.096474; aaVt[12][12] = 0.000000; aaVt[12][13] = 0.173052; aaVt[12][14] = 0.010363; 
+    aaVt[12][15] = 0.090515; aaVt[12][16] = 0.184609; aaVt[12][17] = 0.022019; aaVt[12][18] = 0.073223; aaVt[12][19] = 0.307309; 
+    aaVt[13][ 0] = 0.116646; aaVt[13][ 1] = 0.042569; aaVt[13][ 2] = 0.039769; aaVt[13][ 3] = 0.016577; aaVt[13][ 4] = 0.051127; 
+    aaVt[13][ 5] = 0.026235; aaVt[13][ 6] = 0.028168; aaVt[13][ 7] = 0.050143; aaVt[13][ 8] = 0.079807; aaVt[13][ 9] = 0.321020; 
+    aaVt[13][10] = 0.946499; aaVt[13][11] = 0.038261; aaVt[13][12] = 0.173052; aaVt[13][13] = 0.000000; aaVt[13][14] = 0.042564; 
+    aaVt[13][15] = 0.138119; aaVt[13][16] = 0.085870; aaVt[13][17] = 0.128050; aaVt[13][18] = 0.898663; aaVt[13][19] = 0.247329; 
+    aaVt[14][ 0] = 0.399143; aaVt[14][ 1] = 0.128480; aaVt[14][ 2] = 0.083956; aaVt[14][ 3] = 0.160063; aaVt[14][ 4] = 0.011137; 
+    aaVt[14][ 5] = 0.156570; aaVt[14][ 6] = 0.205134; aaVt[14][ 7] = 0.124492; aaVt[14][ 8] = 0.078892; aaVt[14][ 9] = 0.054797; 
+    aaVt[14][10] = 0.169784; aaVt[14][11] = 0.212302; aaVt[14][12] = 0.010363; aaVt[14][13] = 0.042564; aaVt[14][14] = 0.000000; 
+    aaVt[14][15] = 0.430431; aaVt[14][16] = 0.207143; aaVt[14][17] = 0.014584; aaVt[14][18] = 0.032043; aaVt[14][19] = 0.129315; 
+    aaVt[15][ 0] = 1.817198; aaVt[15][ 1] = 0.292327; aaVt[15][ 2] = 0.847049; aaVt[15][ 3] = 0.461519; aaVt[15][ 4] = 0.175270; 
+    aaVt[15][ 5] = 0.358017; aaVt[15][ 6] = 0.406035; aaVt[15][ 7] = 0.612843; aaVt[15][ 8] = 0.167406; aaVt[15][ 9] = 0.081567; 
+    aaVt[15][10] = 0.214977; aaVt[15][11] = 0.400072; aaVt[15][12] = 0.090515; aaVt[15][13] = 0.138119; aaVt[15][14] = 0.430431; 
+    aaVt[15][15] = 0.000000; aaVt[15][16] = 1.767766; aaVt[15][17] = 0.035933; aaVt[15][18] = 0.121979; aaVt[15][19] = 0.127700; 
+    aaVt[16][ 0] = 0.877877; aaVt[16][ 1] = 0.204109; aaVt[16][ 2] = 0.471268; aaVt[16][ 3] = 0.178197; aaVt[16][ 4] = 0.079511; 
+    aaVt[16][ 5] = 0.248992; aaVt[16][ 6] = 0.321028; aaVt[16][ 7] = 0.136266; aaVt[16][ 8] = 0.101117; aaVt[16][ 9] = 0.376588; 
+    aaVt[16][10] = 0.243227; aaVt[16][11] = 0.446646; aaVt[16][12] = 0.184609; aaVt[16][13] = 0.085870; aaVt[16][14] = 0.207143; 
+    aaVt[16][15] = 1.767766; aaVt[16][16] = 0.000000; aaVt[16][17] = 0.020437; aaVt[16][18] = 0.094617; aaVt[16][19] = 0.740372; 
+    aaVt[17][ 0] = 0.030309; aaVt[17][ 1] = 0.046417; aaVt[17][ 2] = 0.010459; aaVt[17][ 3] = 0.011393; aaVt[17][ 4] = 0.007732; 
+    aaVt[17][ 5] = 0.021248; aaVt[17][ 6] = 0.018844; aaVt[17][ 7] = 0.023990; aaVt[17][ 8] = 0.020009; aaVt[17][ 9] = 0.034954; 
+    aaVt[17][10] = 0.083439; aaVt[17][11] = 0.023321; aaVt[17][12] = 0.022019; aaVt[17][13] = 0.128050; aaVt[17][14] = 0.014584; 
+    aaVt[17][15] = 0.035933; aaVt[17][16] = 0.020437; aaVt[17][17] = 0.000000; aaVt[17][18] = 0.124746; aaVt[17][19] = 0.022134; 
+    aaVt[18][ 0] = 0.087061; aaVt[18][ 1] = 0.097010; aaVt[18][ 2] = 0.093268; aaVt[18][ 3] = 0.051664; aaVt[18][ 4] = 0.042823; 
+    aaVt[18][ 5] = 0.062544; aaVt[18][ 6] = 0.055200; aaVt[18][ 7] = 0.037568; aaVt[18][ 8] = 0.286027; aaVt[18][ 9] = 0.086237; 
+    aaVt[18][10] = 0.189842; aaVt[18][11] = 0.068689; aaVt[18][12] = 0.073223; aaVt[18][13] = 0.898663; aaVt[18][14] = 0.032043; 
+    aaVt[18][15] = 0.121979; aaVt[18][16] = 0.094617; aaVt[18][17] = 0.124746; aaVt[18][18] = 0.000000; aaVt[18][19] = 0.125733; 
+    aaVt[19][ 0] = 1.230985; aaVt[19][ 1] = 0.113146; aaVt[19][ 2] = 0.049824; aaVt[19][ 3] = 0.048769; aaVt[19][ 4] = 0.163831; 
+    aaVt[19][ 5] = 0.112027; aaVt[19][ 6] = 0.205868; aaVt[19][ 7] = 0.082579; aaVt[19][ 8] = 0.068575; aaVt[19][ 9] = 3.654430; 
+    aaVt[19][10] = 1.337571; aaVt[19][11] = 0.144587; aaVt[19][12] = 0.307309; aaVt[19][13] = 0.247329; aaVt[19][14] = 0.129315; 
+    aaVt[19][15] = 0.127700; aaVt[19][16] = 0.740372; aaVt[19][17] = 0.022134; aaVt[19][18] = 0.125733; aaVt[19][19] = 0.000000;
+
+    vtPi[ 0] = 0.078837;
+    vtPi[ 1] = 0.051238;
+    vtPi[ 2] = 0.042313;
+    vtPi[ 3] = 0.053066;
+    vtPi[ 4] = 0.015175;
+    vtPi[ 5] = 0.036713;
+    vtPi[ 6] = 0.061924;
+    vtPi[ 7] = 0.070852;
+    vtPi[ 8] = 0.023082;
+    vtPi[ 9] = 0.062056;
+    vtPi[10] = 0.096371;
+    vtPi[11] = 0.057324;
+    vtPi[12] = 0.023771;
+    vtPi[13] = 0.043296;
+    vtPi[14] = 0.043911;
+    vtPi[15] = 0.063403;
+    vtPi[16] = 0.055897;
+    vtPi[17] = 0.013272;
+    vtPi[18] = 0.034399;
+    vtPi[19] = 0.073101;
+    
+    /* Blosum62 */
+    aaBlosum[ 0][ 0] = 0.000000000000; aaBlosum[ 0][ 1] = 0.735790389698; aaBlosum[ 0][ 2] = 0.485391055466; aaBlosum[ 0][ 3] = 0.543161820899; aaBlosum[ 0][ 4] = 1.459995310470; 
+    aaBlosum[ 0][ 5] = 1.199705704602; aaBlosum[ 0][ 6] = 1.170949042800; aaBlosum[ 0][ 7] = 1.955883574960; aaBlosum[ 0][ 8] = 0.716241444998; aaBlosum[ 0][ 9] = 0.605899003687; 
+    aaBlosum[ 0][10] = 0.800016530518; aaBlosum[ 0][11] = 1.295201266783; aaBlosum[ 0][12] = 1.253758266664; aaBlosum[ 0][13] = 0.492964679748; aaBlosum[ 0][14] = 1.173275900924; 
+    aaBlosum[ 0][15] = 4.325092687057; aaBlosum[ 0][16] = 1.729178019485; aaBlosum[ 0][17] = 0.465839367725; aaBlosum[ 0][18] = 0.718206697586; aaBlosum[ 0][19] = 2.187774522005; 
+    aaBlosum[ 1][ 0] = 0.735790389698; aaBlosum[ 1][ 1] = 0.000000000000; aaBlosum[ 1][ 2] = 1.297446705134; aaBlosum[ 1][ 3] = 0.500964408555; aaBlosum[ 1][ 4] = 0.227826574209; 
+    aaBlosum[ 1][ 5] = 3.020833610064; aaBlosum[ 1][ 6] = 1.360574190420; aaBlosum[ 1][ 7] = 0.418763308518; aaBlosum[ 1][ 8] = 1.456141166336; aaBlosum[ 1][ 9] = 0.232036445142; 
+    aaBlosum[ 1][10] = 0.622711669692; aaBlosum[ 1][11] = 5.411115141489; aaBlosum[ 1][12] = 0.983692987457; aaBlosum[ 1][13] = 0.371644693209; aaBlosum[ 1][14] = 0.448133661718; 
+    aaBlosum[ 1][15] = 1.122783104210; aaBlosum[ 1][16] = 0.914665954563; aaBlosum[ 1][17] = 0.426382310122; aaBlosum[ 1][18] = 0.720517441216; aaBlosum[ 1][19] = 0.438388343772; 
+    aaBlosum[ 2][ 0] = 0.485391055466; aaBlosum[ 2][ 1] = 1.297446705134; aaBlosum[ 2][ 2] = 0.000000000000; aaBlosum[ 2][ 3] = 3.180100048216; aaBlosum[ 2][ 4] = 0.397358949897; 
+    aaBlosum[ 2][ 5] = 1.839216146992; aaBlosum[ 2][ 6] = 1.240488508640; aaBlosum[ 2][ 7] = 1.355872344485; aaBlosum[ 2][ 8] = 2.414501434208; aaBlosum[ 2][ 9] = 0.283017326278; 
+    aaBlosum[ 2][10] = 0.211888159615; aaBlosum[ 2][11] = 1.593137043457; aaBlosum[ 2][12] = 0.648441278787; aaBlosum[ 2][13] = 0.354861249223; aaBlosum[ 2][14] = 0.494887043702; 
+    aaBlosum[ 2][15] = 2.904101656456; aaBlosum[ 2][16] = 1.898173634533; aaBlosum[ 2][17] = 0.191482046247; aaBlosum[ 2][18] = 0.538222519037; aaBlosum[ 2][19] = 0.312858797993; 
+    aaBlosum[ 3][ 0] = 0.543161820899; aaBlosum[ 3][ 1] = 0.500964408555; aaBlosum[ 3][ 2] = 3.180100048216; aaBlosum[ 3][ 3] = 0.000000000000; aaBlosum[ 3][ 4] = 0.240836614802; 
+    aaBlosum[ 3][ 5] = 1.190945703396; aaBlosum[ 3][ 6] = 3.761625208368; aaBlosum[ 3][ 7] = 0.798473248968; aaBlosum[ 3][ 8] = 0.778142664022; aaBlosum[ 3][ 9] = 0.418555732462; 
+    aaBlosum[ 3][10] = 0.218131577594; aaBlosum[ 3][11] = 1.032447924952; aaBlosum[ 3][12] = 0.222621897958; aaBlosum[ 3][13] = 0.281730694207; aaBlosum[ 3][14] = 0.730628272998; 
+    aaBlosum[ 3][15] = 1.582754142065; aaBlosum[ 3][16] = 0.934187509431; aaBlosum[ 3][17] = 0.145345046279; aaBlosum[ 3][18] = 0.261422208965; aaBlosum[ 3][19] = 0.258129289418; 
+    aaBlosum[ 4][ 0] = 1.459995310470; aaBlosum[ 4][ 1] = 0.227826574209; aaBlosum[ 4][ 2] = 0.397358949897; aaBlosum[ 4][ 3] = 0.240836614802; aaBlosum[ 4][ 4] = 0.000000000000; 
+    aaBlosum[ 4][ 5] = 0.329801504630; aaBlosum[ 4][ 6] = 0.140748891814; aaBlosum[ 4][ 7] = 0.418203192284; aaBlosum[ 4][ 8] = 0.354058109831; aaBlosum[ 4][ 9] = 0.774894022794; 
+    aaBlosum[ 4][10] = 0.831842640142; aaBlosum[ 4][11] = 0.285078800906; aaBlosum[ 4][12] = 0.767688823480; aaBlosum[ 4][13] = 0.441337471187; aaBlosum[ 4][14] = 0.356008498769; 
+    aaBlosum[ 4][15] = 1.197188415094; aaBlosum[ 4][16] = 1.119831358516; aaBlosum[ 4][17] = 0.527664418872; aaBlosum[ 4][18] = 0.470237733696; aaBlosum[ 4][19] = 1.116352478606; 
+    aaBlosum[ 5][ 0] = 1.199705704602; aaBlosum[ 5][ 1] = 3.020833610064; aaBlosum[ 5][ 2] = 1.839216146992; aaBlosum[ 5][ 3] = 1.190945703396; aaBlosum[ 5][ 4] = 0.329801504630; 
+    aaBlosum[ 5][ 5] = 0.000000000000; aaBlosum[ 5][ 6] = 5.528919177928; aaBlosum[ 5][ 7] = 0.609846305383; aaBlosum[ 5][ 8] = 2.435341131140; aaBlosum[ 5][ 9] = 0.236202451204; 
+    aaBlosum[ 5][10] = 0.580737093181; aaBlosum[ 5][11] = 3.945277674515; aaBlosum[ 5][12] = 2.494896077113; aaBlosum[ 5][13] = 0.144356959750; aaBlosum[ 5][14] = 0.858570575674; 
+    aaBlosum[ 5][15] = 1.934870924596; aaBlosum[ 5][16] = 1.277480294596; aaBlosum[ 5][17] = 0.758653808642; aaBlosum[ 5][18] = 0.958989742850; aaBlosum[ 5][19] = 0.530785790125; 
+    aaBlosum[ 6][ 0] = 1.170949042800; aaBlosum[ 6][ 1] = 1.360574190420; aaBlosum[ 6][ 2] = 1.240488508640; aaBlosum[ 6][ 3] = 3.761625208368; aaBlosum[ 6][ 4] = 0.140748891814; 
+    aaBlosum[ 6][ 5] = 5.528919177928; aaBlosum[ 6][ 6] = 0.000000000000; aaBlosum[ 6][ 7] = 0.423579992176; aaBlosum[ 6][ 8] = 1.626891056982; aaBlosum[ 6][ 9] = 0.186848046932; 
+    aaBlosum[ 6][10] = 0.372625175087; aaBlosum[ 6][11] = 2.802427151679; aaBlosum[ 6][12] = 0.555415397470; aaBlosum[ 6][13] = 0.291409084165; aaBlosum[ 6][14] = 0.926563934846; 
+    aaBlosum[ 6][15] = 1.769893238937; aaBlosum[ 6][16] = 1.071097236007; aaBlosum[ 6][17] = 0.407635648938; aaBlosum[ 6][18] = 0.596719300346; aaBlosum[ 6][19] = 0.524253846338; 
+    aaBlosum[ 7][ 0] = 1.955883574960; aaBlosum[ 7][ 1] = 0.418763308518; aaBlosum[ 7][ 2] = 1.355872344485; aaBlosum[ 7][ 3] = 0.798473248968; aaBlosum[ 7][ 4] = 0.418203192284; 
+    aaBlosum[ 7][ 5] = 0.609846305383; aaBlosum[ 7][ 6] = 0.423579992176; aaBlosum[ 7][ 7] = 0.000000000000; aaBlosum[ 7][ 8] = 0.539859124954; aaBlosum[ 7][ 9] = 0.189296292376; 
+    aaBlosum[ 7][10] = 0.217721159236; aaBlosum[ 7][11] = 0.752042440303; aaBlosum[ 7][12] = 0.459436173579; aaBlosum[ 7][13] = 0.368166464453; aaBlosum[ 7][14] = 0.504086599527; 
+    aaBlosum[ 7][15] = 1.509326253224; aaBlosum[ 7][16] = 0.641436011405; aaBlosum[ 7][17] = 0.508358924638; aaBlosum[ 7][18] = 0.308055737035; aaBlosum[ 7][19] = 0.253340790190; 
+    aaBlosum[ 8][ 0] = 0.716241444998; aaBlosum[ 8][ 1] = 1.456141166336; aaBlosum[ 8][ 2] = 2.414501434208; aaBlosum[ 8][ 3] = 0.778142664022; aaBlosum[ 8][ 4] = 0.354058109831; 
+    aaBlosum[ 8][ 5] = 2.435341131140; aaBlosum[ 8][ 6] = 1.626891056982; aaBlosum[ 8][ 7] = 0.539859124954; aaBlosum[ 8][ 8] = 0.000000000000; aaBlosum[ 8][ 9] = 0.252718447885; 
+    aaBlosum[ 8][10] = 0.348072209797; aaBlosum[ 8][11] = 1.022507035889; aaBlosum[ 8][12] = 0.984311525359; aaBlosum[ 8][13] = 0.714533703928; aaBlosum[ 8][14] = 0.527007339151; 
+    aaBlosum[ 8][15] = 1.117029762910; aaBlosum[ 8][16] = 0.585407090225; aaBlosum[ 8][17] = 0.301248600780; aaBlosum[ 8][18] = 4.218953969389; aaBlosum[ 8][19] = 0.201555971750; 
+    aaBlosum[ 9][ 0] = 0.605899003687; aaBlosum[ 9][ 1] = 0.232036445142; aaBlosum[ 9][ 2] = 0.283017326278; aaBlosum[ 9][ 3] = 0.418555732462; aaBlosum[ 9][ 4] = 0.774894022794; 
+    aaBlosum[ 9][ 5] = 0.236202451204; aaBlosum[ 9][ 6] = 0.186848046932; aaBlosum[ 9][ 7] = 0.189296292376; aaBlosum[ 9][ 8] = 0.252718447885; aaBlosum[ 9][ 9] = 0.000000000000; 
+    aaBlosum[ 9][10] = 3.890963773304; aaBlosum[ 9][11] = 0.406193586642; aaBlosum[ 9][12] = 3.364797763104; aaBlosum[ 9][13] = 1.517359325954; aaBlosum[ 9][14] = 0.388355409206; 
+    aaBlosum[ 9][15] = 0.357544412460; aaBlosum[ 9][16] = 1.179091197260; aaBlosum[ 9][17] = 0.341985787540; aaBlosum[ 9][18] = 0.674617093228; aaBlosum[ 9][19] = 8.311839405458; 
+    aaBlosum[10][ 0] = 0.800016530518; aaBlosum[10][ 1] = 0.622711669692; aaBlosum[10][ 2] = 0.211888159615; aaBlosum[10][ 3] = 0.218131577594; aaBlosum[10][ 4] = 0.831842640142; 
+    aaBlosum[10][ 5] = 0.580737093181; aaBlosum[10][ 6] = 0.372625175087; aaBlosum[10][ 7] = 0.217721159236; aaBlosum[10][ 8] = 0.348072209797; aaBlosum[10][ 9] = 3.890963773304; 
+    aaBlosum[10][10] = 0.000000000000; aaBlosum[10][11] = 0.445570274261; aaBlosum[10][12] = 6.030559379572; aaBlosum[10][13] = 2.064839703237; aaBlosum[10][14] = 0.374555687471; 
+    aaBlosum[10][15] = 0.352969184527; aaBlosum[10][16] = 0.915259857694; aaBlosum[10][17] = 0.691474634600; aaBlosum[10][18] = 0.811245856323; aaBlosum[10][19] = 2.231405688913; 
+    aaBlosum[11][ 0] = 1.295201266783; aaBlosum[11][ 1] = 5.411115141489; aaBlosum[11][ 2] = 1.593137043457; aaBlosum[11][ 3] = 1.032447924952; aaBlosum[11][ 4] = 0.285078800906; 
+    aaBlosum[11][ 5] = 3.945277674515; aaBlosum[11][ 6] = 2.802427151679; aaBlosum[11][ 7] = 0.752042440303; aaBlosum[11][ 8] = 1.022507035889; aaBlosum[11][ 9] = 0.406193586642; 
+    aaBlosum[11][10] = 0.445570274261; aaBlosum[11][11] = 0.000000000000; aaBlosum[11][12] = 1.073061184332; aaBlosum[11][13] = 0.266924750511; aaBlosum[11][14] = 1.047383450722; 
+    aaBlosum[11][15] = 1.752165917819; aaBlosum[11][16] = 1.303875200799; aaBlosum[11][17] = 0.332243040634; aaBlosum[11][18] = 0.717993486900; aaBlosum[11][19] = 0.498138475304; 
+    aaBlosum[12][ 0] = 1.253758266664; aaBlosum[12][ 1] = 0.983692987457; aaBlosum[12][ 2] = 0.648441278787; aaBlosum[12][ 3] = 0.222621897958; aaBlosum[12][ 4] = 0.767688823480; 
+    aaBlosum[12][ 5] = 2.494896077113; aaBlosum[12][ 6] = 0.555415397470; aaBlosum[12][ 7] = 0.459436173579; aaBlosum[12][ 8] = 0.984311525359; aaBlosum[12][ 9] = 3.364797763104; 
+    aaBlosum[12][10] = 6.030559379572; aaBlosum[12][11] = 1.073061184332; aaBlosum[12][12] = 0.000000000000; aaBlosum[12][13] = 1.773855168830; aaBlosum[12][14] = 0.454123625103; 
+    aaBlosum[12][15] = 0.918723415746; aaBlosum[12][16] = 1.488548053722; aaBlosum[12][17] = 0.888101098152; aaBlosum[12][18] = 0.951682162246; aaBlosum[12][19] = 2.575850755315; 
+    aaBlosum[13][ 0] = 0.492964679748; aaBlosum[13][ 1] = 0.371644693209; aaBlosum[13][ 2] = 0.354861249223; aaBlosum[13][ 3] = 0.281730694207; aaBlosum[13][ 4] = 0.441337471187; 
+    aaBlosum[13][ 5] = 0.144356959750; aaBlosum[13][ 6] = 0.291409084165; aaBlosum[13][ 7] = 0.368166464453; aaBlosum[13][ 8] = 0.714533703928; aaBlosum[13][ 9] = 1.517359325954; 
+    aaBlosum[13][10] = 2.064839703237; aaBlosum[13][11] = 0.266924750511; aaBlosum[13][12] = 1.773855168830; aaBlosum[13][13] = 0.000000000000; aaBlosum[13][14] = 0.233597909629; 
+    aaBlosum[13][15] = 0.540027644824; aaBlosum[13][16] = 0.488206118793; aaBlosum[13][17] = 2.074324893497; aaBlosum[13][18] = 6.747260430801; aaBlosum[13][19] = 0.838119610178; 
+    aaBlosum[14][ 0] = 1.173275900924; aaBlosum[14][ 1] = 0.448133661718; aaBlosum[14][ 2] = 0.494887043702; aaBlosum[14][ 3] = 0.730628272998; aaBlosum[14][ 4] = 0.356008498769; 
+    aaBlosum[14][ 5] = 0.858570575674; aaBlosum[14][ 6] = 0.926563934846; aaBlosum[14][ 7] = 0.504086599527; aaBlosum[14][ 8] = 0.527007339151; aaBlosum[14][ 9] = 0.388355409206; 
+    aaBlosum[14][10] = 0.374555687471; aaBlosum[14][11] = 1.047383450722; aaBlosum[14][12] = 0.454123625103; aaBlosum[14][13] = 0.233597909629; aaBlosum[14][14] = 0.000000000000; 
+    aaBlosum[14][15] = 1.169129577716; aaBlosum[14][16] = 1.005451683149; aaBlosum[14][17] = 0.252214830027; aaBlosum[14][18] = 0.369405319355; aaBlosum[14][19] = 0.496908410676; 
+    aaBlosum[15][ 0] = 4.325092687057; aaBlosum[15][ 1] = 1.122783104210; aaBlosum[15][ 2] = 2.904101656456; aaBlosum[15][ 3] = 1.582754142065; aaBlosum[15][ 4] = 1.197188415094; 
+    aaBlosum[15][ 5] = 1.934870924596; aaBlosum[15][ 6] = 1.769893238937; aaBlosum[15][ 7] = 1.509326253224; aaBlosum[15][ 8] = 1.117029762910; aaBlosum[15][ 9] = 0.357544412460; 
+    aaBlosum[15][10] = 0.352969184527; aaBlosum[15][11] = 1.752165917819; aaBlosum[15][12] = 0.918723415746; aaBlosum[15][13] = 0.540027644824; aaBlosum[15][14] = 1.169129577716; 
+    aaBlosum[15][15] = 0.000000000000; aaBlosum[15][16] = 5.151556292270; aaBlosum[15][17] = 0.387925622098; aaBlosum[15][18] = 0.796751520761; aaBlosum[15][19] = 0.561925457442; 
+    aaBlosum[16][ 0] = 1.729178019485; aaBlosum[16][ 1] = 0.914665954563; aaBlosum[16][ 2] = 1.898173634533; aaBlosum[16][ 3] = 0.934187509431; aaBlosum[16][ 4] = 1.119831358516; 
+    aaBlosum[16][ 5] = 1.277480294596; aaBlosum[16][ 6] = 1.071097236007; aaBlosum[16][ 7] = 0.641436011405; aaBlosum[16][ 8] = 0.585407090225; aaBlosum[16][ 9] = 1.179091197260; 
+    aaBlosum[16][10] = 0.915259857694; aaBlosum[16][11] = 1.303875200799; aaBlosum[16][12] = 1.488548053722; aaBlosum[16][13] = 0.488206118793; aaBlosum[16][14] = 1.005451683149; 
+    aaBlosum[16][15] = 5.151556292270; aaBlosum[16][16] = 0.000000000000; aaBlosum[16][17] = 0.513128126891; aaBlosum[16][18] = 0.801010243199; aaBlosum[16][19] = 2.253074051176; 
+    aaBlosum[17][ 0] = 0.465839367725; aaBlosum[17][ 1] = 0.426382310122; aaBlosum[17][ 2] = 0.191482046247; aaBlosum[17][ 3] = 0.145345046279; aaBlosum[17][ 4] = 0.527664418872; 
+    aaBlosum[17][ 5] = 0.758653808642; aaBlosum[17][ 6] = 0.407635648938; aaBlosum[17][ 7] = 0.508358924638; aaBlosum[17][ 8] = 0.301248600780; aaBlosum[17][ 9] = 0.341985787540; 
+    aaBlosum[17][10] = 0.691474634600; aaBlosum[17][11] = 0.332243040634; aaBlosum[17][12] = 0.888101098152; aaBlosum[17][13] = 2.074324893497; aaBlosum[17][14] = 0.252214830027; 
+    aaBlosum[17][15] = 0.387925622098; aaBlosum[17][16] = 0.513128126891; aaBlosum[17][17] = 0.000000000000; aaBlosum[17][18] = 4.054419006558; aaBlosum[17][19] = 0.266508731426; 
+    aaBlosum[18][ 0] = 0.718206697586; aaBlosum[18][ 1] = 0.720517441216; aaBlosum[18][ 2] = 0.538222519037; aaBlosum[18][ 3] = 0.261422208965; aaBlosum[18][ 4] = 0.470237733696; 
+    aaBlosum[18][ 5] = 0.958989742850; aaBlosum[18][ 6] = 0.596719300346; aaBlosum[18][ 7] = 0.308055737035; aaBlosum[18][ 8] = 4.218953969389; aaBlosum[18][ 9] = 0.674617093228; 
+    aaBlosum[18][10] = 0.811245856323; aaBlosum[18][11] = 0.717993486900; aaBlosum[18][12] = 0.951682162246; aaBlosum[18][13] = 6.747260430801; aaBlosum[18][14] = 0.369405319355; 
+    aaBlosum[18][15] = 0.796751520761; aaBlosum[18][16] = 0.801010243199; aaBlosum[18][17] = 4.054419006558; aaBlosum[18][18] = 0.000000000000; aaBlosum[18][19] = 1.000000000000; 
+    aaBlosum[19][ 0] = 2.187774522005; aaBlosum[19][ 1] = 0.438388343772; aaBlosum[19][ 2] = 0.312858797993; aaBlosum[19][ 3] = 0.258129289418; aaBlosum[19][ 4] = 1.116352478606; 
+    aaBlosum[19][ 5] = 0.530785790125; aaBlosum[19][ 6] = 0.524253846338; aaBlosum[19][ 7] = 0.253340790190; aaBlosum[19][ 8] = 0.201555971750; aaBlosum[19][ 9] = 8.311839405458; 
+    aaBlosum[19][10] = 2.231405688913; aaBlosum[19][11] = 0.498138475304; aaBlosum[19][12] = 2.575850755315; aaBlosum[19][13] = 0.838119610178; aaBlosum[19][14] = 0.496908410676; 
+    aaBlosum[19][15] = 0.561925457442; aaBlosum[19][16] = 2.253074051176; aaBlosum[19][17] = 0.266508731426; aaBlosum[19][18] = 1.000000000000; aaBlosum[19][19] = 0.000000000000;
+
+    blosPi[ 0] = 0.074; 
+    blosPi[ 1] = 0.052; 
+    blosPi[ 2] = 0.045; 
+    blosPi[ 3] = 0.054;
+    blosPi[ 4] = 0.025; 
+    blosPi[ 5] = 0.034; 
+    blosPi[ 6] = 0.054; 
+    blosPi[ 7] = 0.074;
+    blosPi[ 8] = 0.026; 
+    blosPi[ 9] = 0.068; 
+    blosPi[10] = 0.099; 
+    blosPi[11] = 0.058;
+    blosPi[12] = 0.025; 
+    blosPi[13] = 0.047; 
+    blosPi[14] = 0.039; 
+    blosPi[15] = 0.057;
+    blosPi[16] = 0.051; 
+    blosPi[17] = 0.013; 
+    blosPi[18] = 0.032; 
+    blosPi[19] = 0.073;
+
+    /* LG */
+    aaLG[ 0][ 0] = 0.000000; aaLG[ 0][ 1] = 0.425093; aaLG[ 0][ 2] = 0.276818; aaLG[ 0][ 3] = 0.395144; aaLG[ 0][ 4] = 2.489084;
+    aaLG[ 0][ 5] = 0.969894; aaLG[ 0][ 6] = 1.038545; aaLG[ 0][ 7] = 2.066040; aaLG[ 0][ 8] = 0.358858; aaLG[ 0][ 9] = 0.149830;
+    aaLG[ 0][10] = 0.395337; aaLG[ 0][11] = 0.536518; aaLG[ 0][12] = 1.124035; aaLG[ 0][13] = 0.253701; aaLG[ 0][14] = 1.177651;
+    aaLG[ 0][15] = 4.727182; aaLG[ 0][16] = 2.139501; aaLG[ 0][17] = 0.180717; aaLG[ 0][18] = 0.218959; aaLG[ 0][19] = 2.547870;
+    aaLG[ 1][ 0] = 0.425093; aaLG[ 1][ 1] = 0.000000; aaLG[ 1][ 2] = 0.751878; aaLG[ 1][ 3] = 0.123954; aaLG[ 1][ 4] = 0.534551;
+    aaLG[ 1][ 5] = 2.807908; aaLG[ 1][ 6] = 0.363970; aaLG[ 1][ 7] = 0.390192; aaLG[ 1][ 8] = 2.426601; aaLG[ 1][ 9] = 0.126991;
+    aaLG[ 1][10] = 0.301848; aaLG[ 1][11] = 6.326067; aaLG[ 1][12] = 0.484133; aaLG[ 1][13] = 0.052722; aaLG[ 1][14] = 0.332533;
+    aaLG[ 1][15] = 0.858151; aaLG[ 1][16] = 0.578987; aaLG[ 1][17] = 0.593607; aaLG[ 1][18] = 0.314440; aaLG[ 1][19] = 0.170887;
+    aaLG[ 2][ 0] = 0.276818; aaLG[ 2][ 1] = 0.751878; aaLG[ 2][ 2] = 0.000000; aaLG[ 2][ 3] = 5.076149; aaLG[ 2][ 4] = 0.528768;
+    aaLG[ 2][ 5] = 1.695752; aaLG[ 2][ 6] = 0.541712; aaLG[ 2][ 7] = 1.437645; aaLG[ 2][ 8] = 4.509238; aaLG[ 2][ 9] = 0.191503;
+    aaLG[ 2][10] = 0.068427; aaLG[ 2][11] = 2.145078; aaLG[ 2][12] = 0.371004; aaLG[ 2][13] = 0.089525; aaLG[ 2][14] = 0.161787;
+    aaLG[ 2][15] = 4.008358; aaLG[ 2][16] = 2.000679; aaLG[ 2][17] = 0.045376; aaLG[ 2][18] = 0.612025; aaLG[ 2][19] = 0.083688;
+    aaLG[ 3][ 0] = 0.395144; aaLG[ 3][ 1] = 0.123954; aaLG[ 3][ 2] = 5.076149; aaLG[ 3][ 3] = 0.000000; aaLG[ 3][ 4] = 0.062556;
+    aaLG[ 3][ 5] = 0.523386; aaLG[ 3][ 6] = 5.243870; aaLG[ 3][ 7] = 0.844926; aaLG[ 3][ 8] = 0.927114; aaLG[ 3][ 9] = 0.010690;
+    aaLG[ 3][10] = 0.015076; aaLG[ 3][11] = 0.282959; aaLG[ 3][12] = 0.025548; aaLG[ 3][13] = 0.017416; aaLG[ 3][14] = 0.394456;
+    aaLG[ 3][15] = 1.240275; aaLG[ 3][16] = 0.425860; aaLG[ 3][17] = 0.029890; aaLG[ 3][18] = 0.135107; aaLG[ 3][19] = 0.037967;
+    aaLG[ 4][ 0] = 2.489084; aaLG[ 4][ 1] = 0.534551; aaLG[ 4][ 2] = 0.528768; aaLG[ 4][ 3] = 0.062556; aaLG[ 4][ 4] = 0.000000;
+    aaLG[ 4][ 5] = 0.084808; aaLG[ 4][ 6] = 0.003499; aaLG[ 4][ 7] = 0.569265; aaLG[ 4][ 8] = 0.640543; aaLG[ 4][ 9] = 0.320627;
+    aaLG[ 4][10] = 0.594007; aaLG[ 4][11] = 0.013266; aaLG[ 4][12] = 0.893680; aaLG[ 4][13] = 1.105251; aaLG[ 4][14] = 0.075382;
+    aaLG[ 4][15] = 2.784478; aaLG[ 4][16] = 1.143480; aaLG[ 4][17] = 0.670128; aaLG[ 4][18] = 1.165532; aaLG[ 4][19] = 1.959291;
+    aaLG[ 5][ 0] = 0.969894; aaLG[ 5][ 1] = 2.807908; aaLG[ 5][ 2] = 1.695752; aaLG[ 5][ 3] = 0.523386; aaLG[ 5][ 4] = 0.084808;
+    aaLG[ 5][ 5] = 0.000000; aaLG[ 5][ 6] = 4.128591; aaLG[ 5][ 7] = 0.267959; aaLG[ 5][ 8] = 4.813505; aaLG[ 5][ 9] = 0.072854;
+    aaLG[ 5][10] = 0.582457; aaLG[ 5][11] = 3.234294; aaLG[ 5][12] = 1.672569; aaLG[ 5][13] = 0.035855; aaLG[ 5][14] = 0.624294;
+    aaLG[ 5][15] = 1.223828; aaLG[ 5][16] = 1.080136; aaLG[ 5][17] = 0.236199; aaLG[ 5][18] = 0.257336; aaLG[ 5][19] = 0.210332;
+    aaLG[ 6][ 0] = 1.038545; aaLG[ 6][ 1] = 0.363970; aaLG[ 6][ 2] = 0.541712; aaLG[ 6][ 3] = 5.243870; aaLG[ 6][ 4] = 0.003499;
+    aaLG[ 6][ 5] = 4.128591; aaLG[ 6][ 6] = 0.000000; aaLG[ 6][ 7] = 0.348847; aaLG[ 6][ 8] = 0.423881; aaLG[ 6][ 9] = 0.044265;
+    aaLG[ 6][10] = 0.069673; aaLG[ 6][11] = 1.807177; aaLG[ 6][12] = 0.173735; aaLG[ 6][13] = 0.018811; aaLG[ 6][14] = 0.419409;
+    aaLG[ 6][15] = 0.611973; aaLG[ 6][16] = 0.604545; aaLG[ 6][17] = 0.077852; aaLG[ 6][18] = 0.120037; aaLG[ 6][19] = 0.245034;
+    aaLG[ 7][ 0] = 2.066040; aaLG[ 7][ 1] = 0.390192; aaLG[ 7][ 2] = 1.437645; aaLG[ 7][ 3] = 0.844926; aaLG[ 7][ 4] = 0.569265;
+    aaLG[ 7][ 5] = 0.267959; aaLG[ 7][ 6] = 0.348847; aaLG[ 7][ 7] = 0.000000; aaLG[ 7][ 8] = 0.311484; aaLG[ 7][ 9] = 0.008705;
+    aaLG[ 7][10] = 0.044261; aaLG[ 7][11] = 0.296636; aaLG[ 7][12] = 0.139538; aaLG[ 7][13] = 0.089586; aaLG[ 7][14] = 0.196961;
+    aaLG[ 7][15] = 1.739990; aaLG[ 7][16] = 0.129836; aaLG[ 7][17] = 0.268491; aaLG[ 7][18] = 0.054679; aaLG[ 7][19] = 0.076701;
+    aaLG[ 8][ 0] = 0.358858; aaLG[ 8][ 1] = 2.426601; aaLG[ 8][ 2] = 4.509238; aaLG[ 8][ 3] = 0.927114; aaLG[ 8][ 4] = 0.640543;
+    aaLG[ 8][ 5] = 4.813505; aaLG[ 8][ 6] = 0.423881; aaLG[ 8][ 7] = 0.311484; aaLG[ 8][ 8] = 0.000000; aaLG[ 8][ 9] = 0.108882;
+    aaLG[ 8][10] = 0.366317; aaLG[ 8][11] = 0.697264; aaLG[ 8][12] = 0.442472; aaLG[ 8][13] = 0.682139; aaLG[ 8][14] = 0.508851;
+    aaLG[ 8][15] = 0.990012; aaLG[ 8][16] = 0.584262; aaLG[ 8][17] = 0.597054; aaLG[ 8][18] = 5.306834; aaLG[ 8][19] = 0.119013;
+    aaLG[ 9][ 0] = 0.149830; aaLG[ 9][ 1] = 0.126991; aaLG[ 9][ 2] = 0.191503; aaLG[ 9][ 3] = 0.010690; aaLG[ 9][ 4] = 0.320627;
+    aaLG[ 9][ 5] = 0.072854; aaLG[ 9][ 6] = 0.044265; aaLG[ 9][ 7] = 0.008705; aaLG[ 9][ 8] = 0.108882; aaLG[ 9][ 9] = 0.000000;
+    aaLG[ 9][10] = 4.145067; aaLG[ 9][11] = 0.159069; aaLG[ 9][12] = 4.273607; aaLG[ 9][13] = 1.112727; aaLG[ 9][14] = 0.078281;
+    aaLG[ 9][15] = 0.064105; aaLG[ 9][16] = 1.033739; aaLG[ 9][17] = 0.111660; aaLG[ 9][18] = 0.232523; aaLG[ 9][19] = 10.649107;
+    aaLG[10][ 0] = 0.395337; aaLG[10][ 1] = 0.301848; aaLG[10][ 2] = 0.068427; aaLG[10][ 3] = 0.015076; aaLG[10][ 4] = 0.594007;
+    aaLG[10][ 5] = 0.582457; aaLG[10][ 6] = 0.069673; aaLG[10][ 7] = 0.044261; aaLG[10][ 8] = 0.366317; aaLG[10][ 9] = 4.145067;
+    aaLG[10][10] = 0.000000; aaLG[10][11] = 0.137500; aaLG[10][12] = 6.312358; aaLG[10][13] = 2.592692; aaLG[10][14] = 0.249060;
+    aaLG[10][15] = 0.182287; aaLG[10][16] = 0.302936; aaLG[10][17] = 0.619632; aaLG[10][18] = 0.299648; aaLG[10][19] = 1.702745;
+    aaLG[11][ 0] = 0.536518; aaLG[11][ 1] = 6.326067; aaLG[11][ 2] = 2.145078; aaLG[11][ 3] = 0.282959; aaLG[11][ 4] = 0.013266;
+    aaLG[11][ 5] = 3.234294; aaLG[11][ 6] = 1.807177; aaLG[11][ 7] = 0.296636; aaLG[11][ 8] = 0.697264; aaLG[11][ 9] = 0.159069;
+    aaLG[11][10] = 0.137500; aaLG[11][11] = 0.000000; aaLG[11][12] = 0.656604; aaLG[11][13] = 0.023918; aaLG[11][14] = 0.390322;
+    aaLG[11][15] = 0.748683; aaLG[11][16] = 1.136863; aaLG[11][17] = 0.049906; aaLG[11][18] = 0.131932; aaLG[11][19] = 0.185202;
+    aaLG[12][ 0] = 1.124035; aaLG[12][ 1] = 0.484133; aaLG[12][ 2] = 0.371004; aaLG[12][ 3] = 0.025548; aaLG[12][ 4] = 0.893680;
+    aaLG[12][ 5] = 1.672569; aaLG[12][ 6] = 0.173735; aaLG[12][ 7] = 0.139538; aaLG[12][ 8] = 0.442472; aaLG[12][ 9] = 4.273607;
+    aaLG[12][10] = 6.312358; aaLG[12][11] = 0.656604; aaLG[12][12] = 0.000000; aaLG[12][13] = 1.798853; aaLG[12][14] = 0.099849;
+    aaLG[12][15] = 0.346960; aaLG[12][16] = 2.020366; aaLG[12][17] = 0.696175; aaLG[12][18] = 0.481306; aaLG[12][19] = 1.898718;
+    aaLG[13][ 0] = 0.253701; aaLG[13][ 1] = 0.052722; aaLG[13][ 2] = 0.089525; aaLG[13][ 3] = 0.017416; aaLG[13][ 4] = 1.105251;
+    aaLG[13][ 5] = 0.035855; aaLG[13][ 6] = 0.018811; aaLG[13][ 7] = 0.089586; aaLG[13][ 8] = 0.682139; aaLG[13][ 9] = 1.112727;
+    aaLG[13][10] = 2.592692; aaLG[13][11] = 0.023918; aaLG[13][12] = 1.798853; aaLG[13][13] = 0.000000; aaLG[13][14] = 0.094464;
+    aaLG[13][15] = 0.361819; aaLG[13][16] = 0.165001; aaLG[13][17] = 2.457121; aaLG[13][18] = 7.803902; aaLG[13][19] = 0.654683;
+    aaLG[14][ 0] = 1.177651; aaLG[14][ 1] = 0.332533; aaLG[14][ 2] = 0.161787; aaLG[14][ 3] = 0.394456; aaLG[14][ 4] = 0.075382;
+    aaLG[14][ 5] = 0.624294; aaLG[14][ 6] = 0.419409; aaLG[14][ 7] = 0.196961; aaLG[14][ 8] = 0.508851; aaLG[14][ 9] = 0.078281;
+    aaLG[14][10] = 0.249060; aaLG[14][11] = 0.390322; aaLG[14][12] = 0.099849; aaLG[14][13] = 0.094464; aaLG[14][14] = 0.000000;
+    aaLG[14][15] = 1.338132; aaLG[14][16] = 0.571468; aaLG[14][17] = 0.095131; aaLG[14][18] = 0.089613; aaLG[14][19] = 0.296501;
+    aaLG[15][ 0] = 4.727182; aaLG[15][ 1] = 0.858151; aaLG[15][ 2] = 4.008358; aaLG[15][ 3] = 1.240275; aaLG[15][ 4] = 2.784478;
+    aaLG[15][ 5] = 1.223828; aaLG[15][ 6] = 0.611973; aaLG[15][ 7] = 1.739990; aaLG[15][ 8] = 0.990012; aaLG[15][ 9] = 0.064105;
+    aaLG[15][10] = 0.182287; aaLG[15][11] = 0.748683; aaLG[15][12] = 0.346960; aaLG[15][13] = 0.361819; aaLG[15][14] = 1.338132;
+    aaLG[15][15] = 0.000000; aaLG[15][16] = 6.472279; aaLG[15][17] = 0.248862; aaLG[15][18] = 0.400547; aaLG[15][19] = 0.098369;
+    aaLG[16][ 0] = 2.139501; aaLG[16][ 1] = 0.578987; aaLG[16][ 2] = 2.000679; aaLG[16][ 3] = 0.425860; aaLG[16][ 4] = 1.143480;
+    aaLG[16][ 5] = 1.080136; aaLG[16][ 6] = 0.604545; aaLG[16][ 7] = 0.129836; aaLG[16][ 8] = 0.584262; aaLG[16][ 9] = 1.033739;
+    aaLG[16][10] = 0.302936; aaLG[16][11] = 1.136863; aaLG[16][12] = 2.020366; aaLG[16][13] = 0.165001; aaLG[16][14] = 0.571468;
+    aaLG[16][15] = 6.472279; aaLG[16][16] = 0.000000; aaLG[16][17] = 0.140825; aaLG[16][18] = 0.245841; aaLG[16][19] = 2.188158;
+    aaLG[17][ 0] = 0.180717; aaLG[17][ 1] = 0.593607; aaLG[17][ 2] = 0.045376; aaLG[17][ 3] = 0.029890; aaLG[17][ 4] = 0.670128;
+    aaLG[17][ 5] = 0.236199; aaLG[17][ 6] = 0.077852; aaLG[17][ 7] = 0.268491; aaLG[17][ 8] = 0.597054; aaLG[17][ 9] = 0.111660;
+    aaLG[17][10] = 0.619632; aaLG[17][11] = 0.049906; aaLG[17][12] = 0.696175; aaLG[17][13] = 2.457121; aaLG[17][14] = 0.095131;
+    aaLG[17][15] = 0.248862; aaLG[17][16] = 0.140825; aaLG[17][17] = 0.000000; aaLG[17][18] = 3.151815; aaLG[17][19] = 0.189510;
+    aaLG[18][ 0] = 0.218959; aaLG[18][ 1] = 0.314440; aaLG[18][ 2] = 0.612025; aaLG[18][ 3] = 0.135107; aaLG[18][ 4] = 1.165532;
+    aaLG[18][ 5] = 0.257336; aaLG[18][ 6] = 0.120037; aaLG[18][ 7] = 0.054679; aaLG[18][ 8] = 5.306834; aaLG[18][ 9] = 0.232523;
+    aaLG[18][10] = 0.299648; aaLG[18][11] = 0.131932; aaLG[18][12] = 0.481306; aaLG[18][13] = 7.803902; aaLG[18][14] = 0.089613;
+    aaLG[18][15] = 0.400547; aaLG[18][16] = 0.245841; aaLG[18][17] = 3.151815; aaLG[18][18] = 0.000000; aaLG[18][19] = 0.249313;
+    aaLG[19][ 0] = 2.547870; aaLG[19][ 1] = 0.170887; aaLG[19][ 2] = 0.083688; aaLG[19][ 3] = 0.037967; aaLG[19][ 4] = 1.959291;
+    aaLG[19][ 5] = 0.210332; aaLG[19][ 6] = 0.245034; aaLG[19][ 7] = 0.076701; aaLG[19][ 8] = 0.119013; aaLG[19][ 9] = 10.649107;
+    aaLG[19][10] = 1.702745; aaLG[19][11] = 0.185202; aaLG[19][12] = 1.898718; aaLG[19][13] = 0.654683; aaLG[19][14] = 0.296501;
+    aaLG[19][15] = 0.098369; aaLG[19][16] = 2.188158; aaLG[19][17] = 0.189510; aaLG[19][18] = 0.249313; aaLG[19][19] = 0.000000;
+
+    lgPi[0] = 0.079066;  lgPi[1] = 0.055941;  lgPi[2] = 0.041977;  lgPi[3] = 0.053052;
+    lgPi[4] = 0.012937;  lgPi[5] = 0.040767;  lgPi[6] = 0.071586;  lgPi[7] = 0.057337;
+    lgPi[8] = 0.022355;  lgPi[9] = 0.062157;  lgPi[10] = 0.099081; lgPi[11] = 0.064600;
+    lgPi[12] = 0.022951; lgPi[13] = 0.042302; lgPi[14] = 0.044040; lgPi[15] = 0.061197;
+    lgPi[16] = 0.053287; lgPi[17] = 0.012066; lgPi[18] = 0.034155; lgPi[19] = 0.069147;
+
+    /* now, check that the matrices are symmetrical */
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaJones[i][j] - aaJones[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: Jones model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaDayhoff[i][j] - aaDayhoff[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: Dayhoff model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaMtrev24[i][j] - aaMtrev24[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: mtrev24 model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaMtmam[i][j] - aaMtmam[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: mtmam model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aartREV[i][j] - aartREV[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: aartREV model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaWAG[i][j] - aaWAG[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: aaWAG model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aacpREV[i][j] - aacpREV[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: cpREV model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaVt[i][j] - aaVt[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: Vt model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaBlosum[i][j] - aaBlosum[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: Blosum model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            diff = aaLG[i][j] - aaLG[j][i];
+            if (diff < 0.0)
+                diff = -diff;
+            if (diff > 0.001)
+                {
+                MrBayesPrint ("%s   ERROR: LG model is not symmetrical.\n");
+                return (ERROR);
+                }
+            }
+        }
+    
+    /* rescale stationary frequencies, to make certain they sum to 1.0 */
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += jonesPi[i];
+    for (i=0; i<20; i++)
+        jonesPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += dayhoffPi[i];
+    for (i=0; i<20; i++)
+        dayhoffPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += mtrev24Pi[i];
+    for (i=0; i<20; i++)
+        mtrev24Pi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += mtmamPi[i];
+    for (i=0; i<20; i++)
+        mtmamPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += rtrevPi[i];
+    for (i=0; i<20; i++)
+        rtrevPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += wagPi[i];
+    for (i=0; i<20; i++)
+        wagPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += cprevPi[i];
+    for (i=0; i<20; i++)
+        cprevPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += vtPi[i];
+    for (i=0; i<20; i++)
+        vtPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += blosPi[i];
+    for (i=0; i<20; i++)
+        blosPi[i] /= sum;
+    sum = 0.0;
+    for (i=0; i<20; i++)
+        sum += lgPi[i];
+    for (i=0; i<20; i++)
+        lgPi[i] /= sum;
+    
+    /* multiply entries by amino acid frequencies */
+    for (i=0; i<20; i++)
+        {
+        for (j=0; j<20; j++)
+            {
+            aaJones[i][j]   *= jonesPi[j];
+            aaDayhoff[i][j] *= dayhoffPi[j];
+            aaMtrev24[i][j] *= mtrev24Pi[j];
+            aaMtmam[i][j]   *= mtmamPi[j];
+            aartREV[i][j]   *= rtrevPi[j];
+            aaWAG[i][j]     *= wagPi[j];
+            aacpREV[i][j]   *= cprevPi[j];
+            aaVt[i][j]      *= vtPi[j];
+            aaBlosum[i][j]  *= blosPi[j];
+            aaLG[i][j]      *= lgPi[j];
+            }
+        }
+        
+    /* rescale, so branch lengths are in terms of expected number of
+       amino acid substitutions per site */
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += jonesPi[i] * aaJones[i][j];
+            scaler += jonesPi[j] * aaJones[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaJones[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += dayhoffPi[i] * aaDayhoff[i][j];
+            scaler += dayhoffPi[j] * aaDayhoff[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaDayhoff[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += mtrev24Pi[i] * aaMtrev24[i][j];
+            scaler += mtrev24Pi[j] * aaMtrev24[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaMtrev24[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += mtmamPi[i] * aaMtmam[i][j];
+            scaler += mtmamPi[j] * aaMtmam[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaMtmam[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += rtrevPi[i] * aartREV[i][j];
+            scaler += rtrevPi[j] * aartREV[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aartREV[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += wagPi[i] * aaWAG[i][j];
+            scaler += wagPi[j] * aaWAG[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaWAG[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += cprevPi[i] * aacpREV[i][j];
+            scaler += cprevPi[j] * aacpREV[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aacpREV[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += vtPi[i] * aaVt[i][j];
+            scaler += vtPi[j] * aaVt[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaVt[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += blosPi[i] * aaBlosum[i][j];
+            scaler += blosPi[j] * aaBlosum[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaBlosum[i][j] *= scaler;
+    scaler = 0.0;
+    for (i=0; i<20; i++)
+        {
+        for (j=i+1; j<20; j++)
+            {
+            scaler += lgPi[i] * aaLG[i][j];
+            scaler += lgPi[j] * aaLG[j][i];
+            }
+        }
+    scaler = 1.0 / scaler;
+    for (i=0; i<20; i++)
+        for (j=0; j<20; j++)
+            aaLG[i][j] *= scaler;
+    
+    /* set diagonal of matrix */
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaJones[i][j];
+            }
+        aaJones[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaDayhoff[i][j];
+            }
+        aaDayhoff[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaMtrev24[i][j];
+            }
+        aaMtrev24[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaMtmam[i][j];
+            }
+        aaMtmam[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aartREV[i][j];
+            }
+        aartREV[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaWAG[i][j];
+            }
+        aaWAG[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aacpREV[i][j];
+            }
+        aacpREV[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaVt[i][j];
+            }
+        aaVt[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaBlosum[i][j];
+            }
+        aaBlosum[i][i] = -sum;
+        }
+    for (i=0; i<20; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<20; j++)
+            {
+            if (i != j)
+                sum += aaLG[i][j];
+            }
+        aaLG[i][i] = -sum;
+        }
+
+#   if 0
+    for (i=0; i<20; i++)
+        {
+        MrBayesPrint ("%s   ", spacer);
+        for (j=0; j<20; j++)
+            {
+            if (aaLG[i][j] < 0.0)
+                MrBayesPrint ("%1.3lf ", aaLG[i][j]);
+            else
+                MrBayesPrint (" %1.3lf ", aaLG[i][j]);
+            }
+        MrBayesPrint ("\n");
+        }
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+void SetCode (int part)
+{
+    int     i, s, s1, s2, s3, ns;
+    
+    modelParams[part].codon[ 0] = 12; /* AAA Lys */
+    modelParams[part].codon[ 1] =  3; /* AAC Asn */
+    modelParams[part].codon[ 2] = 12; /* AAG Lys */
+    modelParams[part].codon[ 3] =  3; /* AAT Asn */
+    modelParams[part].codon[ 4] = 17; /* ACA Thr */
+    modelParams[part].codon[ 5] = 17; /* ACC Thr */
+    modelParams[part].codon[ 6] = 17; /* ACG Thr */
+    modelParams[part].codon[ 7] = 17; /* ACT Thr */
+    modelParams[part].codon[ 8] =  2; /* AGA Arg */
+    modelParams[part].codon[ 9] = 16; /* AGC Ser */
+    modelParams[part].codon[10] =  2; /* AGG Arg */
+    modelParams[part].codon[11] = 16; /* AGT Ser */
+    modelParams[part].codon[12] = 10; /* ATA Ile */
+    modelParams[part].codon[13] = 10; /* ATC Ile */
+    modelParams[part].codon[14] = 13; /* ATG Met */
+    modelParams[part].codon[15] = 10; /* ATT Ile */
+    modelParams[part].codon[16] =  6; /* CAA Gln */
+    modelParams[part].codon[17] =  9; /* CAC His */
+    modelParams[part].codon[18] =  6; /* CAG Gln */
+    modelParams[part].codon[19] =  9; /* CAT His */
+    modelParams[part].codon[20] = 15; /* CCA Pro */
+    modelParams[part].codon[21] = 15; /* CCC Pro */
+    modelParams[part].codon[22] = 15; /* CCG Pro */
+    modelParams[part].codon[23] = 15; /* CCT Pro */
+    modelParams[part].codon[24] =  2; /* CGA Arg */
+    modelParams[part].codon[25] =  2; /* CGC Arg */
+    modelParams[part].codon[26] =  2; /* CGG Arg */
+    modelParams[part].codon[27] =  2; /* CGT Arg */
+    modelParams[part].codon[28] = 11; /* CTA Leu */
+    modelParams[part].codon[29] = 11; /* CTC Leu */
+    modelParams[part].codon[30] = 11; /* CTG Leu */
+    modelParams[part].codon[31] = 11; /* CTT Leu */
+    modelParams[part].codon[32] =  7; /* GAA Glu */
+    modelParams[part].codon[33] =  4; /* GAC Asp */
+    modelParams[part].codon[34] =  7; /* GAG Glu */
+    modelParams[part].codon[35] =  4; /* GAT Asp */
+    modelParams[part].codon[36] =  1; /* GCA Ala */
+    modelParams[part].codon[37] =  1; /* GCC Ala */
+    modelParams[part].codon[38] =  1; /* GCG Ala */
+    modelParams[part].codon[39] =  1; /* GCT Ala */
+    modelParams[part].codon[40] =  8; /* GGA Gly */
+    modelParams[part].codon[41] =  8; /* GGC Gly */
+    modelParams[part].codon[42] =  8; /* GGG Gly */
+    modelParams[part].codon[43] =  8; /* GGT Gly */
+    modelParams[part].codon[44] = 20; /* GTA Val */
+    modelParams[part].codon[45] = 20; /* GTC Val */
+    modelParams[part].codon[46] = 20; /* GTG Val */
+    modelParams[part].codon[47] = 20; /* GTT Val */
+    modelParams[part].codon[48] = 21; /* TAA Stop*/
+    modelParams[part].codon[49] = 19; /* TAC Tyr */
+    modelParams[part].codon[50] = 21; /* TAG Stop*/
+    modelParams[part].codon[51] = 19; /* TAT Tyr */
+    modelParams[part].codon[52] = 16; /* TCA Ser */
+    modelParams[part].codon[53] = 16; /* TCC Ser */
+    modelParams[part].codon[54] = 16; /* TCG Ser */
+    modelParams[part].codon[55] = 16; /* TCT Ser */
+    modelParams[part].codon[56] = 21; /* TGA Stop*/
+    modelParams[part].codon[57] =  5; /* TGC Cys */
+    modelParams[part].codon[58] = 18; /* TGG Trp */
+    modelParams[part].codon[59] =  5; /* TGT Cys */
+    modelParams[part].codon[60] = 11; /* TTA Leu */
+    modelParams[part].codon[61] = 14; /* TTC Phe */
+    modelParams[part].codon[62] = 11; /* TTG Leu */
+    modelParams[part].codon[63] = 14; /* TTT Phe */
+    
+    if (!strcmp(modelParams[part].geneticCode, "Vertmt"))
+        {
+        /* UGA: Ter -> Trp
+           AUA: Ile -> Met
+           AGA: Arg -> Ter
+           AGG: Arg -> Ter */
+        modelParams[part].codon[ 8] = 21; /* AGA Stop */
+        modelParams[part].codon[10] = 21; /* AGG Stop */
+        modelParams[part].codon[12] = 13; /* ATA Met  */
+        modelParams[part].codon[56] = 18; /* TGA Trp  */
+        }
+    if (!strcmp(modelParams[part].geneticCode, "Invermt"))
+        {
+        /* UGA: Ter -> Trp
+           AUA: Ile -> Met
+           AGA: Arg -> Ser
+           AGG: Arg -> Ser */
+        modelParams[part].codon[ 8] = 16; /* AGA Ser */
+        modelParams[part].codon[10] = 16; /* AGG Ser */
+        modelParams[part].codon[12] = 13; /* ATA Met */
+        modelParams[part].codon[56] = 18; /* TGA Trp */
+        }
+    else if (!strcmp(modelParams[part].geneticCode, "Mycoplasma"))
+        {
+        /* UGA: Ter -> Trp */
+        modelParams[part].codon[56] = 18; /* TGA Trp */
+        }
+    else if (!strcmp(modelParams[part].geneticCode, "Yeast"))
+        {
+        /* UGA: Ter -> Trp
+           AUA: Ile -> Met
+           CUA: Leu -> Thr
+           CUC: Leu -> Thr
+           CUG: Leu -> Thr
+           CUU: Leu -> Thr */
+        modelParams[part].codon[12] = 13; /* ATA Met */
+        modelParams[part].codon[28] = 17; /* CTA Thr */
+        modelParams[part].codon[29] = 17; /* CTC Thr */
+        modelParams[part].codon[30] = 17; /* CTG Thr */
+        modelParams[part].codon[31] = 17; /* CTT Thr */
+        modelParams[part].codon[56] = 18; /* TGA Trp */
+        }
+    else if (!strcmp(modelParams[part].geneticCode, "Ciliate"))
+        {
+        /* UAA: Ter -> Gln
+           UAG: Ter -> Gln */
+        modelParams[part].codon[48] =  6; /* TAA Gln */
+        modelParams[part].codon[50] =  6; /* TAG Gln */
+        }
+    else if (!strcmp(modelParams[part].geneticCode, "Echinoderm"))
+        {
+        /* AAA: Lys -> Asn
+           AGA: Arg -> Ser
+           AGG: Arg -> Ser
+           UGA: Ter -> Trp */
+        modelParams[part].codon[ 0] = 3;  /* AAA Asn */
+        modelParams[part].codon[ 8] = 16; /* AGA Ser */
+        modelParams[part].codon[10] = 16; /* AGG Ser */
+        modelParams[part].codon[56] = 18; /* TGA Trp */
+        }
+    else if (!strcmp(modelParams[part].geneticCode, "Euplotid"))
+        {
+        /* UGA: Ter -> Cys */
+        modelParams[part].codon[56] = 5;  /* TGA Cys */
+        }
+    else if (!strcmp(modelParams[part].geneticCode, "Metmt"))
+        {
+        /* UGA: Ter -> Trp
+           AUA: Ile -> Met
+           AGA: Arg -> Ser
+           AGG: Arg -> Ser */
+        modelParams[part].codon[ 8] = 16; /* AGA Ser */
+        modelParams[part].codon[10] = 16; /* AGG Ser */
+        modelParams[part].codon[12] = 13; /* ATA Met */
+        modelParams[part].codon[56] = 18; /* TGA Trp */
+        }
+    else
+        {
+        }
+    
+    ns = 0;
+    for (i=0; i<64; i++)
+        {
+        if (modelParams[part].codon[i] != 21)
+            ns++;
+        }
+    /* printf ("ns = %d\n", ns); */
+    
+    s = 0;
+    for (s1=0; s1<4; s1++)
+        for (s2=0; s2<4; s2++)
+            for (s3=0; s3<4; s3++)
+                if (modelParams[part].codon[s1*16 + s2*4 + s3] != 21)
+                    {
+                    modelParams[part].codonNucs[s][0] = s1;
+                    modelParams[part].codonNucs[s][1] = s2;
+                    modelParams[part].codonNucs[s][2] = s3;
+                    modelParams[part].codonAAs[s] = modelParams[part].codon[s1*16 + s2*4 + s3];
+                    s++;
+                    }
+}
+
+
+int SetLocalTaxa (void)
+{
+    int         i, j;
+    
+    /* free memory if allocated */
+    if (memAllocs[ALLOC_LOCTAXANAMES] == YES)
+        {
+        free (localTaxonNames);
+        localTaxonNames = NULL;
+        memAllocs[ALLOC_LOCTAXANAMES] = NO;
+        }
+    if (memAllocs[ALLOC_LOCALTAXONCALIBRATION] == YES)
+        {
+        free (localTaxonCalibration);
+        localTaxonCalibration = NULL;
+        memAllocs[ALLOC_LOCALTAXONCALIBRATION] = NO;
+        }
+    
+    /* count number of non-excluded taxa */
+    numLocalTaxa = 0;
+    for (i=0; i<numTaxa; i++)
+        {
+        if (taxaInfo[i].isDeleted == NO)
+            numLocalTaxa++;
+        }
+        
+    /* allocate memory */
+    localTaxonNames = (char **)SafeCalloc((size_t)numLocalTaxa, sizeof(char *));
+    if (!localTaxonNames)
+        return (ERROR);
+    memAllocs[ALLOC_LOCTAXANAMES] = YES;
+
+    localTaxonCalibration = (Calibration **)SafeCalloc((size_t)numLocalTaxa, sizeof(Calibration *));
+    if (!localTaxonCalibration)
+        return (ERROR);
+    memAllocs[ALLOC_LOCALTAXONCALIBRATION] = YES;
+        
+    /* point to names and calibrations of non-excluded taxa */
+    localOutGroup = 0;
+    for (i=j=0; i<numTaxa; i++)
+        {
+        if (taxaInfo[i].isDeleted == NO)
+            {
+            localTaxonNames[j] = taxaNames[i];
+            localTaxonCalibration[j] = &tipCalibration[i];
+            if (i == outGroupNum)
+                localOutGroup = j;
+            j++;
+            }
+        }
+
+#   if 0
+    /* show non-excluded taxa */
+    for (i=0; i<numLocalTaxa; i++)
+        MrBayesPrint ("%s   %4d %s\n", spacer, i+1, localTaxonNames[i]);
+#   endif
+        
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   SetModelDefaults: This function will set up model defaults in modelParams.
+|       It will also initialize parameters and moves by calling SetUpAnalysis.
+|
+-----------------------------------------------------------------------------*/
+int SetModelDefaults (void)
+{
+    int         j;
+
+    MrBayesPrint ("%s   Setting model defaults\n", spacer);
+    MrBayesPrint ("%s   Seed (for generating default start values) = %d\n", spacer, globalSeed);
+
+    if (InitializeLinks () == ERROR)
+        {
+        MrBayesPrint ("%s   Problem initializing link table\n", spacer);
+        return (ERROR);
+        }
+
+    /* Check that models are allocated */
+    if (memAllocs[ALLOC_MODEL] == NO)
+        {
+        MrBayesPrint ("%s   Model not allocated in SetModelDefaults\n", spacer);
+        return (ERROR);
+        }
+
+    /* model parameters */
+    for (j=0; j<numCurrentDivisions; j++)
+        {
+        modelParams[j] = defaultModel;                      /* start with default settings */
+        
+        modelParams[j].dataType = DataType (j);             /* data type for partition                      */
+
+        if (modelParams[j].dataType == STANDARD)
+            {   /* set default ascertainment bias for partition */
+            modelParams[j].coding = VARIABLE;
+            strcpy(modelParams[j].codingString, "Variable"); 
+            }
+        else if (modelParams[j].dataType == RESTRICTION)
+            {
+            modelParams[j].coding = NOABSENCESITES;
+            strcpy(modelParams[j].codingString, "Noabsencesites");   
+            }
+        else
+            {
+            modelParams[j].coding = ALL;
+            strcpy(modelParams[j].codingString, "All");
+            }
+
+        SetCode (j);
+        modelParams[j].nStates = NumStates (j);             /* number of states for partition             */
+
+        modelParams[j].activeConstraints = (int *) SafeCalloc(numDefinedConstraints, sizeof(int));  /* allocate space for active constraints (yes/no) */
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   SetModelInfo: This function will set up model info using model
+|       params
+|
+-----------------------------------------------------------------------------*/
+int SetModelInfo (void)
+{
+    int             i, j, chn, ts;
+    ModelParams     *mp;
+    ModelInfo       *m;
+    
+    /* wipe all model settings */
+    inferSiteRates = NO;
+    inferAncStates = NO;
+    inferSiteOmegas = NO;
+
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = &modelSettings[i];
+
+        /* make certain that we set this intentionally to "NO" so we 
+           calculate cijk information and calculate cond likes when needed */
+        m->upDateCijk = YES;
+        m->upDateCl = YES;
+        m->upDateAll = YES;
+
+        /* make certain that we start with a parsimony branch length of zero */
+        for (j=0; j<MAX_CHAINS; j++)
+            m->parsTreeLength[j*2] = m->parsTreeLength[j*2+1] = 0.0;
+
+        m->tRatio = NULL;
+        m->revMat = NULL;
+        m->omega = NULL;
+        m->stateFreq = NULL;
+        m->shape = NULL;
+        m->pInvar = NULL;
+        m->correlation = NULL;
+        m->switchRates = NULL;
+        m->rateMult = NULL;
+        m->topology = NULL;
+        m->brlens = NULL;
+        m->speciationRates = NULL;
+        m->extinctionRates = NULL;
+        m->fossilizationRates = NULL;
+        m->popSize = NULL;
+        m->aaModel = NULL;
+        m->cppRate = NULL;
+        m->cppEvents = NULL;
+        m->cppMultDev = NULL;
+        m->tk02var = NULL;
+        m->tk02BranchRates = NULL;
+        m->igrvar = NULL;
+        m->igrBranchRates = NULL;
+        m->mixedvar = NULL;
+        m->mixedBrchRates = NULL;
+        m->clockRate = NULL;
+
+        m->CondLikeDown = NULL;
+        m->CondLikeRoot = NULL;
+        m->CondLikeScaler = NULL;
+        m->Likelihood = NULL;
+        m->TiProbs = NULL;
+
+        m->CondLikeUp = NULL;
+        m->StateCode = NULL;
+        m->PrintAncStates = NULL;
+        m->PrintSiteRates = NULL;
+        
+        m->printPosSel = NO;
+        m->printAncStates = NO;
+        m->printSiteRates = NO;
+
+        m->nStates = NULL;
+        m->bsIndex = NULL;
+        m->cType = NULL;
+        m->tiIndex = NULL;
+
+        m->gibbsGamma = NO;
+        m->gibbsFreq = 0;
+
+        m->parsimonyBasedMove = NO;
+
+#   if defined (BEAGLE_ENABLED)
+        m->beagleInstance = -1;               /* beagle instance                              */
+        m->logLikelihoods = NULL;             /* array of log likelihoods from Beagle         */
+        m->inRates = NULL;                    /* array of category rates for Beagle           */
+        m->branchLengths = NULL;              /* array of branch lengths for Beagle           */
+        m->tiProbIndices = NULL;              /* array of trans prob indices for Beagle       */
+        m->inWeights = NULL;                  /* array of weights for Beagle root likelihood  */
+        m->bufferIndices = NULL;              /* array of partial indices for root likelihood */
+        m->childBufferIndices = NULL;         /* array of child partial indices (unrooted)    */
+        m->childTiProbIndices = NULL;         /* array of child ti prob indices (unrooted)    */
+        m->cumulativeScaleIndices = NULL;     /* array of cumulative scale indices            */
+#   endif
+
+        /* likelihood calculator flags */
+        m->useSSE = NO;                       /* use SSE code for this partition?             */
+        m->useBeagle = NO;                    /* use Beagle for this partition?               */
+
+        /* set all memory pointers to NULL */
+        m->parsSets = NULL;
+        m->numParsSets = 0;
+        m->parsNodeLens = NULL;
+        m->numParsNodeLens = 0;
+
+        m->condLikes = NULL;
+        m->tiProbs = NULL;
+        m->scalers = NULL;
+        m->numCondLikes = 0;
+        m->numTiProbs = 0;
+        m->numScalers = 0;
+
+        m->condLikeIndex = NULL;
+        m->condLikeScratchIndex = NULL;
+        m->tiProbsIndex = NULL;
+        m->tiProbsScratchIndex = NULL;
+        m->nodeScalerIndex = NULL;
+        m->nodeScalerScratchIndex = NULL;
+        m->siteScalerIndex = NULL;
+        m->siteScalerScratchIndex = -1;
+
+        m->cijks = NULL;
+        m->nCijkParts = 0;
+        m->cijkIndex = NULL;
+        m->cijkScratchIndex = -1;
+        }
+
+    /* set state of all chains to zero */
+    for (chn=0; chn<numGlobalChains; chn++)
+        state[chn] = 0;
+
+    /* fill in modelSettings info with some basic model characteristics */
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        mp = &modelParams[i];
+        m = &modelSettings[i];
+        
+        if (!strcmp(mp->nucModel,"Protein") && (mp->dataType == DNA || mp->dataType == RNA))
+            m->dataType = PROTEIN;
+        else
+            m->dataType = mp->dataType;
+
+        /* nuc model structure */
+        if (!strcmp(mp->nucModel, "4by4"))
+            m->nucModelId = NUCMODEL_4BY4;
+        else if (!strcmp(mp->nucModel, "Doublet"))
+            m->nucModelId = NUCMODEL_DOUBLET;
+        else if (!strcmp(mp->nucModel, "Protein"))
+            m->nucModelId = NUCMODEL_AA;
+        else /* if (!strcmp(mp->nucModelId, "Codon")) */
+            m->nucModelId = NUCMODEL_CODON;
+            
+        /* model nst */
+        if (!strcmp(mp->nst, "1"))
+            m->nst = 1;
+        else if (!strcmp(mp->nst, "2"))
+            m->nst = 2;
+        else if (!strcmp(mp->nst, "6"))
+            m->nst = 6;
+        else
+            m->nst = NST_MIXED;
+            
+        /* We set the aa model here. We have two options. First, the model
+           could be fixed, in which case mp->aaModel has been set. We then
+           go ahead and also set the model settings. Second, the model
+           could be mixed. In this case, the amino acid matrix is considered
+           a parameter, and we will deal with it below. It doesn't hurt
+           to set it here anyway (it will be overwritten later). */
+        if (!strcmp(mp->aaModelPr, "Fixed"))
+            {
+            if (!strcmp(mp->aaModel, "Poisson"))
+                m->aaModelId = AAMODEL_POISSON;
+            else if (!strcmp(mp->aaModel, "Equalin"))
+                m->aaModelId = AAMODEL_EQ;
+            else if (!strcmp(mp->aaModel, "Jones"))
+                m->aaModelId = AAMODEL_JONES;
+            else if (!strcmp(mp->aaModel, "Dayhoff"))
+                m->aaModelId = AAMODEL_DAY;
+            else if (!strcmp(mp->aaModel, "Mtrev"))
+                m->aaModelId = AAMODEL_MTREV;
+            else if (!strcmp(mp->aaModel, "Mtmam"))
+                m->aaModelId = AAMODEL_MTMAM;
+            else if (!strcmp(mp->aaModel, "Wag"))
+                m->aaModelId = AAMODEL_WAG;
+            else if (!strcmp(mp->aaModel, "Rtrev"))
+                m->aaModelId = AAMODEL_RTREV;
+            else if (!strcmp(mp->aaModel, "Cprev"))
+                m->aaModelId = AAMODEL_CPREV;
+            else if (!strcmp(mp->aaModel, "Vt"))
+                m->aaModelId = AAMODEL_VT;
+            else if (!strcmp(mp->aaModel, "Blosum"))
+                m->aaModelId = AAMODEL_BLOSUM;
+            else if (!strcmp(mp->aaModel, "LG"))
+                m->aaModelId = AAMODEL_LG;
+            else if (!strcmp(mp->aaModel, "Gtr"))
+                m->aaModelId = AAMODEL_GTR;
+            else
+                {
+                MrBayesPrint ("%s   Uncertain amino acid model\n", spacer);
+                return (ERROR);
+                }
+            }
+        else
+            m->aaModelId = -1;
+            
+        /* parsimony model? */
+        if (!strcmp(mp->parsModel, "Yes"))
+            m->parsModelId = YES;
+        else
+            m->parsModelId = NO;
+
+        /* number of gamma categories */
+        if (activeParams[P_SHAPE][i] > 0)
+            m->numGammaCats = mp->numGammaCats;
+        else
+            m->numGammaCats = 1;
+
+        /* number of beta categories */
+        if (mp->dataType == STANDARD && !(AreDoublesEqual(mp->symBetaFix, -1.0, 0.00001) == YES && !strcmp(mp->symPiPr,"Fixed")))
+            m->numBetaCats = mp->numBetaCats;
+        else
+            m->numBetaCats = 1;
+
+        /* number of omega categories */
+        if ((mp->dataType == DNA || mp->dataType == RNA) && (!strcmp(mp->omegaVar, "Ny98") || !strcmp(mp->omegaVar, "M3")) && !strcmp(mp->nucModel, "Codon"))
+            {
+            m->numOmegaCats = 3;
+            m->numGammaCats = 1; /* if we are here, then we cannot have gamma or beta variation */
+            m->numBetaCats = 1;
+            }
+        else if ((mp->dataType == DNA || mp->dataType == RNA) && !strcmp(mp->omegaVar, "M10") && !strcmp(mp->nucModel, "Codon"))
+            {
+            m->numOmegaCats = mp->numM10BetaCats + mp->numM10GammaCats;
+            m->numGammaCats = 1; /* if we are here, then we cannot have gamma or beta variation */
+            m->numBetaCats = 1;
+            }
+        else
+            m->numOmegaCats = 1;
+
+        /* number of transition matrices depends on numGammaCats, numBetaCats, and numOmegaCats */
+        m->numTiCats = m->numGammaCats * m->numBetaCats * m->numOmegaCats;
+
+        /* TODO: check that numStates and numModelStates are set
+            appropriately for codon and doublet models */
+
+        /* number of observable states */
+        if (m->dataType == STANDARD)
+            m->numStates = 0;   /* zero, meaining variable */
+        else if (!strcmp(mp->nucModel,"Protein") && (mp->dataType == DNA || mp->dataType == RNA))
+            m->numStates = 20;
+        else
+            m->numStates = mp->nStates;
+        
+        /* number of model states including hidden ones */
+        if ((mp->dataType == DNA || mp->dataType == RNA) && !strcmp (mp->covarionModel, "Yes") && !strcmp(mp->nucModel, "4by4"))
+            m->numModelStates = mp->nStates * 2;
+        else if (m->dataType == PROTEIN && !strcmp (mp->covarionModel, "Yes"))
+            m->numModelStates = mp->nStates * 2;
+        else if ((mp->dataType == DNA || mp->dataType == RNA) && !strcmp(mp->nucModel,"Protein") && !strcmp (mp->covarionModel, "Yes"))
+            m->numModelStates = 20 * 2;
+        else if (mp->dataType == CONTINUOUS)
+            m->numModelStates = 0;
+        else if (mp->dataType == STANDARD)
+            {
+            /* use max possible for now; we don't know what chars will be included */
+            m->numModelStates = 10;
+            }
+        else
+            m->numModelStates = m->numStates;
+            
+        /* Fill in some information for calculating cijk. We will use m->cijkLength to 
+           figure out if we need to diagonalize Q to calculate transition probabilities.
+           If cijkLength = 0, then we won't bother. We use cijkLength later in this function. */
+        m->cijkLength = 0;
+        m->nCijkParts = 1;
+        if (m->dataType == PROTEIN)
+            {
+            ts = m->numModelStates;
+            m->cijkLength = (ts * ts * ts) + (2 * ts);
+            if (!strcmp (mp->covarionModel, "Yes"))
+                {
+                m->cijkLength *= m->numGammaCats;
+                m->nCijkParts = m->numGammaCats;
+                }
+            }
+        else if (m->dataType == STANDARD)
+            {
+            /* set to 0 for now, update in ProcessStdChars */
+            m->nCijkParts = 0;
+            }
+        else if (m->dataType == DNA || m->dataType == RNA)
+            {
+            if (m->nucModelId == NUCMODEL_4BY4)
+                {
+                if (!strcmp (mp->covarionModel, "No") && m->nst != 6 && m->nst != 203)
+                    m->cijkLength = 0;
+                else
+                    {
+                    ts = m->numModelStates;
+                    m->cijkLength = (ts * ts * ts) + (2 * ts);
+                    }
+                if (!strcmp (mp->covarionModel, "Yes"))
+                    {
+                    m->cijkLength *= m->numGammaCats;
+                    m->nCijkParts = m->numGammaCats;
+                    }
+                }
+            else if (m->nucModelId == NUCMODEL_DOUBLET)
+                {
+                ts = m->numModelStates;
+                m->cijkLength = (ts * ts * ts) + (2 * ts);
+                }
+            else if (m->nucModelId == NUCMODEL_CODON)
+                {
+                ts = m->numModelStates;
+                m->cijkLength = (ts * ts * ts) + (2 * ts);
+                m->cijkLength *= m->numOmegaCats;
+                m->nCijkParts = m->numOmegaCats;
+                }
+            else
+                {
+                MrBayesPrint ("%s   BUG: Inconsistent model. Please report this as a bug.\n");
+                return ERROR;
+                }
+            }
+
+        /* check if we should calculate ancestral states */
+        if (!strcmp(mp->inferAncStates,"Yes"))
+            {
+            if (m->dataType == PROTEIN && !strcmp(mp->covarionModel, "No"))
+                m->printAncStates = YES;
+            else if (m->dataType == DNA || m->dataType == RNA)
+                {
+                if (!strcmp(mp->nucModel,"4by4") && !strcmp(mp->covarionModel, "No"))
+                    m->printAncStates = YES;
+                if (!strcmp(mp->nucModel,"Doublet"))
+                    m->printAncStates = YES;
+                if (!strcmp(mp->nucModel,"Codon") && !strcmp(mp->omegaVar,"Equal"))
+                    m->printAncStates = YES;
+                }
+            else if (m->dataType == STANDARD || m->dataType == RESTRICTION)
+                m->printAncStates = YES;
+            if (m->printAncStates == YES)
+                inferAncStates = YES;
+            else
+                MrBayesPrint ("%s   Print out of ancestral states is not applicable for devision %d.\n",spacer,i);
+            }
+
+        /* check if we should calculate site rates */
+        if (!strcmp(mp->inferSiteRates,"Yes"))
+            {
+            if (m->numGammaCats > 1)
+                {
+                m->printSiteRates = YES;
+                inferSiteRates = YES;
+                }
+            }
+
+        /* check if we should calculate positive selection */
+        if (!strcmp(mp->inferPosSel, "Yes"))
+            {
+            if (m->numOmegaCats > 1)
+                {
+                m->printPosSel = YES;
+                inferPosSel = YES;
+                }
+            }
+
+        /* check if we should calculate site omegas */
+        if (!strcmp(mp->inferSiteOmegas, "Yes"))
+            {
+            if (m->numOmegaCats > 1)
+                {
+                m->printSiteOmegas = YES;
+                inferSiteOmegas = YES;
+                }
+            }
+        /* check if we should use gibbs sampling of gamma (don't use it with pinvar or invgamma) */
+        if (!strcmp(mp->useGibbs,"Yes") && (m->numGammaCats > 1))
+            {
+            if (m->dataType == DNA || m->dataType == RNA || m->dataType == PROTEIN)
+                {
+                if (activeParams[P_CORREL][i] <= 0 && m->printSiteRates == NO && activeParams[P_PINVAR][i] <= 0)
+                    {
+                    m->gibbsGamma = YES;
+                    m->gibbsFreq = mp->gibbsFreq;
+                    }
+                }
+            }
+        }
+
+    return (NO_ERROR);  
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   SetModelParams: Set up parameter structs for all model
+|       parameters, including trees
+|
+|----------------------------------------------------------------*/
+int SetModelParams (void)
+{
+    int             c, i, j, k, n, n1, n2, *isPartTouched, numRelParts, nRelParts, areAllPartsParsimony,
+                    nClockBrlens, nRelaxedBrlens, nCalibratedBrlens;
+    char            tempCodon[15], tempMult[15], *tempStr,temp[30];
+    char static     *partString=NULL; /* mad static to avoid posible memory leak on return ERROR if it would be introduced later */
+    Param           *p;
+    ModelParams     *mp;
+    ModelInfo       *m;
+    int             tempStrSize = 300;
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    isPartTouched = (int *) SafeMalloc ((size_t)numCurrentDivisions * sizeof (int));
+    if (!tempStr || !isPartTouched)
+        {
+        MrBayesPrint ("%s   Problem allocating tempString (%d) or isPartTouched (%d)\n", spacer,
+            tempStrSize * sizeof(char), numCurrentDivisions * sizeof(int));
+        return (ERROR);
+        }
+
+#   if defined DEBUG_SETCHAINPARAMS
+    /* only for debugging */
+    MrBFlt      lnPriorRatio = 0.0, lnProposalRatio = 0.0;
+#   endif
+
+    /* allocate space for parameters */
+    if (memAllocs[ALLOC_PARAMS] == YES)
+        {
+        for (i=0; i<numParams; i++)
+            {
+            SafeFree ((void **)&params[i].name);
+            if (params[i].paramHeader)
+                {
+                free (params[i].paramHeader);
+                params[i].paramHeader = NULL;
+                }
+            }
+        free (params);
+        free (relevantParts);
+        params = NULL;
+        relevantParts = NULL;
+        memAllocs[ALLOC_PARAMS] = NO;
+        }
+
+    /* wipe all chain parameter information */
+    numParams = 0;
+    numTrees = 0;
+    chainHasAdgamma = NO;
+
+    /* figure out number of parameters */
+    /* this relies on activeParams[j][i] being set to 1, 2, ..., numParams */
+    /* which is taken care of in SetUpLinkTable () */
+    nRelParts = 0;
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (activeParams[j][i] > numParams)
+                numParams = activeParams[j][i];
+            if (activeParams[j][i] > 0)
+                nRelParts++;
+            }
+        }
+
+    params = (Param *) SafeMalloc (numParams * sizeof(Param));
+    relevantParts = (int *) SafeMalloc (nRelParts * sizeof(int));
+    if (!params || !relevantParts)
+        {
+        MrBayesPrint ("%s   Problem allocating params and relevantParts\n", spacer);
+        if (params)
+            free (params);
+        if (relevantParts)
+            free (relevantParts);
+        free (tempStr);
+        return ERROR;
+        }
+    else
+        memAllocs[ALLOC_PARAMS] = YES;
+
+    /* fill in info on each parameter */
+    nRelParts = 0;  /* now cumulative number of relevant partitions */
+    for (k=0; k<numParams; k++)
+        {
+        p = &params[k];
+
+        /* find affected partitions */
+        numRelParts = 0;
+        for (j=0; j<NUM_LINKED; j++)
+            {
+            for (i=0; i<numCurrentDivisions; i++)
+                {
+                if (activeParams[j][i] == k + 1)
+                    {
+                    numRelParts++;
+                    isPartTouched[i] = YES;
+                    }
+                else
+                    isPartTouched[i] = NO;
+                }
+            if (numRelParts > 0)
+                break;
+            }
+
+        /* find pointer to modelParams and modelSettings of first relevant partition */
+        /* this will be handy later on */
+        for (i=0; i<numCurrentDivisions; i++)
+            if (isPartTouched[i] == YES)
+                break;
+        mp = &modelParams[i];
+        m  = &modelSettings[i];
+        
+        /* Set default min and max */
+        p->min = p->max = NEG_INFINITY;
+
+        /* Parameter nValues and nSubValues, which are needed for memory allocation
+           are calculated for each case in the code below. nSympi, however, is
+           only used for one special type of parameter and it therefore makes
+           sense to initialize it to 0 here. The same applies to hasBinaryStd
+           and nIntValues. To be safe, we set all to 0 here. */
+        p->nValues = 0;
+        p->nSubValues = 0;
+        p->nIntValues = 0;
+        p->nSympi = 0;
+        p->hasBinaryStd = NO;
+        
+        /* should this parameter be printed to a file? */
+        p->printParam = NO;
+
+        /* set print subparams to 0 */
+        p->nPrintSubParams = 0;
+        
+        /* check constraints for tree parameter ? */
+        p->checkConstraints = NO;
+
+        /* set index number of parameter */
+        p->index = k;
+        
+        /* set prior function to NULL */
+        p->LnPriorRatio = NULL;
+
+        /* set prior paramters to NULL */
+        p->priorParams = NULL;
+
+        /* set affectsLikelihood to NO */
+        p->affectsLikelihood = NO;
+
+        /* set cpp event pointers to NULL */
+        p->nEvents = NULL;
+        p->position = NULL;
+        p->rateMult = NULL;
+
+        /* set header and name to NULL */
+        p->paramHeader = NULL;
+        p->name = NULL;
+
+        /* set up relevant partitions */
+        p->nRelParts = numRelParts;
+        p->relParts = relevantParts + nRelParts;
+        nRelParts += numRelParts;
+        for (i=n=0; i<numCurrentDivisions; i++)
+            if (isPartTouched[i] == YES)
+                p->relParts[n++] = i;
+
+        /* get partition descriptor */
+        SafeStrcat(&partString,"");
+        FillRelPartsString (p, &partString);
+            
+        /* set up information for parameter */
+        if (j == P_TRATIO)
+            {
+            /* Set up tratio ****************************************************************************************/
+            p->paramType = P_TRATIO;
+            p->nValues = 1;         /* we store only the ratio */
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].tRatio = p;
+    
+            p->paramTypeName = "Transition and transversion rates";
+            SafeStrcat(&p->name, "Tratio");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->tRatioPr,"Beta"))
+                {
+                p->paramId = TRATIO_DIR;
+                }
+            else
+                p->paramId = TRATIO_FIX;
+                
+            if (p->paramId != TRATIO_FIX)
+                p->printParam = YES;
+            if (!strcmp(mp->tratioFormat,"Ratio"))
+                {
+                /* report ti/tv ratio */
+                SafeStrcat (&p->paramHeader,"kappa");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else
+                {
+                /* report prop. of ratesum (Dirichlet) */
+                SafeStrcat (&p->paramHeader,"ti");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\ttv");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            }
+        else if (j == P_REVMAT)
+            {
+            /* Set up revMat ****************************************************************************************/
+            p->paramType = P_REVMAT;
+            if (m->dataType == PROTEIN)
+                p->nValues = 190;
+            else
+                p->nValues = 6;
+            p->nSubValues = 0;
+            if (!strcmp(mp->nst, "Mixed"))
+                p->nIntValues = 6;
+            else
+                p->nIntValues = 0;
+            p->min = 0.0;
+            p->max = 1.0;       /* adjust later for REVMAT_MIX, see a few lines below */
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].revMat = p;
+
+            p->paramTypeName = "Rates of reversible rate matrix";
+            SafeStrcat(&p->name, "Revmat");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (m->dataType == PROTEIN)
+                {
+                if (!strcmp(mp->aaRevMatPr,"Dirichlet"))
+                    p->paramId = REVMAT_DIR;
+                else
+                    p->paramId = REVMAT_FIX;
+                if (p->paramId != REVMAT_FIX)
+                    p->printParam = YES;
+
+                for (n1=0; n1<20; n1++)
+                    {
+                    for (n2=n1+1; n2<20; n2++)
+                        {
+                        if (n1==0 && n2==1)
+                            {
+                            sprintf (temp, "r(%c<->%c)", StateCode_AA(n1), StateCode_AA(n2));
+                            SafeStrcat (&p->paramHeader, temp);
+                            SafeStrcat (&p->paramHeader, partString);
+                            }
+                        else
+                            {
+                            sprintf (temp, "\tr(%c<->%c)", StateCode_AA(n1), StateCode_AA(n2));
+                            SafeStrcat (&p->paramHeader, temp);
+                            SafeStrcat (&p->paramHeader, partString);
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                if (!strcmp(mp->nst, "Mixed"))
+                    {
+                    p->paramId = REVMAT_MIX;
+                    p->max = 1E6;   /* some large value */
+                    }
+                else if (!strcmp(mp->revMatPr,"Dirichlet"))
+                    p->paramId = REVMAT_DIR;
+                else
+                    p->paramId = REVMAT_FIX;
+                if (p->paramId != REVMAT_FIX)
+                    p->printParam = YES;
+
+                for (n1=0; n1<4; n1++)
+                    {
+                    for (n2=n1+1; n2<4; n2++)
+                        {
+                        if (n1==0 && n2==1)
+                            {
+                            sprintf (temp, "r(%c<->%c)", StateCode_NUC4(n1), StateCode_NUC4(n2));
+                            SafeStrcat (&p->paramHeader, temp);
+                            SafeStrcat (&p->paramHeader, partString);
+                            }
+                        else
+                            {
+                            sprintf (temp, "\tr(%c<->%c)", StateCode_NUC4(n1), StateCode_NUC4(n2));
+                            SafeStrcat (&p->paramHeader, temp);
+                            SafeStrcat (&p->paramHeader, partString);
+                            }
+                        }
+                    }
+                if (p->paramId == REVMAT_MIX)
+                    {
+                    sprintf (temp, "\tgtrsubmodel");
+                    SafeStrcat (&p->paramHeader, temp);
+                    SafeStrcat (&p->paramHeader, partString);
+                    sprintf (temp, "\tk_revmat");
+                    SafeStrcat (&p->paramHeader, temp);
+                    SafeStrcat (&p->paramHeader, partString);
+                    }
+                }
+            }
+        else if (j == P_OMEGA)
+            {
+            /* Set up omega *****************************************************************************************/
+            p->paramType = P_OMEGA;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            if (!strcmp(mp->omegaVar, "M3"))
+                {
+                p->nValues = 3;         /* omega values */
+                p->nSubValues = 6;      /* category frequencies plus cache */
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (isPartTouched[i] == YES)
+                        modelSettings[i].omega = p;
+            
+                /* find the parameter x prior type */
+                if (!strcmp(mp->m3omegapr, "Exponential")      && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_EF;
+                else if (!strcmp(mp->m3omegapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_ED;
+                else if (!strcmp(mp->m3omegapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_FF;
+                else if (!strcmp(mp->m3omegapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_FD;
+
+                if (p->paramId != OMEGA_FF)
+                    p->printParam = YES;
+
+                SafeStrcat (&p->paramHeader, "omega(1)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tomega(2)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tomega(3)");
+                SafeStrcat (&p->paramHeader, partString);
+                    
+                SafeStrcat (&p->paramHeader, "\tpi(1)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tpi(2)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tpi(3)");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else if (!strcmp(mp->omegaVar, "M10"))
+                {
+                p->nValues = mp->numM10BetaCats + mp->numM10GammaCats;
+                p->nSubValues = mp->numM10BetaCats + mp->numM10GammaCats + 8;
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (isPartTouched[i] == YES)
+                        modelSettings[i].omega = p;
+
+                /* find the parameter x prior type */
+                if      (!strcmp(mp->m10betapr, "Uniform")     && !strcmp(mp->m10gammapr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10UUB;
+                else if (!strcmp(mp->m10betapr, "Uniform")     && !strcmp(mp->m10gammapr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10UUF;
+                else if (!strcmp(mp->m10betapr, "Uniform")     && !strcmp(mp->m10gammapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10UEB;
+                else if (!strcmp(mp->m10betapr, "Uniform")     && !strcmp(mp->m10gammapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10UEF;
+                else if (!strcmp(mp->m10betapr, "Uniform")     && !strcmp(mp->m10gammapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10UFB;
+                else if (!strcmp(mp->m10betapr, "Uniform")     && !strcmp(mp->m10gammapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10UFF;
+                else if (!strcmp(mp->m10betapr, "Exponential") && !strcmp(mp->m10gammapr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10EUB;
+                else if (!strcmp(mp->m10betapr, "Exponential") && !strcmp(mp->m10gammapr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10EUF;
+                else if (!strcmp(mp->m10betapr, "Exponential") && !strcmp(mp->m10gammapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10EEB;
+                else if (!strcmp(mp->m10betapr, "Exponential") && !strcmp(mp->m10gammapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10EEF;
+                else if (!strcmp(mp->m10betapr, "Exponential") && !strcmp(mp->m10gammapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10EFB;
+                else if (!strcmp(mp->m10betapr, "Exponential") && !strcmp(mp->m10gammapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10EFF;
+                else if (!strcmp(mp->m10betapr, "Fixed")       && !strcmp(mp->m10gammapr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10FUB;
+                else if (!strcmp(mp->m10betapr, "Fixed")       && !strcmp(mp->m10gammapr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10FUF;
+                else if (!strcmp(mp->m10betapr, "Fixed")       && !strcmp(mp->m10gammapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10FEB;
+                else if (!strcmp(mp->m10betapr, "Fixed")       && !strcmp(mp->m10gammapr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10FEF;
+                else if (!strcmp(mp->m10betapr, "Fixed")       && !strcmp(mp->m10gammapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_10FFB;
+                else if (!strcmp(mp->m10betapr, "Fixed")       && !strcmp(mp->m10gammapr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_10FFF;
+
+                if (p->paramId != OMEGA_10FFF)
+                    p->printParam = YES;
+                for (i=0; i<p->nValues; i++)
+                    {
+                    if (i==0)
+                        sprintf (temp, "omega(%d)", i+1);
+                    else
+                        sprintf (temp, "\tomega(%d)", i+1);
+                    SafeStrcat (&p->paramHeader, temp);
+                    SafeStrcat (&p->paramHeader, partString);
+                    }
+                SafeStrcat (&p->paramHeader, "\tbeta(alpha)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tbeta(beta)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tgamma(alpha)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tgamma(beta)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tpi(1)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tpi(2)");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else if (!strcmp(mp->omegaVar, "Ny98"))
+                {
+                p->nValues = 3;     /* omega values */
+                p->nSubValues = 6;  /* omega category frequencies plus cache */
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (isPartTouched[i] == YES)
+                        modelSettings[i].omega = p;
+            
+                /* find the parameter x prior type */
+                if      (!strcmp(mp->ny98omega1pr, "Beta")  && !strcmp(mp->ny98omega3pr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_BUD;
+                else if (!strcmp(mp->ny98omega1pr, "Beta")  && !strcmp(mp->ny98omega3pr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_BUF;
+                else if (!strcmp(mp->ny98omega1pr, "Beta")  && !strcmp(mp->ny98omega3pr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_BED;
+                else if (!strcmp(mp->ny98omega1pr, "Beta")  && !strcmp(mp->ny98omega3pr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_BEF;
+                else if (!strcmp(mp->ny98omega1pr, "Beta")  && !strcmp(mp->ny98omega3pr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_BFD;
+                else if (!strcmp(mp->ny98omega1pr, "Beta")  && !strcmp(mp->ny98omega3pr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_BFF;
+                else if (!strcmp(mp->ny98omega1pr, "Fixed") && !strcmp(mp->ny98omega3pr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_FUD;
+                else if (!strcmp(mp->ny98omega1pr, "Fixed") && !strcmp(mp->ny98omega3pr, "Uniform")     && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_FUF;
+                else if (!strcmp(mp->ny98omega1pr, "Fixed") && !strcmp(mp->ny98omega3pr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_FED;
+                else if (!strcmp(mp->ny98omega1pr, "Fixed") && !strcmp(mp->ny98omega3pr, "Exponential") && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_FEF;
+                else if (!strcmp(mp->ny98omega1pr, "Fixed") && !strcmp(mp->ny98omega3pr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Dirichlet"))
+                    p->paramId = OMEGA_FFD;
+                else if (!strcmp(mp->ny98omega1pr, "Fixed") && !strcmp(mp->ny98omega3pr, "Fixed")       && !strcmp(mp->codonCatFreqPr, "Fixed"))
+                    p->paramId = OMEGA_FFF;
+                
+                if (p->paramId != OMEGA_FFF)
+                    p->printParam = YES;
+                SafeStrcat (&p->paramHeader, "omega(-)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tomega(N)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tomega(+)");
+                SafeStrcat (&p->paramHeader, partString);
+                    
+                SafeStrcat (&p->paramHeader, "\tpi(-)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tpi(N)");
+                SafeStrcat (&p->paramHeader, partString);
+                SafeStrcat (&p->paramHeader, "\tpi(+)");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else
+                {
+                p->nValues = 1;
+                p->nSubValues = 0;
+                for (i=0; i<numCurrentDivisions; i++)
+                    if (isPartTouched[i] == YES)
+                        modelSettings[i].omega = p;
+
+                /* find the parameter x prior type */
+                if (!strcmp(mp->omegaPr,"Dirichlet"))
+                    p->paramId = OMEGA_DIR;
+                else
+                    p->paramId = OMEGA_FIX;
+
+                if (p->paramId != OMEGA_FIX)
+                    p->printParam = YES;
+                SafeStrcat (&p->paramHeader, "omega");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            p->paramTypeName = "Positive selection (omega) model";
+            SafeStrcat(&p->name, "Omega");
+            SafeStrcat(&p->name, partString);           
+            }
+        else if (j == P_PI)
+            {
+            /* Set up state frequencies *****************************************************************************/
+            p->paramType = P_PI;
+            p->min = 0.0;
+            p->max = 1.0;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].stateFreq = p;
+
+            if (mp->dataType == STANDARD)
+                {
+                p->paramTypeName = "Symmetric diricihlet/beta distribution alpha_i parameter";
+                SafeStrcat(&p->name, "Alpha_symdir");
+                /* boundaries for alpha_i */
+                p->min = ETA;
+                p->max = POS_INFINITY;
+                }
+            else
+                {
+                p->paramTypeName = "Stationary state frequencies";
+                SafeStrcat(&p->name, "Pi");
+                }
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            /* and the number of values and subvalues needed */
+            if (mp->dataType == STANDARD)
+                {
+                /* find number of model states */
+                m->numModelStates = 2;
+                for (c=0; c<numChar; c++)
+                    {
+                    for (i=0; i<p->nRelParts; i++)
+                        {
+                        if (partitionId[c][partitionNum] == p->relParts[i] + 1 && charInfo[c].numStates > m->numModelStates)
+                            m->numModelStates = charInfo[c].numStates;
+                        }
+                    }
+                for (i=0; i<p->nRelParts; i++)
+                    modelSettings[p->relParts[i]].numModelStates = m->numModelStates;
+
+                /* symmetric hyperprior with only one variable (0 if equal) */
+                p->nValues = 1;     /* set to 0 below for the SYMPI_EQUAL model */
+                if (!strcmp(mp->symPiPr,"Uniform"))
+                    {
+                    if (m->numModelStates > 2) 
+                        p->paramId = SYMPI_UNI_MS;
+                    else
+                        p->paramId = SYMPI_UNI;
+                    }
+                else if (!strcmp(mp->symPiPr,"Exponential"))
+                    {
+                    if (m->numModelStates > 2)
+                        p->paramId = SYMPI_EXP_MS;
+                    else
+                        p->paramId = SYMPI_EXP;
+                    }
+                else if (!strcmp(mp->symPiPr,"Fixed"))
+                    {
+                    if (AreDoublesEqual(mp->symBetaFix, -1.0, 0.00001) == YES)
+                        {
+                        p->paramId = SYMPI_EQUAL;
+                        p->nValues = 0;
+                        }
+                    else
+                        {
+                        if (m->numModelStates > 2) 
+                            p->paramId = SYMPI_FIX_MS;
+                        else
+                            p->paramId = SYMPI_FIX;
+                        }
+                    }
+                p->nSubValues = 0;  /* store state frequencies in p->stdStateFreqs */
+                if (p->paramId == SYMPI_EXP || p->paramId == SYMPI_EXP_MS || p->paramId == SYMPI_UNI || p->paramId == SYMPI_UNI_MS)
+                    p->printParam = YES;
+                SafeStrcat (&p->paramHeader, "alpha_symdir");
+                SafeStrcat (&p->paramHeader, partString);
+                /* further processing done in ProcessStdChars */
+                }
+            else
+                {
+                /* deal with all models except standard */
+                /* no hyperprior or fixed to one value, set default to 0  */
+                p->nValues = 0;
+                /* one subvalue for each state */
+                p->nSubValues = mp->nStates;    /* mp->nStates is set to 20 if DNA || RNA && nucmodel==PROTEIN */
+                if (!strcmp(mp->stateFreqPr, "Dirichlet"))
+                    {
+                    p->paramId = PI_DIR;
+                    p->nValues = mp->nStates;
+                    }
+                else if (!strcmp(mp->stateFreqPr, "Fixed") && !strcmp(mp->stateFreqsFixType,"User"))
+                    p->paramId = PI_USER;
+                else if (!strcmp(mp->stateFreqPr, "Fixed") && !strcmp(mp->stateFreqsFixType,"Empirical"))
+                    p->paramId = PI_EMPIRICAL;
+                else if (!strcmp(mp->stateFreqPr, "Fixed") && !strcmp(mp->stateFreqsFixType,"Equal"))
+                    {
+                    p->paramId = PI_EQUAL;
+                    }
+                    
+                if (m->dataType == PROTEIN)
+                    {
+                    if (!strcmp(mp->aaModelPr, "Fixed"))
+                        {
+                        if (!strcmp(mp->aaModel, "Poisson"))
+                            p->paramId = PI_EQUAL;
+                        else if (!strcmp(mp->aaModel, "Equalin") || !strcmp(mp->aaModel, "Gtr"))
+                            {
+                            /* p->paramId stays to what it was set to above */
+                            }
+                        else
+                            p->paramId = PI_FIXED;
+                        }
+                    else
+                        p->paramId = PI_FIXED;
+                    }
+                    
+                if (p->paramId == PI_DIR)
+                    p->printParam = YES;
+                if (m->dataType == DNA || m->dataType == RNA)
+                    {
+                    if (!strcmp(mp->nucModel, "4by4"))
+                        {
+                        sprintf (temp, "pi(%c)", StateCode_NUC4(0));
+                        SafeStrcat (&p->paramHeader,temp);
+                        SafeStrcat (&p->paramHeader,partString);
+                        for (n1=1; n1<4; n1++)
+                            {
+                            sprintf (temp, "\tpi(%c)", StateCode_NUC4(n1));
+                            SafeStrcat (&p->paramHeader,temp);
+                            SafeStrcat (&p->paramHeader,partString);
+                            }
+                        }
+                    else if (!strcmp(mp->nucModel, "Doublet"))
+                        {
+                        State_DOUBLET(tempCodon,0);
+                        sprintf (temp, "pi(%s)", tempCodon);
+                        SafeStrcat (&p->paramHeader,temp);
+                        SafeStrcat (&p->paramHeader,partString);
+                        for (n1=1; n1<16; n1++)
+                            {
+                            State_DOUBLET(tempCodon,n1);
+                            sprintf (temp, "\tpi(%s)", tempCodon);
+                            SafeStrcat (&p->paramHeader,temp);
+                            SafeStrcat (&p->paramHeader,partString);
+                            }
+                        }
+                    else if (!strcmp(mp->nucModel, "Codon"))
+                        {
+                        for (c=0; c<p->nSubValues; c++)
+                            {
+                            if (mp->codonNucs[c][0] == 0)
+                                strcpy (tempCodon, "pi(A");
+                            else if (mp->codonNucs[c][0] == 1)
+                                strcpy (tempCodon, "pi(C");
+                            else if (mp->codonNucs[c][0] == 2)
+                                strcpy (tempCodon, "pi(G");
+                            else
+                                strcpy (tempCodon, "pi(T");
+                            if (mp->codonNucs[c][1] == 0)
+                                strcat (tempCodon, "A");
+                            else if (mp->codonNucs[c][1] == 1)
+                                strcat (tempCodon, "C");
+                            else if (mp->codonNucs[c][1] == 2)
+                                strcat (tempCodon, "G");
+                            else
+                                strcat (tempCodon, "T");
+                            if (mp->codonNucs[c][2] == 0)
+                                strcat (tempCodon, "A)");
+                            else if (mp->codonNucs[c][2] == 1)
+                                strcat (tempCodon, "C)");
+                            else if (mp->codonNucs[c][2] == 2)
+                                strcat (tempCodon, "G)");
+                            else
+                                strcat (tempCodon, "T)");
+                            if (c == 0)
+                                {
+                                SafeStrcat (&p->paramHeader, tempCodon);
+                                SafeStrcat (&p->paramHeader, partString);
+                                }
+                            else
+                                {
+                                SafeStrcat (&p->paramHeader, "\t");
+                                SafeStrcat (&p->paramHeader, tempCodon);
+                                SafeStrcat (&p->paramHeader, partString);
+                                }
+                            }
+                        }
+                    }
+                else if (m->dataType == PROTEIN)
+                    {
+                    if (FillRelPartsString (p, &partString) == YES)
+                        {
+                        SafeSprintf (&tempStr, &tempStrSize, "pi(Ala)%s\tpi(Arg)%s\tpi(Asn)%s\tpi(Asp)%s\tpi(Cys)%s\tpi(Gln)%s\tpi(Glu)%s\tpi(Gly)%s\tpi(His)%s\tpi(Ile)%s\tpi(Leu)%s\tpi(Lys)%s\tpi(Met)%s\tpi(Phe)%s\tpi(Pro)%s\tpi(Ser)%s\tpi(Thr)%s\tpi(Trp)%s\tpi(Tyr)%s\tpi(Val)%s",
+                        partString, partString, partString, partString, partString, partString, partString, partString, partString, partString,
+                        partString, partString, partString, partString, partString, partString, partString, partString, partString, partString);
+                        SafeStrcat (&p->paramHeader, tempStr);
+                        }
+                    else
+                        SafeStrcat (&p->paramHeader, "pi(Ala)\tpi(Arg)\tpi(Asn)\tpi(Asp)\tpi(Cys)\tpi(Gln)\tpi(Glu)\tpi(Gly)\tpi(His)\tpi(Ile)\tpi(Leu)\tpi(Lys)\tpi(Met)\tpi(Phe)\tpi(Pro)\tpi(Ser)\tpi(Thr)\tpi(Trp)\tpi(Tyr)\tpi(Val)");
+                    }
+                else if (mp->dataType == RESTRICTION)
+                    {
+                    if (FillRelPartsString (p, &partString) == YES)
+                        {
+                        SafeSprintf (&tempStr, &tempStrSize, "pi(0)%s\tpi(1)%s", partString, partString);
+                        SafeStrcat (&p->paramHeader, tempStr);
+                        }
+                    else
+                        SafeStrcat (&p->paramHeader, "pi(0)\tpi(1)");
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Unknown data type in SetModelParams\n", spacer);
+                    }
+                }
+            }
+        else if (j == P_SHAPE)
+            {
+            /* Set up shape parameter of gamma/lnorm *****************************************************************/
+            p->paramType = P_SHAPE;
+            p->nValues = 1;
+            p->nSubValues = mp->numGammaCats;
+            p->min = 1E-5;
+            p->max = 100;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].shape = p;
+            if(!strcmp(mp->ratesModel, "LNorm"))
+                {
+                p->paramTypeName = "SD of scaled lognormal distribution of site rates";
+                SafeStrcat(&p->name, "Sigma");
+                SafeStrcat (&p->paramHeader, "sigma");
+                }
+            else
+                {
+                p->paramTypeName = "Shape of scaled gamma distribution of site rates";
+                SafeStrcat(&p->name, "Alpha");
+                SafeStrcat (&p->paramHeader, "alpha");
+                }
+            SafeStrcat(&p->name, partString);
+            SafeStrcat (&p->paramHeader, partString);
+
+            /* find the parameter x prior type */
+            mp = &modelParams[p->relParts[0]];
+            if (!strcmp(mp->shapePr,"Uniform"))
+                p->paramId = SHAPE_UNI;
+            else if (!strcmp(mp->shapePr,"Exponential"))
+                p->paramId = SHAPE_EXP;
+            else
+                p->paramId = SHAPE_FIX;
+                
+            if (p->paramId != SHAPE_FIX)
+                p->printParam = YES;
+            }
+        else if (j == P_PINVAR)
+            {
+            /* Set up proportion of invariable sites ****************************************************************/
+            p->paramType = P_PINVAR;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = 1.0;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].pInvar = p;
+
+            p->paramTypeName = "Proportion of invariable sites";
+            SafeStrcat(&p->name, "Pinvar");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->pInvarPr,"Uniform"))
+                p->paramId = PINVAR_UNI;
+            else
+                p->paramId = PINVAR_FIX;
+                
+            if (p->paramId != PINVAR_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "pinvar");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_CORREL)
+            {
+            /* Set up correlation parameter of adgamma model ********************************************************/
+            p->paramType = P_CORREL;
+            p->nValues = 1;
+            p->nSubValues = mp->numGammaCats * mp->numGammaCats;
+            p->min = -1.0;
+            p->max = 1.0;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].correlation = p;
+
+            p->paramTypeName = "Autocorrelation of gamma distribution of site rates";
+            SafeStrcat(&p->name, "Rho");
+            SafeStrcat(&p->name, partString);
+            chainHasAdgamma = YES;
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->adGammaCorPr,"Uniform"))
+                p->paramId = CORREL_UNI;
+            else
+                p->paramId = CORREL_FIX;
+
+            if (p->paramId != CORREL_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "rho");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_SWITCH)
+            {
+            /* Set up switchRates for covarion model ****************************************************************/
+            p->paramType = P_SWITCH;
+            p->nValues = 2;
+            p->nSubValues = mp->numGammaCats * mp->numGammaCats;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].switchRates = p;
+
+            p->paramTypeName = "Switch rates of covarion model";
+            SafeStrcat(&p->name, "s_cov");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->covSwitchPr,"Uniform"))
+                p->paramId = SWITCH_UNI;
+            else if (!strcmp(mp->covSwitchPr,"Exponential"))
+                p->paramId = SWITCH_EXP;
+            else
+                p->paramId = SWITCH_FIX;
+                
+            if (p->paramId != SWITCH_FIX)
+                p->printParam = YES;
+
+            SafeStrcat (&p->paramHeader, "s(off->on)");
+            SafeStrcat (&p->paramHeader, partString);
+            SafeStrcat (&p->paramHeader, "\ts(on->off)");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_RATEMULT)
+            {
+            /* Set up rateMult for partition specific rates ***********************************************************/
+            p->paramType = P_RATEMULT;
+            if (!strcmp(mp->ratePr,"Fixed"))
+                {
+                p->nValues = 1;
+                p->nSubValues = 0;
+                }
+            else
+                {
+                p->nValues = p->nRelParts = numRelParts; /* keep scaled division rates in value                        */
+                p->nSubValues = p->nValues * 2;          /* keep number of uncompressed chars for scaling in subValue  */
+                }                                        /* also keep Dirichlet prior parameters here                  */
+            p->min = POS_MIN;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].rateMult = p;
+
+            p->paramTypeName = "Partition-specific rate multiplier";
+            SafeStrcat(&p->name, "Ratemultiplier");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (p->nSubValues == 0)
+                p->paramId = RATEMULT_FIX;
+            else
+                p->paramId = RATEMULT_DIR;
+
+            if (p->paramId != RATEMULT_FIX)
+                p->printParam = YES;
+            for (i=0; i<numCurrentDivisions; i++)
+                {
+                if (isPartTouched[i] == YES)
+                    {
+                    sprintf (tempMult, "m{%d}", i+1);
+                    if (i == 0)
+                        SafeStrcat (&p->paramHeader, tempMult);
+                    else
+                        {
+                        SafeStrcat (&p->paramHeader, "\t");
+                        SafeStrcat (&p->paramHeader, tempMult);
+                        }
+                    }
+                }
+            }
+        else if (j == P_GENETREERATE)
+            {
+            /* Set up rateMult for gene specific rates ****************************************************************/
+            p->paramType = P_GENETREERATE;
+            p->nValues = p->nRelParts = numRelParts;    /* keep scaled division rates in value                        */
+            p->nSubValues = p->nValues * 2;             /* keep number of uncompressed chars for scaling in subValue  */
+                                                        /* also keep Dirichlet prior parameters here                  */
+            p->min = POS_MIN;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].geneTreeRateMult = p;
+
+            p->paramTypeName = "Gene-specific rate multiplier";
+            SafeStrcat(&p->name, "Generatemult");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (strcmp(mp->generatePr,"Fixed") == 0)
+                p->paramId = GENETREERATEMULT_FIX;
+            else
+                p->paramId = GENETREERATEMULT_DIR;
+
+            if (p->paramId == GENETREERATEMULT_FIX)
+                p->printParam = NO;
+            else
+                p->printParam = YES;
+
+            for (i=0; i<numCurrentDivisions; i++)
+                {
+                if (isPartTouched[i] == YES)
+                    {
+                    sprintf (tempMult, "g_m{%d}", i+1);
+                    if (i == 0)
+                        SafeStrcat (&p->paramHeader, tempMult);
+                    else
+                        {
+                        SafeStrcat (&p->paramHeader, "\t");
+                        SafeStrcat (&p->paramHeader, tempMult);
+                        }
+                    }
+                }
+            }
+        else if (j == P_TOPOLOGY)
+            {
+            /* Set up topology **************************************************************************************/
+            p->paramType = P_TOPOLOGY;
+            p->nValues = 0;
+            p->nSubValues = 0;
+            p->min = NEG_INFINITY;  /* NA */
+            p->max = NEG_INFINITY;  /* NA */
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].topology = p;
+
+            p->paramTypeName = "Topology";
+            SafeStrcat(&p->name, "Tau");
+            SafeStrcat(&p->name, partString);
+                    
+            /* check that the model is not parsimony for all of the relevant partitions */
+            areAllPartsParsimony = YES;
+            for (i=0; i<p->nRelParts; i++)
+                {
+                if (modelSettings[p->relParts[i]].parsModelId == NO)
+                    areAllPartsParsimony = NO;
+                }
+
+            /* check if topology is clock or nonclock */
+            nClockBrlens = 0;
+            nCalibratedBrlens = 0;
+            nRelaxedBrlens = 0;
+            if (areAllPartsParsimony == NO)
+                {
+                for (i=0; i<p->nRelParts; i++)
+                    {
+                    if (!strcmp(modelParams[p->relParts[i]].brlensPr, "Clock"))
+                        {
+                        nClockBrlens++;
+                        if (strcmp(modelParams[p->relParts[i]].clockVarPr,"Strict") != 0)  /* not strict */
+                            nRelaxedBrlens++;
+                        if (!strcmp(modelParams[p->relParts[i]].nodeAgePr,"Calibrated"))
+                            nCalibratedBrlens++;
+                        }
+                    }
+                }
+            
+            /* now find the parameter x prior type */
+            if (areAllPartsParsimony == YES)
+                {
+                if (!strcmp(mp->topologyPr, "Uniform"))
+                    p->paramId = TOPOLOGY_PARSIMONY_UNIFORM;
+                else if (!strcmp(mp->topologyPr,"Constraints"))
+                    p->paramId = TOPOLOGY_PARSIMONY_CONSTRAINED;
+                else
+                    p->paramId = TOPOLOGY_PARSIMONY_FIXED;
+                /* For this case, we also need to set the brlens ptr of the relevant partitions
+                   so that it points to the topology parameter, since the rest of the
+                   program will try to access the tree through this pointer. In FillTreeParams,
+                   we will make sure that a pure parsimony topology parameter contains a pointer
+                   to the relevant tree (like a brlens parameter would normally) */
+                for (i=0; i<p->nRelParts; i++)
+                    modelSettings[p->relParts[i]].brlens = p;
+                }
+            else
+                {
+                /* we assume for now that there is only one branch length; we will correct this
+                   later in AllocateTreeParams if there are more than one set of branch lengths,
+                   which is only possible for non-clock trees */
+                if (!strcmp(mp->topologyPr, "Speciestree"))
+                    p->paramId = TOPOLOGY_SPECIESTREE;
+                else if (!strcmp(mp->topologyPr, "Uniform") && nClockBrlens == 0)
+                    p->paramId = TOPOLOGY_NCL_UNIFORM_HOMO;
+                else if (!strcmp(mp->topologyPr,"Constraints") && nClockBrlens == 0)
+                    p->paramId = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+                else if (!strcmp(mp->topologyPr,"Fixed") && nClockBrlens == 0)
+                    p->paramId = TOPOLOGY_NCL_FIXED_HOMO;
+                /* all below have clock branch lengths */
+                else if (!strcmp(mp->topologyPr, "Uniform") && nRelaxedBrlens == 0)
+                    {
+                    if (nCalibratedBrlens >= 1)
+                        p->paramId = TOPOLOGY_CCL_UNIFORM;
+                    else
+                        p->paramId = TOPOLOGY_CL_UNIFORM;
+                    }
+                else if (!strcmp(mp->topologyPr,"Constraints") && nRelaxedBrlens == 0)
+                    {
+                    if (nCalibratedBrlens >= 1)
+                        p->paramId = TOPOLOGY_CCL_CONSTRAINED;
+                    else
+                        p->paramId = TOPOLOGY_CL_CONSTRAINED;
+                    }
+                else if (!strcmp(mp->topologyPr,"Fixed") && nRelaxedBrlens == 0)
+                    {
+                    if (nCalibratedBrlens >= 1)
+                        p->paramId = TOPOLOGY_CCL_FIXED;
+                    else
+                        p->paramId = TOPOLOGY_CL_FIXED;
+                    }
+                /* all below have relaxed clock branch lengths */
+                else if (!strcmp(mp->topologyPr, "Uniform"))
+                    {
+                    if (nCalibratedBrlens >= 1)
+                        p->paramId = TOPOLOGY_RCCL_UNIFORM;
+                    else
+                        p->paramId = TOPOLOGY_RCL_UNIFORM;
+                    }
+                else if (!strcmp(mp->topologyPr,"Constraints"))
+                    {
+                    if (nCalibratedBrlens >= 1)
+                        p->paramId = TOPOLOGY_RCCL_CONSTRAINED;
+                    else
+                        p->paramId = TOPOLOGY_RCL_CONSTRAINED;
+                    }
+                else if (!strcmp(mp->topologyPr,"Fixed"))
+                    {
+                    if (nCalibratedBrlens >= 1)
+                        p->paramId = TOPOLOGY_RCCL_FIXED;
+                    else
+                        p->paramId = TOPOLOGY_RCL_FIXED;
+                    }
+                }
+
+            /* should we print the topology? */
+            for (i=0; i<p->nRelParts; i++)
+                if (strcmp(modelParams[p->relParts[i]].treeFormat,"Topology") != 0)
+                    break;
+            if (i == p->nRelParts)
+                p->printParam = YES;
+            else
+                p->printParam = NO;
+            /* but always print parsimony topology */
+            if (areAllPartsParsimony == YES)
+                p->printParam = YES;
+            /* and never print fixed topologies */
+            if (p->paramId == TOPOLOGY_RCL_FIXED ||
+                p->paramId == TOPOLOGY_RCCL_FIXED ||
+                p->paramId == TOPOLOGY_CL_FIXED ||
+                p->paramId == TOPOLOGY_CCL_FIXED ||
+                p->paramId == TOPOLOGY_NCL_FIXED ||
+                p->paramId == TOPOLOGY_PARSIMONY_FIXED)
+                p->printParam = NO;
+            }
+        else if (j == P_BRLENS)
+            {
+            /* Set up branch lengths ********************************************************************************/
+            p->paramType = P_BRLENS;
+            p->nValues = 0;
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].brlens = p;
+
+            p->paramTypeName = "Branch lengths";
+            SafeStrcat(&p->name, "V");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (modelSettings[p->relParts[0]].parsModelId == YES)
+                p->paramId = BRLENS_PARSIMONY;
+            else
+                {
+                if (!strcmp(mp->brlensPr, "Clock"))
+                    {
+                    if (!strcmp(mp->clockPr,"Uniform"))
+                        p->paramId = BRLENS_CLOCK_UNI;
+                    else if (!strcmp(mp->clockPr,"Coalescence"))
+                        p->paramId = BRLENS_CLOCK_COAL;
+                    else if (!strcmp(mp->clockPr,"Birthdeath"))
+                        p->paramId = BRLENS_CLOCK_BD;
+                    else if (!strcmp(mp->clockPr,"Speciestreecoalescence"))
+                        p->paramId = BRLENS_CLOCK_SPCOAL;
+                    else if (!strcmp(mp->clockPr,"Fossilization"))
+                        p->paramId = BRLENS_CLOCK_FOSSIL;
+                    else if (!strcmp(mp->clockPr,"Fixed"))
+                        p->paramId = BRLENS_CLOCK_FIXED;
+                    }
+                else if (!strcmp(mp->brlensPr, "Unconstrained"))
+                    {
+                    if (!strcmp(mp->unconstrainedPr,"Uniform"))
+                        p->paramId = BRLENS_UNI;
+                    else if (!strcmp(mp->unconstrainedPr,"Exponential"))
+                        p->paramId = BRLENS_EXP;
+                    else if (!strcmp(mp->unconstrainedPr,"GammaDir"))
+                        p->paramId = BRLENS_GamDir;
+                    else if (!strcmp(mp->unconstrainedPr,"invGamDir"))
+                        p->paramId = BRLENS_iGmDir;
+                    else if (!strcmp(mp->unconstrainedPr,"twoExp"))
+                        p->paramId = BRLENS_twoExp;
+                    }
+                else if (!strcmp(mp->brlensPr,"Fixed"))
+                    {
+                    p->paramId = BRLENS_FIXED;
+                    }
+                }
+
+            /* should we print the branch lengths? */
+            for (i=0; i<p->nRelParts; i++)
+                if (strcmp(modelParams[p->relParts[i]].treeFormat,"Topology") != 0)
+                    break;
+            if (i < p->nRelParts)
+                p->printParam = YES;
+            else
+                p->printParam = NO;
+            }
+        else if (j == P_SPECIESTREE)
+            {
+            /* Set up species tree **************************************************************************************/
+            p->paramType = P_SPECIESTREE;
+            p->nValues = 0;
+            p->nSubValues = 0;
+            p->min = NEG_INFINITY;  /* NA */
+            p->max = NEG_INFINITY;  /* NA */
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].speciesTree = p;
+
+            p->paramTypeName = "Species tree";
+            SafeStrcat(&p->name, "Spt");
+            SafeStrcat(&p->name, partString);
+                    
+            /* check that the model is not parsimony for all of the relevant partitions */
+            areAllPartsParsimony = YES;
+            for (i=0; i<p->nRelParts; i++)
+                {
+                if (modelSettings[p->relParts[i]].parsModelId == NO)
+                    areAllPartsParsimony = NO;
+                }
+            
+            /* find the parameter x prior type */
+            p->paramId = SPECIESTREE_UNIFORM;
+
+            /* should we print the tree? */
+            p->printParam = YES;
+            }
+        else if (j == P_SPECRATE)
+            {
+            /* Set up speciation rate ******************************************************************************/
+            p->paramType = P_SPECRATE;
+            if (!strcmp(mp->clockPr,"Fossilization"))
+                p->nValues = mp->sampleFSNum +1;  // rate in each time interval
+            else
+                p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = POS_MIN;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].speciationRates = p;
+
+            p->paramTypeName = "Speciation rate";
+            SafeStrcat(&p->name, "Net_speciation");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->speciationPr,"Uniform"))
+                p->paramId = SPECRATE_UNI;
+            else if (!strcmp(mp->speciationPr,"Exponential"))
+                p->paramId = SPECRATE_EXP;
+            else
+                p->paramId = SPECRATE_FIX;
+
+            if (p->paramId != SPECRATE_FIX)
+                p->printParam = YES;
+                
+            if (p->nValues == 1)
+                {
+                SafeStrcat (&p->paramHeader, "net_speciation");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else for (i = 0; i < p->nValues; i++)
+                {
+                sprintf (tempStr, "\tnet_speciation_%d", i+1);
+                SafeStrcat (&p->paramHeader, tempStr);
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            }
+        else if (j == P_EXTRATE)
+            {
+            /* Set up extinction rates ******************************************************************************/
+            p->paramType = P_EXTRATE;
+            if (!strcmp(mp->clockPr,"Fossilization"))
+                p->nValues = mp->sampleFSNum +1;  // rate in each time interval
+            else
+                p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = 1.0;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].extinctionRates = p;
+
+            p->paramTypeName = "Extinction rate";
+            SafeStrcat(&p->name, "Relative_extinction");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->extinctionPr,"Beta"))
+                p->paramId = EXTRATE_BETA;
+            else
+                p->paramId = EXTRATE_FIX;
+
+            if (p->paramId != EXTRATE_FIX)
+                p->printParam = YES;
+                
+            if (p->nValues == 1)
+                {
+                SafeStrcat (&p->paramHeader, "relative_extinction");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else for (i = 0; i < p->nValues; i++)
+                {
+                sprintf (tempStr, "\trelative_extinction_%d", i+1);
+                SafeStrcat (&p->paramHeader, tempStr);
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            }
+        else if (j == P_FOSLRATE)
+            {
+            /* Set up fossilization rates */
+            p->paramType = P_FOSLRATE;
+            p->nValues = mp->sampleFSNum +1;  // rate in each time interval
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = 1.0;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].fossilizationRates = p;
+            
+            p->paramTypeName = "Fossilization rate";
+            SafeStrcat(&p->name, "Relative_fossilization");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            if (!strcmp(mp->fossilizationPr,"Beta"))
+                p->paramId = FOSLRATE_BETA;
+            else
+                p->paramId = FOSLRATE_FIX;
+            
+            if (p->paramId != FOSLRATE_FIX)
+                p->printParam = YES;
+            
+            if (p->nValues == 1)
+                {
+                SafeStrcat (&p->paramHeader, "relative_fossilization");
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            else for (i = 0; i < p->nValues; i++)
+                {
+                sprintf (tempStr, "\trelative_fossilization_%d", i+1);
+                SafeStrcat (&p->paramHeader, tempStr);
+                SafeStrcat (&p->paramHeader, partString);
+                }
+            }
+        else if (j == P_POPSIZE)
+            {
+            /* Set up population size *****************************************************************************************/
+            p->paramType = P_POPSIZE;
+            if (!strcmp(mp->topologyPr,"Speciestree") && !strcmp(mp->popVarPr, "Variable"))
+                p->nValues = 2 * numSpecies;
+            else
+                p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = POS_MIN;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].popSize = p;
+
+            p->paramTypeName = "Coalescent process population size parameter";
+            SafeStrcat(&p->name, "Popsize");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->popSizePr,"Uniform"))
+                {
+                p->paramId      = POPSIZE_UNI;
+                p->LnPriorRatio = &LnProbRatioUniform;
+                p->priorParams  = mp->popSizeUni;
+                p->LnPriorProb  = &LnPriorProbUniform;
+                }
+            else if (!strcmp(mp->popSizePr,"Normal"))
+                {
+                p->paramId      = POPSIZE_NORMAL;
+                p->LnPriorRatio = &LnProbRatioTruncatedNormal;
+                p->priorParams  = mp->popSizeNormal;
+                p->LnPriorProb  = &LnPriorProbTruncatedNormal;
+                }
+            else if (!strcmp(mp->popSizePr,"Lognormal"))
+                {
+                p->paramId      = POPSIZE_LOGNORMAL;
+                p->LnPriorRatio = &LnProbRatioLognormal;
+                p->priorParams  = mp->popSizeLognormal;
+                p->LnPriorProb  = &LnPriorProbLognormal;
+                }
+            else if (!strcmp(mp->popSizePr,"Gamma"))
+                {
+                p->paramId      = POPSIZE_GAMMA;
+                p->LnPriorRatio = &LnProbRatioGamma;
+                p->priorParams  = mp->popSizeGamma;
+                p->LnPriorProb  = &LnPriorProbGamma;
+                }
+            else
+                {
+                p->paramId      = POPSIZE_FIX;
+                p->LnPriorRatio = NULL;
+                p->priorParams  = &mp->popSizeFix;
+                p->LnPriorProb  = &LnPriorProbFix;
+                }
+
+            if (p->paramId != POPSIZE_FIX && p->nValues == 1)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "popsize");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_GROWTH)
+            {
+            /* Set up growth rate ************************************************************************************/
+            p->paramType = P_GROWTH;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].growthRate = p;
+
+            p->paramTypeName = "Population growth rate";
+            SafeStrcat(&p->name, "R_pop");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->growthPr,"Uniform"))
+                {
+                p->paramId = GROWTH_UNI;
+                p->priorParams = mp->growthUni;
+                p->min = mp->growthUni[0];
+                p->max = mp->growthUni[1];
+                p->LnPriorRatio = &LnProbRatioUniform;
+                p->LnPriorProb = &LnPriorProbUniform;
+                }
+            else if (!strcmp(mp->growthPr,"Exponential"))
+                {
+                p->paramId = GROWTH_EXP;
+                p->priorParams = &mp->growthExp;
+                p->min = GROWTH_MIN;
+                p->max = GROWTH_MAX;
+                p->LnPriorRatio = &LnProbRatioExponential;
+                p->LnPriorProb = &LnPriorProbExponential;
+                }
+            else if (!strcmp(mp->growthPr,"Normal"))
+                {
+                p->paramId = GROWTH_NORMAL;
+                p->priorParams = mp->growthNorm;
+                p->min = GROWTH_MIN;
+                p->max = GROWTH_MAX;
+                p->LnPriorRatio = &LnProbRatioTruncatedNormal;
+                p->LnPriorProb = &LnPriorProbTruncatedNormal;
+                }
+            else
+                p->paramId = GROWTH_FIX;
+                {
+                p->paramId = GROWTH_FIX;
+                p->priorParams = &mp->growthFix;
+                p->min = p->max = mp->growthFix;
+                p->LnPriorRatio = &LnProbRatioFix;
+                p->LnPriorProb = &LnPriorProbFix;
+                }
+
+            if (p->paramId != GROWTH_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "growthRate");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_AAMODEL)
+            {
+            /* Set up aamodel *****************************************************************************************/
+            p->paramType = P_AAMODEL;
+            p->nValues = 1;
+            p->nSubValues = 10;
+            p->min = 0;
+            p->max = 9;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].aaModel = p;
+
+            p->paramTypeName = "Aminoacid model";
+            SafeStrcat(&p->name, "Aamodel");
+            SafeStrcat(&p->name, partString);
+
+            /* find the parameter x prior type */
+            if (!strcmp(mp->aaModelPr,"Mixed"))
+                p->paramId = AAMODEL_MIX;
+            else
+                p->paramId = AAMODEL_FIX;
+
+            if (p->paramId != AAMODEL_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "aamodel");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_CPPRATE)
+            {
+            /* Set up cpprate *****************************************************************************************/
+            p->paramType = P_CPPRATE;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].cppRate = p;
+
+            p->paramTypeName = "Rate of rate-multiplying compound Poisson process";
+            SafeStrcat(&p->name, "Lambda_cpp");
+            SafeStrcat(&p->name, partString);
+                    
+            /* find the parameter x prior type */
+            if (!strcmp(mp->cppRatePr,"Exponential"))
+                p->paramId = CPPRATE_EXP;
+            else
+                p->paramId = CPPRATE_FIX;
+            
+            if (p->paramId != CPPRATE_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "cppRate");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_CPPMULTDEV)
+            {
+            /* Set up sigma of cpp rate multipliers *****************************************************************************************/
+            p->paramType = P_CPPMULTDEV;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 0.0;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].cppMultDev = p;
+
+            p->paramTypeName = "Standard deviation (log) of CPP rate multipliers";
+            SafeStrcat(&p->name, "Sigma_cpp");
+            SafeStrcat(&p->name, partString);
+                    
+            /* find the parameter x prior type */
+            if (!strcmp(mp->cppMultDevPr,"Fixed"))
+                p->paramId = CPPMULTDEV_FIX;
+            
+            if (p->paramId != CPPMULTDEV_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "sigma_cpp");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_CPPEVENTS)
+            {
+            /* Set up cpp events parameter *****************************************************************************************/
+            p->paramType = P_CPPEVENTS;
+            p->nValues = 0;
+            p->nSubValues = 2*numLocalTaxa;     /* keep effective branch lengths here (for all nodes to be on the safe side) */
+            p->min = 1E-6;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].cppEvents = p;
+
+            p->paramTypeName = "Events of rate-multiplying compound Poisson process";
+            SafeStrcat(&p->name, "CppEvents");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            p->paramId = CPPEVENTS;
+            
+            /* should we print values to .p file? */
+            p->printParam = NO;
+            
+            SafeStrcat (&p->paramHeader, "cppEvents");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_TK02VAR)
+            {
+            /* Set up tk02 relaxed clock variance parameter *****************************************************************************************/
+            p->paramType = P_TK02VAR;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 1E-6;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].tk02var = p;
+
+            p->paramTypeName = "Variance of lognormal distribution of branch rates";
+            SafeStrcat(&p->name, "TK02var");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            if (!strcmp(mp->tk02varPr,"Uniform"))
+                p->paramId = TK02VAR_UNI;
+            else if (!strcmp(mp->tk02varPr,"Exponential"))
+                p->paramId = TK02VAR_EXP;
+            else
+                p->paramId = TK02VAR_FIX;
+            
+            if (p->paramId != TK02VAR_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "tk02var");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_TK02BRANCHRATES)
+            {
+            /* Set up tk02 relaxed clock rates parameter *****************************************************************************************/
+            p->paramType = P_TK02BRANCHRATES;
+            p->nValues = 2*numLocalTaxa;     /* use to hold the branch rates; we need one rate for the root */
+            p->nSubValues = 2*numLocalTaxa;  /* use to hold the effective branch lengths */
+            p->min = RATE_MIN;
+            p->max = RATE_MAX;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].tk02BranchRates = p;
+            
+            p->paramTypeName = "Branch rates of TK02 relaxed clock";
+            SafeStrcat(&p->name, "TK02Brlens");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            p->paramId = TK02BRANCHRATES;
+            
+            /* should we print values to .p file? */
+            p->printParam = NO;
+
+            SafeStrcat (&p->paramHeader, "tk02_brlens");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_IGRVAR)
+            {
+            /* Set up igr relaxed clock variance parameter *****************************************************************************************/
+            p->paramType = P_IGRVAR;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 1E-6;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].igrvar = p;
+
+            p->paramTypeName = "Variance increase of igr model branch lenths";
+            SafeStrcat(&p->name, "Igrvar");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            if (!strcmp(mp->igrvarPr,"Uniform"))
+                p->paramId = IGRVAR_UNI;
+            else if (!strcmp(mp->igrvarPr,"Exponential"))
+                p->paramId = IGRVAR_EXP;
+            else
+                p->paramId = IGRVAR_FIX;
+            
+            if (p->paramId != IGRVAR_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "igrvar");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_IGRBRANCHRATES)
+            {
+            /* Set up igr relaxed clock rates parameter *****************************************************************************************/
+            p->paramType = P_IGRBRANCHRATES;
+            p->nValues = 2*numLocalTaxa;     /* use to hold the branch rates; we need one rate for the root */
+            p->nSubValues = 2*numLocalTaxa;  /* use to hold the effective branch lengths */
+            p->min = RATE_MIN;
+            p->max = RATE_MAX;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].igrBranchRates = p;
+            
+            p->paramTypeName = "Branch lengths of IGR relaxed clock";
+            SafeStrcat(&p->name, "IgrBrlens");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            p->paramId = IGRBRANCHRATES;
+            
+            /* should we print values to .p file? */
+            p->printParam = NO;
+
+            SafeStrcat (&p->paramHeader, "igr_brlens");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_MIXEDVAR)
+            {
+            /* Set up mixed relaxed clock variance parameter *****************************************************************************************/
+            p->paramType = P_MIXEDVAR;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = 1E-6;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].mixedvar = p;
+            
+            p->paramTypeName = "Variance shared for mixed relaxed clock moodel";
+            SafeStrcat(&p->name, "Mixedvar");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            if (!strcmp(mp->mixedvarPr,"Uniform"))
+                p->paramId = MIXEDVAR_UNI;
+            else if (!strcmp(mp->mixedvarPr,"Exponential"))
+                p->paramId = MIXEDVAR_EXP;
+            else
+                p->paramId = MIXEDVAR_FIX;
+            
+            if (p->paramId != MIXEDVAR_FIX)
+                p->printParam = YES;
+            SafeStrcat (&p->paramHeader, "mixedvar");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_MIXEDBRCHRATES)
+            {
+            /* Set up mixed relaxed clock rates parameter *****************************************************************************************/
+            p->paramType = P_MIXEDBRCHRATES;
+            p->nValues = 2*numLocalTaxa;     /* use to hold the branch rates; we need one rate for the root */
+            p->nSubValues = 2*numLocalTaxa;  /* use to hold the effective branch lengths */
+            p->nIntValues = 1;               /* use to hold the model indicator: TK02 or IGR */
+            p->min = RATE_MIN;
+            p->max = RATE_MAX;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].mixedBrchRates = p;
+            
+            p->paramTypeName = "Branch rates of mixed relaxed clock";
+            SafeStrcat(&p->name, "MixedBrlens");
+            SafeStrcat(&p->name, partString);
+            
+            /* find the parameter x prior type */
+            p->paramId = MIXEDBRCHRATES;
+            
+            /* how to print model indicator (0 or 1) to .p file? */
+            p->printParam = NO;
+            
+            SafeStrcat (&p->paramHeader, "mixed_brlens");
+            SafeStrcat (&p->paramHeader, partString);
+            }
+        else if (j == P_CLOCKRATE)
+            {
+            /* Set up clockRate ****************************************************************************************/
+            p->paramType = P_CLOCKRATE;
+            p->nValues = 1;
+            p->nSubValues = 0;
+            p->min = POS_MIN;
+            p->max = POS_INFINITY;
+            for (i=0; i<numCurrentDivisions; i++)
+                if (isPartTouched[i] == YES)
+                    modelSettings[i].clockRate = p;
+    
+            p->paramTypeName = "Base rate of clock";
+            SafeStrcat(&p->name, "Clockrate");
+            SafeStrcat(&p->name, partString);
+
+            /* parameter does affect likelihoods */
+            p->affectsLikelihood = YES;
+            
+            /* find the parameter x prior type */
+            if (!strcmp(mp->clockRatePr,"Normal"))
+                {
+                p->paramId      = CLOCKRATE_NORMAL;
+                p->LnPriorRatio = &LnProbRatioTruncatedNormal;
+                p->priorParams  = mp->clockRateNormal;
+                p->LnPriorProb  = &LnPriorProbTruncatedNormal;
+                }
+            else if (!strcmp(mp->clockRatePr,"Lognormal"))
+                {
+                p->paramId      = CLOCKRATE_LOGNORMAL;
+                p->LnPriorRatio = &LnProbRatioLognormal;
+                p->priorParams  = mp->clockRateLognormal;
+                p->LnPriorProb  = &LnPriorProbLognormal;
+                }
+            else if (!strcmp(mp->clockRatePr,"Exponential"))
+                {
+                p->paramId      = CLOCKRATE_EXP;
+                p->LnPriorRatio = &LnProbRatioExponential;
+                p->priorParams  = &mp->clockRateExp;
+                p->LnPriorProb  = &LnPriorProbExponential;
+                }
+            else if (!strcmp(mp->clockRatePr,"Gamma"))
+                {
+                p->paramId      = CLOCKRATE_GAMMA;
+                p->LnPriorRatio = &LnProbRatioGamma;
+                p->priorParams  = mp->clockRateGamma;
+                p->LnPriorProb  = &LnPriorProbGamma;
+                }
+            else
+                {
+                p->paramId      = CLOCKRATE_FIX;
+                p->LnPriorRatio = NULL;
+                p->priorParams  = &mp->clockRateFix;
+                p->LnPriorProb  = &LnPriorProbFix;
+                }
+                
+            SafeStrcat (&p->paramHeader, "clockrate");
+            SafeStrcat (&p->paramHeader, partString);
+            if (p->paramId != CLOCKRATE_FIX)
+                p->printParam = YES;
+            }
+        }
+    free (tempStr);
+    free (isPartTouched);
+    SafeFree ((void **)&partString);
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------------------
+|
+|   SetMoves: This function will set up the applicable moves that could
+|       potentially be used in updating the model parameters
+|
+-----------------------------------------------------------------------------*/
+int SetMoves (void)
+{
+    int         i, j, k, moveIndex;
+    Param       *param;
+    
+    /* free up previous moves if any */
+    if (memAllocs[ALLOC_MOVES] == YES)
+        {
+        for (i=0; i<numApplicableMoves; i++)
+            FreeMove (moves[i]);
+        free (moves);
+        moves = NULL;
+        memAllocs[ALLOC_MOVES] = NO;
+        }
+
+    /* set up applicable moves                                   */
+    /* each combination of moveType and param is a separate move */
+    
+    /* first count applicable moves */
+    numApplicableMoves = 0;
+    for (k=0; k<numParams; k++)
+        {
+        param = &params[k];
+        for (i=0; i<NUM_MOVE_TYPES; i++)
+            {
+            if (moveTypes[i].level > userLevel)
+                continue;
+            if (moveTypes[i].isApplicable(param) == NO)
+                continue;
+            for (j=0; j<moveTypes[i].nApplicable; j++)
+                if (moveTypes[i].applicableTo[j] == param->paramId)
+                    {
+                    numApplicableMoves++;
+                    break;
+                    }
+            }
+        }
+
+    /* then allocate space for move pointers */
+    moves = (MCMCMove **) SafeMalloc (numApplicableMoves * sizeof (MCMCMove *));
+    if (!moves)
+        {
+        MrBayesPrint ("%s   Problem allocating moves\n", spacer);
+        return (ERROR);
+        }
+    memAllocs[ALLOC_MOVES] = YES;
+
+    /* finally allocate space for and set move defaults */
+    moveIndex = 0;
+    for (k=0; k<numParams; k++)
+        {
+        param = &params[k];
+        for (i=0; i<NUM_MOVE_TYPES; i++)
+            {   
+            if (moveTypes[i].level > userLevel)
+                continue;
+            if (moveTypes[i].isApplicable(param) == NO)
+                continue;
+            for (j=0; j<moveTypes[i].nApplicable; j++)
+                {
+                if (moveTypes[i].applicableTo[j] == param->paramId)
+                    {
+                    if ((moves[moveIndex] = AllocateMove (&moveTypes[i], param)) == NULL)
+                        break;
+                    else
+                        {
+                        moves[moveIndex]->parm = param;
+                        moveIndex++;
+                        break;
+                        }
+                    }
+                }
+            }
+        }
+
+    if (moveIndex < numApplicableMoves)
+        {
+        for (i=0; i<moveIndex; i++)
+            FreeMove (moves[i]);
+        free (moves);
+        memAllocs[ALLOC_MOVES] = NO;
+        MrBayesPrint ("%s   Problem setting moves\n", spacer);
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/** SetPopSizeParam: Set population size values for a species tree from an input tree */
+int SetPopSizeParam (Param *param, int chn, int state, PolyTree *pt)
+{
+    int         i, j, k, nLongsNeeded;
+    MrBFlt      *values;
+    Tree        *speciesTree;
+    PolyNode    *pp;
+    TreeNode    *p=NULL;
+
+    nLongsNeeded = 1 + (pt->nNodes - pt->nIntNodes - 1) / nBitsInALong;
+
+    /* Get pointer to values to be set */
+    values = GetParamVals (param, chn, state);
+
+    /* Get species tree */
+    speciesTree = GetTree (modelSettings[param->relParts[0]].speciesTree, chn, state);
+
+    /* Set them based on index of matching partitions */
+    AllocatePolyTreePartitions(pt);
+    AllocateTreePartitions(speciesTree);
+    for (i=0; i<pt->nNodes; i++)
+        {
+        pp = pt->allDownPass[i];
+        for (j=0; j<speciesTree->nNodes-1; j++)
+            {
+            p = speciesTree->allDownPass[j];
+            for (k=0; k<nLongsNeeded; k++)
+                {
+                if (pp->partition[k] != p->partition[k])
+                    break;
+                }
+            if (k == nLongsNeeded)
+                break;
+            }
+        if (j == speciesTree->nNodes - 1)
+            {
+            MrBayesPrint ("%s   Non-matching partitions when setting population size parameter", spacer);
+            FreePolyTreePartitions(pt);
+            FreeTreePartitions(speciesTree);
+            return (ERROR);
+            }
+        values[p->index] = pt->popSize[pp->index];
+    }
+
+    FreePolyTreePartitions(pt);
+    FreeTreePartitions(speciesTree);
+    
+    return (NO_ERROR);
+}
+
+
+/* SetRelaxedClockParam: set values for a relaxed clock param from an input tree */
+int SetRelaxedClockParam (Param *param, int chn, int state, PolyTree *pt)
+{
+    int         i, j, k, *nEvents=NULL, *nEventsP=NULL, nLongsNeeded, isEventSet;
+    MrBFlt       *effectiveBranchLengthP=NULL, *branchRate=NULL,
+                **position=NULL, **rateMult=NULL, **positionP=NULL, **rateMultP=NULL,
+                baseRate;
+    Tree        *t;
+    PolyNode    *pp;
+    TreeNode    *p=NULL, *q;
+
+    nLongsNeeded = 1 + (numLocalTaxa - 1) / nBitsInALong;
+
+    /* set pointers to the right set of values */
+    isEventSet = NO;
+    if (param->paramType == P_CPPEVENTS)
+        {
+        /* find the right event set */
+        for (i=0; i<pt->nESets; i++)
+            {
+            if (!strcmp(param->name,pt->eSetName[i]))
+                break;
+            }
+        if (i == pt->nESets)
+            {
+            for (i=0; i<pt->nBSets; i++)
+                if (!strcmp(param->name,pt->bSetName[i]))
+                    break;
+
+            if (i == pt->nBSets)
+                return (NO_ERROR);
+            else
+                isEventSet = NO;
+            }
+        else
+            isEventSet = YES;
+
+        if (isEventSet == YES)
+            {
+            nEventsP  = pt->nEvents[i];
+            positionP = pt->position[i];
+            rateMultP = pt->rateMult[i];
+            }
+        else
+            effectiveBranchLengthP = pt->effectiveBrLen[i];
+
+        nEvents  = param->nEvents[2*chn+state];
+        position = param->position[2*chn+state];
+        rateMult = param->rateMult[2*chn+state];
+        }
+    else if (param->paramType == P_TK02BRANCHRATES || param->paramType == P_IGRBRANCHRATES || param->paramType == P_MIXEDBRCHRATES)
+        {
+        /* find the right effective branch length set */
+        for (i=0; i<pt->nBSets; i++)
+            if (!strcmp(param->name,pt->bSetName[i]))
+                break;
+        if (i == pt->nBSets)
+            return (NO_ERROR);
+
+        effectiveBranchLengthP = pt->effectiveBrLen[i];
+        branchRate = GetParamVals (param, chn, state);
+        }
+
+    t = GetTree (param, chn, state);
+    AllocatePolyTreePartitions (pt);
+    AllocateTreePartitions (t);
+    
+    for (i=pt->nNodes-1; i>=0; i--)
+        {
+        pp = pt->allDownPass[i];
+        for (j=0; j<t->nNodes; j++)
+            {
+            p = t->allDownPass[j];
+            for (k=0; k<nLongsNeeded; k++)
+                if (p->partition[k] != pp->partition[k])
+                    break;
+            if (k == nLongsNeeded)
+                break;  /* match */
+            }
+        if (param->paramType == P_CPPEVENTS)
+            {
+            if (isEventSet == NO)
+                {
+                if (nEvents[p->index] != 1)
+                    {
+                    position[p->index] = (MrBFlt *) SafeRealloc ((void *) position[p->index], 1*sizeof(MrBFlt));
+                    rateMult[p->index] = (MrBFlt *) SafeRealloc ((void *) rateMult[p->index], 1*sizeof(MrBFlt));
+                    nEvents [p->index] = 1;
+                    }
+                position[p->index][0] = 0.5;
+                if (p->anc->anc == NULL)
+                    rateMult[p->index][0] = 1.0;
+                else
+                    {
+                    baseRate = 1.0;
+                    q = p->anc;
+                    while (q->anc != NULL)
+                        {
+                        baseRate *= rateMult[q->index][0];
+                        q = q->anc;
+                        }
+                    rateMult[p->index][0] = 2.0 * effectiveBranchLengthP[pp->index] / (p->length * baseRate) - 1.0;
+                    }
+                }
+            else
+                {
+                if (nEvents[p->index] != nEventsP[pp->index])
+                    {
+                    if (nEventsP[pp->index] == 0)
+                        {
+                        free (position[p->index]);
+                        free (rateMult[p->index]);
+                        }
+                    else
+                        {
+                        position[p->index] = (MrBFlt *) SafeRealloc ((void *) position[p->index], nEventsP[pp->index]*sizeof(MrBFlt));
+                        rateMult[p->index] = (MrBFlt *) SafeRealloc ((void *) rateMult[p->index], nEventsP[pp->index]*sizeof(MrBFlt));
+                        }
+                    nEvents[p->index] = nEventsP[pp->index];
+                    }
+                for (j=0; j<nEventsP[pp->index]; j++)
+                    {
+                    position[p->index][j] = positionP[pp->index][j];
+                    rateMult[p->index][j] = rateMultP[pp->index][j];
+                    }
+                }
+            }
+        else if (param->paramType == P_TK02BRANCHRATES ||
+                 (param->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(param, chn, state) == RCL_TK02))
+            {
+            if (p->anc->anc == NULL)
+                branchRate[p->index] = 1.0;
+            else if (p->length > 0.0)
+                branchRate[p->index] = 2.0 * effectiveBranchLengthP[pp->index] / p->length - branchRate[p->anc->index];
+            else
+                branchRate[p->index] = branchRate[p->anc->index];
+            }
+        else if (param->paramType == P_IGRBRANCHRATES ||
+                 (param->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(param, chn, state) == RCL_IGR))
+            {
+            if (p->length > 0.0)
+                branchRate[p->index] = effectiveBranchLengthP[pp->index] / p->length;
+            else
+                branchRate[p->index] = branchRate[p->anc->index];
+            }  // we are now reading effective branch length for TK02 and IGR
+        }
+
+    if (param->paramType == P_CPPEVENTS)
+        {
+        if (UpdateCppEvolLengths (param, t->root->left, chn) == ERROR)
+            return (ERROR);
+        }
+    else if (param->paramType == P_TK02BRANCHRATES ||
+             (param->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(param, chn, state) == RCL_TK02))
+        {
+        if (UpdateTK02EvolLengths (param, t, chn) == ERROR)
+            return (ERROR);
+        }
+    else if (param->paramType == P_IGRBRANCHRATES ||
+             (param->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(param, chn, state) == RCL_IGR))
+        {
+        if (UpdateIgrBrachLengths (param, t, chn) == ERROR)
+            return (ERROR);
+        }
+
+    FreePolyTreePartitions (pt);
+    FreeTreePartitions (t);
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   SetUpAnalysis: Set parameters and moves
+|
+------------------------------------------------------------------------*/
+int SetUpAnalysis (RandLong *seed)
+{
+    setUpAnalysisSuccess=NO;
+
+    /* calculate number of characters and taxa */
+    numLocalChar = NumNonExcludedChar ();
+
+    /* we are checking later to make sure no partition is without characters */
+    SetLocalTaxa ();
+    if (numLocalTaxa <= 2)
+        {
+        MrBayesPrint ("%s   There must be at least two included taxa, now there is %s\n", spacer,
+            numLocalTaxa == 0 ? "none" : "only one");
+        return (ERROR);
+        }
+
+    /* calculate number of global chains */
+    numGlobalChains = chainParams.numRuns * chainParams.numChains;
+
+    /* Set up link table */
+    if (SetUpLinkTable () == ERROR)
+        return (ERROR);
+    
+    /* Check that the settings for doublet or codon models are correct. */
+    if (CheckExpandedModels() == ERROR)
+        return (ERROR);
+
+    /* Set up model info */
+    if (SetModelInfo() == ERROR) 
+        return (ERROR);
+    
+    /* Calculate number of (uncompressed) characters for each division */
+    if (GetNumDivisionChars() == ERROR)
+        return (ERROR);
+
+    /* Compress data and calculate some things needed for setting up params. */
+    if (CompressData() == ERROR)
+        return (ERROR);
+
+    /* Add dummy characters, if needed. */
+    if (AddDummyChars() == ERROR)
+        return (ERROR);
+
+    /* Set up parameters for the chain. */
+    if (SetModelParams () == ERROR)
+        return (ERROR);
+    
+    /* Allocate normal params */
+    if (AllocateNormalParams () == ERROR)
+        return (ERROR);
+    
+    /* Allocate tree params */
+    if (AllocateTreeParams () == ERROR)
+        return (ERROR);
+    
+    /* Set default number of trees for sumt to appropriate number */
+    sumtParams.numTrees = numTrees;
+
+    /* Fill in normal parameters */
+    if (FillNormalParams (seed, 0, numGlobalChains) == ERROR) 
+        return (ERROR);
+
+    /* Process standard characters (calculates bsIndex, tiIndex, and more). */
+    if (ProcessStdChars(seed) == ERROR)
+        return (ERROR);
+
+    /* Fill in trees */
+    if (FillTreeParams (seed, 0, numGlobalChains) == ERROR)
+        return (ERROR);
+    
+    /* Set the applicable moves that could be used by the chain. */
+    if (SetMoves () == ERROR)
+        return (ERROR);
+    
+    setUpAnalysisSuccess=YES;
+    
+    return (NO_ERROR);
+}
+
+
+int SetUpLinkTable (void)
+{
+    int         i, j, k, m, paramCount, isApplicable1, isApplicable2,
+                isFirst, isSame;
+    int         *check, *modelId;
+
+    check = (int *) SafeMalloc (2 * (size_t)numCurrentDivisions * sizeof (int));
+    if (!check)
+        {
+        MrBayesPrint ("%s   Problem allocating check (%d)\n", spacer, 2 * numCurrentDivisions * sizeof(int));
+        return (ERROR);
+        }
+    modelId = check + numCurrentDivisions;
+
+    for (j=0; j<NUM_LINKED; j++)
+        for (i=0; i<numCurrentDivisions; i++)
+            activeParams[j][i] = 0;
+    
+    if (numCurrentDivisions > 1)
+        {
+        paramCount = 0;
+        for (j=0; j<NUM_LINKED; j++) /* loop over parameters */
+            {
+            isFirst = YES;
+            for (i=0; i<numCurrentDivisions; i++)
+                modelId[i] = 0;     
+            for (i=0; i<numCurrentDivisions-1; i++) /* loop over partitions */
+                {
+                for (k=i+1; k<numCurrentDivisions; k++)
+                    {
+                    if (IsModelSame (j, i, k, &isApplicable1, &isApplicable2) == NO || linkTable[j][i] != linkTable[j][k])
+                        {
+                        /* we cannot link the parameters */
+                        if (isApplicable1 == NO)
+                            modelId[i] = -1;
+                        if (isApplicable2 == NO)
+                            modelId[k] = -1;
+                        if (isApplicable1 == YES)
+                            {
+                            if (isFirst == YES && modelId[i] == 0)
+                                {
+                                modelId[i] = ++paramCount;
+                                isFirst = NO;
+                                }
+                            else
+                                {
+                                if (modelId[i] == 0)
+                                    modelId[i] = ++paramCount;
+                                }
+                            }
+                        if (modelId[k] == 0 && isApplicable2 == YES)
+                            modelId[k] = ++paramCount;
+                        }
+                    else
+                        {
+                        /* we can link the parameters */
+                        if (isFirst == YES)
+                            {
+                            if (modelId[i] == 0)
+                                modelId[i] = ++paramCount;
+                            isFirst = NO;
+                            }
+                        else
+                            {
+                            if (modelId[i] == 0)
+                                modelId[i] = ++paramCount;
+                            }
+                        modelId[k] = modelId[i];
+                        }
+                    }
+                }
+            for (i=0; i<numCurrentDivisions; i++)
+                activeParams[j][i] = modelId[i];
+            }
+        }
+    else
+        {
+        /* if we have only one partition, then we do things a bit differently */
+        paramCount = 0;
+        for (j=0; j<NUM_LINKED; j++) /* loop over parameters */
+            {
+            IsModelSame (j, 0, 0, &isApplicable1, &isApplicable2);
+            if (isApplicable1 == YES)
+                activeParams[j][0] = ++paramCount;
+            else
+                activeParams[j][0] = -1;
+            }
+        }
+        
+    /* Check that the same report format is specified for all partitions with the same rate multiplier */
+    for (i=0; i<numCurrentDivisions; i++)
+        check[i] = NO;
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        m = activeParams[P_RATEMULT][i];
+        if (m == -1 || check[i] == YES)
+            continue;
+        isSame = YES;
+        for (j=i+1; j<numCurrentDivisions; j++)
+            {
+            if (activeParams[P_RATEMULT][j] == m)
+                {
+                check[i] = YES;
+                if (strcmp(modelParams[i].ratemultFormat,modelParams[j].ratemultFormat)!= 0)
+                    {
+                    isSame = NO;
+                    strcpy (modelParams[j].ratemultFormat, modelParams[i].ratemultFormat);
+                    }
+                }
+            }
+        if (isSame == NO)
+            {
+            MrBayesPrint ("%s   WARNING: Report format for ratemult (parameter %d) varies across partitions.\n", spacer);
+            MrBayesPrint ("%s      MrBayes will use the format for the first partition, which is %s.\n", spacer, modelParams[i].ratemultFormat);
+            }
+        }
+       
+    /* probably a good idea to clean up link table here */
+    paramCount = 0;
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        for (i=0; i<numCurrentDivisions; i++)
+            check[i] = NO;
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (check[i] == NO && activeParams[j][i] > 0)
+                {
+                m = activeParams[j][i];
+                paramCount++;
+                for (k=i; k<numCurrentDivisions; k++)
+                    {
+                    if (check[k] == NO && activeParams[j][k] == m)
+                        {
+                        activeParams[j][k] = paramCount;
+                        check[k] = YES;
+                        }
+                    }
+                }
+            }
+        }
+
+    free (check);
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------
+|
+|   SetUpMoveTypes: Set up structs holding info on each move type
+|
+------------------------------------------------------------------------*/
+void SetUpMoveTypes (void)
+{
+    /* Register the move type here when new move functions are added 
+       Remember to check that the number of move types does not exceed NUM_MOVE_TYPES
+       defined in bayes.h.         */
+    int         i;
+    MoveType    *mt;
+
+    /* reset move types */
+    for (i=0; i<NUM_MOVE_TYPES; i++)
+        {
+        mt = &moveTypes[i];
+        mt->level = DEVELOPER;
+        mt->numTuningParams = 0;
+        mt->minimum[0] = mt->minimum[1] = -1000000000.0;
+        mt->maximum[0] = mt->maximum[1] =  1000000000.0;
+        mt->tuningParam[0] = mt->tuningParam[1] = 0.0;
+        mt->nApplicable = 0;
+        mt->name = mt->tuningName[0] = mt->tuningName[1] = "";
+        mt->paramName = "";
+        mt->subParams = NO;
+        mt->relProposalProb = 0.0;
+        mt->parsimonyBased = NO;
+        mt->isApplicable = &IsApplicable;
+        mt->Autotune = NULL;
+        mt->targetRate = -1.0;
+        }
+
+    /* Moves are in alphabetic order after parameter name, which matches the name of a move function if
+       there is a separate move function for the parameter. See proposal.h for declaration of move functions.
+       Since 2010-10-04, some parameters use generalized move functions and do not have their own. */
+    
+    i = 0;
+
+    /* Move_Aamodel */
+    mt = &moveTypes[i++];
+    mt->name = "Uniform random pick";
+    mt->shortName = "Uniform";
+    mt->applicableTo[0] = AAMODEL_MIX;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Aamodel;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    
+    /* Move_Adgamma */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = CORREL_UNI;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Adgamma;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.5;  /* window size */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 1.999;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Beta */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = SYMPI_UNI;
+    mt->applicableTo[1] = SYMPI_EXP;
+    mt->applicableTo[2] = SYMPI_UNI_MS;
+    mt->applicableTo[3] = SYMPI_EXP_MS;
+    mt->nApplicable = 4;
+    mt->moveFxn = &Move_Beta;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.5);  /* so-called lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_BrLen */
+    mt = &moveTypes[i++];
+    mt->name = "Random brlen hit with multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";  
+    mt->applicableTo[0] = BRLENS_UNI;
+    mt->applicableTo[1] = BRLENS_EXP;
+    mt->applicableTo[2] = BRLENS_GamDir;
+    mt->applicableTo[3] = BRLENS_iGmDir;
+    mt->applicableTo[4] = BRLENS_twoExp;
+    mt->nApplicable = 5;  // was 2
+    mt->moveFxn = &Move_BrLen;
+    mt->relProposalProb = 20.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (2.0);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;  /* change it smaller to avoid overflow in the exp function, same for following "smaller" */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_ClockRate_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = CLOCKRATE_NORMAL;
+    mt->applicableTo[1] = CLOCKRATE_LOGNORMAL;
+    mt->applicableTo[2] = CLOCKRATE_GAMMA;
+    mt->applicableTo[3] = CLOCKRATE_EXP;
+    mt->nApplicable = 4;
+    mt->moveFxn = &Move_ClockRate_M;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.5);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_Extinction */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = EXTRATE_BETA;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Extinction;
+    mt->relProposalProb = 3.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.1;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Fossilization */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = FOSLRATE_BETA;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Fossilization;
+    mt->relProposalProb = 3.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.1;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_AddBranch, for fossilization prior */
+    mt = &moveTypes[i++];
+    mt->name = "Add branch for FossilizedBD";
+    mt->shortName = "AddBranch";
+    // mt->subParams = YES;
+    mt->applicableTo[0] = BRLENS_CLOCK_FOSSIL;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_AddBranch;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level =STANDARD_USER;
+    mt->isApplicable = &IsApplicable_AncestralFossil;
+
+    /* Move_DelBranch, for fossilization prior */
+    mt = &moveTypes[i++];
+    mt->name = "Delete branch for FossilizedBD";
+    mt->shortName = "DelBranch";
+    // mt->subParams = YES;
+    mt->applicableTo[0] = BRLENS_CLOCK_FOSSIL;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_DelBranch;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level =STANDARD_USER;
+    mt->isApplicable = &IsApplicable_AncestralFossil;
+
+    /* Move_ExtSPR */
+    mt = &moveTypes[i++];
+    mt->name = "Extending SPR";
+    mt->shortName = "ExtSPR";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "p_ext";
+    mt->tuningName[1] = "Multiplier tuning parameter";
+    mt->shortTuningName[1] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ExtSPR;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 2;
+    mt->tuningParam[0] = 0.5; /* extension probability */
+    mt->tuningParam[1] = 2.0 * log (1.05);   /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 0.99999;
+    mt->minimum[1] = 0.00001;
+    mt->maximum[1] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_ExtSPR1 */
+    mt = &moveTypes[i++];
+    mt->name = "Extending SPR variant 1";
+    mt->shortName = "ExtSPR1";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "p_ext";
+    mt->tuningName[1] = "Multiplier tuning parameter";
+    mt->shortTuningName[1] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ExtSPR1;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 2;
+    mt->tuningParam[0] = 0.5; /* extension probability */
+    mt->tuningParam[1] = 2.0 * log (1.05);   /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 0.99999;
+    mt->minimum[1] = 0.00001;
+    mt->maximum[1] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = DEVELOPER;
+    mt->isApplicable = &IsApplicable_FiveTaxaOrMore;
+
+    /* Move_ExtSPRClock */
+    mt = &moveTypes[i++];
+    mt->name = "Extending SPR for clock trees";
+    mt->shortName = "ExtSprClock";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "p_ext";
+    mt->applicableTo[0] = TOPOLOGY_CL_UNIFORM;
+    mt->applicableTo[1] = TOPOLOGY_CCL_UNIFORM;
+    mt->applicableTo[2] = TOPOLOGY_CL_CONSTRAINED;
+    mt->applicableTo[3] = TOPOLOGY_CCL_CONSTRAINED;
+    mt->applicableTo[4] = TOPOLOGY_RCL_UNIFORM;
+    mt->applicableTo[5] = TOPOLOGY_RCL_CONSTRAINED;
+    mt->applicableTo[6] = TOPOLOGY_RCCL_UNIFORM;
+    mt->applicableTo[7] = TOPOLOGY_RCCL_CONSTRAINED;
+    mt->nApplicable = 8;
+    mt->moveFxn = &Move_ExtSPRClock;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.5; /* extension probability */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 0.99999;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_ThreeTaxaOrMore;
+
+    /* Move_ExtSS */
+    mt = &moveTypes[i++];
+    mt->name = "Extending subtree swapper";
+    mt->shortName = "ExtSS";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "p_ext";
+    mt->tuningName[1] = "Multiplier tuning parameter";
+    mt->shortTuningName[1] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ExtSS;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 2;
+    mt->tuningParam[0] = 0.5; /* extension probability */
+    mt->tuningParam[1] = 2.0 * log (1.05); /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 0.99999;
+    mt->minimum[1] = 0.00001;
+    mt->maximum[1] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_ExtSSClock */
+    mt = &moveTypes[i++];
+    mt->name = "Extending subtree swapper";
+    mt->shortName = "ExtSsClock";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "p_ext";
+    mt->applicableTo[0] = TOPOLOGY_CL_UNIFORM;
+    mt->applicableTo[1] = TOPOLOGY_CCL_UNIFORM;
+    mt->applicableTo[2] = TOPOLOGY_CL_CONSTRAINED;
+    mt->applicableTo[3] = TOPOLOGY_CCL_CONSTRAINED;
+    mt->applicableTo[4] = TOPOLOGY_RCL_UNIFORM;
+    mt->applicableTo[5] = TOPOLOGY_RCL_CONSTRAINED;
+    mt->applicableTo[6] = TOPOLOGY_RCCL_UNIFORM;
+    mt->applicableTo[7] = TOPOLOGY_RCCL_CONSTRAINED;
+    mt->nApplicable = 8;
+    mt->moveFxn = &Move_ExtSSClock;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.5; /* extension probability */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 0.99999;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_ThreeTaxaOrMore;
+
+    /* Move_ExtTBR */
+    mt = &moveTypes[i++];
+    mt->name = "Extending TBR";
+    mt->shortName = "ExtTBR";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "p_ext";
+    mt->tuningName[1] = "Multiplier tuning parameter";
+    mt->shortTuningName[1] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ExtTBR;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 2;
+    mt->tuningParam[0] = 0.5; /* extension probability */
+    mt->tuningParam[1] = 2.0 * log (1.05);   /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 0.99999;
+    mt->minimum[1] = 0.00001;
+    mt->maximum[1] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FiveTaxaOrMore;
+
+    /* Move_RateShape_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = SHAPE_UNI;
+    mt->applicableTo[1] = SHAPE_EXP;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_RateShape_M;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.5);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 10.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_GeneRate_Dir */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = GENETREERATEMULT_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_GeneRate_Dir;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 1000.0; /* alphaPi */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 1000000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_GeneTree1 */
+    mt = &moveTypes[i++];
+    mt->name = "Extending SPR move for gene trees in species trees";
+    mt->shortName = "ExtSPRClockGS";
+    mt->tuningName[0] = "Extension probability";
+    mt->shortTuningName[0] = "prob";
+    mt->applicableTo[0] = TOPOLOGY_SPECIESTREE;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_GeneTree1;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.5;       /* Tuning parameter value */
+    mt->minimum[0] = 0.00001;       /* Minimum value of tuning param */
+    mt->maximum[0] = 0.99999;       /* Maximum value of tuning param */
+    mt->parsimonyBased = NO;        /* It does not use parsimony scores */
+    mt->level = STANDARD_USER;
+
+    /* Move_GeneTree2 */
+    mt = &moveTypes[i++];
+    mt->name = "NNI move for gene trees in species trees";
+    mt->shortName = "NNIClockGS";
+    mt->applicableTo[0] = TOPOLOGY_SPECIESTREE;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_GeneTree2;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 0;        /* No tuning parameters */
+    mt->parsimonyBased = NO;        /* It does not use parsimony scores */
+    mt->level = STANDARD_USER;
+
+    /* Move_GeneTree3 */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased SPR for gene trees in species trees";
+    mt->shortName = "ParsSPRClockGS";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->applicableTo[0] = TOPOLOGY_SPECIESTREE;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_GeneTree3;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 3;
+    mt->tuningParam[0] = 0.1;  /* warp */
+    mt->tuningParam[1] = 0.05; /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.05; /* typical branch length */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 1.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->parsimonyBased = YES;
+    mt->level = STANDARD_USER;
+
+    /* Move_Growth_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = GROWTH_UNI;
+    mt->applicableTo[1] = GROWTH_EXP;
+    mt->applicableTo[2] = GROWTH_NORMAL;
+    mt->nApplicable = 3;
+    mt->moveFxn = &Move_Growth_M;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log(1.5);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_Local */
+    mt = &moveTypes[i++];
+    mt->name = "BAMBE's LOCAL";
+    mt->shortName = "Local";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_Local;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_LocalClock */
+    mt = &moveTypes[i++];
+    mt->name = "Modified LOCAL for clock trees";
+    mt->shortName = "LocalClock";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_CL_UNIFORM;
+    mt->applicableTo[1] = TOPOLOGY_CCL_UNIFORM;
+    mt->applicableTo[2] = TOPOLOGY_CL_CONSTRAINED;
+    mt->applicableTo[3] = TOPOLOGY_CCL_CONSTRAINED;
+    mt->nApplicable = 4;
+    mt->moveFxn = &Move_LocalClock;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (2.0);  /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_ThreeTaxaOrMore;
+
+    /* Move_NNI */
+    mt = &moveTypes[i++];
+    mt->name = "NNI move for parsimony trees";
+    mt->shortName = "ParsNNI";
+    mt->applicableTo[0] = TOPOLOGY_PARSIMONY_UNIFORM;
+    mt->applicableTo[1] = TOPOLOGY_PARSIMONY_CONSTRAINED;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_NNI;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;    /* no extra parsimony scores are needed */
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_NNIClock */
+    mt = &moveTypes[i++];
+    mt->name = "NNI move for clock trees";
+    mt->shortName = "NNIClock";
+    mt->subParams = YES;
+    mt->applicableTo[0] = TOPOLOGY_CL_UNIFORM;
+    mt->applicableTo[1] = TOPOLOGY_CCL_UNIFORM;
+    mt->applicableTo[2] = TOPOLOGY_CL_CONSTRAINED;
+    mt->applicableTo[3] = TOPOLOGY_CCL_CONSTRAINED;
+    mt->applicableTo[4] = TOPOLOGY_RCL_UNIFORM;
+    mt->applicableTo[5] = TOPOLOGY_RCL_CONSTRAINED;
+    mt->applicableTo[6] = TOPOLOGY_RCCL_UNIFORM;
+    mt->applicableTo[7] = TOPOLOGY_RCCL_CONSTRAINED;
+    mt->nApplicable = 8;
+    mt->moveFxn = &Move_NNIClock;
+    mt->relProposalProb = 12.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_ThreeTaxaOrMore;
+
+    /* Move_NNI */
+    mt = &moveTypes[i++];
+    mt->name = "NNI move";
+    mt->shortName = "NNI";
+    mt->subParams = YES;
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_NNI;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 0;
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_NNI_Hetero */
+    mt = &moveTypes[i++];
+    mt->name = "NNI move for trees with independent brlens";
+    mt->shortName = "MultNNI";
+    mt->subParams = YES;
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HETERO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HETERO;
+    mt->nApplicable = 2; /* 3; */
+    mt->moveFxn = &Move_NNI_Hetero;
+    mt->relProposalProb = 15.0;
+    mt->numTuningParams = 0;
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_NodeSlider */
+    mt = &moveTypes[i++];
+    mt->name = "Node slider (uniform on possible positions)";
+    mt->shortName = "Nodeslider";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = BRLENS_UNI;
+    mt->applicableTo[1] = BRLENS_EXP;
+    mt->applicableTo[2] = BRLENS_GamDir;
+    mt->applicableTo[3] = BRLENS_iGmDir;
+    mt->applicableTo[4] = BRLENS_twoExp;
+    mt->nApplicable = 5;  // was 2
+    mt->moveFxn = &Move_NodeSlider;
+    mt->relProposalProb = 7.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+
+    /* Move_NodeSliderClock */
+    mt = &moveTypes[i++];
+    mt->name = "Node depth window slider (clock-constrained)";
+    mt->shortName = "NodesliderClock";
+    mt->tuningName[0] = "Window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = BRLENS_CLOCK_UNI;
+    mt->applicableTo[1] = BRLENS_CLOCK_COAL;
+    mt->applicableTo[2] = BRLENS_CLOCK_BD;
+    mt->applicableTo[3] = BRLENS_CLOCK_FOSSIL;
+    mt->nApplicable = 4;
+    mt->moveFxn = &Move_NodeSliderClock;
+    mt->relProposalProb = 20.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.05; /* window size */
+    mt->minimum[0] = 0.000001;
+    mt->maximum[0] = 1.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_NodeSliderGeneTree */
+    mt = &moveTypes[i++];
+    mt->name = "Node depth slider for gene trees";
+    mt->shortName = "NodesliderGenetree";
+    mt->tuningName[0] = "Window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = BRLENS_CLOCK_SPCOAL;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_NodeSliderGeneTree;
+    mt->relProposalProb = 20.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.05; /* window size */
+    mt->minimum[0] = 0.000001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Omega */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = OMEGA_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Omega;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 1.0; /* sliding window size */
+    mt->minimum[0] = 0.000001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Omega_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = OMEGA_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Omega_M;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.5);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_OmegaBeta_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->paramName = "Omega_beta_M10";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = OMEGA_10UUB;
+    mt->applicableTo[1] = OMEGA_10UUF;
+    mt->applicableTo[2] = OMEGA_10UEB;
+    mt->applicableTo[3] = OMEGA_10UEF;
+    mt->applicableTo[4] = OMEGA_10UFB;
+    mt->applicableTo[5] = OMEGA_10UFF;
+    mt->applicableTo[6] = OMEGA_10EUB;
+    mt->applicableTo[7] = OMEGA_10EUF;
+    mt->applicableTo[8] = OMEGA_10EEB;
+    mt->applicableTo[9] = OMEGA_10EEF;
+    mt->applicableTo[10] = OMEGA_10EFB;
+    mt->applicableTo[11] = OMEGA_10EFF;
+    mt->nApplicable = 12;
+    mt->moveFxn = &Move_OmegaBeta_M;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_OmegaCat */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->paramName = "Omega_pi";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = OMEGA_BUD;
+    mt->applicableTo[1] = OMEGA_BED;
+    mt->applicableTo[2] = OMEGA_BFD;
+    mt->applicableTo[3] = OMEGA_FUD;
+    mt->applicableTo[4] = OMEGA_FED;
+    mt->applicableTo[5] = OMEGA_FFD;
+    mt->applicableTo[6] = OMEGA_ED;
+    mt->applicableTo[7] = OMEGA_FD;
+    mt->applicableTo[8] = OMEGA_10UUB;
+    mt->applicableTo[9] = OMEGA_10UEB;
+    mt->applicableTo[10] = OMEGA_10UFB;
+    mt->applicableTo[11] = OMEGA_10EUB;
+    mt->applicableTo[12] = OMEGA_10EEB;
+    mt->applicableTo[13] = OMEGA_10EFB;
+    mt->applicableTo[14] = OMEGA_10FUB;
+    mt->applicableTo[15] = OMEGA_10FEB;
+    mt->applicableTo[16] = OMEGA_10FFB;
+    mt->nApplicable = 17;
+    mt->moveFxn = &Move_OmegaCat;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 300.0;  /* alpha-pi */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_OmegaGamma_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->paramName = "Omega_shape_M10";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = OMEGA_10UUB;
+    mt->applicableTo[1] = OMEGA_10UUF;
+    mt->applicableTo[2] = OMEGA_10UEB;
+    mt->applicableTo[3] = OMEGA_10UEF;
+    mt->applicableTo[4] = OMEGA_10EUB;
+    mt->applicableTo[5] = OMEGA_10EUF;
+    mt->applicableTo[6] = OMEGA_10EEB;
+    mt->applicableTo[7] = OMEGA_10EEF;
+    mt->applicableTo[8] = OMEGA_10FUB;
+    mt->applicableTo[9] = OMEGA_10FUF;
+    mt->applicableTo[10] = OMEGA_10FEB;
+    mt->applicableTo[11] = OMEGA_10FEF;
+    mt->nApplicable = 12;
+    mt->moveFxn = &Move_OmegaGamma_M;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_OmegaM3 */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = OMEGA_ED;
+    mt->applicableTo[1] = OMEGA_EF;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_OmegaM3;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.1;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 1.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_OmegaPur : Let it be here so that omega moves are listed in logical order! */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->paramName = "Omega_pur";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = OMEGA_BUD;
+    mt->applicableTo[1] = OMEGA_BUF;
+    mt->applicableTo[2] = OMEGA_BED;
+    mt->applicableTo[3] = OMEGA_BEF;
+    mt->applicableTo[4] = OMEGA_BFD;
+    mt->applicableTo[5] = OMEGA_BFF;
+    mt->nApplicable = 6;
+    mt->moveFxn = &Move_OmegaPur;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.1;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 1.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_OmegaPos */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->paramName = "Omega_pos";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = OMEGA_BUD;
+    mt->applicableTo[1] = OMEGA_BUF;
+    mt->applicableTo[2] = OMEGA_BED;
+    mt->applicableTo[3] = OMEGA_BEF;
+    mt->applicableTo[4] = OMEGA_FUD;
+    mt->applicableTo[5] = OMEGA_FUF;
+    mt->applicableTo[6] = OMEGA_FED;
+    mt->applicableTo[7] = OMEGA_FEF;
+    mt->nApplicable = 8;
+    mt->moveFxn = &Move_OmegaPos;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 1.0;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_ParsEraser1 */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased eraser version 1";
+    mt->shortName = "pEraser1";
+    mt->subParams = YES;
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->tuningName[1] = "parsimony warp factor";
+    mt->shortTuningName[1] = "warp";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_ParsEraser1;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 2;
+    mt->tuningParam[0] = 0.5; /* alphaPi */
+    mt->tuningParam[1] = 0.1; /* warp */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 10000.0;
+    mt->minimum[1] = 0.00001;
+    mt->maximum[1] = 0.99999;
+    mt->parsimonyBased = YES;
+    mt->level = DEVELOPER;
+    mt->isApplicable = &IsApplicable_FiveTaxaOrMore;
+
+    /* Move_ParsSPR asym */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased SPR";
+    mt->shortName = "ParsSPR";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->tuningName[3] = "multiplier tuning parameter";
+    mt->shortTuningName[3] = "lambda";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ParsSPR;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 4;
+    mt->tuningParam[0] = 0.1;              /* warp */
+    mt->tuningParam[1] = 0.05;             /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.03;             /* typical branch length */
+    mt->tuningParam[3] = 2.0 * log (1.05); /* multiplier tuning parameter lambda */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 1.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->minimum[3] = 2.0 * log (0.001);
+    mt->maximum[3] = 2.0 * log (1000.);
+    mt->parsimonyBased = YES;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_ParsSPR1 e^{-S} */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased SPR variant 1";
+    mt->shortName = "ParsSPR1";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->tuningName[3] = "multiplier tuning parameter";
+    mt->shortTuningName[3] = "lambda";
+    mt->tuningName[4] = "moving distance";
+    mt->shortTuningName[4] = "d";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ParsSPR1;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 5;
+    mt->tuningParam[0] = 0.5;              /* warp */
+    mt->tuningParam[1] = 0.05;             /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.03;             /* typical branch length */
+    mt->tuningParam[3] = 2.0 * log (1.05); /* multiplier tuning parameter lambda */
+    mt->tuningParam[4] = 10.0;             /* distance to move picked branch */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 5.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->minimum[3] = 2.0 * log (0.001);
+    mt->maximum[3] = 2.0 * log (1000.);
+    mt->minimum[4] = 2.0;
+    mt->maximum[4] = 1000.0;
+    mt->parsimonyBased = YES;
+    mt->level = DEVELOPER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_ParsSPR2 S/N */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased SPR variant 2";
+    mt->shortName = "ParsSPR2";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->tuningName[3] = "multiplier tuning parameter";
+    mt->shortTuningName[3] = "lambda";
+    mt->tuningName[4] = "moving distance";
+    mt->shortTuningName[4] = "d";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ParsSPR2;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 5;
+    mt->tuningParam[0] = 0.1;              /* warp */
+    mt->tuningParam[1] = 0.05;             /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.03;             /* typical branch length */
+    mt->tuningParam[3] = 2.0 * log (1.05); /* multiplier tuning parameter lambda */
+    mt->tuningParam[4] = 10.0;             /* distance to move picked branch */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 1.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->minimum[3] = 2.0 * log (0.001);
+    mt->maximum[3] = 2.0 * log (1000.);
+    mt->minimum[4] = 2.0;
+    mt->maximum[4] = 1000.0;
+    mt->parsimonyBased = YES;
+    mt->level = DEVELOPER;
+    mt->isApplicable = &IsApplicable_FourTaxaOrMore;
+
+    /* Move_ParsSPRClock */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased SPR for clock trees";
+    mt->shortName = "ParsSPRClock";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->applicableTo[0] = TOPOLOGY_CL_UNIFORM;
+    mt->applicableTo[1] = TOPOLOGY_CCL_UNIFORM;
+    mt->applicableTo[2] = TOPOLOGY_CL_CONSTRAINED;
+    mt->applicableTo[3] = TOPOLOGY_CCL_CONSTRAINED;
+    mt->applicableTo[4] = TOPOLOGY_RCL_UNIFORM;
+    mt->applicableTo[5] = TOPOLOGY_RCL_CONSTRAINED;
+    mt->applicableTo[6] = TOPOLOGY_RCCL_UNIFORM;
+    mt->applicableTo[7] = TOPOLOGY_RCCL_CONSTRAINED;
+    mt->nApplicable = 8;
+    mt->moveFxn = &Move_ParsSPRClock;
+    mt->relProposalProb = 8.0;
+    mt->numTuningParams = 3;
+    mt->tuningParam[0] = 0.1;  /* warp */
+    mt->tuningParam[1] = 0.05; /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.03; /* typical branch length */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 1.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->parsimonyBased = YES;
+    mt->level = STANDARD_USER;
+    mt->isApplicable = &IsApplicable_ThreeTaxaOrMore;
+
+    /* Move_ParsTBR1 e^{-S} */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased TBR variant 1";
+    mt->shortName = "ParsTBR1";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->tuningName[3] = "multiplier tuning parameter";
+    mt->shortTuningName[3] = "lambda";
+    mt->tuningName[4] = "moving distance";
+    mt->shortTuningName[4] = "d";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ParsTBR1;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 5;
+    mt->tuningParam[0] = 0.5;              /* warp */
+    mt->tuningParam[1] = 0.05;             /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.05;             /* typical branch length */
+    mt->tuningParam[3] = 2.0 * log (1.05); /* multiplier tuning parameter lambda */
+    mt->tuningParam[4] = 5.0;              /* distance to move picked branch */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 5.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->minimum[3] = 2.0 * log (0.001);
+    mt->maximum[3] = 2.0 * log (1000.);
+    mt->minimum[4] = 2.0;
+    mt->maximum[4] = 1000.0;
+    mt->parsimonyBased = YES;
+    mt->level = DEVELOPER;
+    mt->isApplicable = &IsApplicable_FiveTaxaOrMore;
+
+    /* Move_ParsTBR2 S/N */
+    mt = &moveTypes[i++];
+    mt->name = "Parsimony-biased TBR variant 2";
+    mt->shortName = "ParsTBR2";
+    mt->subParams = YES;
+    mt->tuningName[0] = "parsimony warp factor";
+    mt->shortTuningName[0] = "warp";
+    mt->tuningName[1] = "reweighting probability";
+    mt->shortTuningName[1] = "r";
+    mt->tuningName[2] = "typical branch length";
+    mt->shortTuningName[2] = "v_t";
+    mt->tuningName[3] = "multiplier tuning parameter";
+    mt->shortTuningName[3] = "lambda";
+    mt->tuningName[4] = "moving distance";
+    mt->shortTuningName[4] = "d";
+    mt->applicableTo[0] = TOPOLOGY_NCL_UNIFORM_HOMO;
+    mt->applicableTo[1] = TOPOLOGY_NCL_CONSTRAINED_HOMO;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_ParsTBR2;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 5;
+    mt->tuningParam[0] = 0.1;              /* warp */
+    mt->tuningParam[1] = 0.05;             /* upweight and downweight probability */
+    mt->tuningParam[2] = 0.05;             /* typical branch length */
+    mt->tuningParam[3] = 2.0 * log (1.05); /* multiplier tuning parameter lambda */
+    mt->tuningParam[4] = 5.0;              /* distance to move picked branch */
+    mt->minimum[0] = 0.0;
+    mt->maximum[0] = 1.0;
+    mt->minimum[1] = 0.0;
+    mt->maximum[1] = 0.3;
+    mt->minimum[2] = 0.0001;
+    mt->maximum[2] = 0.5;
+    mt->minimum[3] = 2.0 * log (0.001);
+    mt->maximum[3] = 2.0 * log (1000.);
+    mt->minimum[4] = 2.0;
+    mt->maximum[4] = 1000.0;
+    mt->parsimonyBased = YES;
+    mt->level = DEVELOPER;
+    mt->isApplicable = &IsApplicable_FiveTaxaOrMore;
+
+    /* Move_Pinvar */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = PINVAR_UNI;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Pinvar;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.1;  /* window size */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 0.999;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Popsize_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = POPSIZE_UNI;
+    mt->applicableTo[1] = POPSIZE_LOGNORMAL;
+    mt->applicableTo[2] = POPSIZE_NORMAL;
+    mt->applicableTo[3] = POPSIZE_GAMMA;
+    mt->nApplicable = 4;
+    mt->moveFxn = &Move_PopSize_M;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log(1.5);  /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_RateMult_Dir */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = RATEMULT_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_RateMult_Dir;
+    mt->relProposalProb = 0.75;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 50.0; /* alphaPi per site */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_RateMult_Slider */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = RATEMULT_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_RateMult_Slider;
+    mt->relProposalProb = 0.75;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.05;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 1.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Revmat_Dir */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = REVMAT_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Revmat_Dir;
+    mt->relProposalProb = 0.5;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 100.0;  /* alphaPi per rate */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_Revmat_Slider */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = REVMAT_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Revmat_Slider;
+    mt->relProposalProb = 0.5;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.15;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 1.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Revmat_DirMix */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = REVMAT_MIX;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Revmat_DirMix;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 100.0;  /* alphaPi per rate */
+    mt->minimum[0] = 0.01;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+    
+    /* Move_Revmat_SplitMerge1 */
+    mt = &moveTypes[i++];
+    mt->name = "Split-merge move 1";
+    mt->shortName = "Splitmerge1";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = REVMAT_MIX;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Revmat_SplitMerge1;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 10.0;  /* alphaPi per rate */
+    mt->minimum[0] = 0.5;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_Revmat_SplitMerge2 */
+    mt = &moveTypes[i++];
+    mt->name = "Split-merge move 2";
+    mt->shortName = "Splitmerge2";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = REVMAT_MIX;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Revmat_SplitMerge2;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 10.0;  /* alphaPi per rate */
+    mt->minimum[0] = 0.5;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_Speciation */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = SPECRATE_UNI;
+    mt->applicableTo[1] = SPECRATE_EXP;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_Speciation;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 1.0;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_Speciation_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = SPECRATE_UNI;
+    mt->applicableTo[1] = SPECRATE_EXP;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_Speciation_M;
+    mt->relProposalProb = 3.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_SpeciesTree */
+    mt = &moveTypes[i++];
+    mt->name = "Species tree move";
+    mt->shortName = "Distmatrixmove";
+    mt->tuningName[0] = "Divider of rate of truncated exponential";
+    mt->shortTuningName[0] = "lambdadiv";
+    mt->applicableTo[0] = SPECIESTREE_UNIFORM;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_SpeciesTree;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 1.2;       /* Default tuning parameter value */
+    mt->minimum[0] = 0.00001;       /* Minimum value of tuning param */
+    mt->maximum[0] = 1000.0;        /* Maximum value of tuning param */
+    mt->parsimonyBased = NO;        /* It does not use parsimony scores */
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier; /* Autotune this move as a mutliplier move (larger is more bold) */
+    mt->targetRate = 0.25;              /* Target acceptance rate */
+
+    /* Move_Statefreqs */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = PI_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Statefreqs;
+    mt->relProposalProb = 0.5;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 100.0; /* alphaPi per state */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_Statefreqs_Slider */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = PI_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Statefreqs_Slider;
+    mt->relProposalProb = 0.5;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 0.20;  /* window size (change in proportions) */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 1.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_StatefreqsSymDirMultistate */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->paramName = "Pi_symdir";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = SYMPI_FIX_MS;
+    mt->applicableTo[1] = SYMPI_UNI_MS;
+    mt->applicableTo[2] = SYMPI_EXP_MS;
+    mt->nApplicable = 3;
+    mt->moveFxn = &Move_StatefreqsSymDirMultistate;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 50.0; /* alphaPi */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_SwitchRate */
+    mt = &moveTypes[i++];
+    mt->name = "Sliding window";
+    mt->shortName = "Slider";
+    mt->tuningName[0] = "Sliding window size";
+    mt->shortTuningName[0] = "delta";
+    mt->applicableTo[0] = SWITCH_UNI;
+    mt->applicableTo[1] = SWITCH_EXP;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_SwitchRate;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 1.0;  /* window size */
+    mt->minimum[0] = 0.00001;
+    mt->maximum[0] = 100.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneSlider;
+    mt->targetRate = 0.25;
+
+    /* Move_SwitchRate_M */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = SWITCH_UNI;
+    mt->applicableTo[1] = SWITCH_EXP;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_SwitchRate_M;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.5);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_Tratio_Dir */
+    mt = &moveTypes[i++];
+    mt->name = "Dirichlet proposal";
+    mt->shortName = "Dirichlet";
+    mt->tuningName[0] = "Dirichlet parameter";
+    mt->shortTuningName[0] = "alpha";
+    mt->applicableTo[0] = TRATIO_DIR;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_Tratio_Dir;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 50.0;  /* alphaPi */
+    mt->minimum[0] = 0.001;
+    mt->maximum[0] = 10000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneDirichlet;
+    mt->targetRate = 0.25;
+
+    /* Move_TreeStretch */
+    mt = &moveTypes[i++];
+    mt->name = "Tree stretch";
+    mt->shortName = "TreeStretch";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = BRLENS_CLOCK_UNI;
+    mt->applicableTo[1] = BRLENS_CLOCK_BD;
+    mt->applicableTo[2] = BRLENS_CLOCK_COAL;
+    mt->applicableTo[3] = BRLENS_CLOCK_FOSSIL;
+    mt->nApplicable = 4;
+    mt->moveFxn = &Move_TreeStretch;
+    mt->relProposalProb = 3.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log(1.01); /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 2.0 * log(2.0);
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_TreeLen, by Jeremy Brown */
+    mt = &moveTypes[i++];
+    mt->name = "Whole treelength hit with multiplier";
+    mt->shortName = "TLMultiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";  
+    mt->applicableTo[0] = BRLENS_UNI;
+    mt->applicableTo[1] = BRLENS_EXP;
+    mt->applicableTo[2] = BRLENS_GamDir;
+    mt->applicableTo[3] = BRLENS_iGmDir;
+    mt->applicableTo[4] = BRLENS_twoExp;
+    mt->nApplicable = 5;  // was 2
+    mt->moveFxn = &Move_TreeLen;
+    mt->relProposalProb = 3.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (2.0);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 100.0;                /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_AddDeleteCPPEvent */
+    mt = &moveTypes[i++];
+    mt->name = "Random addition/deletion of CPP event";
+    mt->shortName = "Add_delete";
+    mt->applicableTo[0] = CPPEVENTS;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_AddDeleteCPPEvent;
+    mt->relProposalProb = 1.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+
+    /* Move_CPPEventPosition */
+    mt = &moveTypes[i++];
+    mt->name = "Random draw of CPP event position from prior";
+    mt->shortName = "Prior_draw_pos";
+    mt->applicableTo[0] = CPPEVENTS;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_CPPEventPosition;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+
+    /* Move_CPPRate */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = CPPRATE_EXP;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_CPPRate;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_CPPRateMultiplier_M */
+    mt = &moveTypes[i++];
+    mt->name = "Random CPP rate multiplier hit with multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = CPPEVENTS;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_CPPRateMultiplier_M;
+    mt->relProposalProb = 0.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_CPPRateMultiplierRnd */
+    mt = &moveTypes[i++];
+    mt->name = "Random draw of CPP rate multiplier from prior";
+    mt->shortName = "Prior_draw_mult";
+    mt->applicableTo[0] = CPPEVENTS;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_CPPRateMultiplierRnd;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+
+    /* Move_Nu */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = TK02VAR_EXP;
+    mt->applicableTo[1] = TK02VAR_UNI;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_Nu;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_TK02BranchRate */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = TK02BRANCHRATES;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_TK02BranchRate;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_IgrVar */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = IGRVAR_EXP;
+    mt->applicableTo[1] = IGRVAR_UNI;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_IgrVar;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_IgrBranchRate */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = IGRBRANCHRATES;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_IgrBranchRate;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_MixedVar */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = MIXEDVAR_EXP;
+    mt->applicableTo[1] = MIXEDVAR_UNI;
+    mt->nApplicable = 2;
+    mt->moveFxn = &Move_MixedVar;
+    mt->relProposalProb = 2.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;                 /* smaller */
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+    
+    /* Move_MixedBranchRate */
+    mt = &moveTypes[i++];
+    mt->name = "Multiplier";
+    mt->shortName = "Multiplier";
+    mt->tuningName[0] = "Multiplier tuning parameter";
+    mt->shortTuningName[0] = "lambda";
+    mt->applicableTo[0] = MIXEDBRCHRATES;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_MixedBranchRate;
+    mt->relProposalProb = 10.0;
+    mt->numTuningParams = 1;
+    mt->tuningParam[0] = 2.0 * log (1.1);  /* lambda */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 20.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    mt->Autotune = &AutotuneMultiplier;
+    mt->targetRate = 0.25;
+
+    /* Move_RelaxedClockModel */
+    mt = &moveTypes[i++];
+    mt->name = "rjMCMC among Relaxed Clock Models";
+    mt->shortName = "rjMCMC_RCL";
+    mt->tuningName[0] = "sigma_TK over sigma_IGR";
+    mt->shortTuningName[0] = "ratio";
+    mt->tuningName[1] = "Sliding window size";
+    mt->shortTuningName[1] = "delta";
+    mt->applicableTo[0] = MIXEDBRCHRATES;
+    mt->nApplicable = 1;
+    mt->moveFxn = &Move_RelaxedClockModel;
+    mt->relProposalProb = 5.0;
+    mt->numTuningParams = 2;
+    mt->tuningParam[0] = 100.0; /* TK/IGR var ratio */
+    mt->tuningParam[1] = 10.0;  /* window size */
+    mt->minimum[0] = 0.0001;
+    mt->maximum[0] = 10000.0;
+    mt->minimum[1] = 0.0001;
+    mt->maximum[1] = 1000.0;
+    mt->parsimonyBased = NO;
+    mt->level = STANDARD_USER;
+    
+    numMoveTypes = i;
+}
+
+
+/* ShowModel: Display model on screen */
+int ShowModel (void)
+{
+    int         i, j, ns;
+
+    MrBayesPrint ("%s   Model settings:\n\n", spacer);
+    for (i=0; i<numCurrentDivisions; i++)
+        {
+        ns = 0;
+
+        if (numCurrentDivisions > 1)
+            MrBayesPrint ("%s      Settings for partition %d --\n", spacer, i+1);
+        else
+            MrBayesPrint ("%s      Data not partitioned --\n", spacer);
+        
+        if (modelParams[i].dataType == DNA)
+            {
+            MrBayesPrint ("%s         Datatype  = DNA\n", spacer);
+            ns = 4;
+            }
+        else if (modelParams[i].dataType == RNA)
+            {
+            MrBayesPrint ("%s         Datatype  = RNA\n", spacer);
+            ns = 4;
+            }
+        else if (modelParams[i].dataType == PROTEIN)
+            {
+            MrBayesPrint ("%s         Datatype  = Protein\n", spacer);
+            ns = 20;
+            }
+        else if (modelParams[i].dataType == RESTRICTION)
+            {
+            MrBayesPrint ("%s         Datatype  = Restriction\n", spacer);
+            ns = 2;
+            }
+        else if (modelParams[i].dataType == STANDARD)
+            {
+            MrBayesPrint ("%s         Datatype  = Standard\n", spacer);
+            ns = 10;
+            }
+        else if (modelParams[i].dataType == CONTINUOUS)
+            {
+            MrBayesPrint ("%s         Datatype  = Continuous\n", spacer);
+            }
+            
+        if (modelSettings[i].dataType == CONTINUOUS)
+            {
+            /* begin description of continuous models */
+              if (!strcmp(modelParams[i].brownCorPr, "Fixed") && AreDoublesEqual(modelParams[i].brownCorrFix, 0.0, ETA)==YES)
+                MrBayesPrint ("%s         Model     = Independent Brownian motion\n", spacer);
+            else
+                MrBayesPrint ("%s         Model     = Correlated Brownian motion\n", spacer);
+            /* end description of continuous models */
+            }
+        else
+            {
+            /* begin description of discrete models */
+            if (!strcmp(modelParams[i].parsModel, "Yes"))
+                {
+                MrBayesPrint ("%s         Parsmodel = %s\n", spacer, modelParams[i].parsModel);
+                }
+            else
+                {
+                /* dna characters in this partition */
+                if (modelSettings[i].dataType == DNA || modelSettings[i].dataType == RNA)
+                    {
+                    /* general form of the rate matrix */ 
+                    MrBayesPrint ("%s         Nucmodel  = %s\n", spacer, modelParams[i].nucModel);
+                
+                    /* constraints on rates of substitution */
+                    MrBayesPrint ("%s         Nst       = %s\n", spacer, modelParams[i].nst);
+                    if (!strcmp(modelParams[i].nst, "2"))
+                        {
+                        if (!strcmp(modelParams[i].tRatioPr,"Beta"))
+                            {
+                            MrBayesPrint ("%s                     Transition and transversion  rates, expressed\n", spacer);
+                            MrBayesPrint ("%s                     as proportions of the rate sum, have a\n", spacer);
+                            MrBayesPrint ("%s                     Beta(%1.2lf,%1.2lf) prior\n", spacer, modelParams[i].tRatioDir[0], modelParams[i].tRatioDir[1]);
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s                     Transition/transversion rate ratio is fixed to %1.2lf.\n", spacer, modelParams[i].tRatioFix);
+                            }
+                        }
+                    else if (!strcmp(modelParams[i].nst, "6"))
+                        {
+                        if (!strcmp(modelParams[i].revMatPr,"Dirichlet"))
+                            {
+                            MrBayesPrint ("%s                     Substitution rates, expressed as proportions\n", spacer);
+                            MrBayesPrint ("%s                     of the rate sum, have a Dirichlet prior\n", spacer);
+                            MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer,
+                                modelParams[i].revMatDir[0], modelParams[i].revMatDir[1], modelParams[i].revMatDir[2],
+                                modelParams[i].revMatDir[3], modelParams[i].revMatDir[4], modelParams[i].revMatDir[5]);
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s                     Substitution rates are fixed to be \n", spacer);
+                            MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf).\n", spacer,
+                                modelParams[i].revMatFix[0], modelParams[i].revMatFix[1], modelParams[i].revMatFix[2],
+                                modelParams[i].revMatFix[3], modelParams[i].revMatFix[4], modelParams[i].revMatFix[5]);
+                            }
+                        }
+                    else if (!strcmp(modelParams[i].nst, "Mixed"))
+                        {
+                        if (!strcmp(modelParams[i].revMatPr,"Dirichlet"))
+                            {
+                            MrBayesPrint ("%s                     Substitution rates, expressed as proportions\n", spacer);
+                            MrBayesPrint ("%s                     of the rate sum, have a Dirichlet prior\n", spacer);
+                            MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer,
+                                modelParams[i].revMatDir[0], modelParams[i].revMatDir[1], modelParams[i].revMatDir[2],
+                                modelParams[i].revMatDir[3], modelParams[i].revMatDir[4], modelParams[i].revMatDir[5]);
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s                     Substitution rates are fixed to be \n", spacer);
+                            MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf).\n", spacer,
+                                modelParams[i].revMatFix[0], modelParams[i].revMatFix[1], modelParams[i].revMatFix[2],
+                                modelParams[i].revMatFix[3], modelParams[i].revMatFix[4], modelParams[i].revMatFix[5]);
+                            }
+                        }
+                    
+                    if (!strcmp(modelParams[i].nucModel,"Codon"))
+                        {
+                        /* what is the distribution on the nonsyn./syn. rate ratio */
+                        if (!strcmp(modelParams[i].omegaVar, "Equal"))
+                            {
+                            if (!strcmp(modelParams[i].omegaPr,"Dirichlet"))
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous and synonymous rates, expressed\n", spacer);
+                                MrBayesPrint ("%s                     as proportions of the rate sum, have a\n", spacer);
+                                MrBayesPrint ("%s                     Dirichlet(%1.2lf,%1.2lf) prior\n", spacer, modelParams[i].omegaDir[0], modelParams[i].omegaDir[1]);
+                                }
+                            else
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio is fixed to %1.2lf.\n", spacer, modelParams[i].omegaFix);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].omegaVar, "Ny98"))
+                            {
+                            if (!strcmp(modelParams[i].ny98omega1pr, "Beta"))
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for purifying selection\n", spacer);
+                                MrBayesPrint ("%s                     (class 1) has a Beta(%1.2lf,%1.2lf) on the interval (0,1).\n", spacer, modelParams[i].ny98omega1Beta[0], modelParams[i].ny98omega1Beta[1]);
+                                }
+                            else
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for purifying selection\n", spacer);
+                                MrBayesPrint ("%s                     (class 1) is fixed to %1.2lf.\n", spacer, modelParams[i].ny98omega1Fixed);
+                                }
+                            MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for neutral selection\n", spacer);
+                            MrBayesPrint ("%s                     (class 2) is fixed to 1.0.\n", spacer);
+                            if (!strcmp(modelParams[i].ny98omega3pr, "Uniform"))
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for positive selection\n", spacer);
+                                MrBayesPrint ("%s                     is uniformly distributed on the interval (%1.2lf,%1.2lf).\n", spacer, modelParams[i].ny98omega3Uni[0], modelParams[i].ny98omega3Uni[1]);
+                                }
+                            else if (!strcmp(modelParams[i].ny98omega3pr, "Exponential"))
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for positive selection\n", spacer);
+                                MrBayesPrint ("%s                     is exponentially distributed with parameter (%1.2lf).\n", spacer, modelParams[i].ny98omega3Exp);
+                                }
+                            else
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for positive \n", spacer);
+                                MrBayesPrint ("%s                     selection is fixed to %1.2lf.\n", spacer, modelParams[i].ny98omega3Fixed);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].omegaVar, "M3"))
+                            {
+                            if (!strcmp(modelParams[i].m3omegapr, "Exponential"))
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous and synonymous rates for the tree classes of\n", spacer);
+                                MrBayesPrint ("%s                     omega are exponentially distributed random variables.\n", spacer);
+                                }
+                            else if (!strcmp(modelParams[i].m3omegapr, "Fixed"))
+                                {
+                                MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for the three omega\n", spacer);
+                                MrBayesPrint ("%s                     are fixed to %1.2lf, %1.2lf, and %1.2lf.\n", spacer, modelParams[i].m3omegaFixed[0], modelParams[i].m3omegaFixed[1], modelParams[i].m3omegaFixed[2]);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].omegaVar, "M10"))
+                            {
+                            MrBayesPrint ("%s                     Nonsynonymous/synonymous rate ratio for purifying \n", spacer);
+                            MrBayesPrint ("%s                     selection (class 1) has a Beta(alpha1,beta1) on the \n", spacer);
+                            MrBayesPrint ("%s                     interval (0,1). Nonsynonymous/synonymous rate ratio \n", spacer);
+                            MrBayesPrint ("%s                     for positive selection (class 2) has an offset \n", spacer);
+                            MrBayesPrint ("%s                     Gamma(alpha2,beta2) on the interval (1,Infinity).\n", spacer);
+                            }
+                            
+                        /* genetic code that is used (if nucmodel=codon) */
+                        MrBayesPrint ("%s         Code      = %s\n", spacer, modelParams[i].geneticCode);
+                        }
+                    }
+                /* amino acid characters in this partition */
+                else if (modelSettings[i].dataType == PROTEIN)
+                    {
+                    if (modelParams[i].dataType == DNA || modelParams[i].dataType == RNA)
+                        MrBayesPrint ("%s         Nucmodel  = %s\n", spacer, modelParams[i].nucModel);
+                    /* constraints on rates of substitution in 20 X 20 matrix */
+                    if (!strcmp(modelParams[i].aaModelPr, "Mixed"))
+                        MrBayesPrint ("%s         Aamodel   = Mixture of models with fixed rate matrices\n", spacer);
+                    else
+                        MrBayesPrint ("%s         Aamodel   = %s\n", spacer, modelParams[i].aaModel);
+                    /* revmat rates */
+                    if (!strcmp(modelParams[i].aaModelPr, "Mixed"))
+                        MrBayesPrint ("%s                     Substitution rates come from the mixture of models\n", spacer);
+                    else if (!strcmp(modelParams[i].aaModelPr, "Fixed") && (!strcmp(modelParams[i].aaModel, "Poisson") ||
+                                !strcmp(modelParams[i].aaModel, "Equalin")))
+                        MrBayesPrint ("%s                     Substitution rates are fixed to be equal\n", spacer);
+                    else if (!strcmp(modelParams[i].aaModelPr, "Fixed") && strcmp(modelParams[i].aaModel, "Gtr")!=0)
+                        MrBayesPrint ("%s                     Substitution rates are fixed to the %s rates\n", spacer, modelParams[i].aaModel);
+                    else if (!strcmp(modelParams[i].aaModelPr, "Fixed") && !strcmp(modelParams[i].aaModel, "Gtr"))
+                        {
+                        if (!strcmp(modelParams[i].aaRevMatPr,"Dirichlet"))
+                            {
+                            for (j=0; j<190; j++)
+                                if (AreDoublesEqual(modelParams[i].aaRevMatDir[0], modelParams[i].aaRevMatDir[j], 0.00001) == NO)
+                                    break;
+                            if (j == 190)
+                                {
+                                MrBayesPrint ("%s                     Substitution rates have a Dirichlet(%1.2lf,%1.2lf,...) prior\n",
+                                    spacer, modelParams[i].aaRevMatDir[0], modelParams[i].aaRevMatDir[0]);
+                                }
+                            else
+                                {
+                                MrBayesPrint ("%s                     Substitution rates have a Dirichlet(\n", spacer);
+                                for (j=0; j<190; j++)
+                                    {
+                                    if (j % 10 == 0)
+                                        MrBayesPrint ("%s                        ", spacer);
+                                    MrBayesPrint ("%1.2lf", modelParams[i].aaRevMatDir[j]);
+                                    if (j == 189)
+                                        MrBayesPrint (") prior\n");
+                                    else if ((j+1) % 10 == 0)
+                                        MrBayesPrint (",\n");
+                                    else
+                                        MrBayesPrint (",");
+                                    }
+                                }
+                            }
+                        else /* if (!strcmp(modelParams[i].aaRevMatPr,"Fixed")) */
+                            {
+                            for (j=0; j<190; j++)
+                                if (AreDoublesEqual(modelParams[i].aaRevMatFix[0], modelParams[i].aaRevMatFix[j], 0.00001) == NO)
+                                    break;
+                            if (j == 190)
+                                {
+                                MrBayesPrint ("%s                     Substitution rates are fixed to (%1.1lf,%1.1lf,...)\n",
+                                    spacer, modelParams[i].aaRevMatFix[0], modelParams[i].aaRevMatFix[0]);
+                                }
+                            else
+                                {
+                                MrBayesPrint ("%s                     Substitution rates are fixed to (\n", spacer);
+                                for (j=0; j<190; j++)
+                                    {
+                                    if (j % 10 == 0)
+                                        MrBayesPrint ("%s                        ", spacer);
+                                    MrBayesPrint ("%1.1lf", modelParams[i].aaRevMatFix[j]);
+                                    if (j == 189)
+                                        MrBayesPrint (") prior\n");
+                                    else if ((j+1) % 10 == 0)
+                                        MrBayesPrint (",\n");
+                                    else
+                                        MrBayesPrint (",");
+                                    }
+                                }
+                            }
+                        }
+                    }
+                /* restriction site or morphological characters in this partition */
+                else if (modelSettings[i].dataType == RESTRICTION || modelSettings[i].dataType == STANDARD)
+                    {
+                    /* what type of characters are sampled? */
+                    MrBayesPrint ("%s         Coding    = %s\n", spacer, modelParams[i].codingString);
+                    }
+                    
+                /* is there rate variation in a single site across the tree? */
+                if (((modelSettings[i].dataType == DNA || modelSettings[i].dataType == RNA) && !strcmp(modelParams[i].nucModel, "4by4")) || modelSettings[i].dataType == PROTEIN)
+                    {
+                    /* do rates change on tree accoding to covarion model? */
+                    MrBayesPrint ("%s         Covarion  = %s\n", spacer, modelParams[i].covarionModel);
+                    if (!strcmp(modelParams[i].covarionModel, "Yes"))
+                        {
+                        /* distribution on switching parameters, if appropriate */
+                        if (!strcmp(modelParams[i].covSwitchPr,"Uniform"))
+                            {
+                            MrBayesPrint ("%s                     Switching rates have independent uniform dist-\n", spacer);
+                            MrBayesPrint ("%s                     ributions on the interval (%1.2lf,%1.2lf).\n", spacer, modelParams[i].covswitchUni[0], modelParams[i].covswitchUni[1]);
+                            }
+                        else if (!strcmp(modelParams[i].covSwitchPr,"Exponential"))
+                            {
+                            MrBayesPrint ("%s                     Switching rates have independent exponential\n", spacer);
+                            MrBayesPrint ("%s                     distributions with parameters (%1.2lf).\n", spacer, modelParams[i].covswitchExp);
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s                     Switching rates are fixed to %1.2lf and %1.2lf.\n", spacer, modelParams[i].covswitchFix[0], modelParams[i].covswitchFix[0]);
+                            }
+                        ns *= 2;
+                        }
+                    }
+
+                /* now, let's deal with variation in omega */
+                if ((modelParams[i].dataType == DNA || modelParams[i].dataType == RNA) && !strcmp(modelParams[i].nucModel,"Codon"))
+                    {
+                    MrBayesPrint ("%s         Omegavar  = %s\n", spacer, modelParams[i].omegaVar);
+                    if (!strcmp(modelParams[i].geneticCode, "Universal"))
+                        ns = 61;
+                    else if (!strcmp(modelParams[i].geneticCode, "Vertmt"))
+                        ns = 60;
+                    else if (!strcmp(modelParams[i].geneticCode, "Invermt"))
+                        ns = 62;
+                    else if (!strcmp(modelParams[i].geneticCode, "Mycoplasma"))
+                        ns = 62;
+                    else if (!strcmp(modelParams[i].geneticCode, "Yeast"))
+                        ns = 62;
+                    else if (!strcmp(modelParams[i].geneticCode, "Ciliate"))
+                        ns = 63;
+                    else if (!strcmp(modelParams[i].geneticCode, "Echinoderm"))
+                        ns = 62;
+                    else if (!strcmp(modelParams[i].geneticCode, "Euplotid"))
+                        ns = 62;
+                    else if (!strcmp(modelParams[i].geneticCode, "Metmt"))
+                        ns = 62;
+                    }
+
+                /* what assumptions are made about the state frequencies? */
+                if (modelParams[i].dataType != CONTINUOUS)
+                    {
+                    if (modelParams[i].dataType == STANDARD)
+                        MrBayesPrint ("%s         # States  = Variable, up to 10\n", spacer);
+                    else if (modelSettings[i].numStates != modelSettings[i].numModelStates)
+                        MrBayesPrint ("%s         # States  = %d (in the model)\n", spacer, modelSettings[i].numModelStates);
+                    else
+                        MrBayesPrint ("%s         # States  = %d\n", spacer, ns);
+                    if (modelSettings[i].dataType == STANDARD)
+                        {
+                        if (!strcmp(modelParams[i].symPiPr,"Fixed"))
+                            {
+                            if (AreDoublesEqual(modelParams[i].symBetaFix, -1.0, ETA)==YES)
+                                MrBayesPrint ("%s                     State frequencies are fixed to be equal\n", spacer);
+                            else
+                                MrBayesPrint ("%s                     Symmetric Dirichlet alpha is fixed to %1.2lf\n", spacer, modelParams[i].symBetaFix);
+                            }
+                        else if (!strcmp(modelParams[i].symPiPr,"Uniform"))
+                            {
+                            MrBayesPrint ("%s                     Symmetric Dirichlet alpha has a Uniform(%1.2lf,%1.2lf) prior\n", spacer, modelParams[i].symBetaUni[0], modelParams[i].symBetaUni[1]);
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s                     Symmetric Dirichlet alpha has a Exponential(%1.2lf) prior\n", spacer, modelParams[i].symBetaExp);
+                            }
+                        }
+                    else if (modelSettings[i].dataType == RESTRICTION)
+                        {
+                        /* distribution on state frequencies for restriction site model */
+                        if (!strcmp(modelParams[i].stateFreqPr,"Dirichlet"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies have a Dirichlet (%1.2lf,%1.2lf) prior\n", spacer,
+                                modelParams[i].stateFreqsDir[0], modelParams[i].stateFreqsDir[1]);
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"Equal"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies are fixed to be equal\n", spacer);
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"User"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies have been fixed by the user\n", spacer);
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"Empirical"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies have been fixed to the empirical frequencies in the data\n", spacer);
+                            }
+                        }
+                    else if (modelSettings[i].dataType == PROTEIN)
+                        {
+                        /* distribution on state frequencies for aminoacid model */
+                        if (!strcmp(modelParams[i].aaModelPr, "Fixed") && (strcmp(modelParams[i].aaModel, "Equalin")==0 ||
+                            strcmp(modelParams[i].aaModel, "Gtr")==0))
+                            {
+                            if (!strcmp(modelParams[i].stateFreqPr,"Dirichlet"))
+                                {
+                                MrBayesPrint ("%s                     State frequencies have a Dirichlet prior\n", spacer);
+                                MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,", spacer,
+                                    modelParams[i].stateFreqsDir[0], modelParams[i].stateFreqsDir[1], modelParams[i].stateFreqsDir[2],
+                                    modelParams[i].stateFreqsDir[3], modelParams[i].stateFreqsDir[4]);
+                                MrBayesPrint ("%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,\n",
+                                    modelParams[i].stateFreqsDir[5], modelParams[i].stateFreqsDir[6], modelParams[i].stateFreqsDir[7],
+                                    modelParams[i].stateFreqsDir[8], modelParams[i].stateFreqsDir[9]);
+                                MrBayesPrint ("%s                     %1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,", spacer,
+                                    modelParams[i].stateFreqsDir[10], modelParams[i].stateFreqsDir[11], modelParams[i].stateFreqsDir[12],
+                                    modelParams[i].stateFreqsDir[13], modelParams[i].stateFreqsDir[14]);
+                                MrBayesPrint ("%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n",
+                                    modelParams[i].stateFreqsDir[15], modelParams[i].stateFreqsDir[16], modelParams[i].stateFreqsDir[17],
+                                    modelParams[i].stateFreqsDir[18], modelParams[i].stateFreqsDir[19]);
+                                }
+                            else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"Equal"))
+                                {
+                                MrBayesPrint ("%s                     State frequencies are fixed to be equal\n", spacer);
+                                }
+                            else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"User"))
+                                {
+                                MrBayesPrint ("%s                     State frequencies have been fixed by the user\n", spacer);
+                                }
+                            else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"Empirical"))
+                                {
+                                MrBayesPrint ("%s                     State frequencies have been fixed to the empirical frequencies in the data\n", spacer);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].aaModelPr, "Fixed") && !strcmp(modelParams[i].aaModel, "Poisson"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies are fixed to be equal\n", spacer);
+                            }
+                        else if (!strcmp(modelParams[i].aaModelPr, "Fixed") && strcmp(modelParams[i].aaModel, "Equalin") && strcmp(modelParams[i].aaModel, "Poisson"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies are fixed to the %s frequencies\n", spacer, modelParams[i].aaModel);
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s                     State frequencies come from the mixture of models\n", spacer);
+                            }
+                        }
+                    else
+                        {
+                        /* distribution on state frequencies for all other models */
+                        if (!strcmp(modelParams[i].stateFreqPr,"Dirichlet"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies have a Dirichlet prior\n", spacer);
+                            if (!strcmp(modelParams[i].nucModel, "Doublet"))
+                                {
+                                MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf,\n", spacer,
+                                    modelParams[i].stateFreqsDir[0], modelParams[i].stateFreqsDir[1], modelParams[i].stateFreqsDir[2],
+                                    modelParams[i].stateFreqsDir[3]);
+                                MrBayesPrint ("%s                     %1.2lf,%1.2lf,%1.2lf,%1.2lf,\n", spacer,
+                                    modelParams[i].stateFreqsDir[4], modelParams[i].stateFreqsDir[5], modelParams[i].stateFreqsDir[6],
+                                    modelParams[i].stateFreqsDir[7]);
+                                MrBayesPrint ("%s                     %1.2lf,%1.2lf,%1.2lf,%1.2lf,\n", spacer,
+                                    modelParams[i].stateFreqsDir[8], modelParams[i].stateFreqsDir[9], modelParams[i].stateFreqsDir[10],
+                                    modelParams[i].stateFreqsDir[11]);
+                                MrBayesPrint ("%s                     %1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer,
+                                    modelParams[i].stateFreqsDir[12], modelParams[i].stateFreqsDir[13], modelParams[i].stateFreqsDir[14],
+                                    modelParams[i].stateFreqsDir[15]);
+                                }
+                            else if (!strcmp(modelParams[i].nucModel, "4by4"))
+                                {
+                                MrBayesPrint ("%s                     (%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer,
+                                    modelParams[i].stateFreqsDir[0], modelParams[i].stateFreqsDir[1], modelParams[i].stateFreqsDir[2],
+                                    modelParams[i].stateFreqsDir[3]);
+                                }
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"Equal"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies are fixed to be equal\n", spacer);
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"User"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies have been fixed by the user\n", spacer);
+                            }
+                        else if (!strcmp(modelParams[i].stateFreqPr,"Fixed") && !strcmp(modelParams[i].stateFreqsFixType,"Empirical"))
+                            {
+                            MrBayesPrint ("%s                     State frequencies have been fixed to the empirical frequencies in the data\n", spacer);
+                            }
+                        }
+                    }
+                else
+                    MrBayesPrint ("%s         # States  = Infinity\n", spacer);
+
+                /* now, let's deal with rate variation across sites */
+                if (modelSettings[i].dataType != CONTINUOUS)
+                    {
+                    if (((modelSettings[i].dataType == DNA || modelSettings[i].dataType == RNA) && strcmp(modelParams[i].nucModel,"Codon")) ||
+                          modelSettings[i].dataType == PROTEIN || modelSettings[i].dataType == RESTRICTION || modelSettings[i].dataType == STANDARD)
+                        {
+                        if (!strcmp(modelParams[i].covarionModel, "No"))
+                            MrBayesPrint ("%s         Rates     = %s\n", spacer, modelParams[i].ratesModel);
+                        else
+                            {
+                            if (!strcmp(modelParams[i].ratesModel, "Propinv"))
+                                MrBayesPrint ("%s         Rates     = Equal ", spacer);
+                            else if (!strcmp(modelParams[i].ratesModel, "Invgamma"))
+                                MrBayesPrint ("%s         Rates     = Gamma ", spacer);
+                            else
+                                MrBayesPrint ("%s         Rates     = %s ", spacer, modelParams[i].ratesModel);
+                            MrBayesPrint ("(+ Propinv induced by covarion model)\n");
+                            }
+                        
+                        if ((modelParams[i].dataType == RESTRICTION || modelParams[i].dataType == STANDARD) && !strcmp(modelParams[i].ratesModel, "Adgamma"))
+                            {
+                            
+                            }
+                        else
+                            {
+                            if (!strcmp(modelParams[i].ratesModel, "Gamma") || !strcmp(modelParams[i].ratesModel, "Invgamma") ||
+                                !strcmp(modelParams[i].ratesModel, "LNorm") || !strcmp(modelParams[i].ratesModel, "Adgamma"))
+                                {
+                                /* how many categories is the continuous gamma approximated by? */
+                                MrBayesPrint ("%s                     The distribution is approximated using %d categories.\n", spacer, modelParams[i].numGammaCats);
+                                if (!strcmp(modelParams[i].useGibbs,"Yes"))
+                                    MrBayesPrint ("%s                     Rate categories sampled using Gibbs sampling.\n", spacer, modelParams[i].numGammaCats);
+                                else
+                                    MrBayesPrint ("%s                     Likelihood summarized over all rate categories in each generation.\n", spacer, modelParams[i].numGammaCats);
+                                /* distribution on shape parameter, if appropriate */
+                                if (!strcmp(modelParams[i].shapePr,"Uniform"))
+                                    {
+                                    MrBayesPrint ("%s                     Shape parameter is uniformly distributed\n", spacer);
+                                    MrBayesPrint ("%s                     on the interval (%1.2lf,%1.2lf).\n", spacer, modelParams[i].shapeUni[0], modelParams[i].shapeUni[1]);
+                                    }
+                                else if (!strcmp(modelParams[i].shapePr,"Exponential"))
+                                    {
+                                    MrBayesPrint ("%s                     Shape parameter is exponentially\n", spacer);
+                                    MrBayesPrint ("%s                     distributed with parameter (%1.2lf).\n", spacer, modelParams[i].shapeExp);
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s                     Shape parameter is fixed to %1.2lf.\n", spacer, modelParams[i].shapeFix);
+                                    }
+                                }
+                            if ((!strcmp(modelParams[i].ratesModel, "Propinv") || !strcmp(modelParams[i].ratesModel, "Invgamma")) && !strcmp(modelParams[i].covarionModel, "No"))
+                                {
+                                /* distribution on pInvar parameter, if appropriate */
+                                if (!strcmp(modelParams[i].pInvarPr,"Uniform"))
+                                    {
+                                    MrBayesPrint ("%s                     Proportion of invariable sites is uniformly dist-\n", spacer);
+                                    MrBayesPrint ("%s                     ributed on the interval (%1.2lf,%1.2lf).\n", spacer, modelParams[i].pInvarUni[0], modelParams[i].pInvarUni[1]);
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s                     Proportion of invariable sites is fixed to %1.2lf.\n", spacer, modelParams[i].pInvarFix);
+                                    }
+                                }
+                            if (!strcmp(modelParams[i].ratesModel, "Adgamma"))
+                                {
+                                /* distribution on correlation parameter, if appropriate */
+                                if (!strcmp(modelParams[i].adGammaCorPr,"Uniform"))
+                                    {
+                                    MrBayesPrint ("%s                     Rate correlation parameter is uniformly dist-\n", spacer);
+                                    MrBayesPrint ("%s                     ributed on the interval (%1.2lf,%1.2lf).\n", spacer, modelParams[i].corrUni[0], modelParams[i].corrUni[1]);
+                                    }
+                                else
+                                    {
+                                    MrBayesPrint ("%s                     Rate correlation parameter is fixed to %1.2lf.\n", spacer, modelParams[i].corrFix);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            /* end description of discrete models */
+            }
+
+        if (i != numCurrentDivisions - 1)
+            MrBayesPrint ("\n");
+        
+        }
+
+    MrBayesPrint ("\n");
+    ShowParameters (NO, NO, NO);
+    
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------------
+|
+|   ShowMoves: Show applicable moves
+|
+------------------------------------------------------------------------------*/
+int ShowMoves (int used)
+{
+    int             i, k, run, chain, chainIndex, areRunsSame, areChainsSame, numPrintedMoves;
+    MCMCMove        *mv;
+    
+    chainIndex = 0;
+    numPrintedMoves = 0;
+    for (i=0; i<numApplicableMoves; i++)
+        {
+        mv = moves[i];
+        
+        for (k=0; k<numGlobalChains; k++)
+            {
+            if (mv->relProposalProb[k] > 0.000001)
+                break;
+            }
+
+        if (k == numGlobalChains && used == YES)
+            continue;
+
+        if (k < numGlobalChains && used == NO)
+            continue;
+
+        numPrintedMoves++;
+        
+        /* print move number and name */
+        MrBayesPrint ("%s   %4d -- Move        = %s\n", spacer, numPrintedMoves, mv->name);
+        
+        /* print move type */
+        MrBayesPrint ("%s           Type        = %s\n", spacer, mv->moveType->name);
+
+        /* print parameter */
+        if (mv->parm->nSubParams > 0)
+            MrBayesPrint ("%s           Parameters  = %s [param. %d] (%s)\n", spacer, mv->parm->name,
+                mv->parm->index+1, mv->parm->paramTypeName);
+        else
+            MrBayesPrint ("%s           Parameter   = %s [param. %d] (%s)\n", spacer, mv->parm->name,
+                mv->parm->index+1, mv->parm->paramTypeName);
+        for (k=0; k<mv->parm->nSubParams; k++)
+            MrBayesPrint ("%s                         %s [param. %d] (%s)\n", spacer, mv->parm->subParams[k]->name,
+                mv->parm->subParams[k]->index+1, mv->parm->subParams[k]->paramTypeName);
+
+        /* print tuning parameters */
+        for (k=0; k<mv->moveType->numTuningParams; k++)
+            {
+            if (k==0)
+                MrBayesPrint ("%s           Tuningparam = %s (%s)\n", spacer, mv->moveType->shortTuningName[k], mv->moveType->tuningName[k]);
+            else
+                MrBayesPrint ("%s                         %s (%s)\n", spacer, mv->moveType->shortTuningName[k], mv->moveType->tuningName[k]);
+            }
+        
+        /* loop over tuning parameters */
+        for (k=0; k<mv->moveType->numTuningParams; k++)
+            {
+            /* find if tuning parameters are different for different runs */
+            areRunsSame = YES;
+            for (run=1; run<chainParams.numRuns; run++)
+                {
+                for (chain=0; chain<chainParams.numChains; chain++)
+                    {
+                    chainIndex = run*chainParams.numChains + chain;
+                    if (AreDoublesEqual (mv->tuningParam[chainIndex][k], mv->tuningParam[chain][k], 0.000001) == NO)
+                        {
+                        areRunsSame = NO;
+                        break;
+                        }
+                    }
+                if (areRunsSame == NO)
+                    break;
+                }
+        
+            /* now print values */
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                if (areRunsSame == YES && run >= 1)
+                    break;
+
+                /* find out if chains are different within this run */
+                areChainsSame = YES;
+                for (chain=1; chain<chainParams.numChains; chain++)
+                    {
+                    chainIndex = run*chainParams.numChains + chain;
+                    if (AreDoublesEqual (mv->tuningParam[chainIndex][k], mv->tuningParam[chainIndex-chain][k],0.000001) == NO)
+                        {
+                        areChainsSame = NO;
+                        break;
+                        }
+                    }
+                /* now we can print the values */
+                for (chain=0; chain<chainParams.numChains; chain++)
+                    {
+                    chainIndex = run*chainParams.numChains + chain;
+                    if (areChainsSame == YES && chain >= 1)
+                        break;
+                    
+                    if (run == 0 && chain == 0)
+                        MrBayesPrint ("%s%22s = %1.3lf", spacer, mv->moveType->shortTuningName[k], mv->tuningParam[chainIndex][k]);
+                    else
+                        MrBayesPrint ("%s                         %1.3lf", spacer, mv->tuningParam[chainIndex][k]);
+
+                    if (areChainsSame == NO && areRunsSame == YES)
+                        MrBayesPrint ("  [chain %d]\n", chain+1);
+                    else if (areChainsSame == YES && areRunsSame == NO)
+                        MrBayesPrint ("  [run %d]\n", run+1);
+                    else if (areChainsSame == NO && areRunsSame == NO)
+                        MrBayesPrint ("  [run %d, chain %d]\n", run+1, chain+1);
+                    else
+                        MrBayesPrint ("\n");
+                    }
+                }
+            }   /* next tuning parameter */
+
+        /* print target acceptance rate for autotuning */
+        if (mv->moveType->targetRate > 0.0 && mv->moveType->targetRate < 1.0)
+            {
+
+            /* first find out if the targets are different in different runs */         
+            areRunsSame = YES;
+            for (run=1; run<chainParams.numRuns; run++)
+                {
+                for (chain=0; chain<chainParams.numChains; chain++)
+                    {
+                    chainIndex = run*chainParams.numChains + chain;
+                    if (AreDoublesEqual (mv->targetRate[chainIndex], mv->targetRate[chain], 0.000001) == NO)
+                        {
+                        areRunsSame = NO;
+                        break;
+                        }
+                    }
+                if (areRunsSame == NO)
+                    break;
+                }
+        
+            /* now print values */
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                if (areRunsSame == YES && run >= 1)
+                    break;
+
+                /* find out if chains are different within this run */
+                areChainsSame = YES;
+                for (chain=1; chain<chainParams.numChains; chain++)
+                    {
+                    chainIndex = run*chainParams.numChains + chain;
+                    if (AreDoublesEqual (mv->targetRate[chainIndex], mv->targetRate[chainIndex-chain], 0.000001) == NO)
+                        {
+                        areChainsSame = NO;
+                        break;
+                        }
+                    }
+                /* now we can print the values */
+                for (chain=0; chain<chainParams.numChains; chain++)
+                    {
+                    chainIndex = run*chainParams.numChains + chain;
+                    if (areChainsSame == YES && chain >= 1)
+                        break;
+                    
+                    if (run == 0 && chain == 0)
+                        MrBayesPrint ("%s           Targetrate  = %1.3lf", spacer, mv->targetRate[chainIndex]);
+                    else
+                        MrBayesPrint ("%s                         %1.3lf", spacer, mv->targetRate[chainIndex]);
+
+                    if (areChainsSame == NO && areRunsSame == YES)
+                        MrBayesPrint ("  [chain %d]\n", chain+1);
+                    else if (areChainsSame == YES && areRunsSame == NO)
+                        MrBayesPrint ("  [run %d]\n", run+1);
+                    else if (areChainsSame == NO && areRunsSame == NO)
+                        MrBayesPrint ("  [run %d, chain %d]\n", run+1, chain+1);
+                    else
+                        MrBayesPrint ("\n");
+                    }
+                }
+            }
+
+        
+        /* finally print the relative proposal probability */
+        
+        /* first find out if the probabilities are different in different runs */           
+        areRunsSame = YES;
+        for (run=1; run<chainParams.numRuns; run++)
+            {
+            for (chain=0; chain<chainParams.numChains; chain++)
+                {
+                chainIndex = run*chainParams.numChains + chain;
+                if (AreDoublesEqual (mv->relProposalProb[chainIndex], mv->relProposalProb[chain], 0.000001) == NO)
+                    {
+                    areRunsSame = NO;
+                    break;
+                    }
+                }
+            if (areRunsSame == NO)
+                break;
+            }
+    
+        /* now print values */
+        for (run=0; run<chainParams.numRuns; run++)
+            {
+            if (areRunsSame == YES && run >= 1)
+                break;
+
+            /* find out if chains are different within this run */
+            areChainsSame = YES;
+            for (chain=1; chain<chainParams.numChains; chain++)
+                {
+                chainIndex = run*chainParams.numChains + chain;
+                if (AreDoublesEqual (mv->relProposalProb[chainIndex], mv->relProposalProb[chainIndex-chain], 0.000001) == NO)
+                    {
+                    areChainsSame = NO;
+                    break;
+                    }
+                }
+            /* now we can print the values */
+            for (chain=0; chain<chainParams.numChains; chain++)
+                {
+                chainIndex = run*chainParams.numChains + chain;
+                if (areChainsSame == YES && chain >= 1)
+                    break;
+                
+                if (run == 0 && chain == 0)
+                    MrBayesPrint ("%s           Rel. prob.  = %1.1lf", spacer, mv->relProposalProb[chainIndex]);
+                else
+                    MrBayesPrint ("%s                         %1.1lf", spacer, mv->relProposalProb[chainIndex]);
+
+                if (areChainsSame == NO && areRunsSame == YES)
+                    MrBayesPrint ("  [chain %d]\n", chain+1);
+                else if (areChainsSame == YES && areRunsSame == NO)
+                    MrBayesPrint ("  [run %d]\n", run+1);
+                else if (areChainsSame == NO && areRunsSame == NO)
+                    MrBayesPrint ("  [run %d, chain %d]\n", run+1, chain+1);
+                else
+                    MrBayesPrint ("\n");
+                }
+            }
+        MrBayesPrint ("\n");
+        }   /* next move */
+        
+    if (numPrintedMoves == 0)
+        {
+        if (used == YES)
+            {
+            MrBayesPrint ("%s      No moves currently used for this analysis. All parameters\n", spacer);
+            MrBayesPrint ("%s      will be fixed to their starting values.\n\n", spacer);
+            }
+        else
+            {
+            MrBayesPrint ("%s      No additional moves available for this model.\n\n", spacer);
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------------------
+|
+|   ShowParameters: Show parameter table and parameter info
+|
+------------------------------------------------------------------------------*/
+int ShowParameters (int showStartVals, int showMoves, int showAllAvailable)
+{
+    int             a, b, d, i, j, k, m, n, run, chain, shouldPrint, isSame, areRunsSame, areChainsSame, nValues,
+                    chainIndex, refIndex, numPrinted, numMovedChains, printedCol, screenWidth=100;
+    Param           *p;
+    Model           *mp;
+    ModelInfo       *ms;
+    MrBFlt          *value, *refValue, *subValue;
+    MCMCMove        *mv;
+    
+    MrBayesPrint ("%s   Active parameters: \n\n", spacer);
+    if (numCurrentDivisions > 1)
+        { 
+        MrBayesPrint ("%s                          Partition(s)\n", spacer);
+        MrBayesPrint ("%s      Parameters        ", spacer);
+        for (i=0; i<numCurrentDivisions; i++)
+            MrBayesPrint (" %2d", i+1);
+        MrBayesPrint ("\n");
+        MrBayesPrint ("%s      ------------------", spacer);
+        for (i=0; i<numCurrentDivisions; i++)
+            MrBayesPrint ("---");
+        MrBayesPrint ("\n");
+        }
+    else
+        {
+        MrBayesPrint ("%s      Parameters\n", spacer);
+        MrBayesPrint ("%s      ---------------------\n", spacer);
+        }
+    for (j=0; j<NUM_LINKED; j++)
+        {
+        shouldPrint = NO;
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (activeParams[j][i] == -1)
+                {}
+            else
+                shouldPrint = YES;
+            }
+        if (shouldPrint == NO)
+            continue;
+        
+        if (j == P_TRATIO)
+            {
+            MrBayesPrint ("%s      Tratio            ", spacer);
+            }
+        else if (j == P_REVMAT)
+            {
+            MrBayesPrint ("%s      Revmat            ", spacer);
+            }
+        else if (j == P_OMEGA)
+            {
+            MrBayesPrint ("%s      Omega             ", spacer);
+            }
+        else if (j == P_PI)
+            {
+            MrBayesPrint ("%s      Statefreq         ", spacer);
+            }
+        else if (j == P_SHAPE)
+            {
+            MrBayesPrint ("%s      Shape             ", spacer);
+            }
+        else if (j == P_PINVAR)
+            {
+            MrBayesPrint ("%s      Pinvar            ", spacer);
+            }
+        else if (j == P_CORREL)
+            {
+            MrBayesPrint ("%s      Correlation       ", spacer);
+            }
+        else if (j == P_SWITCH)
+            {
+            MrBayesPrint ("%s      Switchrates       ", spacer);
+            }
+        else if (j == P_RATEMULT)
+            {
+            MrBayesPrint ("%s      Ratemultiplier    ", spacer);
+            }
+        else if (j == P_GENETREERATE)
+            {
+            MrBayesPrint ("%s      Generatemult      ", spacer);
+            }
+        else if (j == P_TOPOLOGY)
+            {
+            MrBayesPrint ("%s      Topology          ", spacer);
+            }
+        else if (j == P_BRLENS)
+            {
+            MrBayesPrint ("%s      Brlens            ", spacer);
+            }
+        else if (j == P_SPECRATE)
+            {
+            MrBayesPrint ("%s      Speciationrate    ", spacer);
+            }
+        else if (j == P_EXTRATE)
+            {
+            MrBayesPrint ("%s      Extinctionrate    ", spacer);
+            }
+        else if (j == P_FOSLRATE)
+            {
+            MrBayesPrint ("%s      Fossilizationrate ", spacer);
+            }
+        else if (j == P_POPSIZE)
+            {
+            MrBayesPrint ("%s      Popsize           ", spacer);
+            }
+        else if (j == P_GROWTH)
+            {
+            MrBayesPrint ("%s      Growthrate        ", spacer);
+            } 
+        else if (j == P_AAMODEL)
+            {
+            MrBayesPrint ("%s      Aamodel           ", spacer);
+            }
+        else if (j == P_BRCORR)
+            {
+            MrBayesPrint ("%s      Brownian corr.    ", spacer);
+            }
+        else if (j == P_BRSIGMA)
+            {
+            MrBayesPrint ("%s      Brownian sigma    ", spacer);
+            }
+        else if (j == P_CPPRATE)
+            {
+            MrBayesPrint ("%s      Cpprate           ", spacer);
+            }
+        else if (j == P_CPPMULTDEV)
+            {
+            MrBayesPrint ("%s      Cppmultdev        ", spacer);
+            }
+        else if (j == P_CPPEVENTS)
+            {
+            MrBayesPrint ("%s      Cppevents         ", spacer);
+            }
+        else if (j == P_TK02VAR)
+            {
+            MrBayesPrint ("%s      TK02var           ", spacer);
+            }
+        else if (j == P_TK02BRANCHRATES)
+            {
+            MrBayesPrint ("%s      TK02branchrates   ", spacer);
+            }
+        else if (j == P_IGRVAR)
+            {
+            MrBayesPrint ("%s      Igrvar            ", spacer);
+            }
+        else if (j == P_IGRBRANCHRATES)
+            {
+            MrBayesPrint ("%s      Igrbranchrates    ", spacer);
+            }
+        else if (j == P_MIXEDVAR)
+            {
+            MrBayesPrint ("%s      Mixedvar          ", spacer);
+            }
+        else if (j == P_MIXEDBRCHRATES)
+            {
+            MrBayesPrint ("%s      Mixedbranchrates  ", spacer);
+            }
+        else if (j == P_CLOCKRATE)
+            {
+            MrBayesPrint ("%s      Clockrate         ", spacer);
+            }
+        else if (j == P_SPECIESTREE)
+            {
+            MrBayesPrint ("%s      Speciestree       ", spacer);
+            }
+        else
+            {
+            MrBayesPrint ("%s      ERROR: Someone forgot to name parameter type %d", spacer, j);
+            return (ERROR);
+            }
+        
+        for (i=0; i<numCurrentDivisions; i++)
+            {
+            if (activeParams[j][i] == -1)
+                MrBayesPrint ("  .");
+            else
+                MrBayesPrint (" %2d", activeParams[j][i]);
+            }
+        MrBayesPrint ("\n");
+        }
+    if (numCurrentDivisions > 1)
+        { 
+        MrBayesPrint ("%s      ------------------", spacer);
+        for (i=0; i<numCurrentDivisions; i++)
+            MrBayesPrint ("---");
+        MrBayesPrint ("\n");
+        }
+    else
+        {
+        MrBayesPrint ("%s      ---------------------\n", spacer);
+        }
+    
+    MrBayesPrint ("\n");
+    
+    if (numCurrentDivisions > 1)
+        MrBayesPrint ("%s      Parameters can be linked or unlinked across partitions using 'link' and 'unlink'\n\n", spacer);
+    
+    for (i=0; i<numParams; i++)
+        {
+        p = &params[i];
+        j = p->paramType;
+        
+        mp = &modelParams[p->relParts[0]];
+        ms = &modelSettings[p->relParts[0]];
+        
+        /* print parameter number and name */
+        MrBayesPrint ("%s   %4d --  Parameter  = %s\n", spacer, i+1, p->name);
+        MrBayesPrint ("%s            Type       = %s\n", spacer, p->paramTypeName);
+        /* print prior */
+        if (j == P_TRATIO)
+            {
+            if (!strcmp(mp->tRatioPr,"Beta"))
+                MrBayesPrint ("%s            Prior      = Beta(%1.2lf,%1.2lf)\n", spacer, mp->tRatioDir[0], modelParams[i].tRatioDir[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->tRatioFix);
+            }
+        else if (j == P_REVMAT)
+            {
+            if (ms->numModelStates != 20)
+                {
+                if (!strcmp(mp->nst,"Mixed"))
+                    {
+                    MrBayesPrint ("%s            Prior      = All GTR submodels have equal probability\n", spacer); 
+                    MrBayesPrint ("%s                         All revmat rates have a Symmetric Dirichlet(%1.2lf) prior\n", spacer, mp->revMatSymDir);
+                    }
+                else if (!strcmp(mp->revMatPr,"Dirichlet"))
+                    {
+                    MrBayesPrint ("%s            Prior      = Dirichlet(%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer, 
+                    mp->revMatDir[0], mp->revMatDir[1], mp->revMatDir[2],
+                    mp->revMatDir[3], mp->revMatDir[4], mp->revMatDir[5]);
+                    }
+                else
+                    MrBayesPrint ("%s            Prior      = Fixed(%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf,%1.2lf)\n", spacer, 
+                    mp->revMatFix[0], mp->revMatFix[1], mp->revMatFix[2],
+                    mp->revMatFix[3], mp->revMatFix[4], mp->revMatFix[5]);
+                }
+            else if (ms->numModelStates == 20)
+                {
+                if (!strcmp(mp->aaRevMatPr,"Dirichlet"))
+                    MrBayesPrint ("%s            Prior      = Dirichlet\n", spacer);
+                else
+                    MrBayesPrint ("%s            Prior      = Fixed(user-specified)\n", spacer);
+                }
+            }
+        else if (j == P_OMEGA)
+            {
+            if (!strcmp(mp->omegaVar,"Equal"))
+                {
+                if (!strcmp(mp->omegaPr,"Dirichlet"))
+                    MrBayesPrint ("%s            Prior      = Dirichlet(%1.2lf,%1.2lf)\n", spacer, mp->omegaDir[0], mp->omegaDir[1]);
+                else
+                    MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->omegaFix);
+                }
+            else if (!strcmp(mp->omegaVar,"Ny98"))
+                {
+                if (!strcmp(mp->ny98omega1pr,"Beta"))
+                    MrBayesPrint ("%s            Prior      = Beta(%1.2lf,%1.2lf) on omega(1)\n", spacer, mp->ny98omega1Beta[0], mp->ny98omega1Beta[1]);
+                else
+                    MrBayesPrint ("%s            Prior      = Fixed(%1.2lf) on omega(1)\n", spacer, mp->ny98omega1Fixed);
+                MrBayesPrint ("%s                         Fixed(1.00) on omega(2)\n", spacer);
+                if (!strcmp(mp->ny98omega3pr,"Uniform"))
+                    MrBayesPrint ("%s                         Uniform(%1.2lf,%1.2lf) on omega(3)\n", spacer, mp->ny98omega3Uni[0], mp->ny98omega3Uni[1]);
+                else if (!strcmp(mp->ny98omega3pr,"Exponential"))
+                    MrBayesPrint ("%s                         Exponential(%1.2lf) on omega(3)\n", spacer, mp->ny98omega3Exp);
+                else
+                    MrBayesPrint ("%s                         Fixed(%1.2lf) on omega(3)\n", spacer, mp->ny98omega3Fixed);
+                if (!strcmp(mp->codonCatFreqPr,"Dirichlet"))
+                    MrBayesPrint ("%s                         Dirichlet(%1.2lf,%1.2lf,%1.2lf) on pi(-), pi(N), and pi(+)\n", spacer, mp->codonCatDir[0], mp->codonCatDir[1], mp->codonCatDir[2]);
+                else
+                    MrBayesPrint ("%s                         Fixed(%1.2lf,%1.2lf,%1.2lf) on pi(-), pi(N), and pi(+)\n", spacer, mp->codonCatFreqFix[0], mp->codonCatFreqFix[1], mp->codonCatFreqFix[2]);
+                }
+            else if (!strcmp(mp->omegaVar,"M3"))
+                {
+                if (!strcmp(mp->m3omegapr,"Exponential"))
+                    MrBayesPrint ("%s                         dN1, dN2, dN3, and dS are all exponential random variables\n", spacer);
+                else
+                    MrBayesPrint ("%s                         Fixed(%1.2lf,%1.2lf,%1.2lf) for the three selection categories\n", spacer, mp->m3omegaFixed[0], mp->m3omegaFixed[1], mp->m3omegaFixed[2]);
+                if (!strcmp(mp->codonCatFreqPr,"Dirichlet"))
+                    MrBayesPrint ("%s                         Dirichlet(%1.2lf,%1.2lf,%1.2lf) on pi(1), pi(2), and pi(3)\n", spacer, mp->codonCatDir[0], mp->codonCatDir[1], mp->codonCatDir[2]);
+                else
+                    MrBayesPrint ("%s                         Fixed(%1.2lf,%1.2lf,%1.2lf) on pi(1), pi(2), and pi(3)\n", spacer, mp->codonCatFreqFix[0], mp->codonCatFreqFix[1], mp->codonCatFreqFix[2]);
+                }
+            else if (!strcmp(mp->omegaVar,"M10"))
+                {
+                MrBayesPrint ("%s                         With probability pi(1), omega is drawn from a Beta(alpha1,beta1) \n", spacer);
+                MrBayesPrint ("%s                         distribution and with probability pi(2), omega is drawn from\n", spacer);
+                MrBayesPrint ("%s                         a Gamma(alpha2,beta2) distribution.\n", spacer);
+                if (!strcmp(mp->m10betapr,"Uniform"))
+                    {
+                    MrBayesPrint ("%s                         The parameters of the beta distribution each follow \n", spacer);
+                    MrBayesPrint ("%s                         independent Uniform(%1.2lf,%1.2lf) priors\n", spacer, mp->m10betaUni[0], mp->m10betaUni[1]);
+                    }
+                else if (!strcmp(mp->m10betapr,"Exponential"))
+                    {
+                    MrBayesPrint ("%s                         The parameters of the beta distribution each follow \n", spacer);
+                    MrBayesPrint ("%s                         independent Exponential(%1.2lf) priors\n", spacer, mp->m10betaExp);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s                         The parameters of the beta distribution are fixed to \n", spacer);
+                    MrBayesPrint ("%s                         %1.2lf and %1.2lf\n", spacer, mp->m10betaFix[0], mp->m10betaFix[0]);
+                    }
+
+                if (!strcmp(mp->m10gammapr,"Uniform"))
+                    {
+                    MrBayesPrint ("%s                         The parameters of the gamma distribution each follow  \n", spacer);
+                    MrBayesPrint ("%s                         independent Uniform(%1.2lf,%1.2lf) priors\n", spacer, mp->m10gammaUni[0], mp->m10gammaUni[1]);
+                    }
+                else if (!strcmp(mp->m10gammapr,"Exponential"))
+                    {
+                    MrBayesPrint ("%s                         The parameters of the gamma distribution each follow \n", spacer);
+                    MrBayesPrint ("%s                         independent Exponential(%1.2lf) priors\n", spacer, mp->m10gammaExp);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s                         The parameters of the gamma distribution are fixed to \n", spacer);
+                    MrBayesPrint ("%s                         %1.2lf and %1.2lf\n", spacer, mp->m10gammaFix[0], mp->m10gammaFix[0]);
+                    }
+
+                if (!strcmp(mp->codonCatFreqPr,"Dirichlet"))
+                    MrBayesPrint ("%s                         Dirichlet(%1.2lf,%1.2lf) on pi(1) and pi(2)\n", spacer, mp->codonCatDir[0], mp->codonCatDir[1]);
+                else
+                    MrBayesPrint ("%s                         Fixed(%1.2lf,%1.2lf) on pi(1) and pi(2)\n", spacer, mp->codonCatFreqFix[0], mp->codonCatFreqFix[1]);
+                }
+            }
+        else if (j == P_PI)
+            {
+            if (ms->dataType == STANDARD)
+                {
+                if (!strcmp(mp->symPiPr, "Uniform"))
+                    MrBayesPrint ("%s            Prior      = Symmetric dirichlet with uniform(%1.2lf,%1.2lf) variance parameter\n", spacer, mp->symBetaUni[0], mp->symBetaUni[1]);
+                else if (!strcmp(mp->symPiPr, "Exponential"))
+                    MrBayesPrint ("%s            Prior      = Symmetric dirichlet with exponential(%1.2lf) variance parameter\n", spacer, mp->symBetaExp);
+                else
+                    { /* mp->symBetaFix == -1 */
+                    if (AreDoublesEqual(mp->symBetaFix, -1.0, ETA)==YES)
+                        MrBayesPrint ("%s            Prior      = Symmetric dirichlet with all parameters equal to infinity\n", spacer);
+                    else
+                        MrBayesPrint ("%s            Prior      = Symmetric dirichlet with all parameters equal to %1.2lf\n", spacer, mp->symBetaFix);
+                    }
+                }
+            else if (ms->dataType == PROTEIN)
+                {
+                if (!strcmp(mp->aaModelPr, "Fixed") && (!strcmp(mp->aaModel, "Equalin") || !strcmp(mp->aaModel, "Gtr")))
+                    {
+                    if (!strcmp(mp->stateFreqPr,"Dirichlet"))
+                        {
+                        MrBayesPrint ("%s            Prior      = Dirichlet\n", spacer);
+                        }
+                    else if (!strcmp(mp->stateFreqPr,"Fixed") && !strcmp(mp->stateFreqsFixType,"Equal"))
+                        {
+                        MrBayesPrint ("%s            Prior      = Fixed (equal frequencies)\n", spacer);
+                        }
+                    else if (!strcmp(mp->stateFreqPr,"Fixed") && !strcmp(mp->stateFreqsFixType,"User"))
+                        {
+                        MrBayesPrint ("%s            Prior      = Fixed (user-specified)\n", spacer);
+                        }
+                    else if (!strcmp(mp->stateFreqPr,"Fixed") && !strcmp(mp->stateFreqsFixType,"Empirical"))
+                        {
+                        MrBayesPrint ("%s            Prior      = Fixed (empirical frequencies)\n", spacer);
+                        }
+                    }
+                else if (!strcmp(mp->aaModelPr, "Fixed") && !strcmp(mp->aaModel, "Poisson"))
+                    {
+                    MrBayesPrint ("%s            Prior      = Fixed (equal frequencies)\n", spacer);
+                    }
+                else if (!strcmp(mp->aaModelPr, "Fixed") && strcmp(mp->aaModel, "Equalin") && strcmp(mp->aaModel, "Poisson"))
+                    {
+                    MrBayesPrint ("%s            Prior      = Fixed (%s frequencies)\n", spacer, mp->aaModel);
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s            Prior      = Fixed (from mixture of models)\n", spacer);
+                    }
+                }
+            else
+                {
+                if (!strcmp(mp->stateFreqPr,"Dirichlet"))
+                    MrBayesPrint ("%s            Prior      = Dirichlet\n", spacer);
+                else
+                    MrBayesPrint ("%s            Prior      = Fixed\n", spacer);
+                }
+            }
+        else if (j == P_SHAPE)
+            {
+            if (!strcmp(mp->shapePr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->shapeUni[0], mp->shapeUni[1]);
+            else if (!strcmp(mp->shapePr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->shapeExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->shapeFix);
+            }
+        else if (j == P_PINVAR)
+            {
+            if (!strcmp(mp->pInvarPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->pInvarUni[0], mp->pInvarUni[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->pInvarFix);
+            }
+        else if (j == P_CORREL)
+            {
+            if (!strcmp(mp->adGammaCorPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->corrUni[0], mp->corrUni[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->corrFix);
+            }
+        else if (j == P_SWITCH)
+            {
+            if (!strcmp(mp->covSwitchPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->covswitchUni[0], mp->covswitchUni[1]);
+            else if (!strcmp(mp->covSwitchPr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->covswitchExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf,%1.2lf)\n", spacer, mp->covswitchFix[0], mp->covswitchFix[1]);
+            }
+        else if (j == P_RATEMULT)
+            {
+            if (!strcmp(mp->ratePr,"Fixed"))
+                MrBayesPrint ("%s            Prior      = Fixed(1.0)\n", spacer);
+            else
+                {
+                MrBayesPrint ("%s            Prior      = Dirichlet(", spacer);
+                for (d=n=0; d<numCurrentDivisions; d++)
+                    {
+                    if (activeParams[j][d] == i+1)
+                        n++;
+                    }
+                for (d=m=0; d<numCurrentDivisions; d++)
+                    {
+                    if (activeParams[j][d] == i+1)
+                        {
+                        m++;
+                        if (m < n)
+                            MrBayesPrint ("%1.2lf,", modelParams[d].ratePrDir);
+                        else
+                            MrBayesPrint ("%1.2lf)\n", modelParams[d].ratePrDir);
+                        }
+                    }
+                }
+            }
+        else if (j == P_GENETREERATE)
+            {
+            if (!strcmp(mp->generatePr,"Fixed"))
+                MrBayesPrint ("%s            Prior      = Fixed(1.0)\n", spacer);
+            else
+                {
+                MrBayesPrint ("%s            Prior      = Dirichlet(", spacer);
+                printedCol = (int)(strlen(spacer)) + 25 + 10;
+                for (n=0; n<numTrees-1; n++)
+                    {
+                    if (printedCol + 5 > screenWidth)
+                        {
+                        MrBayesPrint("\n%s                                   ", spacer);
+                        printedCol = (int)(strlen(spacer)) + 25 + 10;
+                        }
+                    if (n == numTrees-2)
+                        MrBayesPrint ("1.00)\n");
+                    else
+                        MrBayesPrint ("1.00,");
+                    printedCol += 5;
+                    }
+                }
+            }
+        else if (j == P_TOPOLOGY)
+            {
+            if (!strcmp(mp->topologyPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = All topologies equally probable a priori\n", spacer);
+            else if (!strcmp(mp->topologyPr,"Speciestree"))
+                MrBayesPrint ("%s            Prior      = Topology constrained to fold within species tree\n", spacer);
+            else if (!strcmp(mp->topologyPr,"Constraints"))
+                MrBayesPrint ("%s            Prior      = Prior on topologies obeys constraints\n", spacer);
+            else
+                MrBayesPrint ("%s            Prior      = Prior is fixed to the topology of user tree '%s'\n", spacer,
+                                                    userTree[mp->topologyFix]->name);
+            }
+        else if (j == P_BRLENS)
+            {
+            if (!strcmp(mp->parsModel, "Yes"))
+                MrBayesPrint ("%s            Prior      = Reconstructed using parsimony\n", spacer);
+            else
+                {
+                if (!strcmp(mp->brlensPr,"Unconstrained"))
+                    {
+                    MrBayesPrint ("%s            Prior      = Unconstrained:%s", spacer, mp->unconstrainedPr);
+                    if (!strcmp(mp->unconstrainedPr, "Uniform"))
+                        MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->brlensUni[0], mp->brlensUni[1]);
+                    else if (!strcmp(mp->unconstrainedPr, "Exponential"))
+                        MrBayesPrint ("(%1.1lf)\n", mp->brlensExp);
+                    else if (!strcmp(mp->unconstrainedPr, "twoExp"))
+                        MrBayesPrint ("(%1.1lf,%1.1lf)\n", mp->brlens2Exp[0], mp->brlens2Exp[1]);
+                    else
+                        MrBayesPrint ("(%1.1lf,%1.4lf,%1.1lf,%1.1lf)\n", mp->brlensDir[0], mp->brlensDir[1], mp->brlensDir[2], mp->brlensDir[3]);
+                    }
+                else if (!strcmp(mp->brlensPr, "Clock"))
+                    {
+                    MrBayesPrint ("%s            Prior      = Clock:%s\n", spacer, mp->clockPr);
+                    if ((!strcmp(mp->clockPr,"Uniform") || !strcmp(mp->clockPr,"Fossilization")) && !strcmp(mp->nodeAgePr,"Unconstrained"))
+                        {
+                        MrBayesPrint ("%s                         Tree age has a %s distribution\n", spacer, mp->treeAgePr.name);
+                        }
+                    else if (!strcmp(mp->clockPr, "Birthdeath") && !strcmp(mp->nodeAgePr,"Unconstrained"))
+                        {
+                        MrBayesPrint ("%s                         Tree age has a Uniform(0,infinity) distribution\n", spacer);
+                        }
+                    if (!strcmp(mp->nodeAgePr,"Calibrated"))
+                        {
+                        b = 0;
+                        for (a=0; a<numTaxa; a++)
+                            {
+                            if (taxaInfo[a].isDeleted == NO && tipCalibration[a].prior != unconstrained)
+                                b++;
+                            }
+                        for (a=0; a<numDefinedConstraints; a++)
+                            {
+                            if (mp->activeConstraints[a] == YES && nodeCalibration[a].prior != unconstrained)
+                                b++;
+                            }
+                        if (b > 1)
+                            MrBayesPrint ("%s                         Node depths are constrained by the following age constraints:\n", spacer);
+                        else
+                            MrBayesPrint ("%s                         Node depths are calibrated by the following age constraint:\n", spacer);
+                        for (a=0; a<numTaxa; a++)
+                            {
+                            if (taxaInfo[a].isDeleted == NO && tipCalibration[a].prior != unconstrained)
+                                {
+                                MrBayesPrint ("%s                         -- The age of terminal \"%s\" is %s\n", spacer, taxaNames[a],
+                                    tipCalibration[a].name);
+                                }
+                            }
+                        for (a=b=0; a<numDefinedConstraints; a++)
+                            {
+                            if (mp->activeConstraints[a] == YES && nodeCalibration[a].prior != unconstrained)
+                                {
+                                MrBayesPrint ("%s                         -- The age of node '%s' is %s\n", spacer,
+                                    constraintNames[a], nodeCalibration[a].name);
+                                for (k=0; k<numTaxa; k++)
+                                    if (taxaInfo[k].isDeleted == NO && IsBitSet(k,definedConstraint[a]) == NO)
+                                        break;
+                                if (k == numTaxa)
+                                    b = 1;          /* root is calibrated */
+                                }
+                            }
+                        if (b == 0) /* we need to use default calibration for root for uniform and birthdeath */
+                            {
+                            if (!strcmp(mp->clockPr,"Uniform") || !strcmp(mp->clockPr,"Fossilization"))
+                                {
+                                MrBayesPrint ("%s                         -- Tree age has a %s distribution\n", spacer, mp->treeAgePr.name);
+                                }
+                            else if (!strcmp(mp->clockPr,"Birthdeath"))
+                                {
+                                MrBayesPrint ("%s                         -- Tree age has a Uniform(0,infinity) distribution\n", spacer);
+                                }
+                            }
+                        }
+                    else
+                        MrBayesPrint ("%s                         Node ages are not constrained\n", spacer);
+                    }
+                else
+                    {
+                    assert (!strcmp(mp->brlensPr, "Fixed"));
+                    MrBayesPrint ("%s            Prior      = Fixed, branch lengths are fixed to the ones of the user tree '%s'\n", spacer,
+                                                    userTree[mp->topologyFix]->name);
+                    }
+                }
+            }
+        else if (j == P_SPECRATE)
+            {
+            if (!strcmp(mp->speciationPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->speciationUni[0], mp->speciationUni[1]);
+            else if (!strcmp(mp->speciationPr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->speciationExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->speciationFix);
+            }
+        else if (j == P_EXTRATE)
+            {
+            if (!strcmp(mp->extinctionPr,"Beta"))
+                MrBayesPrint ("%s            Prior      = Beta(%1.2lf,%1.2lf)\n", spacer, mp->extinctionBeta[0], mp->extinctionBeta[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->extinctionFix);
+            }
+        else if (j == P_FOSLRATE)
+            {
+            if (!strcmp(mp->fossilizationPr,"Beta"))
+                MrBayesPrint ("%s            Prior      = Beta(%1.2lf,%1.2lf)\n", spacer, mp->fossilizationBeta[0], mp->fossilizationBeta[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->fossilizationFix);
+            }
+        else if (j == P_POPSIZE)
+            {
+            if (!strcmp(mp->popSizePr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->popSizeUni[0], mp->popSizeUni[1]);
+            else if (!strcmp(mp->popSizePr,"Lognormal"))
+                MrBayesPrint ("%s            Prior      = Lognormal(%1.2lf,%1.2lf)\n", spacer, mp->popSizeLognormal[0], mp->popSizeLognormal[1]);
+            else if (!strcmp(mp->popSizePr,"Normal"))
+                MrBayesPrint ("%s            Prior      = Truncated Normal(%1.2lf,%1.2lf)\n", spacer, mp->popSizeNormal[0], mp->popSizeNormal[1]);
+            else if (!strcmp(mp->popSizePr,"Gamma"))
+                MrBayesPrint ("%s            Prior      = Gamma(%1.2lf,%1.2lf)\n", spacer, mp->popSizeGamma[0], mp->popSizeGamma[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.5lf)\n", spacer, mp->popSizeFix);
+            if (!strcmp(mp->topologyPr,"Speciestree"))
+                {
+                if (!strcmp(mp->popVarPr,"Equal") || !strcmp(mp->popSizePr,"Fixed"))
+                    MrBayesPrint ("%s                         Population size the same across species tree\n", spacer);
+                else
+                    MrBayesPrint ("%s                         Population size varies across branches in species tree\n", spacer);
+                }
+            }
+        else if (j == P_GROWTH)
+            {
+            if (!strcmp(mp->growthPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->growthUni[0], mp->growthUni[1]);
+            else if (!strcmp(mp->growthPr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->growthExp);
+            else if (!strcmp(mp->growthPr,"Normal"))
+                MrBayesPrint ("%s            Prior      = Normal(%1.2lf,%1.2lf)\n", spacer, mp->growthNorm[0], mp->growthNorm[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->growthFix);
+            } 
+        else if (j == P_AAMODEL)
+            {
+            if (!strcmp(mp->aaModelPr,"Mixed"))
+                {
+                /* check to see if you have a uniform prior */
+                isSame = YES;
+                for (a=0; a<9; a++)
+                    for (b=a+1; b<10; b++)
+                            /* mp->aaModelPrProbs[a] != mp->aaModelPrProbs[b] */
+                    if (AreDoublesEqual(mp->aaModelPrProbs[a], mp->aaModelPrProbs[b], ETA)==FALSE)
+                            isSame = NO;
+                MrBayesPrint ("%s            Prior      = Poisson, Jones, Dayhoff, Mtrev, Mtmam, Wag, Rtrev,\n", spacer);
+                if (isSame == YES)
+                    MrBayesPrint ("%s                         Cprev, Vt, and Blosum models have equal prior probability\n", spacer);
+                else
+                    MrBayesPrint ("%s                         Cprev, Vt, and Blosum models have unequal prior probability\n", spacer);
+                }
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%s)\n", spacer, mp->aaModel);
+            }
+        else if (j == P_BRCORR)
+            {
+            if (!strcmp(mp->brownCorPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->brownCorrUni[0], mp->brownCorrUni[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->brownCorrFix);
+            }
+        else if (j == P_BRSIGMA)
+            {
+            if (!strcmp(mp->brownScalesPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->brownScalesUni[0], mp->brownScalesUni[1]);
+            else if (!strcmp(mp->brownScalesPr,"Gammamean"))
+                MrBayesPrint ("%s            Prior      = Gamma Mean=<char. ave.> Var=%1.2lf\n", spacer, mp->brownScalesGammaMean);
+            else if (!strcmp(mp->brownScalesPr,"Gamma"))
+                MrBayesPrint ("%s            Prior      = Gamma Mean=%lf Var=%1.2lf\n", spacer, mp->brownScalesGamma[0], mp->brownScalesGamma[1]);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->brownScalesFix);
+            }
+        else if (j == P_CPPRATE)
+            {
+            if (!strcmp(mp->cppRatePr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->cppRateExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->cppRateFix);
+            }
+        else if (j == P_CPPMULTDEV)
+            {
+            if (!strcmp(mp->cppMultDevPr,"Fixed"))
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->cppMultDevFix);
+            }
+        else if (j == P_CPPEVENTS)
+            {
+            MrBayesPrint ("%s            Prior      = Poisson (%s) [Events]\n", spacer, modelSettings[p->relParts[0]].cppRate->name);
+            MrBayesPrint ("%s                         Lognormal (0.00,%1.2lf) [Rate multipliers]\n", spacer, mp->cppMultDevFix);
+            }
+        else if (j == P_TK02VAR)
+            {
+            if (!strcmp(mp->tk02varPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->tk02varUni[0], mp->tk02varUni[1]);
+            else if (!strcmp(mp->tk02varPr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->tk02varExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->tk02varFix);
+            }
+        else if (j == P_TK02BRANCHRATES)
+            {
+            MrBayesPrint ("%s            Prior      = LogNormal (expectation = r_0, variance = %s * v) \n", spacer, modelSettings[p->relParts[0]].tk02var->name);
+            MrBayesPrint ("%s                            [r_0 is beginning rate of branch, v is branch length]\n", spacer);
+            }
+        else if (j == P_IGRVAR)
+            {
+            if (!strcmp(mp->igrvarPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->igrvarUni[0], mp->igrvarUni[1]);
+            else if (!strcmp(mp->igrvarPr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->igrvarExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->igrvarFix);
+            }
+        else if (j == P_IGRBRANCHRATES)
+            {
+            MrBayesPrint ("%s            Prior      = Gamma (expectation = v, variance = %s * v) \n", spacer, modelSettings[p->relParts[0]].igrvar->name);
+            MrBayesPrint ("%s                            [where v is branch length]\n", spacer);
+            }
+        else if (j == P_MIXEDVAR)
+            {
+            if (!strcmp(mp->mixedvarPr,"Uniform"))
+                MrBayesPrint ("%s            Prior      = Uniform(%1.2lf,%1.2lf)\n", spacer, mp->mixedvarUni[0], mp->mixedvarUni[1]);
+            else if (!strcmp(mp->mixedvarPr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->mixedvarExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.2lf)\n", spacer, mp->mixedvarFix);
+            }
+        else if (j == P_MIXEDBRCHRATES)
+            {
+            MrBayesPrint ("%s            Prior      = Mixed TK02 and IGR (variance = %s * v)\n", spacer, modelSettings[p->relParts[0]].mixedvar->name);
+            MrBayesPrint ("%s                            [where v is branch length]\n", spacer);
+            MrBayesPrint ("%s                         Uniform prior on relaxed clock models [Pr(TK02)=Pr(IGR)=1/2]\n", spacer);
+            }
+        else if (j == P_CLOCKRATE)
+            {
+            if (!strcmp(mp->clockRatePr,"Normal"))
+                MrBayesPrint ("%s            Prior      = Normal(%1.6lf,%1.6lf)\n", spacer, mp->clockRateNormal[0], mp->clockRateNormal[1]);
+            else if (!strcmp(mp->clockRatePr,"Lognormal"))
+                MrBayesPrint ("%s            Prior      = Lognormal(%1.2lf,%1.2lf)\n", spacer, mp->clockRateLognormal[0], mp->clockRateLognormal[1]);
+            else if (!strcmp(mp->clockRatePr,"Gamma"))
+                MrBayesPrint ("%s            Prior      = Gamma(%1.2lf,%1.2lf)\n", spacer, mp->clockRateGamma[0], mp->clockRateGamma[1]);
+            else if (!strcmp(mp->clockRatePr,"Exponential"))
+                MrBayesPrint ("%s            Prior      = Exponential(%1.2lf)\n", spacer, mp->clockRateExp);
+            else
+                MrBayesPrint ("%s            Prior      = Fixed(%1.6lf)\n", spacer, mp->clockRateFix);
+            if (!strcmp(mp->clockVarPr,"Strict"))
+                MrBayesPrint ("%s                         The clock rate is constant (strict clock)\n", spacer);
+            else if (!strcmp(mp->clockVarPr,"Cpp"))
+                MrBayesPrint ("%s                         The clock rate varies according to a CPP model\n", spacer);
+            else if (!strcmp(mp->clockVarPr,"TK02"))
+                MrBayesPrint ("%s                         The clock rate varies according to a Brownian motion model\n", spacer);
+            else if (!strcmp(mp->clockVarPr,"Igr"))
+                MrBayesPrint ("%s                         The clock rate varies according to an independent gamma (white noise) model\n", spacer);
+            else /* if (!strcmp(mp->clockVarPr,"Mixed")) */
+                MrBayesPrint ("%s                         The clock rate varies according to mixed TK02 and IGR models\n", spacer);
+            }
+        else if (j == P_SPECIESTREE)
+            {
+            MrBayesPrint ("%s            Prior      = Uniform on topologies and branch lengths\n", spacer);
+            }
+                
+        /* print partitions */
+        if (numCurrentDivisions > 1)
+            {
+            if (p->nRelParts == 1)
+                MrBayesPrint ("%s            Partition  = %d\n", spacer, p->relParts[0]+1);
+            else if (p->nRelParts == 2)
+                {
+                MrBayesPrint ("%s            Partitions = %d and %d\n", spacer, p->relParts[0]+1, p->relParts[1]+1);                    
+                }
+            else if (p->nRelParts == numCurrentDivisions)
+                {
+                MrBayesPrint ("%s            Partitions = All\n", spacer);                  
+                }           
+            else /* if (p->nRelParts > 2) */
+                {
+                MrBayesPrint ("%s            Partitions = ", spacer);
+                for (j=0; j<p->nRelParts; j++)
+                    {
+                    if (j == p->nRelParts - 2)
+                        MrBayesPrint ("%d, and ", p->relParts[j]+1);
+                    else if (j == p->nRelParts - 1)
+                        MrBayesPrint ("%d\n", p->relParts[j]+1);
+                    else
+                        MrBayesPrint ("%d, ", p->relParts[j]+1);
+                    }               
+                }
+            }
+
+        /* show subparams */
+        if (p->nSubParams > 0)
+            {
+            if (p->nSubParams == 1)
+                MrBayesPrint ("%s            Subparam.  = %s\n", spacer, p->subParams[0]->name);
+            else
+                {
+                printedCol = 0;
+                for (k=0; k<p->nSubParams; k++)
+                    {
+                    if (k == 0)
+                        {
+                        MrBayesPrint ("%s            Subparams  = %s", spacer, p->subParams[k]->name);
+                        printedCol = (int)(strlen(spacer)) + 25 + (int)(strlen(p->subParams[k]->name));
+                        }
+                    else if (k == p->nSubParams - 1)
+                        {
+                        if (printedCol + 5 > screenWidth)
+                            MrBayesPrint ("\n%s                         and ", spacer);
+                        else if (printedCol + (int)(strlen(p->subParams[k]->name)) + 5 > screenWidth)
+                            MrBayesPrint (" and \n%s                         ", spacer);
+                        else
+                            MrBayesPrint (" and ");
+                        MrBayesPrint ("%s\n", p->subParams[k]->name);
+                        }
+                    else
+                        {
+                        if (printedCol + (int)(strlen(p->subParams[k]->name)) + 2 > screenWidth)
+                            {
+                            MrBayesPrint (", \n%s                         ", spacer);
+                            printedCol = (int)(strlen(spacer)) + 25;
+                            }
+                        else
+                            {
+                            MrBayesPrint(", ");
+                            printedCol += 2;
+                            }
+                        MrBayesPrint ("%s", p->subParams[k]->name);
+                        printedCol += (int)strlen(p->subParams[k]->name);
+                        }
+                    }
+                }
+            }
+
+        /* show used moves */
+        if (showMoves == YES && (p->printParam == YES || p->paramType == P_TOPOLOGY || p->paramType == P_BRLENS))
+            {
+            /* check if runs are same */
+            areRunsSame = YES;
+            for (run=1; run<chainParams.numRuns; run++)
+                {
+                for (chain=0; chain<chainParams.numChains; chain++)
+                    {
+                    for (k=0; k<numApplicableMoves; k++)
+                        {
+                        mv = moves[k];
+                        if (mv->parm != p)
+                            continue;
+                        chainIndex = run*chainParams.numChains + chain;
+                        refIndex = chain;
+                        if (AreDoublesEqual (mv->relProposalProb[chainIndex], mv->relProposalProb[refIndex], 0.000001) == NO)
+                            areRunsSame = NO;
+                        }
+                    }
+                }
+
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                if (run > 0 && areRunsSame == YES)
+                    continue;
+                
+                /* check if chains are same */
+                areChainsSame = YES;
+                for (chain=1; chain<chainParams.numChains; chain++)
+                    {
+                    for (k=0; k<numApplicableMoves; k++)
+                        {
+                        mv = moves[k];
+                        if (mv->parm != p)
+                            continue;
+                        chainIndex = run*chainParams.numChains + chain;
+                        refIndex = run*chainParams.numChains;
+                        if (AreDoublesEqual (mv->relProposalProb[chainIndex], mv->relProposalProb[refIndex], 0.000001) == NO)
+                            areChainsSame = NO;
+                        }
+                    }
+
+                /* now print moves */
+                for (chain=0; chain<chainParams.numChains; chain++)
+                    {
+                    if (chain > 0 && areChainsSame == YES)
+                        continue;
+                    if (run==0 && chain==0)
+                        MrBayesPrint ("%s            Moves      = ", spacer);
+                    else
+                        MrBayesPrint ("%s                         ", spacer);
+                    numPrinted = 0;
+                    printedCol = (int)(strlen(spacer)) + 25;
+                    for (k=0; k<numApplicableMoves; k++)
+                        {
+                        mv = moves[k];
+                        if (mv->parm != p)
+                            continue;
+                        chainIndex = run*chainParams.numChains + chain;
+                        if (mv->relProposalProb[chainIndex] <= 0.000001)
+                            continue;
+                        if (numPrinted == 0)
+                            {
+                            MrBayesPrint ("%s <prob %.1f>", mv->name, mv->relProposalProb[chainIndex]);
+                            printedCol += 9 + (int)strlen(mv->name) + (int)(log10(mv->relProposalProb[chainIndex])) + 3;
+                            }
+                        else
+                            {
+                            if (printedCol + 11 + (int)(strlen(mv->name)) + (int)(log10(mv->relProposalProb[chainIndex])) + 3 > screenWidth)
+                                {
+                                MrBayesPrint(", \n%s                         ", spacer);
+                                printedCol = 25 + (int)(strlen(spacer));
+                                }
+                            else
+                                {
+                                MrBayesPrint(", ");
+                                printedCol += 2;
+                                }
+                            MrBayesPrint ("%s <prob %.1f>", mv->name, mv->relProposalProb[chainIndex]);
+                            printedCol += (9 + (int)(strlen(mv->name)) + (int)(log10(mv->relProposalProb[chainIndex])) + 3);
+                            }
+                        numPrinted++;
+                        }
+
+                    if (numPrinted == 0 && p->paramType == P_BRLENS)
+                        {
+                        for (k=0; k<numParams; k++)
+                            if (params[k].tree == p->tree)
+                                break;
+                        MrBayesPrint ("For moves, see param. '%s'", params[k].name);
+                        }
+                    else if (numPrinted == 0)
+                        MrBayesPrint ("WARNING! No moves -- param. fixed to startvals");
+
+                    if (areRunsSame == YES && areChainsSame == YES)
+                        MrBayesPrint ("\n");
+                    else if (areRunsSame == YES && areChainsSame == NO)
+                        MrBayesPrint (" [chain %d]\n", chain+1);
+                    else if (areRunsSame == NO && areChainsSame == YES)
+                        MrBayesPrint (" [run %d]\n", run+1);
+                    else /* if (areRunsSame == NO && areChainsSame == NO) */
+                            MrBayesPrint (" [run %d, chain %d]\n", run+1, chain+1);
+                    }
+                }
+            }
+            
+        /* show available moves */
+        if (showAllAvailable == YES && (p->printParam == YES || p->paramType == P_TOPOLOGY || p->paramType == P_BRLENS))
+            {
+            /* loop over moves */
+            numPrinted = 0;
+            printedCol = 0;
+            for (k=0; k<numApplicableMoves; k++)
+                {
+                mv = moves[k];
+                if (mv->parm != p)
+                    continue;
+                numMovedChains = 0;
+                for (run=0; run<chainParams.numRuns; run++)
+                    {
+                    for (chain=0; chain<chainParams.numChains; chain++)
+                        {
+                        chainIndex = run*chainParams.numChains + chain;
+                        if (mv->relProposalProb[chainIndex] > 0.000001)
+                            numMovedChains++;
+                        }
+                    }
+                if (numMovedChains == 0)
+                    {
+                    if (numPrinted == 0)
+                        {
+                        MrBayesPrint ("%s            Not used   = ", spacer);
+                        printedCol = (int)(strlen(spacer)) + 25;
+                        }
+                    else if (printedCol + 2 + (int)(strlen(mv->moveType->shortName)) > screenWidth)
+                        {
+                        MrBayesPrint (", \n%s                         ", spacer);
+                        printedCol = (int)(strlen(spacer)) + 25;
+                        }
+                    else
+                        {
+                        MrBayesPrint (", ");
+                        printedCol += 2;
+                        }
+                    MrBayesPrint("%s", mv->moveType->shortName);
+                    printedCol += (int)strlen(mv->moveType->shortName);
+                    numPrinted++;
+                    }
+                }
+                if (numPrinted > 0)
+                    MrBayesPrint ("\n");
+            }
+
+        /* show startvals */
+        if (showStartVals == YES && (p->printParam == YES || p->paramType == P_TOPOLOGY || p->paramType == P_BRLENS || p->paramType == P_SPECIESTREE || p->paramType == P_POPSIZE))
+            {                   
+            if (p->paramType == P_TOPOLOGY || p->paramType == P_BRLENS || p->paramType == P_SPECIESTREE)
+                {
+                /* check if they are the same */
+                areRunsSame = YES;
+                if (p->paramType == P_TOPOLOGY)
+                    {
+                    for (run=1; run<chainParams.numRuns; run++)
+                        {
+                        for (chain=0; chain<chainParams.numChains; chain++)
+                            {
+                            if (AreTopologiesSame (GetTree (p, run*chainParams.numChains + chain, 0), GetTree (p, chain, 0)) == NO)
+                                {
+                                areRunsSame = NO;
+                                break;
+                                }
+                            }
+                        }
+                    }
+                else if (p->paramType == P_BRLENS)
+                    {
+                    for (run=1; run<chainParams.numRuns; run++)
+                        {
+                        for (chain=0; chain<chainParams.numChains; chain++)
+                            {
+                            if (AreTreesSame (GetTree (p, run*chainParams.numChains + chain, 0), GetTree (p, chain, 0)) == NO)
+                                {
+                                areRunsSame = NO;
+                                break;
+                                }
+                            }
+                        }
+                    }
+                else if (p->paramType == P_SPECIESTREE)
+                    {
+                    for (run=1; run<chainParams.numRuns; run++)
+                        {
+                        for (chain=0; chain<chainParams.numChains; chain++)
+                            {
+                            if (AreTreesSame (GetTree (p, run*chainParams.numChains + chain, 0), GetTree (p, chain, 0)) == NO)
+                                {
+                                areRunsSame = NO;
+                                break;
+                                }
+                            }
+                        }
+                    }
+                
+                /* print trees */
+                for (run=0; run<chainParams.numRuns; run++)
+                    {
+                    if (run > 0 && areRunsSame == YES)
+                        break;
+                    for (chain=0; chain<chainParams.numChains; chain++)
+                        {
+                        if (run == 0 && chain == 0)
+                            MrBayesPrint ("%s            Startvals  = tree '%s'", spacer, GetTree (p, run*chainParams.numChains+chain, 0)->name);
+                        else
+                            MrBayesPrint ("%s                         tree '%s'", spacer, GetTree (p, run*chainParams.numChains+chain, 0)->name);
+                        if (chainParams.numChains > 1 && areRunsSame == YES)
+                            MrBayesPrint ("  [chain %d]", chain+1);
+                        else if (chainParams.numChains == 1 && areRunsSame == NO)
+                            MrBayesPrint ("  [run %d]", run+1);
+                        else if (areRunsSame == NO)
+                            MrBayesPrint ("  [run %d, chain %d]", run+1, chain+1);
+                        MrBayesPrint ("\n");
+                        }
+                    }               
+                }   /* end topology and brlens parameters */
+
+            else if (p->paramType == P_OMEGA && p->paramId != OMEGA_DIR && p->paramId != OMEGA_FIX &&
+                     p->paramId != OMEGA_FFF && p->paramId != OMEGA_FF && p->paramId != OMEGA_10FFF)
+                {
+                /* we need to print values and subvalues for the category frequencies in a NY98-like model. */
+                areRunsSame = YES;
+                for (run=1; run<chainParams.numRuns; run++)
+                    {
+                    for (chain=0; chain<chainParams.numChains; chain++)
+                        {
+                        value = GetParamVals (p, run*chainParams.numRuns+chain, 0);
+                        refValue = GetParamVals (p, chain, 0);
+                        nValues = p->nValues;
+                        for (k=0; k<nValues; k++)
+                            {
+                            if (AreDoublesEqual (value[k], refValue[k], 0.000001) == NO)
+                                {
+                                areRunsSame = NO;
+                                break;
+                                }
+                            }
+                        value = GetParamSubVals (p, run*chainParams.numRuns+chain, 0);
+                        refValue = GetParamSubVals (p, chain, 0);
+                        if (!strcmp(modelParams[p->relParts[0]].omegaVar, "M10"))
+                            {
+                            value += (mp->numM10BetaCats + mp->numM10GammaCats);
+                            refValue += (mp->numM10BetaCats + mp->numM10GammaCats);
+                            for (k=0; k<4; k++)
+                                {
+                                if (AreDoublesEqual (value[k + 4], refValue[k + 4], 0.000001) == NO)
+                                    {
+                                    areRunsSame = NO;
+                                    break;
+                                    }
+                                }
+                            for (k=0; k<2; k++)
+                                {
+                                if (AreDoublesEqual (value[k], refValue[k], 0.000001) == NO)
+                                    {
+                                    areRunsSame = NO;
+                                    break;
+                                    }
+                                }                           
+                            }
+                        else
+                            {
+                            for (k=0; k<3; k++)
+                                {
+                                if (AreDoublesEqual (value[k], refValue[k], 0.000001) == NO)
+                                    {
+                                    areRunsSame = NO;
+                                    break;
+                                    }
+                                }
+                            }
+                        if (areRunsSame == NO)
+                            break;
+                        }
+                    if (areRunsSame == NO)
+                        break;
+                    }
+                
+                /* now print values */
+                for (run=0; run<chainParams.numRuns; run++)
+                    {
+                    for (chain=0; chain<chainParams.numChains; chain++)
+                        {
+                        value = GetParamVals (p, run*chainParams.numRuns+chain, 0);
+                        subValue = GetParamSubVals (p, run*chainParams.numRuns+chain, 0);
+                        nValues = p->nValues;                       
+                        if (run == 0 && chain == 0)
+                            MrBayesPrint ("%s            Startvals  = (%1.3lf", spacer, value[0]);
+                        else
+                            MrBayesPrint ("%s                         (%1.3lf", spacer, value[0]);
+                        for (k=1; k<nValues; k++)
+                            {
+                            MrBayesPrint (",%1.3lf", value[k]);
+                            }
+
+                        if (!strcmp(modelParams[p->relParts[0]].omegaVar, "M10"))
+                            {
+                            for (k=0; k<4; k++)
+                                {
+                                MrBayesPrint (",%1.3lf", subValue[k + mp->numM10BetaCats+mp->numM10GammaCats+4]);
+                                }
+                            for (k=0; k<2; k++)
+                                {
+                                MrBayesPrint (",%1.3lf", subValue[k + mp->numM10BetaCats+mp->numM10GammaCats]);
+                                }                   
+                            }
+                        else
+                            {
+                            for (k=0; k<3; k++)
+                                {
+                                MrBayesPrint (",%1.3lf", subValue[k]);
+                                }
+                            }       
+                        MrBayesPrint (")");
+                        if (chainParams.numChains > 1 && areRunsSame == YES)
+                            MrBayesPrint ("  [chain %d]\n", chain+1);
+                        else if (chainParams.numChains == 1 && areRunsSame == NO)
+                            MrBayesPrint ("  [run %d]\n", run+1);
+                        else if (areRunsSame == NO)
+                            MrBayesPrint ("  [run %d, chain %d]\n", run+1, chain+1);
+                        }
+                    }
+                }
+            else
+                {
+                /* run of the mill parameter */
+                if (p->paramType == P_CLOCKRATE)
+                    {
+                     for (j=0; j<numGlobalChains; j++)
+                        {
+                        if (UpdateClockRate(-1.0, j) == ERROR)
+                            {
+                            MrBayesPrint ("%s            Warning: There is no appropriate clock rate that would satisfy all calibrated trees for run:%d chain%d. Some of calibration, trees or clockprior needs to be changed. ", spacer, j/chainParams.numChains, j%chainParams.numChains);
+                            }
+                        }
+                    }
+                areRunsSame = YES;
+                for (run=1; run<chainParams.numRuns; run++)
+                    {
+                    for (chain=0; chain<chainParams.numChains; chain++)
+                        {
+                        if ((p->paramType == P_PI && modelParams[p->relParts[0]].dataType != STANDARD))
+                            {
+                            nValues = p->nSubValues;
+                            value = GetParamSubVals (p, run*chainParams.numChains+chain, 0);
+                            refValue = GetParamSubVals (p, chain, 0);
+                            }
+                        else
+                            {
+                            nValues = p->nValues;
+                            value = GetParamVals (p, run*chainParams.numChains+chain, 0);
+                            refValue = GetParamVals (p, chain, 0);
+                            }
+                        for (k=0; k<nValues; k++)
+                            {
+                            if (AreDoublesEqual(value[k], refValue[k], 0.000001) == NO)
+                                {
+                                areRunsSame = NO;
+                                break;
+                                }                           
+                            }
+                        if (areRunsSame == NO)
+                            break;                          
+                        }
+                    if (areRunsSame == NO)
+                        break;
+                    }
+
+                /* print values */
+                for (run=0; run<chainParams.numRuns; run++)
+                    {
+                    if (run > 0 && areRunsSame == YES)
+                        break;
+                    areChainsSame = YES;
+                    for (chain=1; chain<chainParams.numChains; chain++)
+                        {
+                        if ((p->paramType == P_PI && modelParams[p->relParts[0]].dataType != STANDARD))
+                            {
+                            nValues = p->nSubValues;
+                            value = GetParamSubVals (p, run*chainParams.numChains+chain, 0);
+                            refValue = GetParamSubVals (p, run*chainParams.numChains, 0);
+                            }
+                        else
+                            {
+                            nValues = p->nValues;
+                            value = GetParamVals (p, run*chainParams.numChains+chain, 0);
+                            refValue = GetParamVals (p, run*chainParams.numChains, 0);
+                            }
+                        for (k=0; k<nValues; k++)
+                            {
+                            if (AreDoublesEqual(value[k], refValue[k], 0.000001) == NO)
+                                {
+                                areChainsSame = NO;
+                                break;
+                                }                           
+                            }
+                        }
+                    for (chain=0; chain<chainParams.numChains; chain++)
+                        {
+                        if (areChainsSame == YES && chain > 0)
+                            continue;
+
+                        if ((p->paramType == P_PI && modelParams[p->relParts[0]].dataType != STANDARD))
+                            {
+                            nValues = p->nSubValues;
+                            value = GetParamSubVals (p, run*chainParams.numChains+chain, 0);
+                            }
+                        else
+                            {
+                            nValues = p->nValues;
+                            value = GetParamVals (p, run*chainParams.numChains+chain, 0);
+                            }
+
+                        if (run == 0 && chain == 0)
+                            MrBayesPrint ("%s            Startvals  = (%1.3lf", spacer, value[0]);
+                        else
+                            MrBayesPrint ("%s                         (%1.3lf", spacer, value[0]);
+                        
+                        for (k=1; k<nValues; k++)
+                            {
+                            if (k%10==0)
+                                MrBayesPrint (",\n%s                          %1.3lf", spacer, value[k]);
+                            else
+                                MrBayesPrint (",%1.3lf", value[k]);
+                            }
+                        MrBayesPrint (")");
+                        
+                        if (areChainsSame == YES && areRunsSame == NO)
+                            MrBayesPrint ("  [run %d]", run+1);
+                        else if (areChainsSame == NO && areRunsSame == YES)
+                            MrBayesPrint ("  [chain %d]", chain+1);
+                        else if (areChainsSame == NO && areRunsSame == NO)
+                            MrBayesPrint ("  [run %d, chain %d]", run+1, chain+1);
+                        MrBayesPrint ("\n");
+                        }   
+                    }
+                }
+            }   /* end print start values */
+
+        MrBayesPrint ("\n");
+        }   /* next parameter */
+
+    return (NO_ERROR);
+}
+
+
+int Unlink (void)
+{
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------
+|
+|   UpdateClockRate:    Update clockRate of the given chain. Above all it will enforce fixed clockrate prior if it is set.
+|                       Error will be returned if fixed clockrate prior may not be respected.
+|   @param clockRate    is the new clockRate to setup. Clock rate value could be set as positive, 0.0 or negative value. 
+|                       The function does the fallowing depending on one of this three values:
+|                        positive    - check that this 'positive' value is suitable rate. At the end re-enforce (update) the 'positive' value as clock rate on all trees. 
+|                        0.0         - check if current rate is suitable, if not update it with minimal suitable value. At the end re-enforce (update) the resulting clock rate on all trees. 
+|                        negative    - check if current rate is suitable, if not update it with minimal suitable value. At the end re-enforce (update) the resulting clock rate ONLY if clock rate was changed 
+|   @return             ERROR if clockRate can not be set up, NO_ERROR otherwise. 
+|
+--------------------------------------------------*/
+int UpdateClockRate (MrBFlt clockRate, int chain)
+{
+    int         i, updateTrees;
+    MrBFlt      *clockRatep;
+    Tree        *t, *t_calibrated=NULL;
+    MrBFlt      mintmp,maxtmp,minClockRate,maxClockRate;
+
+    clockRatep=NULL;
+    minClockRate = 0.0;
+    maxClockRate = MRBFLT_MAX;
+
+    for (i=0; i<numTrees; i++)
+        {
+        t = GetTreeFromIndex(i, chain, 0);
+        if (t->isCalibrated == NO)
+            continue;
+
+        if (clockRatep == NULL)
+            {
+            clockRatep = GetParamVals(modelSettings[t->relParts[0]].clockRate, chain, 0);
+            t_calibrated = t;
+            assert (clockRatep);
+            }
+
+        findAllowedClockrate (t, &mintmp, &maxtmp);
+
+        if (minClockRate < mintmp)
+            minClockRate = mintmp;
+
+        if (maxClockRate > maxtmp)
+            maxClockRate = maxtmp;
+
+        }
+    /* clock rate is the same for all trees of a given chain */
+    if (clockRatep != NULL)
+        {
+        if (minClockRate > maxClockRate)
+            {
+            MrBayesPrint ("%s   ERROR: Calibrated trees require compatible clockrates but they are incompatible for run %d, chain %d.\n",
+                          spacer, chain/chainParams.numChains + 1, chain%chainParams.numChains + 1);
+            *clockRatep=0;
+            return (ERROR);
+            }
+
+        if (!strcmp(modelParams[t_calibrated->relParts[0]].clockRatePr, "Fixed"))
+            {
+            if (clockRate < 0.0 && AreDoublesEqual (*clockRatep, modelParams[t_calibrated->relParts[0]].clockRateFix, 0.0001) == YES)
+                {
+                updateTrees = NO;
+                }
+            else
+                {
+                updateTrees = YES;
+                }
+            *clockRatep = modelParams[t_calibrated->relParts[0]].clockRateFix;
+            if ((*clockRatep < minClockRate && AreDoublesEqual (*clockRatep, minClockRate, 0.0001) == NO) ||
+                (*clockRatep > maxClockRate && AreDoublesEqual (*clockRatep, maxClockRate, 0.0001) == NO))
+                {
+                MrBayesPrint ("%s   ERROR: Calibrated trees require clockrate in range from %f to %f, while clockrate prior is fixed to %f for run %d chain %d.\n",
+                              spacer, minClockRate, maxClockRate, *clockRatep, chain/chainParams.numChains + 1, chain%chainParams.numChains + 1);
+                *clockRatep=0;
+                return (ERROR);
+                }
+            if (clockRate > 0.0)
+                {
+                if (AreDoublesEqual (*clockRatep, clockRate, 0.0001) == NO)
+                    {
+                    MrBayesPrint ("%s   ERROR: Requested clockrate:%f does not match fixed clockrate prior:%f.\n", spacer, clockRate, *clockRatep);
+                    *clockRatep=0;
+                    return (ERROR);
+                    }
+                }
+            }
+        else {
+            /* clock prior is not fixed */
+            updateTrees = YES;
+            if (clockRate > 0.0)
+                {
+                *clockRatep = clockRate;
+                if ((*clockRatep < minClockRate && AreDoublesEqual (*clockRatep, minClockRate, 0.0001) == NO) ||
+                    (*clockRatep > maxClockRate && AreDoublesEqual (*clockRatep, maxClockRate, 0.0001) == NO))
+                    {
+                    MrBayesPrint ("%s   ERROR: Calibrated trees require clockrate in range from %f to %f, while requested clockrate is %f for run %d chain %d.\n",
+                                  spacer, minClockRate, maxClockRate, clockRate, chain/chainParams.numChains + 1, chain%chainParams.numChains + 1);
+                    *clockRatep=0;
+                    return (ERROR);
+                    }
+                }
+            else if (clockRate == 0.0) 
+                {
+                if ((*clockRatep < minClockRate && AreDoublesEqual (*clockRatep, minClockRate, 0.0001) == NO) ||
+                    (*clockRatep > maxClockRate && AreDoublesEqual (*clockRatep, maxClockRate, 0.0001) == NO))
+                    {
+                    *clockRatep = minClockRate;
+                    }
+                }
+            else // if (clockRate < 0.0)
+                {
+                if ((*clockRatep < minClockRate && AreDoublesEqual (*clockRatep, minClockRate, 0.0001) == NO) ||
+                    (*clockRatep > maxClockRate && AreDoublesEqual (*clockRatep, maxClockRate, 0.0001) == NO))
+                    {
+                    *clockRatep = minClockRate;
+                    }
+                else
+                    {
+                    updateTrees = NO;
+                    }
+                }
+            }
+
+        
+        if (updateTrees == YES)
+            {
+            for (i=0; i<numTrees; i++)
+                {
+                t = GetTreeFromIndex(i, chain, 0);
+                if (t->isCalibrated == NO)
+                    continue;
+                UpdateTreeWithClockrate (t,*clockRatep);
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------
+|
+|   UpdateCppEvolLength: Recursive function to
+|      update evolLength of one node for Cpp
+|      relaxed clock model
+|
+-----------------------------------------------*/
+int UpdateCppEvolLength (int *nEvents, MrBFlt **pos, MrBFlt **rateMult, MrBFlt *evolLength, TreeNode *p, MrBFlt baseRate)
+{
+    int     i;
+    MrBFlt  endRate;
+
+    if (p != NULL)
+        {
+#   ifdef DEBUG_CPP
+        if (baseRate < POS_MIN || baseRate > POS_INFINITY)
+            {
+            printf ("baseRate out of bounds (%.15e for node %d\n", baseRate, p->index);
+            return (ERROR);
+            }
+#   endif
+        p->upDateTi = YES;
+        p->upDateCl = YES;
+        if (nEvents[p->index] == 0)
+            {
+            evolLength[p->index] = p->length * baseRate;
+            }
+        else
+            {
+            /* note that event positions are from the top of the branch (more recent)
+               to the bottom of the branch (older) */
+            /* The algorithm below successively multiplies in the more basal rate multipliers,
+               starting from the top of the branch. The length of the branch is first assumed
+               to be 1.0; at the end we multiply the result with the true length of the branch. */
+            evolLength[p->index] = pos[p->index][0] * rateMult[p->index][0];
+            for (i=1; i<nEvents[p->index]; i++)
+                {
+                evolLength[p->index] += (pos[p->index][i] - pos[p->index][i-1]);
+                evolLength[p->index] *= rateMult[p->index][i];
+                }
+            evolLength[p->index] += (1.0 - pos[p->index][nEvents[p->index]-1]);
+            evolLength[p->index] *= baseRate;
+            evolLength[p->index] *= p->length;
+            }
+
+        /* calculate end rate; we can do this in any order */
+        endRate = baseRate;
+        for (i=0; i<nEvents[p->index]; i++)
+            endRate *= rateMult[p->index][i];
+
+#   ifdef DEBUG_CPP
+        if (endRate < POS_MIN || endRate > POS_INFINITY)
+            {
+            printf ("endRate out of bounds (%.15e for node %d)\n", endRate, p->index);
+            return (ERROR);
+            }
+        if (p->anc != NULL && p->anc->anc != NULL && (evolLength[p->index] < POS_MIN || evolLength[p->index] > POS_INFINITY))
+            {
+            printf ("Effective branch length out of bounds (%.15e for node %d)\n", evolLength[p->index], p->index);
+            return (ERROR);
+            }
+#   endif
+        /* call left and right descendants */
+        if (UpdateCppEvolLength (nEvents, pos, rateMult, evolLength, p->left, endRate)==ERROR)
+            return (ERROR);
+        if (UpdateCppEvolLength (nEvents, pos, rateMult, evolLength, p->right, endRate)==ERROR)
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------
+ |
+ |  UpdateCppEvolLengths: Recalculate effective
+ |      evolutionary lengths and set update flags
+ |      for Cpp relaxed clock model
+ |
+ --------------------------------------------------*/
+int UpdateCppEvolLengths (Param *param, TreeNode *p, int chain)
+{
+    int         i, *nEvents;
+    TreeNode    *q;
+    MrBFlt      baseRate = 1.0, **pos, **rateMult, *evolLength;
+    
+    i = 2*chain + state[chain];
+    nEvents = param->nEvents[i];
+    pos = param->position[i];
+    rateMult = param->rateMult[i];
+    evolLength = GetParamSubVals (param, chain, state[chain]);
+    
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        for (i=0; i<nEvents[q->index]; i++)
+            baseRate *= rateMult[q->index][i];
+        q = q->anc;
+        }
+    
+    if (UpdateCppEvolLength (nEvents, pos, rateMult, evolLength, p, baseRate)==ERROR)
+        return (ERROR);
+    
+    return(NO_ERROR);
+}
+
+
+/* UpdateTK02EvolLengths: update branch lengths for tk02 model */
+int UpdateTK02EvolLengths (Param *param, Tree *t, int chain)
+{
+    int         i;
+    MrBFlt      *tk02Rate, *brlens;
+    TreeNode    *p;
+    
+    tk02Rate = GetParamVals (param, chain, state[chain]);
+    brlens = GetParamSubVals (param, chain, state[chain]);
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        brlens[p->index] = p->length * (tk02Rate[p->index] + tk02Rate[p->anc->index]) / 2.0;
+        }
+    
+    return (NO_ERROR);
+}
+
+
+/* UpdateIgrBranchLengths: update branch lengths for igr model */
+int UpdateIgrBrachLengths (Param *param, Tree *t, int chain)
+{
+    int         i;
+    MrBFlt      *igrRate, *brlens;
+    TreeNode    *p;
+    
+    igrRate = GetParamVals (param, chain, state[chain]);
+    brlens = GetParamSubVals (param, chain, state[chain]);
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        brlens[p->index] = p->length * igrRate[p->index];
+        }
+
+    return (NO_ERROR);
+}
+
diff --git a/src/model.h b/src/model.h
new file mode 100644 (file)
index 0000000..934e634
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef __MODEL_H__
+#define __MODEL_H__
+
+int     AreDoublesEqual (MrBFlt x, MrBFlt y, MrBFlt tol);
+int     ChangeNumRuns (int from, int to);
+int     ChangeNumChains (int from, int to);
+int     CheckModel (void);
+int     DoesTreeSatisfyConstraints (Tree *t);
+int     DoLink (void);
+int     DoLinkParm (char *parmName, char *tkn);
+int     DoLset (void);
+int     DoLsetParm (char *parmName, char *tkn);
+int     DoPlot (void);
+int     DoPlotParm (char *parmName, char *tkn);
+int     DoPropset (void);
+int     DoPropsetParm (char *parmName, char *tkn);
+int     DoPrset (void);
+int     DoPrsetParm (char *parmName, char *tkn);
+int     DoQuit (void);
+int     DoReport (void);
+int     DoReportParm (char *parmName, char *tkn);
+int     DoShowMcmcTrees (void);
+int     DoShowModel (void);
+int     DoShowMoves (void);
+int     DoShowmovesParm (char *parmName, char *tkn);
+int     DoShowParams (void);
+int     DoStartvals (void);
+int     DoStartvalsParm (char *parmName, char *tkn);
+int     DoUnlink (void);
+int     FillNormalParams (RandLong *seed, int fromChain, int toChain);
+int     FillRelPartsString (Param *p, char **relPartString);
+void    FillStdStateFreqs (int chfrom, int chto, RandLong *seed);
+int     FillTopologySubParams (Param *param, int chn, int state, RandLong *seed);
+int     FillTreeParams (RandLong *seed, int fromChain, int toChain);
+int     FreeModel (void);
+int     GetEmpiricalFreqs (int *relParts, int nRelParts);
+int     GetNumDivisionChars (void);
+int     *GetParamIntVals (Param *parm, int chain, int state);
+MrBFlt  *GetParamStdStateFreqs (Param *parm, int chain, int state);
+MrBFlt  *GetParamSubVals (Param *parm, int chain, int state);
+MrBFlt  *GetParamVals (Param *parm, int chain, int state);
+Tree    *GetTree (Param *parm, int chain, int state);
+Tree    *GetTreeFromIndex (int index, int chain, int state);
+int     InitializeLinks (void);
+int     InitializeTreeCalibrations (Tree *t);
+int     Link (void);
+int     SetAARates (void);
+int     SetLocalTaxa (void);
+int     SetModelDefaults (void);
+int     SetMoves (void);
+int     SetUpAnalysis (RandLong *seed);
+void    SetUpMoveTypes (void);
+int     ShowModel (void);
+int     Unlink (void);
+int     UpdateClockRate (MrBFlt clockRate, int chain);
+int     UpdateCppEvolLengths (Param *param, TreeNode *p, int chain);
+int     UpdateTK02EvolLengths (Param *param, Tree *t, int chain);
+int     UpdateIgrBrachLengths (Param *param, Tree *t, int chain);
+
+#endif  /* __MODEL_H__ */
diff --git a/src/proposal.c b/src/proposal.c
new file mode 100644 (file)
index 0000000..ac1218c
--- /dev/null
@@ -0,0 +1,15022 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "best.h"
+#include "command.h"
+#include "mcmc.h"
+#include "model.h"
+#include "proposal.h"
+#include "utils.h"
+
+const char* const svnRevisionProposalC = "$Rev: 1069 $";   /* Revision keyword which is expanded/updated by svn on each commit/update */
+
+/* debugging compiler statements */
+#undef  DEBUG_LOCAL
+#undef  DEBUG_UNROOTED_SLIDER
+#undef  DEBUG_ParsSPR
+#undef  DEBUG_ExtSS
+#undef  DEBUG_CSLIDER
+#undef  DEBUG_ExtSPRClock
+#undef  DEBUG_ParsSPRClock
+#undef  DEBUG_ExtTBR
+#undef  DEBUG_NNIClock
+#undef  DEBUG_SPLITMERGE
+#undef  DEBUG_FBDPR
+
+
+extern int *chainId;
+
+void TouchAllTreeNodes (ModelInfo *m, int chain);
+
+
+int Move_Aamodel (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change amino acid model for model mixing 
+       amino acid model ID's
+        AAMODEL_POISSON         0
+        AAMODEL_JONES           1
+        AAMODEL_DAY             2
+        AAMODEL_MTREV           3
+        AAMODEL_MTMAM           4
+        AAMODEL_WAG             5
+        AAMODEL_RTREV           6 
+        AAMODEL_CPREV           7 
+        AAMODEL_VT              8
+        AAMODEL_BLOSUM          9 */
+
+    int         i, oldM, newM;
+    MrBFlt      *bs, *subValue;
+    ModelParams *mp;
+    
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    subValue = GetParamSubVals(param, chain, state[chain]);
+
+    /* get old value of model */
+    newM = oldM = (int)*GetParamVals(param, chain, state[chain]);
+    
+    /* get a new model ID */
+    do
+        {
+        newM = (int)(RandomNumber(seed) * 10);
+        } while (newM == oldM);
+
+    /* set proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* set prior ratio */
+    *lnPriorRatio = subValue[newM] - subValue[oldM];
+    
+    /* copy new amino acid model ID back */
+    *GetParamVals(param, chain, state[chain]) = (MrBFlt)newM;
+    
+    /* set amino acid frequencies */
+    bs = GetParamSubVals (modelSettings[param->relParts[0]].stateFreq, chain, state[chain]);
+    if (newM == AAMODEL_POISSON)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = 1.0 / 20.0;
+        }
+    else if (newM == AAMODEL_JONES)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = jonesPi[i];
+        }
+    else if (newM == AAMODEL_DAY)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = dayhoffPi[i];
+        }
+    else if (newM == AAMODEL_MTREV)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = mtrev24Pi[i];
+        }
+    else if (newM == AAMODEL_MTMAM)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = mtmamPi[i];
+        }
+    else if (newM == AAMODEL_WAG)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = wagPi[i];
+        }
+    else if (newM == AAMODEL_RTREV)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = rtrevPi[i];
+        }
+    else if (newM == AAMODEL_CPREV)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = cprevPi[i];
+        }
+    else if (newM == AAMODEL_VT)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = vtPi[i];
+        }
+    else if (newM == AAMODEL_BLOSUM)
+        {
+        for (i=0; i<mp->nStates; i++)
+            bs[i] = blosPi[i];
+        }
+
+    /* Set update flags for all partitions that share this amino acid model. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_AddDeleteCPPEvent (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* add or delete one Poisson process event */
+    
+    int         i, k, addEvent, *nEvents, numEvents;
+    MrBFlt      sigma, m, lognormalLnProb, **position, **rateMultiplier, length, pos, rate;
+    TreeNode    *p, *q;
+    ModelInfo   *model;
+    Tree        *t;
+
+    /* get the model settings */
+    model = &modelSettings[param->relParts[0]];
+
+    /* get cpp rate */
+    rate = *GetParamVals (model->cppRate, chain, state[chain]);
+    
+    /* get sigma of lognormal of rate multipliers */
+    sigma = *GetParamVals (model->cppMultDev, chain, state[chain]);
+
+    /* get the cpp event data */
+    nEvents = param->nEvents[2*chain+state[chain]];
+    position = param->position[2*chain+state[chain]];
+    rateMultiplier = param->rateMult[2*chain+state[chain]];
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* pick a branch */
+    do
+        {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes -2))];
+        } while (p->anc == NULL || (p->anc->anc == NULL));
+
+    /* get number of events for convenience */
+    numEvents = nEvents[p->index];
+
+    /* add or delete ? */
+    addEvent = NO;
+    if (numEvents == 0)
+        addEvent = YES;
+    else if (RandomNumber(seed) < 0.5)
+        addEvent = YES;
+    
+    if (addEvent == NO)
+        {
+        /* delete event */
+
+        /* choose random event */
+        k = (int) (RandomNumber(seed) * numEvents);
+        
+        /* save multiplier to be deleted */
+        m = rateMultiplier[p->index][k];
+
+        /* rearrange and reduce */
+        for (i=k; i<numEvents-1; i++)
+            {
+            position[p->index][i] = position[p->index][i+1];
+            rateMultiplier[p->index][i] = rateMultiplier[p->index][i+1];
+            }
+        if (numEvents-1 > 0)
+            {
+            position[p->index] = (MrBFlt *) SafeRealloc ((void *) position[p->index], (numEvents-1)*sizeof(MrBFlt));
+            rateMultiplier[p->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[p->index], (numEvents-1)*sizeof(MrBFlt));
+            assert (position[p->index] != NULL && rateMultiplier[p->index] != NULL);
+            }
+        else
+            {
+            free (position[p->index]);
+            free (rateMultiplier[p->index]);
+            position[p->index] = rateMultiplier[p->index] = NULL;
+            }
+        /* update number of events */
+        nEvents[p->index]--;
+        }
+    else /* if (addEvent == YES) */
+        {
+        /* add event */
+
+        /* generate new multiplier */
+        m = LogNormalRandomVariable (0.0, sigma, seed);
+
+        /* generate new position */
+        pos = RandomNumber(seed);
+
+        /* find place in current array */
+        for (k=0; k<numEvents; k++)
+            {
+            if (position[p->index][k] > pos)
+                break;
+            }
+
+        /* rearrange and insert */
+        position[p->index] = (MrBFlt *) SafeRealloc ((void *)position[p->index], (numEvents+1)*sizeof(MrBFlt));
+        rateMultiplier[p->index] = (MrBFlt *) SafeRealloc ((void *)rateMultiplier[p->index], (numEvents+1)*sizeof(MrBFlt));
+        assert (position[p->index] != NULL && rateMultiplier[p->index] != NULL);
+        for (i=numEvents; i>k; i--)
+            {
+            position[p->index][i] = position[p->index][i-1];
+            rateMultiplier[p->index][i] = rateMultiplier[p->index][i-1];
+            }
+        position[p->index][k] = pos;
+        rateMultiplier[p->index][k] = m;
+
+        /* update number of events */
+        nEvents[p->index]++;
+        }
+    
+    /* the CPP process is relative to expected substitutions */
+    length = p->length;
+    
+    lognormalLnProb = LnProbLogNormal(0.0, sigma, m);
+    if (addEvent == YES)
+        (*lnPriorRatio) = lognormalLnProb + log (rate); 
+    else
+        (*lnPriorRatio) = -(lognormalLnProb + log(rate));
+
+    if (addEvent == YES)
+        /* note that nEvents[p->index] now contains k+1 after addition */
+        (*lnProposalRatio) = log (length / ((double) nEvents[p->index])) - lognormalLnProb;
+    else
+        /* note that nEvents[p->index] contains k after deletion */
+        (*lnProposalRatio) = log ((double)(nEvents[p->index]+1) / length) + lognormalLnProb;
+
+    /* take care of asymmetric add and delete probabilities around 0 and 1 events */
+    if (addEvent == YES && nEvents[p->index] == 1)
+        (*lnProposalRatio) += log (0.5);
+    else if (addEvent == NO && nEvents[p->index] == 0)
+        (*lnProposalRatio) += log (2.0);
+
+    /* update evolLengths in subtree above new event */
+    if (UpdateCppEvolLengths (param, p, chain)==ERROR)
+        {
+        abortMove=YES;
+        return (NO_ERROR);
+        }
+    
+    /* set update of cond likes down to root */
+    /* crown tree update flags set in UpdateCppEvolLengths */
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_Adgamma (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change correlation parameter (-1, 1) of adgamma model */
+
+    int         i, isValidP;
+    MrBFlt      oldP, newP, window, minP, maxP, ran, *markovTiValues;
+    ModelParams *mp;
+
+    /* get size of window, centered on current rho */
+    window = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get minimum and maximum values for rho */
+    minP = mp->corrUni[0];
+    maxP = mp->corrUni[1];
+
+    /* get address of markovTi */
+    markovTiValues = GetParamSubVals (param, chain, state[chain]);
+
+    /* get old value of rho */
+    newP = oldP = *GetParamVals(param, chain, state[chain]);
+
+    /* change value for rho */
+    ran = RandomNumber(seed);
+     if (maxP-minP < window)
+        {
+        window = maxP-minP;
+        }
+    newP = oldP + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidP = NO;
+    do
+        {
+        if (newP < minP)
+            newP = 2* minP - newP;
+        else if (newP > maxP)
+            newP = 2 * maxP - newP;
+        else
+            isValidP = YES;
+        } while (isValidP == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* get prior ratio */
+    *lnPriorRatio = 0.0;
+    
+    /* copy new rho value back */
+    *GetParamVals(param, chain, state[chain]) = newP;
+
+    /* fill in new Markov trans probs */
+    AutodGamma (markovTiValues, newP, mp->numGammaCats);
+        
+    /* Set update flags for all partitions that share this rho. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Update flags for divisions already set */
+
+    return (NO_ERROR);
+}
+
+
+int Move_Beta (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change symmetric Dirichlet variance using multiplier */
+
+    int         i, j, k, isValidB, isPriorExp, nStates;
+    MrBFlt      oldB, newB, minB, maxB, priorExp=0.0, *bs, ran, factor, tuning,
+                x, y;
+    ModelParams *mp;
+
+    /* get tuning parameter */
+    tuning = mvp[0];    /* multiplier tuning parameter lambda */
+
+    /* get model paramaters */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get prior, minimum and maximum values for rate     */
+    if (!strcmp(mp->symPiPr,"Uniform"))
+        {
+        isPriorExp = NO;
+        minB = mp->symBetaUni[0];
+        maxB = mp->symBetaUni[1];
+        }
+    else
+        {
+        isPriorExp = YES;
+        priorExp = mp->symBetaExp;
+        minB = SYMPI_MIN;
+        maxB = SYMPI_MAX;
+        }
+
+    /* get old value of symDir */
+    oldB = *GetParamVals(param, chain, state[chain]);
+
+    /* change value */
+    ran = RandomNumber(seed);
+    factor = exp(tuning * (ran - 0.5));
+    newB = oldB * factor;
+
+    /* check validity */
+    isValidB = NO;
+    do
+        {
+        if (newB < minB)
+            newB = minB * minB / newB;
+        else if (newB > maxB)
+            newB = maxB * maxB / newB;
+        else
+            isValidB = YES;
+        } while (isValidB == NO);
+
+    /* set new value of symDir */
+    *GetParamVals(param, chain, state[chain]) = newB;
+
+    /* get proposal ratio */
+    *lnProposalRatio = log (newB / oldB);
+
+    /* get prior ratio */
+    if (isPriorExp == YES)
+        {
+        *lnPriorRatio = priorExp * (oldB - newB);
+        }
+    else
+        *lnPriorRatio = 0.0;
+
+    /* fill in the new betacat frequencies */
+    bs = GetParamStdStateFreqs(param, chain, state[chain]);
+    k = mp->numBetaCats;
+    BetaBreaks (newB, newB, bs, k);
+    k *= 2;
+    for (i=k-2; i>0; i-=2)
+        {
+        bs[i] = bs[i/2];
+        }
+    for (i=1; i<k; i+=2)
+        {
+        bs[i] = 1.0 - bs[i-1];
+        }
+        
+    /* if there are multistate characters, update prior probability of current pis */
+    bs += 2 * mp->numBetaCats;
+    for (i=0; i<param->nSympi; i++)
+        {
+        /* get number of states */
+        nStates = param->sympinStates[i];
+
+        /* get prior ratio update */
+        x = LnGamma(newB*nStates) - nStates*LnGamma(newB);
+        y = LnGamma(oldB*nStates) - nStates*LnGamma(oldB);
+        for (j=0; j<nStates; j++)
+            {
+            x += (newB-1.0)*log(bs[j]);
+            y += (oldB-1.0)*log(bs[j]);
+            }
+        (*lnPriorRatio) += x - y;
+
+        /* update pointer to state freqs */
+        bs += nStates;
+        }
+        
+    /* Set update flags for all tree nodes. Note that the conditional
+       likelihood update flags have been set for the relevant partitions
+       before we even call the move function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* may need to hit update flag for cijks if we have multistate characters */
+    for (i=0; i<param->nRelParts; i++)
+        {
+        if (modelSettings[param->relParts[i]].nCijkParts > 0)
+            modelSettings[param->relParts[i]].upDateCijk = YES;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int Move_BrLen (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change one branch length */
+
+    MrBFlt      tuning, maxV, minV, m, newM, brlensPrExp=0.0;
+    TreeNode    *p;
+    ModelParams *mp;
+    Tree        *t;
+    int isVPriorExp;
+    
+    tuning = mvp[0]; /* Larget & Simon's tuning parameter lambda */
+
+    mp = &modelParams[param->relParts[0]];
+
+    /* max and min brlen */
+    if (param->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0];
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else if (param->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensPrExp = mp->brlensExp;
+        isVPriorExp = YES;  
+        }
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+
+    /* pick a branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * t->nNodes)];
+        }
+    while (p->anc == NULL || (t->isRooted == YES && p->anc->anc == NULL));
+
+    /* determine new length */
+    m = p->length;
+    newM = m * exp(tuning * (RandomNumber(seed) - 0.5));
+
+    /* reflect new length if necessary */
+    while (newM < minV || newM > maxV)
+        {
+        if (newM < minV)
+            newM = minV * minV / newM;
+        else if (newM > maxV)
+            newM = maxV * maxV / newM;
+        }
+    p->length = newM;
+
+    /* calculate proposal ratio */
+    /* must be based on new length after reflection */
+    (*lnProposalRatio) = log(newM / m);
+
+    /* set flags for update of transition probabilities at p */
+    p->upDateTi = YES;
+
+    /* set the update flag for cond likes if p is connected to root in unrooted */
+    /* tree, if this is not done, cond likes are not updated in this case       */
+    if (t->isRooted == NO && p->anc->anc == NULL)  
+        p->upDateCl = YES;
+
+    /* set flags for update of cond likes from p->anc and down to root */
+    while (p->anc->anc != NULL)
+        {
+        p = p->anc;
+        p->upDateCl = YES; 
+        }
+
+    /* update prior if exponential prior on branch lengths */
+    if (param->paramId == BRLENS_EXP)
+        (*lnPriorRatio) = brlensPrExp * (m - newM);
+    /* Dirichlet or twoExp prior */
+    else if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+
+    return (NO_ERROR);
+}
+
+
+int Move_ClockRate_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change clock rate using multiplier */
+    
+    int             i, j, k, *nEvents;
+    MrBFlt          oldRate, newRate, factor, lambda, nu, igrvar, *brlens, *igrRate, *tk02Rate,
+                    N, newTheta, oldTheta, growth, newLnPrior, oldLnPrior;
+    Tree            *t, *oldT;
+    TreeNode        *p, *q;
+    Param           *treeParam, *subParm;
+    ModelParams     *mp;
+    ModelInfo       *m;
+    
+    /* get old value of clock rate */
+    oldRate = *GetParamVals(param, chain, state[chain]);
+
+    /* Rely on general algorithm to change the value */
+    Move_PosRealMultiplier(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp);
+    if (abortMove == YES)
+        return NO_ERROR;
+
+    /* get new value of clock rate */
+    newRate = *GetParamVals(param, chain, state[chain]);
+
+    /* calculate factor */
+    factor = newRate / oldRate;
+
+    /* clock rate applies to all clock trees */
+    for (i = 0; i < numTrees; i++)
+        {
+        t = GetTreeFromIndex(i, chain, state[chain]);
+        if (t->isClock == NO)
+            continue;
+        if (!strcmp(modelParams[t->relParts[0]].clockPr, "Fixed"))
+            continue;
+
+        oldT = GetTreeFromIndex(i, chain, 1^state[chain]);
+        treeParam = modelSettings[t->relParts[0]].brlens;
+        
+        /* adjust the node depths and lengths */
+        for (j = 0; j < t->nNodes-1; j++)
+            {
+            p = t->allDownPass[j];
+            q = oldT->allDownPass[j];
+            p->nodeDepth *= factor; /* no harm done if nodeDepth==0.0 (undated tips) */
+            p->length *= factor;    /* no harm done if length==0.0 (root or fossil ancestors)*/
+            if (p->length < 0.0 || p->length > BRLENS_MAX ||
+                (q->length > BRLENS_MIN && p->length < BRLENS_MIN) ||
+                (q->length < TIME_MIN   && p->length > TIME_MIN))
+                {  /* consider ancestral fossil (brl=0) in fossilized bd tree */
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+
+        /* prior ratio for coalecent tree, as theta is changed */
+        mp = &modelParams[t->relParts[0]];
+        if (!strcmp(mp->clockPr,"Coalescence"))
+            {
+            m = &modelSettings[t->relParts[0]];
+            N = *GetParamVals(m->popSize, chain, state[chain]);
+            if (!strcmp(mp->ploidy, "Diploid"))
+                N *= 4.0;
+            else if (!strcmp(mp->ploidy, "Zlinked"))
+                N *= 3.0;
+            else
+                N *= 2.0;
+            oldTheta = N * oldRate;
+            newTheta = N * newRate;
+            if (!strcmp(mp->growthPr, "Fixed"))
+                growth = mp->growthFix;
+            else
+                growth = *GetParamVals(m->growthRate, chain, state[chain]);
+
+            if (LnCoalescencePriorPr (oldT, &oldLnPrior, oldTheta, growth) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem calculating prior for coalescent process\n", spacer);
+                return (ERROR);
+                }
+            if (LnCoalescencePriorPr (t, &newLnPrior, newTheta, growth) == ERROR)
+                {
+                MrBayesPrint ("%s   Problem calculating prior for coalescent process\n", spacer);
+                return (ERROR);
+                }
+            (*lnPriorRatio) += newLnPrior - oldLnPrior;
+            }
+            
+        /* adjust proposal and prior ratio for relaxed clock models */
+        for (k = 0; k < treeParam->nSubParams; k++)
+            {
+            subParm = treeParam->subParams[k];
+            if (subParm->paramType == P_CPPEVENTS)
+                {
+                nEvents = subParm->nEvents[2*chain+state[chain]];
+                lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+                /* proposal ratio */
+                for (j=0; j<t->nNodes-2; j++)
+                    {
+                    p = t->allDownPass[j];
+                    q = oldT->allDownPass[j];
+                    (*lnProposalRatio) += nEvents[p->index ] * log (p->length  / q->length);
+                    }
+                /* prior ratio */
+                (*lnPriorRatio) += lambda * (TreeLen(oldT) - TreeLen(t));
+                /* update effective evolutionary lengths */
+                if (UpdateCppEvolLengths (subParm, t->root->left, chain) == ERROR)
+                    {
+                    abortMove = YES;
+                    return (NO_ERROR);
+                    }
+                }
+            else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                     (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+                {
+                if (subParm->paramType == P_TK02BRANCHRATES)
+                    nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+                else
+                    nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+                tk02Rate = GetParamVals (subParm, chain, state[chain]);
+                brlens = GetParamSubVals (subParm, chain, state[chain]);
+
+                /* no proposal ratio effect */
+
+                /* prior ratio and update of brlens */
+                for (j = 0; j < t->nNodes-2; j++)
+                    {
+                    p = t->allDownPass[j];
+                    q = oldT->allDownPass[j];
+                    if (p->length > 0.0)  // not ancestral fossil
+                        {
+                        (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->anc->index], nu*q->length, tk02Rate[q->index]);
+                        (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*p->length, tk02Rate[p->index]);
+                        
+                        brlens[p->index] = p->length * (tk02Rate[p->anc->index]+tk02Rate[p->index])/2.0;
+                        }
+                    }
+                }
+            else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                     (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+                {
+                if (subParm->paramType == P_IGRBRANCHRATES)
+                    igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+                else
+                    igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+                igrRate = GetParamVals (subParm, chain, state[chain]);
+                brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+                /* prior ratio and update of brlens */
+                for (j = 0; j < t->nNodes-2; j++)
+                    {
+                    p = t->allDownPass[j];
+                    q = oldT->allDownPass[j];
+                    if (p->length > 0.0)  // not ancestral fossil
+                        {
+                        (*lnPriorRatio) -= LnProbGamma (q->length/igrvar, q->length/igrvar, igrRate[q->index]);
+                        (*lnPriorRatio) += LnProbGamma (p->length/igrvar, p->length/igrvar, igrRate[p->index]);
+
+                        brlens[p->index] = igrRate[p->index] * p->length;
+                        }
+                    }
+                }
+            }
+        }
+    return (NO_ERROR);
+}
+
+
+int Move_CPPEventPosition (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move the position of one CPP event */
+
+    int         i, j, k, *nEvents;
+    MrBFlt      pos, temp, **position, **rateMultiplier;
+    TreeNode    *p=NULL, *q;
+    Tree        *t;
+
+    /* get the cpp event data */
+    nEvents = param->nEvents[2*chain+state[chain]];
+    position = param->position[2*chain+state[chain]];
+    rateMultiplier = param->rateMult[2*chain+state[chain]];
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* pick a branch and an event */
+    for (i=j=0; i<t->nNodes - 2; i++)
+        {
+        p = t->allDownPass[i];
+        j += nEvents[p->index];
+        }       
+    if (j == 0)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    k = (int) (RandomNumber(seed) * j);
+    for (i=j=0; i<t->nNodes - 2; i++)
+        {
+        p = t->allDownPass[i];
+        j += nEvents[p->index];
+        if (j > k)
+            break;
+        }       
+    if (position[p->index] == NULL)
+        getchar();
+
+    /* find local index */
+    k = k - (j - nEvents[p->index]);
+
+    /* find new position */
+    pos = RandomNumber(seed);
+    if (pos < POS_MIN || 1.0 - pos < POS_MIN)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    position[p->index][k] = pos;
+
+    /* sort events; bubble sort for now */
+    for (i=0; i<nEvents[p->index]; i++)
+        {
+        for (j=i+1; j<nEvents[p->index]; j++)
+            {
+            if (position[p->index][j] < position[p->index][i])
+                {
+                temp = position[p->index][i];
+                position[p->index][i] = position[p->index][j];
+                position[p->index][j] = temp;
+                temp = rateMultiplier[p->index][i];
+                rateMultiplier[p->index][i] = rateMultiplier[p->index][j];
+                rateMultiplier[p->index][j] = temp;
+                }
+            }
+        }
+
+    /* calculate prior and proposal ratio */
+    (*lnPriorRatio) = (*lnProposalRatio) = 0.0;
+
+    /* update branch evolution lengths */
+    if (UpdateCppEvolLengths (param, p, chain) == ERROR)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* set update of cond likes down to root */
+    /* update of crowntree set in UpdateCppEvolLengths */
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_CPPRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move the CPP rate (lambda) using multiplier */
+
+    int         i, j, *nEvents, sumEvents;
+    MrBFlt      oldLambda, newLambda, treeLength, tuning;
+    Model       *mp;
+    TreeNode    *p;
+    Tree        *t;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get the CPP rate */
+    oldLambda = *GetParamVals (param, chain, state[chain]);
+
+    /* set new value */
+    newLambda = oldLambda * exp ((0.5 - RandomNumber(seed))*tuning);
+    
+    /* reflect if necessary */
+    while (newLambda < CPPLAMBDA_MIN || newLambda > CPPLAMBDA_MAX)
+        {
+        if (newLambda < CPPLAMBDA_MIN)
+            newLambda = CPPLAMBDA_MIN * CPPLAMBDA_MIN / newLambda;
+        if (newLambda > CPPLAMBDA_MAX)
+            newLambda = CPPLAMBDA_MAX * CPPLAMBDA_MAX / newLambda;
+        }
+    
+    /* store new value */
+    (*GetParamVals (param, chain, state[chain])) = newLambda;
+
+    /* calculate prior ratio */
+    (*lnPriorRatio) = 0.0;
+    for (i=0; i<param->nSubParams; i++)
+        {
+        nEvents = param->subParams[i]->nEvents[2*chain+state[chain]];
+        sumEvents = 0;
+        t = GetTree (param->subParams[i], chain, state[chain]); 
+        treeLength = 0.0;
+        for (j=0; j<t->nNodes-2; j++)
+            {
+            p = t->allDownPass[j];
+            sumEvents += nEvents[p->index];
+            treeLength += p->length;
+            }
+        (*lnPriorRatio) += (oldLambda - newLambda) * treeLength;
+        (*lnPriorRatio) += sumEvents * log (newLambda / oldLambda);
+        }
+
+    /* adjust for prior on cppRate */
+    if (!strcmp(mp->cppRatePr,"Exponential"))
+        (*lnPriorRatio) +=  mp->cppRateExp * (oldLambda - newLambda);
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newLambda / oldLambda);
+
+    /* we do not need to update likelihoods */
+    for (i=0; i<param->nRelParts; i++)
+        {
+        modelSettings[param->relParts[i]].upDateCl = NO;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int Move_CPPRateMultiplier_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move one CPP rate multiplier using multiplier */
+
+    int         i, j, k, *nEvents;
+    MrBFlt      newRateMultiplier, oldRateMultiplier, tuning, minM, maxM, sigma, **rateMultiplier;
+    TreeNode    *p = NULL;
+    ModelInfo   *m;
+    Tree        *t;
+    TreeNode    *q;
+
+    /* get the tuning parameter */
+    tuning = mvp[0];
+    
+    /* get the model settings */
+    m = &modelSettings[param->relParts[0]];
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get CPP event data */
+    nEvents = param->nEvents[2*chain+state[chain]];
+    rateMultiplier = param->rateMult[2*chain+state[chain]];
+
+    /* get minimum and maximum of CPP rate multiplier */
+    minM = param->min;
+    maxM = param->max;
+    
+    /* pick a branch and a rateMultiplier */
+    for (i=j=0; i<t->nNodes - 2; i++)
+        {
+        p = t->allDownPass[i];
+        j += nEvents[p->index];
+        }       
+    if (j == 0)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    k = (int) (RandomNumber(seed) * j);
+    for (i=j=0; i<t->nNodes - 2; i++)
+        {
+        p = t->allDownPass[i];
+        j += nEvents[p->index];
+        if (j > k)
+            break;
+        }
+
+    /* find local index */
+    k = nEvents[p->index] - (j - k);
+
+    /* find new rateMultiplier */
+    oldRateMultiplier = rateMultiplier[p->index][k];
+    newRateMultiplier = oldRateMultiplier * (exp (0.5 - RandomNumber(seed) * tuning));
+
+    /* reflect if necessary */
+    while (newRateMultiplier < minM || newRateMultiplier > maxM)
+        {
+        if (newRateMultiplier < minM)
+            newRateMultiplier = minM * minM / newRateMultiplier;
+        if (newRateMultiplier > maxM)
+            newRateMultiplier = maxM * maxM / newRateMultiplier;
+        }
+
+    rateMultiplier[p->index][k] = newRateMultiplier;
+    
+    /* calculate prior ratio */
+    sigma = *GetParamVals (m->cppMultDev, chain, state[chain]);
+    (*lnPriorRatio) = LnRatioLogNormal (0.0, sigma, newRateMultiplier, oldRateMultiplier);
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newRateMultiplier / oldRateMultiplier);
+
+    /* update branch evolution lengths */
+    if (UpdateCppEvolLengths (param, p, chain)==ERROR)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* set update of cond likes down to root */
+    /* update of crowntree set in UpdateCppEvolLengths */
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int Move_CPPRateMultiplierRnd (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move one CPP rate multiplier by redrawing from prior */
+
+    int         i, j, k, *nEvents;
+    MrBFlt      sigma, newRateMultiplier, oldRateMultiplier, **rateMultiplier;
+    TreeNode    *p=NULL, *q;
+    ModelInfo   *m;
+    Tree        *t;
+
+    /* get the model settings */
+    m = &modelSettings[param->relParts[0]];
+
+    /* get the CPP event data */
+    nEvents = param->nEvents[2*chain+state[chain]];
+    rateMultiplier = param->rateMult[2*chain+state[chain]];
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* pick a branch and a rateMultiplier */
+    for (i=j=0; i<t->nNodes - 2; i++)
+        {
+        p = t->allDownPass[i];
+        j += nEvents[p->index];
+        }       
+    if (j == 0)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    k = (int) (RandomNumber(seed) * j);
+    for (i=j=0; i<t->nNodes - 2; i++)
+        {
+        p = t->allDownPass[i];
+        j += nEvents[p->index];
+        if (j > k)
+            break;
+        }
+
+    /* find local index */
+    k = nEvents[p->index] - (j - k);
+
+    /* record old rate multiplier */
+    oldRateMultiplier = rateMultiplier[p->index][k];
+
+    /* find stdev of lognormal */
+    sigma = *GetParamVals (m->cppMultDev, chain, state[chain]);
+
+    /* set new value */
+    do {
+        newRateMultiplier = LogNormalRandomVariable (0.0, sigma, seed);
+        } while (newRateMultiplier < param->min || newRateMultiplier > param->max);
+    rateMultiplier[p->index][k] = newRateMultiplier;
+
+    /* calculate prior ratio */
+    (*lnPriorRatio) = LnRatioLogNormal(0.0, sigma, newRateMultiplier, oldRateMultiplier);
+        
+    /* calculate proposal ratio */
+    (*lnProposalRatio) += LnRatioLogNormal (0.0, sigma, oldRateMultiplier, newRateMultiplier);
+
+    /* update branch evolution lengths */
+    if (UpdateCppEvolLengths (param, p, chain) == ERROR)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* set update of cond likes down to root */
+    /* update of crowntree set in UpdateCppEvolLengths */
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_AddBranch (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Move an ancestral fossil (brl = 0) to fossil tip (brl > 0)
+
+       __|__              __|__
+      |     |            |     |
+            |       -->       q|___
+            |       -->        |   |
+           q|___p              |   |p
+           r|                 r|
+     
+       1. Pich a fossil among those with brl = 0 (prob = 1/k)
+       2. Propose brl from a uniform(0, ?) distribution
+     */
+    
+    int    i, j, k, mFossil, kFossil;
+    MrBFlt minDepth, maxDepth, newLength, clockRate, x, oldQLength, oldRLength,
+           *brlens=NULL, nu=0.0, *tk02Rate=NULL, igrvar=0.0, *igrRate=NULL;
+    TreeNode    *p=NULL, *q=NULL, *r;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Param       *subParm;
+    Calibration *calibrationPtr = NULL;
+    
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* get number of ancestral and tip fossils */
+    kFossil = mFossil = 0;
+    for (i = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;  // reset marked node
+        if (p->left == NULL && p->right == NULL && p->nodeDepth > 0.0)
+            {
+            if (p->length > 0.0)
+                {
+                mFossil++;        // count tip fossil
+                }
+            else
+                {
+                p->marked = YES;  // mark  anc fossil
+                kFossil++;        // count anc fossil
+                }
+            }
+        }
+    if (kFossil == 0)  // no ancestral fossil, nothing to do
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get clock rate */
+    clockRate = *(GetParamVals(m->clockRate, chain, state[chain]));
+    
+    /* pick an ancestral fossil randomly */
+    j = (int) (RandomNumber(seed) * kFossil);
+    for (i = k = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES)
+            k++;
+        if (k > j)
+            break;
+        }
+    /* now p is pointing to the ancestral fossil
+       whose brl needs to be changed to >0. let's do it! */
+    q = p->anc;
+    if (q->left == p)
+        r = q->right;
+    else
+        r = q->left;
+
+    /* determine lower and upper bound of forward move, abort if impossible */
+    minDepth = p->nodeDepth + BRLENS_MIN;
+    if (q->anc->anc == NULL)
+        maxDepth = TREEHEIGHT_MAX;
+    else
+        maxDepth = q->anc->nodeDepth - BRLENS_MIN;
+    
+    if (q->isDated == YES)
+        calibrationPtr = q->calibration;
+    else if (q->anc->anc == NULL)  // q is root but not dated
+        calibrationPtr = &mp->treeAgePr;
+    
+    if (calibrationPtr != NULL)
+        {
+        if (calibrationPtr->prior == fixed || calibrationPtr->min * clockRate > minDepth)
+            {
+            abortMove = YES;
+            return (NO_ERROR);
+            }
+        if (calibrationPtr->max * clockRate < maxDepth)
+            maxDepth = calibrationPtr->max * clockRate;
+        }
+    if (minDepth >= maxDepth)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    
+    /* record old lengths and depths */
+    oldQLength = q->length;
+    oldRLength = r->length;
+    // oldDepth = q->nodeDepth;
+    
+    /* propose the branch length leading to the fossil */
+    newLength = (RandomNumber(seed)) * (maxDepth - minDepth);
+    
+    /* adjust brls and depths, set flags for update of trans probs */
+    p->length   = newLength;
+    p->upDateTi = YES;
+    q->nodeDepth += newLength;
+    if (q->anc->anc != NULL)
+        {
+        q->length  -= newLength;
+        q->upDateTi = YES;
+        }
+    r->length += newLength;
+    r->upDateTi = YES;
+    // newDepth = q->nodeDepth;
+
+    /* adjust age of q if dated */
+    if (calibrationPtr != NULL)
+        {
+        q->age = q->nodeDepth / clockRate;
+        }
+    
+    /* set flags for update of cond likes from p/r to root */
+    r->upDateCl = YES;
+    q = p;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+    q = p->anc;
+
+    /* calculate prior ratio */
+    if (LogClockTreePriorRatio(param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+    
+    /* calculate proposal ratio, need to double check !! */
+    (*lnProposalRatio) = log(kFossil) - log(mFossil +1);
+    // if (mFossil == 0)       // current tree has no fossil tips
+    //   (*lnProposalRatio) += log(0.5);
+    // else if (kFossil == 1)  // proposed tree has no ancestral fossils
+    //   (*lnProposalRatio) += log(2.0);
+    
+    /* add the Jacobian term */
+    (*lnProposalRatio) += log((maxDepth - minDepth) / clockRate);
+            
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        subParm = param->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            /* CPP is not compatible with FBD ancestral fossils until we have a good way to implement it !! */
+            MrBayesPrint ("%s   CPP clock is not compatible with Fossilization prior currently\n", spacer);
+            return (ERROR);
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+            /* prior ratio */
+            tk02Rate[p->index] = tk02Rate[q->index];
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->index], nu*oldRLength, tk02Rate[r->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[q->index], nu* p->length, tk02Rate[p->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[q->index], nu* r->length, tk02Rate[r->index]);
+            if (q->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->anc->index], nu*oldQLength, tk02Rate[q->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[q->anc->index], nu* q->length, tk02Rate[q->index]);
+                }
+            
+            /* update effective evolutionary lengths */
+            brlens[p->index] = p->length * (tk02Rate[p->index]+tk02Rate[q->index])/2.0;
+            brlens[r->index] = r->length * (tk02Rate[r->index]+tk02Rate[q->index])/2.0;
+            if (q->anc->anc != NULL)
+                {
+                brlens[q->index] = q->length * (tk02Rate[q->index]+tk02Rate[q->anc->index])/2.0;
+                }
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+            /* prior ratio */
+            igrRate[p->index] = igrRate[q->index];
+            (*lnPriorRatio) -= LnProbGamma (oldRLength/igrvar, oldRLength/igrvar, igrRate[r->index]);
+            (*lnPriorRatio) += LnProbGamma (p->length /igrvar, p->length /igrvar, igrRate[p->index]);
+            (*lnPriorRatio) += LnProbGamma (r->length /igrvar, r->length /igrvar, igrRate[r->index]);
+            if (q->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbGamma (oldQLength/igrvar, oldQLength/igrvar, igrRate[q->index]);
+                (*lnPriorRatio) += LnProbGamma (q->length /igrvar, q->length /igrvar, igrRate[q->index]);
+                }
+            
+            /* update effective evolutionary lengths */
+            brlens[p->index] = igrRate[p->index] * p->length;
+            brlens[r->index] = igrRate[r->index] * r->length;
+            if (q->anc->anc != NULL)
+                {
+                brlens[q->index] = igrRate[q->index] * q->length;
+                }
+            }
+        }
+    
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_DelBranch (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Move a fossil tip (brl > 0) to be ancestral (brl =0)
+
+       __|__              __|__
+      |     |            |     |
+           q|___     -->       |
+            |   |    -->       |
+            |   |p            q|___p
+           r|                 r|
+         
+       1. Pich a fossil among those with brl > 0 (prob = 1/m)
+       2. Set brl = 0
+     */
+    
+    int    i, j, k, mFossil, kFossil;
+    MrBFlt minDepth, maxDepth, clockRate, x, oldPLength, oldQLength, oldRLength,
+           *brlens=NULL, nu=0.0, *tk02Rate=NULL, igrvar=0.0, *igrRate=NULL;
+    TreeNode    *p=NULL, *q=NULL, *r;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Param       *subParm;
+    Calibration *calibrationPtr = NULL;
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* get number of ancestral and tip fossils */
+    kFossil = mFossil = 0;
+    for (i = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;  // reset marked node
+        if (p->left == NULL && p->right == NULL && p->nodeDepth > 0.0)
+            {
+            if (p->length > 0.0)
+                {
+                p->marked = YES;  // mark  tip fossil
+                mFossil++;        // count tip fossil
+                }
+            else
+                {
+                kFossil++;        // count anc fossil
+                }
+            }
+        }
+    if (mFossil == 0)  // no tip fossil, nothing to do
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get clock rate */
+    clockRate = *(GetParamVals(m->clockRate, chain, state[chain]));
+
+    /* pick a tip fossil randomly */
+    j = (int) (RandomNumber(seed) * mFossil);
+    for (i = k = 0; i < t->nNodes -1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES)
+            k++;
+        if (k > j)
+            break;
+        }
+    /* now p is pointing to the fossil tip
+       whose brl needs to be changed to 0. let's do it */
+    q = p->anc;
+    if (q->left == p)
+        r = q->right;
+    else
+        r = q->left;
+
+    /* determine lower and upper bound of backward move, abort if impossible */
+    minDepth = p->nodeDepth + BRLENS_MIN;
+    if (q->anc->anc == NULL)
+        maxDepth = TREEHEIGHT_MAX;
+    else
+        maxDepth = q->anc->nodeDepth - BRLENS_MIN;
+    
+    if (q->isDated == YES)
+        calibrationPtr = q->calibration;
+    else if (q->anc->anc == NULL)  // q is root but not dated
+        calibrationPtr = &mp->treeAgePr;
+    
+    if (calibrationPtr != NULL)
+        {
+        if (calibrationPtr->prior == fixed || calibrationPtr->min * clockRate > minDepth)
+            {
+            abortMove = YES;
+            return (NO_ERROR);
+            }
+        if (calibrationPtr->max * clockRate < maxDepth)
+            maxDepth = calibrationPtr->max * clockRate;
+        }
+    if (r->nodeDepth > p->nodeDepth -BRLENS_MIN || minDepth >= maxDepth)
+        {  /* the sister node (another fossil) is older than the current fossil */
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* record old lengths and depths */
+    oldPLength = p->length;
+    oldQLength = q->length;
+    oldRLength = r->length;
+    // oldDepth = q->nodeDepth;
+
+    /* set the brl to 0 for the fossil tip, it becomes an ancestral fossil */
+    /* set flags for update of transition probabilities too */
+    q->nodeDepth = p->nodeDepth;
+    if (q->anc->anc != NULL)
+        {
+        q->length += p->length;
+        q->upDateTi = YES;
+        }
+    r->length  -= p->length;
+    r->upDateTi = YES;
+    p->length   = 0.0;
+    p->upDateTi = YES;
+    // newDepth = q->nodeDepth;
+    
+    /* adjust age of q if dated */
+    if (calibrationPtr != NULL)
+        {
+        q->age = q->nodeDepth / clockRate;
+        }
+    
+    /* set flags for update of cond likes from p/r to root */
+    r->upDateCl = YES;
+    q = p;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+    q = p->anc;
+
+    /* calculate prior ratio */
+    if (LogClockTreePriorRatio(param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+    
+    /* calculate proposal ratio, need to double check !! */
+    (*lnProposalRatio) = log(mFossil) - log(kFossil +1);
+    // if (kFossil == 0)       // current tree has no ancestral fossils
+    //  (*lnProposalRatio) += log(2.0);
+    // else if (mFossil == 1)  // proposed tree has no fossil tips
+    //  (*lnProposalRatio) += log(0.5);
+
+    /* add the Jacobian term */
+    (*lnProposalRatio) -= log((maxDepth - minDepth) / clockRate);
+
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        subParm = param->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            /* CPP is not compatible with FBD ancestral fossils until we have a good way to implement it !! */
+            MrBayesPrint ("%s   CPP clock is not compatible with Fossilization prior currently\n", spacer);
+            return (ERROR);
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+           {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+            /* prior ratio */
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->index], nu*oldPLength, tk02Rate[p->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->index], nu*oldRLength, tk02Rate[r->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[q->index], nu* r->length, tk02Rate[r->index]);
+            if (q->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->anc->index], nu*oldQLength, tk02Rate[q->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[q->anc->index], nu* q->length, tk02Rate[q->index]);
+                }
+            
+            /* update effective evolutionary lengths */
+            brlens[p->index] = 0.0;  // tk02Rate[p->index] = tk02Rate[q->index];
+            brlens[r->index] = r->length * (tk02Rate[r->index]+tk02Rate[q->index])/2.0;
+            if (q->anc->anc != NULL)
+                {
+                brlens[q->index] = q->length * (tk02Rate[q->index]+tk02Rate[q->anc->index])/2.0;
+                }
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+            (*lnPriorRatio) -= LnProbGamma (oldPLength/igrvar, oldPLength/igrvar, igrRate[p->index]);
+            (*lnPriorRatio) -= LnProbGamma (oldRLength/igrvar, oldRLength/igrvar, igrRate[r->index]);
+            (*lnPriorRatio) += LnProbGamma (r->length /igrvar, r->length /igrvar, igrRate[r->index]);
+            if (q->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbGamma (oldQLength/igrvar, oldQLength/igrvar, igrRate[q->index]);
+                (*lnPriorRatio) += LnProbGamma (q->length /igrvar, q->length /igrvar, igrRate[q->index]);
+                }
+            
+            /* update effective evolutionary lengths */
+            brlens[p->index] = 0.0;  // igrRate[p->index] = igrRate[q->index];
+            brlens[r->index] = igrRate[r->index] * r->length;
+            if (q->anc->anc != NULL)
+                {
+                brlens[q->index] = igrRate[q->index] * q->length;
+                }
+            }
+        }
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_Extinction (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change relative extinction rate using sliding window */
+    
+    int         i, isValidM, valIndex;
+    MrBFlt      *valPtr, oldM, newM, window, minM, maxM, *sR, *eR, sF, *fR, oldLnPrior, newLnPrior,
+                oldProp[2], newProp[2], x, y, *alphaDir, clockRate;
+    char        *sS;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Tree        *t;
+
+    /* get size of window, centered on current value */
+    window = mvp[0];
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get minimum and maximum values */
+    minM = 0.0;
+    maxM = 0.99999;
+
+    /* get pointer to value to be changed */
+    valIndex = (int)(RandomNumber(seed) * param->nValues);
+    valPtr = GetParamVals(param, chain, state[chain]) + valIndex;
+    
+    /* get old value */
+    oldM = *valPtr;
+
+    /* change value */
+    if (window > maxM-minM)
+        window = maxM-minM;
+    newM = oldM + window * (RandomNumber(seed) - 0.5);
+    
+    /* check that new value is valid */
+    isValidM = NO;
+    do  {
+        if (newM < minM)
+            newM = 2 * minM - newM;
+        else if (newM > maxM)
+            newM = 2 * maxM - newM;
+        else
+            isValidM = YES;
+        } while (isValidM == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* calculate prior ratio */
+    t  = GetTree(modelSettings[param->relParts[0]].brlens,chain,state[chain]);
+    sR = GetParamVals (m->speciationRates, chain, state[chain]);
+    eR = GetParamVals (param, chain, state[chain]);
+    sF = mp->sampleProb;
+    sS = mp->sampleStrat;
+    clockRate = *GetParamVals (m->clockRate, chain, state[chain]);
+    
+    if (!strcmp(mp->clockPr,"Birthdeath"))
+        {
+        if (LnBirthDeathPriorPr (t, clockRate, &oldLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        *valPtr = newM;  // update with new value
+        if (LnBirthDeathPriorPr (t, clockRate, &newLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        }
+    else if (!strcmp(mp->clockPr,"Fossilization"))
+        {
+        fR = GetParamVals (m->fossilizationRates, chain, state[chain]);
+        if (LnFossilizationPriorPr (t, clockRate, &oldLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        *valPtr = newM;  // update with new value
+        // for (i=0; i<param->nValues; i++)  *(GetParamVals(param, chain, state[chain]) + i) = newM;
+        if (LnFossilizationPriorPr (t, clockRate, &newLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        }
+    else {
+        MrBayesPrint ("%s   Move_Extinction not applicable\n", spacer);
+        return (ERROR);
+        }
+    
+    /* get proportions */
+    oldProp[0] = oldM;
+    oldProp[1] = 1.0 - oldM;
+    newProp[0] = newM;
+    newProp[1] = 1.0 - newM;
+    
+    /* adjust prior ratio according to beta distribution */
+    alphaDir = mp->extinctionBeta;
+    x = y = 0.0;
+    for (i=0; i<2; i++)
+        x += (alphaDir[i]-1.0)*log(newProp[i]);
+    for (i=0; i<2; i++)
+        y += (alphaDir[i]-1.0)*log(oldProp[i]);
+    (*lnPriorRatio) = x - y + newLnPrior - oldLnPrior;
+    
+    return (NO_ERROR);
+}
+
+
+int Move_Fossilization (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change fossilization rate using sliding window */
+    
+    int         i, isValidM, valIndex;
+    MrBFlt      *valPtr, oldM, newM, window, minM, maxM, *sR, *eR, sF, *fR, oldLnPrior, newLnPrior,
+                oldProp[2], newProp[2], x, y, *alphaDir, clockRate;
+    char        *sS;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Tree        *t;
+    
+    /* get size of window, centered on current value */
+    window = mvp[0];
+    
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get minimum and maximum values */
+    minM = 0.00001;
+    maxM = 1.0;
+    
+    /* get pointer to value to be changed */
+    valIndex = (int)(RandomNumber(seed) * param->nValues);
+    valPtr = GetParamVals(param, chain, state[chain]) + valIndex;
+
+    /* get old value */
+    oldM = *valPtr;
+    
+    /* change value */
+    if (window > maxM-minM)
+        window = maxM-minM;
+    newM = oldM + window * (RandomNumber(seed) - 0.5);
+    
+    /* check that new value is valid */
+    isValidM = NO;
+    do  {
+        if (newM < minM)
+            newM = 2 * minM - newM;
+        else if (newM > maxM)
+            newM = 2 * maxM - newM;
+        else
+            isValidM = YES;
+        } while (isValidM == NO);
+    
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* calculate prior ratio */
+    t  = GetTree(modelSettings[param->relParts[0]].brlens,chain,state[chain]);
+    sR = GetParamVals (m->speciationRates, chain, state[chain]);
+    eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+    fR = GetParamVals (param, chain, state[chain]);
+    sF = mp->sampleProb;
+    sS = mp->sampleStrat;
+    clockRate = *GetParamVals(m->clockRate, chain, state[chain]);
+
+    if (LnFossilizationPriorPr (t, clockRate, &oldLnPrior, sR, eR, sF, fR, sS) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+        return (ERROR);
+        }
+    *valPtr = newM;  // update with new value
+    if (LnFossilizationPriorPr (t, clockRate, &newLnPrior, sR, eR, sF, fR, sS) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+        return (ERROR);
+        }
+    
+    /* get proportions */
+    oldProp[0] = oldM;
+    oldProp[1] = 1.0 - oldM;
+    newProp[0] = newM;
+    newProp[1] = 1.0 - newM;
+
+    /* adjust prior ratio according to beta distribution */
+    alphaDir = mp->fossilizationBeta;
+    x = y = 0.0;
+    for (i=0; i<2; i++)
+        x += (alphaDir[i]-1.0)*log(newProp[i]);
+    for (i=0; i<2; i++)
+        y += (alphaDir[i]-1.0)*log(oldProp[i]);
+    (*lnPriorRatio) = x - y + newLnPrior - oldLnPrior;            
+    
+    return (NO_ERROR);
+}
+
+
+int Move_ExtSPR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology (and branch lengths) using SPR (unrooted) with extension probability.
+       Pick either external or internal branches instead of just internal branches. */
+    
+    int         i, j, topologyHasChanged, nCrownNodes, nRootNodes, directionLeft, directionUp, 
+                isVPriorExp, moveInRoot, isStartConstrained, isStopConstrained;
+    MrBFlt      m, x, y, tuning, maxV, minV, extensionProb, brlensExp=0.0;
+    TreeNode    *p, *q, *a, *b, *c, *d, *u, *v;
+    Tree        *t;
+    ModelParams *mp;
+    
+    /* these parameters should be possible to set by user */
+    extensionProb = mvp[0]; /* extension probability */
+    tuning = mvp[1];        /* Larget & Simon's tuning parameter lambda */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else  /* (param->subParams[0]->paramId == BRLENS_EXP) */
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    topologyHasChanged = NO;
+
+#   if defined (DEBUG_ExtSPR)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+#   endif
+    
+    /* pick a random branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes -1))];
+        q = p->anc->right;  if (q == p) q = p->anc->left;
+        i = j = 0;
+        if (p->left == NULL)
+            j = 2;
+        if (p->anc->anc == NULL)
+            i = 2;
+        if (p->anc->anc != NULL && (p->anc->isLocked == YES || p->anc->anc->anc == NULL))
+            i++;
+        if (p->anc->anc != NULL && (q->isLocked == YES || q->left == NULL))
+            i++;
+        if (p->left != NULL && (p->left->isLocked == YES || p->left->left == NULL))
+            j++;
+        if (p->left != NULL && (p->right->isLocked == YES || p->right->left == NULL))
+            j++;
+        } while (i == 2 && j == 2);
+    
+    /* change in root tree ? */
+    if (j == 2)
+        moveInRoot = YES;
+    else if (i == 2)
+        moveInRoot = NO;
+    else if (RandomNumber(seed) < 0.5)
+        moveInRoot = YES;
+    else
+        moveInRoot = NO;
+
+    /* determine whether start is constrained on backward move */
+    isStartConstrained = isStopConstrained = NO;
+    if (moveInRoot == YES && i == 1)
+        isStartConstrained = YES;
+    else if (moveInRoot == NO && j == 1)
+        isStartConstrained = YES;
+
+    /* set up pointers for nodes around the picked branch */
+    /* cut the tree into crown, root and attachment part  */
+    /* change the relevant lengths in the attachment part */
+    v = p;
+    u = p->anc;
+
+    /* modify length of middle branch */
+    m = v->length;
+    x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV) x = minV * minV / x;
+        if (x > maxV) x = maxV * maxV / x;
+        }
+    v->length = x;
+    v->upDateTi = YES;
+
+    /* update proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / m);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (m - x);
+
+    /* move around in root subtree */
+    nRootNodes = 0;
+    if (moveInRoot == YES)
+        {
+        /* mark nodes in root part */
+        /* also determine direction of move in root part */
+        if (u->left == v)
+            a = u->right;
+        else
+            a = u->left;
+        b = u->anc;
+        if (u->anc->anc == NULL || u->isLocked == YES)
+            directionUp = YES;
+        else if (a->left == NULL || a->isLocked == YES)
+            directionUp = NO;
+        else if (RandomNumber(seed) < 0.5)
+            directionUp = YES;
+        else
+            directionUp = NO;
+        /* cut root part*/
+        if (directionUp == NO)
+            {
+            b = a;  /* switch a and b */
+            a = u->anc;
+            b->anc = a;
+            if (a->left == u)
+                a->left = b;
+            else
+                a->right = b;
+            }
+        else  // if (directionUp == YES)
+            {
+            a->anc = b;
+            if (b->left == u)
+                b->left = a;
+            else
+                b->right = a;
+            y = a->length;
+            a->length = u->length;
+            u->length = y;
+            a->upDateTi = YES;
+            u->upDateTi = YES;
+            }
+
+        for (nRootNodes=0; RandomNumber(seed)<extensionProb || nRootNodes==0; nRootNodes++) 
+            {
+            if (directionUp == YES) 
+                {   /* going up tree */
+                if (a->left == NULL || a->isLocked == YES)
+                    break;      /* can't go further */
+                b = a;
+                if (RandomNumber(seed) < 0.5)
+                    a = a->left;
+                else
+                    a = a->right;
+                if (u->isLocked == YES)
+                    {
+                    b->isLocked = YES;
+                    u->isLocked = NO;
+                    b->lockID = u->lockID;
+                    u->lockID = 0;
+                    }
+                }
+            else  // directionUp == NO
+                {   /* going down tree */
+                if (a->anc == NULL || u->isLocked == YES)
+                    break;      /* can't go further */
+                if (RandomNumber(seed) < 0.5)
+                    {
+                    directionUp = YES; /* switch direction */
+                    /* find sister of a */
+                    if (a->left == b) 
+                        {
+                        b = a;
+                        a = a->right;
+                        }
+                    else 
+                        {  
+                        b = a;
+                        a = a->left;
+                        }
+                    /* as long as we are moving upwards, the cond likes to update
+                       will be flagged by the last pass from u to the root */
+                    }   
+                else 
+                    {   /* continue down */
+                    b = a;
+                    a = a->anc;
+                    b->upDateCl = YES; 
+                    if (b->isLocked == YES)
+                        {
+                        u->isLocked = YES;
+                        b->isLocked = NO;
+                        u->lockID = b->lockID;
+                        b->lockID = 0;
+                        }
+                    }
+                }
+            }
+            
+        topologyHasChanged = YES;
+        /* check whether stop is constrained */
+        if (directionUp == YES && (a->left == NULL || a->isLocked == YES))
+            isStopConstrained = YES;
+        if (directionUp == NO  && (a->anc  == NULL || u->isLocked == YES))
+            isStopConstrained = YES;
+        
+        /* modify branch length */
+        m = u->length;
+        x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        u->length = x;
+        u->upDateTi = YES;
+
+        /* update proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / m);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (m - x);
+
+        /* combine the subtrees */
+        if (directionUp == YES)
+            {
+            u->anc = b;
+            if (u->left == v)
+                u->right = a;
+            else 
+                u->left = a;
+            a->anc = u;
+            if (b->left == a)
+                b->left = u;
+            else
+                b->right = u;
+            }
+        else  // if (directionUp == NO)
+            {
+            u->anc = a;
+            if (u->left == v)
+                u->right = b;
+            else 
+                u->left = b;
+            b->anc = u;
+            if (a->left == b)
+                a->left = u;
+            else
+                a->right = u;
+            /* the modified branch contained in u->length will have to be moved to b->length to enable back move
+               BUT if we haven't moved, it is better to keep it in place (necessary for rooted trees) */
+            y = u->length;
+            u->length = b->length;
+            b->length = y;
+            b->upDateTi = YES;
+            u->upDateTi = YES;
+            }
+        }
+
+    /* move around in crown subtree */
+    nCrownNodes = 0;
+    if (moveInRoot == NO)
+        {
+        /* set up pointers for crown part */
+        /* also determine direction of move in crown part */
+        if (v->right->left == NULL || v->right->isLocked == YES)
+            directionLeft = YES;
+        else if (v->left->left == NULL || v->left->isLocked == YES)
+            directionLeft = NO;
+        else if (RandomNumber(seed) < 0.5)
+            directionLeft = YES;
+        else
+            directionLeft = NO;
+        if (directionLeft == YES)
+            {
+            c = v->left;
+            d = v->right;
+            }
+        else
+            {
+            c = v->right;
+            d = v->left;
+            }
+
+        /* store brlen nodes and brlen to move */
+        x = c->length;
+
+        /* cut and reconnect crown part */
+        c->anc = d;
+        d->anc = c;
+    
+        for (nCrownNodes=0; RandomNumber(seed)<extensionProb || nCrownNodes==0; nCrownNodes++) 
+            {
+            if (c->left == NULL || c->isLocked == YES)
+                break;  /* can't go further */
+            if (RandomNumber(seed) < 0.5)
+                {
+                /* rotate c anticlockwise - prepare pointers for move left */
+                c->anc = c->left;  /* the root will be in the direction we are heading */
+                c->left = c->right;
+                c->right = d;
+                }
+            else 
+                {
+                /* rotate c clockwise - prepare pointers for move right */
+                c->anc = c->right;  /* the root will be in the direction we are heading */
+                c->right = c->left;
+                c->left = d;  
+                }
+            /* OK - let's move! c->anc points in the right direction
+               don't forget to move the branch lengths as well */
+            d = c;
+            c = c->anc;
+            d->length = c->length;  /* also rotate other info ?? */
+            d->upDateCl = YES; 
+            d->upDateTi = YES;
+            }
+            
+        topologyHasChanged = YES;
+        /* check if stop constrained */
+        if (c->left == NULL || c->isLocked == YES)
+            isStopConstrained = YES;
+        
+        /* combine the subtrees */
+        c->anc = v;
+        d->anc = v;
+        if (directionLeft == YES)
+            {
+            v->left = c;
+            v->right = d;
+            }
+        else
+            {
+            v->left = d;
+            v->right = c;
+            }
+        
+        /* the dangling branch is inserted in reverted position such that the back move will be possible
+           if we have moved around in crown subtree otherwise it is left in its original position */
+        d->length = x;
+        
+        /* modify branch length */
+        m = d->length;
+        x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        d->length = x;
+        d->upDateTi = YES;
+
+        /* update proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / m);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (m - x);
+        }
+
+    /* adjust proposal ratio for constraints */
+    if (isStartConstrained == NO && isStopConstrained == YES)
+        (*lnProposalRatio) += log (2.0 * (1.0 - extensionProb));
+    else if (isStartConstrained == YES && isStopConstrained == NO)
+        (*lnProposalRatio) -= log (2.0 * (1.0 - extensionProb));
+
+    /* set flags for update of cond likes from v and down to root */
+    p = v;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+
+#   if defined (DEBUG_ExtSPR)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  c: %d  d: %d  a: %d  b: %d\n",v->index, u->index,
+            c->index, d->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("No. nodes moved in crown subtree: %d\n",nCrownNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int Move_ExtSPR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology (and branch lengths) using SPR (unrooted) with extension probability. */
+    /* Pick only internal branches. For a description, see Lakner et al. (2008). */
+    
+    int         i, j, topologyHasChanged, nCrownNodes, nRootNodes, directionLeft, directionUp, 
+                isVPriorExp, moveInRoot, isStartConstrained, isStopConstrained;
+    MrBFlt      m, x, y, tuning, maxV, minV, extensionProb, brlensExp=0.0;
+    TreeNode    *p, *a, *b, *c, *d, *u, *v, *brlenNode[7];
+    Tree        *t;
+    ModelParams *mp;
+    
+    /* these parameters should be possible to set by user */
+    extensionProb = mvp[0]; /* extension probability */
+    tuning = mvp[1];        /* Larget & Simon's tuning parameter lambda */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    topologyHasChanged = NO;
+
+#   if defined (DEBUG_ExtSPR)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+#   endif
+    
+    /* pick an internal branch that is free to move in either end
+       (i and j keep track of number of locked directions) */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed) * (t->nIntNodes-1))];
+        if (p->anc->left == p)
+            a = p->anc->right;
+        else
+            a = p->anc->left;
+        i = j = 0;
+        if (a->isLocked == YES || a->left == NULL)
+            i++;
+        if (p->anc->isLocked == YES || p->anc->anc->anc == NULL)
+            i++;
+        if (p->left->isLocked == YES || p->left->left == NULL)
+            j++;
+        if (p->right->isLocked == YES || p->right->left == NULL)
+            j++;
+        } while (i == 2 && j == 2);
+        
+    /* set up pointers for nodes around the picked branch */
+    /* cut the tree into crown, root and attachment part */
+    /* change the relevant lengths in the attachment part */
+    /* the lengths of a and v are automatically contained in the */
+    /* "attachment" part but the length of c has to be stored in x */
+    v = p;
+    u = p->anc;
+
+    /* store brlen node */
+    brlenNode[3] = v;
+
+    /* change in root tree ? */
+    if (j == 2)
+        moveInRoot = YES;
+    else if (i == 2)
+        moveInRoot = NO;
+    else if (RandomNumber(seed) < 0.5)
+        moveInRoot = YES;
+    else
+        moveInRoot = NO;
+
+    /* determine whether start is constrained on backward move */
+    isStartConstrained = isStopConstrained = NO;
+    if (moveInRoot == YES && i == 1)
+        isStartConstrained = YES;
+    else if (moveInRoot == NO && j == 1)
+        isStartConstrained = YES;
+
+    /* set up pointers for crown part */
+    /* also determine direction of move in crown part */
+    if (v->right->left == NULL || v->right->isLocked == YES)
+        directionLeft = YES;
+    else if (v->left->left == NULL || v->left->isLocked == YES)
+        directionLeft = NO;
+    else if (RandomNumber(seed) < 0.5)
+        directionLeft = YES;
+    else
+        directionLeft = NO;
+    if (directionLeft == YES)
+        {
+        c = v->left;
+        d = v->right;
+        }
+    else
+        {
+        c = v->right;
+        d = v->left;
+        }
+
+    /* store brlen nodes and brlen to move */
+    brlenNode[0] = d;
+    brlenNode[1] = c;
+    x = c->length;
+
+    /* cut and reconnect crown part */
+    c->anc = d;
+    d->anc = c;
+    
+    /* mark nodes in root part */
+    /* also determine direction of move in root part */
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    if (u->anc->anc == NULL || u->isLocked == YES)
+        directionUp = YES;
+    else if (a->left == NULL || a->isLocked == YES)
+        directionUp = NO;
+    else if (RandomNumber(seed) < 0.5)
+        directionUp = YES;
+    else
+        directionUp = NO;
+    if (directionUp == NO)
+        {
+        /* switch a and b */
+        b = a;
+        a = u->anc;
+        }
+
+    /* store brlen nodes */
+    if (directionUp == YES)
+        {
+        brlenNode[4] = u;
+        brlenNode[5] = a;
+        }
+    else
+        {
+        brlenNode[4] = b;
+        brlenNode[5] = u;
+        }
+
+    /* cut root part*/
+    if (directionUp == NO)
+        {
+        b->anc = a;
+        if (a->left == u)
+            a->left = b;
+        else
+            a->right = b;
+        }
+    else 
+        {
+        a->anc = b;
+        if (b->left == u)
+            b->left = a;
+        else
+            b->right = a;
+        y = a->length;
+        a->length = u->length;
+        u->length = y;
+        a->upDateTi = YES;
+        u->upDateTi = YES;
+        }
+
+    /* move around in root subtree */
+    nRootNodes = 0;
+    if (moveInRoot == YES)
+        {
+        for (nRootNodes=0; RandomNumber(seed)<extensionProb || nRootNodes==0; nRootNodes++) 
+            {
+            if (directionUp == YES) 
+                {   /* going up tree */
+                if (a->left == NULL || a->isLocked == YES)
+                    break;      /* can't go further */
+                topologyHasChanged = YES;
+                b = a;
+                if (RandomNumber(seed) < 0.5)
+                    a = a->left;
+                else
+                    a = a->right;
+                if (u->isLocked == YES)
+                    {
+                    b->isLocked = YES;
+                    u->isLocked = NO;
+                    b->lockID = u->lockID;
+                    u->lockID = 0;
+                    }
+                }
+            else 
+                {   /* going down tree */
+                if (a->anc == NULL || u->isLocked == YES)
+                    break;      /* can't go further */
+                topologyHasChanged = YES;
+                if (RandomNumber(seed)<0.5) 
+                    {
+                    directionUp = YES; /* switch direction */
+                    /* find sister of a */
+                    if (a->left == b) 
+                        {
+                        b = a;
+                        a = a->right;
+                        }
+                    else 
+                        {  
+                        b = a;
+                        a = a->left;
+                        }
+                    /* as long as we are moving upwards
+                    the cond likes to update will be
+                    flagged by the last pass from u to the root */
+                    }   
+                else 
+                    {   /* continue down */
+                    b = a;
+                    a = a->anc;
+                    b->upDateCl = YES; 
+                    if (b->isLocked == YES)
+                        {
+                        u->isLocked = YES;
+                        b->isLocked = NO;
+                        u->lockID = b->lockID;
+                        b->lockID = 0;
+                        }
+                    }
+                }
+            }
+        /* check whether stop is constrained */
+        if (directionUp == YES) 
+            {
+            if (a->left == NULL || a->isLocked == YES) 
+                isStopConstrained = YES;
+            }
+        else 
+            {
+            if (a->anc  == NULL || u->isLocked == YES)
+                isStopConstrained = YES;
+            }
+        }
+
+    /* store brlen nodes */
+    if (nRootNodes > 0)
+        {
+        if (directionUp == YES)
+            {
+            brlenNode[6] = a;
+            brlenNode[5] = u;
+            }
+        else
+            {
+            brlenNode[6] = u;
+            brlenNode[5] = b;
+            }
+        }
+
+    /* move around in crown subtree */
+    nCrownNodes = 0;
+    if (moveInRoot == NO)       
+        {
+        for (nCrownNodes=0; RandomNumber(seed)<extensionProb || nCrownNodes==0; nCrownNodes++) 
+            {
+            if (c->left == NULL || c->isLocked == YES)
+                break;  /* can't go further */
+            topologyHasChanged = YES;
+            if (RandomNumber(seed) < 0.5) 
+                {
+                /* rotate c anticlockwise - prepare pointers for move left */
+                c->anc = c->left;  /* the root will be in the direction we are heading */
+                c->left = c->right;
+                c->right = d;
+                }
+            else 
+                {
+                /* rotate c clockwise - prepare pointers for move right */
+                c->anc = c->right;  /* the root will be in the direction we are heading */
+                c->right = c->left;
+                c->left = d;  
+                }
+            /* OK - let's move!; c->anc points in the right direction
+            don't forget to move the branch lengths as well */
+            d = c;
+            c = c->anc;
+            d->length = c->length;
+            d->upDateCl = YES; 
+            d->upDateTi = YES;
+            }
+        /* check if stop constrained */
+        if (c->left == NULL || c->isLocked == YES)
+            isStopConstrained = YES;
+        }
+
+    /* store brlen nodes */
+    if (nCrownNodes > 0)
+        {
+        brlenNode[2] = c;
+        brlenNode[1] = d;
+        }
+
+    /* adjust proposal ratio for constraints */
+    if (isStartConstrained == NO && isStopConstrained == YES)
+        (*lnProposalRatio) += log (2.0 * (1.0 - extensionProb));
+    else if (isStartConstrained == YES && isStopConstrained == NO)
+        (*lnProposalRatio) -= log (2.0 * (1.0 - extensionProb));
+
+    /* combine the subtrees */
+    c->anc = v;
+    d->anc = v;
+    if (directionLeft == YES) 
+        {
+        v->left = c;
+        v->right = d;
+        }
+    else 
+        {
+        v->left = d;
+        v->right = c;
+        }
+
+    /* the dangling branch is inserted in reverted position
+       such that the back move will be possible
+       if we have moved around in crown subtree
+       otherwise it is left in its original position */
+    if (nCrownNodes > 0)
+        {
+        d->length = x;
+        d->upDateTi = YES;
+        }
+    else
+        {
+        c->length = x;
+        }
+
+    if (directionUp == YES) 
+        {
+        u->anc = b;
+        if (u->left == v)
+            u->right = a;
+        else 
+            u->left = a;
+        a->anc = u;
+        if (b->left == a)
+            b->left = u;
+        else
+            b->right = u;
+        /* the dangling branch is contained in u->length
+           and will automatically be inserted in the right position
+           to enable the back move regardless of whether it was
+           initially directed upwards or downwards
+           BUT if we haven't moved in root subtree, it is advantageous (necessary
+           for rooted trees) to avoid switching branches, which occurs otherwise
+           if directionUp == YES */
+        if (nRootNodes == 0) 
+            {
+            x = u->length;
+            u->length = a->length;
+            a->length = x;
+            a->upDateTi = NO;
+            u->upDateTi = NO;
+            }
+        }
+    else 
+        {
+        u->anc = a;
+        if (u->left == v)
+            u->right = b;
+        else 
+            u->left = b;
+        b->anc = u;
+        if (a->left == b)
+            a->left = u;
+        else
+            a->right = u;
+        /* the modified branch contained in u->length will have
+           to be moved to b->length to enable back move
+           BUT if we haven't moved, it is better to keep it in place
+           (necessary for rooted trees) */
+        if (nRootNodes > 0) 
+            {
+            x = u->length;
+            u->length = b->length;
+            b->length = x;
+            b->upDateTi = YES;
+            u->upDateTi = YES;
+            }
+        }
+    
+    /* modify branch lengths */
+    /* first modify length of middle branch */
+    m = brlenNode[3]->length;
+    x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV)
+            x = minV * minV / x;
+        else if (x > maxV)
+            x = maxV * maxV / x;
+        }
+    brlenNode[3]->length = x;
+    brlenNode[3]->upDateTi = YES;
+
+    /* update proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / m);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (m - x);
+
+    if (moveInRoot == NO)
+        {
+        /* if no move in crown, then select randomly, otherwise always the moved branch */
+        if (nCrownNodes == 0 && RandomNumber(seed) < 0.5)
+            p = brlenNode[0];
+        else
+            p = brlenNode[1];
+
+        /* modify branch length */
+        m = p->length;
+        x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV)
+                x = minV * minV / x;
+            else if (x > maxV)
+                x = maxV * maxV / x;
+            }
+        p->length = x;
+        p->upDateTi = YES;
+
+        /* update proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / m);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (m - x);
+        }
+            
+    if (moveInRoot == YES)
+        {
+        /* if no move in root, then select randomly, otherwise always the moved branch */
+        if (nRootNodes == 0 && RandomNumber(seed) < 0.5)
+            p = brlenNode[4];
+        else
+            p = brlenNode[5];
+        
+        /* modify branch length but not if 'root' branch in rooted tree */
+        if (t->isRooted == NO || p->anc->anc != NULL)
+            {
+            m = p->length;
+            x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+            while (x < minV || x > maxV)
+                {
+                if (x < minV)
+                    x = minV * minV / x;
+                else if (x > maxV)
+                    x = maxV * maxV / x;
+                }
+            p->length = x;
+            p->upDateTi = YES;
+
+            /* update proposal and prior ratio based on length modification */
+            (*lnProposalRatio) += log (x / m);
+            if (isVPriorExp == YES)
+                (*lnPriorRatio) += brlensExp * (m - x); 
+            }
+        }
+
+    /* set flags for update of cond likes from v and down to root */
+    p = v;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+
+#   if defined (DEBUG_ExtSPR)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  c: %d  d: %d  a: %d  b: %d\n",v->index, u->index,
+            c->index, d->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("No. nodes moved in crown subtree: %d\n",nCrownNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int Move_ExtSPRClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change branch lengths and topology (potentially) using SPR-type move 
+       with extension probability (rather than window, attachment rate or similar).
+       The move is Metropolized, which should improve mixing. However, this means 
+       that it must be combined with a node slider move to be efficient.
+
+       The move picks a branch and then moves its lower attachment point 
+       from its original position, one node at a time, with
+       a probability determined by the extensionProb parameter. This is
+       done in a way consistent with the clock constraints and any locked
+       nodes there might be in the tree. The lower attachment point is 
+       minimally moved one node away.
+       
+       On the ending branch, the attachment point is reinserted randomly
+       along the branch (below the minimum age of the node). */
+    
+    int         i, j, topologyHasChanged=NO, isStartLocked=NO, isStopLocked=NO, nRootNodes, directionUp,
+                n1=0, n2=0, n3=0, n4=0, n5=0, *nEvents;
+    MrBFlt      x, y, oldBrlen=0.0, newBrlen=0.0, extensionProb, igrvar, *igrRate=NULL,
+                v1=0.0, v2=0.0, v3=0.0, v4=0.0, v5=0.0, v3new=0.0, lambda, *tk02Rate=NULL,
+                **position=NULL, **rateMultiplier=NULL, *brlens, nu, minV, clockRate;
+    TreeNode    *p, *a, *b, *u, *v, *oldA;
+    Tree        *t;
+    ModelInfo   *m;
+    Param       *subParm;
+
+    extensionProb = mvp[0]; /* extension probability */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    /* get model params and model info */
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get clock rate */
+    clockRate = *GetParamVals (m->clockRate, chain, state[chain]);
+
+    /* get min and max branch lengths in relative time and substitution units */
+    minV = BRLENS_MIN;
+
+#   if defined (DEBUG_ExtSPRClock)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+#   endif
+    
+    /* pick a branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes - 2))];
+        a = p->anc->left;
+        b = p->anc->right;
+        }
+    while (p->anc->isLocked == YES || p->anc->anc->anc == NULL
+           || (p == b && a->length < TIME_MIN) || (p == a && b->length < TIME_MIN)
+           || (p->length < TIME_MIN && p->calibration->prior == fixed));
+    /* skip constraints, siblings of root (and root); and consider ancestral fossils in fbd tree */
+    
+    /* set up pointers for nodes around the picked branch */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    oldA = a;
+
+    /* record branch length for insertion in back move */
+    if (v->length > 0.0)  /* side branch, not anc fossil */
+        {
+        if (v->nodeDepth > a->nodeDepth)
+            oldBrlen = b->nodeDepth - v->nodeDepth - 2.0*minV;
+        else
+            oldBrlen = b->nodeDepth - a->nodeDepth - 2.0*minV;
+        }
+    else  /* ancestral fossil */
+        {
+        y = (b->nodeDepth - minV > v->calibration->max * clockRate) ? (v->calibration->max * clockRate) : (b->nodeDepth - minV);
+        x = (a->nodeDepth + minV < v->calibration->min * clockRate) ? (v->calibration->min * clockRate) : (a->nodeDepth + minV);
+        oldBrlen = y - x;
+        }
+    v1 = a->length;
+    v2 = u->length;
+    v3 = v->length;
+
+    /* reassign events for CPP and adjust prior and proposal ratios for relaxed clock models */
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            /* get pointers to CPP events */
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            position = subParm->position[2*chain+state[chain]];
+            rateMultiplier = subParm->rateMult[2*chain+state[chain]];
+            n1 = nEvents[a->index];
+            n2 = nEvents[u->index];
+            n3 = nEvents[v->index];
+            if (n2 > 0)
+                {
+                position[a->index] = (MrBFlt *) SafeRealloc ((void *) position[a->index], (n1+n2) * sizeof (MrBFlt));
+                rateMultiplier[a->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[a->index], (n1+n2) * sizeof (MrBFlt));
+                }
+            for (j=0; j<n1; j++)
+                position[a->index][j] *= v1 / (v1+v2);
+            for (j=n1; j<n1+n2; j++)
+                {
+                position[a->index][j] = (position[u->index][j-n1] * v2 + v1) / (v1+v2);
+                rateMultiplier[a->index][j] = rateMultiplier[u->index][j-n1];
+                }
+            nEvents[a->index] = n1+n2;
+            nEvents[u->index] = 0;
+            if (n2 > 0)
+                {
+                free (position[u->index]);
+                free (rateMultiplier[u->index]);
+                position[u->index] = rateMultiplier[u->index] = NULL;
+                }
+            }   /* end CPP events parm */
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            /* adjust prior ratio */
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            if (v->length > 0.0)
+                (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[v->anc->index], nu*v->length, tk02Rate[v->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[a->anc->index], nu*a->length, tk02Rate[a->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*u->length, tk02Rate[u->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*(a->length+u->length), tk02Rate[a->index]);
+            
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = (tk02Rate[a->index] + tk02Rate[b->index]) / 2.0 * (a->length + u->length);
+            }   /* end tk02 branch rate parameter */
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+
+             /* adjust prior ratio for old branches */
+            if (v->length > 0.0)
+                (*lnPriorRatio) -= LnProbGamma(v->length/igrvar, v->length/igrvar, igrRate[v->index]);
+            (*lnPriorRatio) -= LnProbGamma(a->length/igrvar, a->length/igrvar, igrRate[a->index]);
+            (*lnPriorRatio) -= LnProbGamma(u->length/igrvar, u->length/igrvar, igrRate[u->index]);
+            (*lnPriorRatio) += LnProbGamma((a->length+u->length)/igrvar, (a->length+u->length)/igrvar, igrRate[a->index]);
+
+            /* adjust effective branch lengths and rates */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = igrRate[a->index] * (a->length + u->length);
+            }
+        }   /* next subparameter */
+
+    /* cut tree */
+    a->anc = b;
+    if (b->left == u)
+        b->left = a;
+    else
+        b->right = a;
+    a->length += u->length;
+    a->upDateTi = YES;
+
+    /* determine initial direction of move and whether the reverse move would be stopped by constraints */
+    if (a->left == NULL || a->isLocked == YES || a->nodeDepth < v->nodeDepth + minV)
+        {
+        isStartLocked = YES;
+        directionUp = NO;
+        }
+    else
+        {
+        isStartLocked = NO;
+        if (RandomNumber(seed) < 0.5)
+            directionUp = YES;
+        else
+            directionUp = NO;
+        }
+        
+    /* move around in root subtree */
+    for (nRootNodes=0; nRootNodes==0 || RandomNumber(seed)<extensionProb; nRootNodes++) 
+        {
+        if (directionUp == YES) 
+            {   /* going up tree */
+            if (a->left == NULL || a->isLocked == YES || a->nodeDepth < v->nodeDepth + minV)
+                break;      /* can't go farther */
+            topologyHasChanged = YES;
+            b = a;
+            if (a->left->length < TIME_MIN)
+                a = a->right;
+            else if (a->right->length < TIME_MIN)
+                a = a->left;
+            else if (RandomNumber(seed) < 0.5)
+                a = a->left;
+            else
+                a = a->right;
+            }
+        else 
+            {   /* going down tree */
+            topologyHasChanged = YES;
+            if (RandomNumber(seed) < 0.5 || b->anc->anc == NULL || b->isLocked == YES)
+                {
+                directionUp = YES; /* switch direction */
+                /* find sister of a */
+                if (b->left == a)
+                    a = b->right;
+                else
+                    a = b->left;
+                /* as long as we are moving upwards
+                the cond likes to update will be
+                flagged by the last pass from u to the root */
+                }   
+            else 
+                {   /* continue down */
+                a = b;
+                b = b->anc;
+                a->upDateCl = YES;
+                }
+            }
+        }
+        
+    /* determine whether the forward move was or would have been stopped by constraints */
+    isStopLocked = NO;
+    if (directionUp == YES)
+        {
+        if (a->left == NULL || a->isLocked == YES || a->nodeDepth < v->nodeDepth + minV)
+            isStopLocked = YES;
+        }
+
+    /* reattach u */
+    if (u->left == v)
+        u->right = a;
+    else
+        u->left = a;
+    a->anc = u;
+    u->anc = b;
+    if (b->left == a)
+        b->left = u;
+    else
+        b->right = u;
+
+    if (v->length > 0.0)  /* side branch, not anc fossil */
+        {
+        if (a->nodeDepth > v->nodeDepth)
+            newBrlen = b->nodeDepth - a->nodeDepth - 2.0*minV;
+        else
+            newBrlen = b->nodeDepth - v->nodeDepth - 2.0*minV;
+        }
+    else  /* ancestral fossil */
+        {
+        y = (b->nodeDepth - minV > v->calibration->max * clockRate) ? (v->calibration->max * clockRate) : (b->nodeDepth - minV);
+        x = (a->nodeDepth + minV < v->calibration->min * clockRate) ? (v->calibration->min * clockRate) : (a->nodeDepth + minV);
+        newBrlen = y - x;
+        }
+    if (newBrlen <= 0.0)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+    
+    /* adjust lengths */
+    if (v->length > 0.0)  /* side branch, not anc fossil */
+        {
+        u->nodeDepth = b->nodeDepth - minV - RandomNumber(seed) * newBrlen;
+        v->length = u->nodeDepth - v->nodeDepth;
+        }
+    else  /* ancestral fossil */
+        {
+        u->nodeDepth = y - RandomNumber(seed) * newBrlen;
+        v->nodeDepth = u->nodeDepth;
+        v->age = u->age = u->nodeDepth / clockRate;
+        }
+    u->length = b->nodeDepth - u->nodeDepth;
+    a->length = u->nodeDepth - a->nodeDepth;
+    
+    v3new = v->length;
+    v4 = a->length;
+    v5 = u->length;
+
+    /* adjust events, prior ratio and proposal ratio for relaxed clock models */
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            /* reassign events for CPP */
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            position = subParm->position[2*chain+state[chain]];
+            rateMultiplier = subParm->rateMult[2*chain+state[chain]];
+            for (j=0; j<nEvents[a->index]; j++)
+                {
+                if (position[a->index][j] > v4 / (v4+v5))
+                    break;
+                }
+            n4 = j;
+            n5 = nEvents[a->index] - j;
+            nEvents[u->index] = n5;
+            if (n5 > 0)
+                {
+                position[u->index] = (MrBFlt *) SafeRealloc ((void *) position[u->index], n5 * sizeof (MrBFlt));
+                rateMultiplier[u->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[u->index], n5 * sizeof (MrBFlt));            
+                for (j=n4; j<nEvents[a->index]; j++)
+                    {
+                    position[u->index][j-n4] = (position[a->index][j] * (v4+v5) - v4) / v5;
+                    rateMultiplier[u->index][j-n4] = rateMultiplier[a->index][j];
+                    }
+                if (n4 > 0)
+                    {
+                    position[a->index] = (MrBFlt *) SafeRealloc ((void *) position[a->index], n4 * sizeof (MrBFlt));
+                    rateMultiplier[a->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[a->index], n4 * sizeof (MrBFlt));
+                    for (j=0; j<n4; j++)
+                        position[a->index][j] *= ((v4+v5) / v4);
+                    }
+                else
+                    {
+                    free (position[a->index]);
+                    free (rateMultiplier[a->index]);
+                    position[a->index] = rateMultiplier[a->index] = NULL;
+                    }
+                nEvents[a->index] = n4;
+                }
+            else
+                {
+                for (j=0; j<nEvents[a->index]; j++)
+                    position[a->index][j] *= ((v4+v5) / v4);
+                }
+
+            /* adjust proposal ratio for length change in v branch*/
+            (*lnProposalRatio) += n3 * log (v3new / v3);
+
+            /* adjust prior ratio for length change */
+            lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+            (*lnPriorRatio) += lambda * (v3 - v3new);
+
+            /* update effective branch lengths */
+            if (UpdateCppEvolLengths (subParm, oldA, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            if (UpdateCppEvolLengths (subParm, u, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }   /* end cpp events parameter */
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            /* adjust prior ratio */
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*(a->length+u->length), tk02Rate[a->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[a->anc->index], nu*a->length, tk02Rate[a->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*u->length, tk02Rate[u->index]);
+            if (v->length > 0.0)
+                (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[v->anc->index], nu*v->length, tk02Rate[v->index]);
+
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = a->length * (tk02Rate[a->index] + tk02Rate[a->anc->index]) / 2.0;
+            brlens[v->index] = v->length * (tk02Rate[v->index] + tk02Rate[v->anc->index]) / 2.0;
+            brlens[u->index] = u->length * (tk02Rate[u->index] + tk02Rate[u->anc->index]) / 2.0;
+            }   /* end tk02 branch rate parameter */
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            /* adjust prior ratio */
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            (*lnPriorRatio) -= LnProbGamma ((a->length+u->length)/igrvar, (a->length+u->length)/igrvar, igrRate[a->index]);
+            (*lnPriorRatio) += LnProbGamma (a->length/igrvar, a->length/igrvar, igrRate[a->index]);
+            (*lnPriorRatio) += LnProbGamma (u->length/igrvar, u->length/igrvar, igrRate[u->index]);
+            if (v->length > 0.0)
+                (*lnPriorRatio) += LnProbGamma (v->length/igrvar, v->length/igrvar, igrRate[v->index]);
+
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[v->index] = igrRate[v->index] * v->length;
+            brlens[u->index] = igrRate[u->index] * u->length;
+            brlens[a->index] = igrRate[a->index] * a->length;
+            }   /* end igr branch rate parameter */
+        }   /* next subparameter */
+
+    /* set tiprobs update flags */
+    a->upDateTi = YES;
+    u->upDateTi = YES;
+    v->upDateTi = YES;
+
+    /* set flags for update of cond likes from u and down to root */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* adjust prior ratio for clock tree */
+    if (LogClockTreePriorRatio(param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+
+    if (topologyHasChanged == YES)
+        {
+        /* get down pass sequence if tree topology has changed */
+        GetDownPass (t);
+        /* calculate proposal ratio for tree change */
+        (*lnProposalRatio) += log (newBrlen / oldBrlen);
+        if (isStartLocked == NO && isStopLocked == YES)
+            (*lnProposalRatio) += log (2.0 * (1.0 - extensionProb));
+        else if (isStartLocked == YES && isStopLocked == NO)
+            (*lnProposalRatio) -= log (2.0 * (1.0 - extensionProb));
+        }
+
+#   if defined (DEBUG_ExtSPRClock)
+    ShowNodes (t->root, 2, YES);
+    printf ("After\nProposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  a: %d  b: %d\n",v->index, u->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int Move_ExtSS (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change branch lengths and topology (potentially) using Subtree Swapping (unrooted) 
+       with extension probability.
+
+       This move type picks two subtrees and swaps their position. Like the SPR and TBR,
+       it is a superset of the NNI but there are some interesting differences. With the
+       SPR and TBR, it is not possible to go between all five-tip trees in a single
+       step. For instance, going from ((1,2),3,(4,5)) to ((1,5),3,(4,2)) requires two
+       steps. The SS move can go between all pairs of five-tip trees in a single step.
+       Some six-tip tree pairs will require two steps though.
+
+       Unlike the published version of the move (Lakner et al, Syst Bio), this version
+       does _not_ multiply all branch lengths between the subtrees.
+       
+       */
+    
+    int         i, numFree, topologyHasChanged, nCrownNodes, nRootNodes, directionLeft, directionUp, 
+                isVPriorExp, moveInRoot;
+    MrBFlt      m, x, tuning, maxV, minV, extensionProb, brlensExp=0.0;
+    TreeNode    *p, *q, *a, *b, *c, *d, *u, *v;
+    Tree        *t;
+    ModelParams *mp;
+
+    (*lnPriorRatio) = (*lnProposalRatio) = 0.0;
+
+    /* these parameters should be possible to set by user */
+    extensionProb = mvp[0]; /* extension probability */
+    tuning = mvp[1];        /* Larget & Simon's tuning parameter lambda */
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+
+    topologyHasChanged = NO;
+
+    /* unmark all tree */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        }
+
+    /* pick a branch */
+    do
+        {
+        p = t->allDownPass[(int)(RandomNumber(seed) * t->nNodes)];
+        } while (p->anc == NULL);
+        
+    /* set up pointers for nodes around the picked branch */
+    v = p;
+    u = p->anc;
+
+    /* check the possible move directions */
+    numFree = 0;
+    if (v->left != NULL && v->left->isLocked == NO)
+        numFree ++;
+    if (v->right != NULL && v->right->isLocked == NO)
+        numFree++;
+    if (u->anc != NULL && u->isLocked == NO)
+        numFree++;
+    if (u->left == v)
+        {
+        if (u->right != NULL && u->right->isLocked == NO)
+            numFree++;
+        }
+    else
+        {
+        if (u->left != NULL && u->left->isLocked == NO)
+            numFree++;
+        }
+
+    /* select one of them randomly */
+    i = (int) (RandomNumber(seed) * numFree) + 1;
+    numFree = 0;
+    a = b = c = d = p;
+    directionLeft = directionUp = moveInRoot = NO;
+    if (v->left != NULL && v->left->isLocked == NO)
+        {
+        numFree ++;
+        if (i == numFree)
+            {
+            moveInRoot = NO;
+            directionLeft = YES;
+            c = v->left;
+            d = v;
+            }
+        }
+    if (v->right != NULL && v->right->isLocked == NO)
+        {
+        numFree ++;
+        if (i == numFree)
+            {
+            moveInRoot = NO;
+            directionLeft = NO;
+            c = v->right;
+            d = v;
+            }
+        }
+    if (u->anc != NULL && u->isLocked == NO)
+        {
+        numFree ++;
+        if (i == numFree)
+            {
+            moveInRoot = YES;
+            directionUp = NO;
+            a = u->anc;
+            b = u;
+            }
+        }
+    if (u->left == v)
+        {
+        if (u->right != NULL && u->right->isLocked == NO)
+            {
+            numFree ++;
+            if (i == numFree)
+                {
+                moveInRoot = YES;
+                directionUp = YES;
+                a = u->right;
+                b = u;
+                }
+            }
+        }
+    else
+        {
+        if (u->left != NULL && u->left->isLocked == NO)
+            {
+            numFree ++;
+            if (i == numFree)
+                {
+                moveInRoot = YES;
+                directionUp = YES;
+                a = u->left;
+                b = u;
+                }
+            }
+        }
+
+#   if defined (DEBUG_ExtSS)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, NO);
+    printf ("v: %d  u: %d  c: %d  d: %d  a: %d  b: %d\n",v->index, u->index, 
+        c->index, d->index, a->index, b->index);
+    printf ("directionUp = %d -- directionLeft = %d -- moveInRoot = %d\n", directionUp, directionLeft, moveInRoot);
+    getchar();
+#   endif
+    
+    /* move around and potentially swap in root subtree */
+    nRootNodes = 0;
+    if (moveInRoot == YES)
+        {
+        for (nRootNodes=0; nRootNodes==0 || RandomNumber(seed)<extensionProb; nRootNodes++) 
+            {
+            if (directionUp == YES) 
+                {   /* going up tree */
+                if (a->left == NULL || a->isLocked == YES)
+                    break;      /* can't go further */
+                topologyHasChanged = YES;
+                b = a;
+                if (RandomNumber(seed) < 0.5)
+                    a = a->left;
+                else
+                    a = a->right;
+                }
+            else 
+                {   /* going down tree */
+                if (a->anc == NULL || a->isLocked == YES)
+                    break;      /* can't go further */
+                topologyHasChanged = YES;
+                b->marked = YES;
+
+                if (RandomNumber(seed) < 0.5) 
+                    {
+                    directionUp = YES; /* switch direction */
+                    /* find sister of a */
+                    if (a->left == b) 
+                        {
+                        b = a;
+                        a = a->right;
+                        }
+                    else 
+                        {  
+                        b = a;
+                        a = a->left;
+                        }
+                    }   
+                else 
+                    {   /* continue down */
+                    b = a;
+                    a = a->anc;
+                    }
+                }
+            }
+        /* swap the root subtrees */
+        if (nRootNodes > 0)
+            {
+            if (directionUp == YES)
+                {
+                v->anc = b;
+                a->anc = u;
+                if (b->left == a)
+                    b->left = v;
+                else if (b->right == a)
+                    b->right = v;
+                if (u->left == v)
+                    u->left = a;
+                else
+                    u->right = a;
+                }
+            else
+                {
+                /* rotate the nodes from b to u*/
+                p = b;
+                q = a;
+                x = b->length;
+                while (p->left->marked == YES || p->right->marked == YES)
+                    {                   
+                    if (p->left->marked == YES) 
+                        {
+                        /* rotate p anticlockwise - prepare pointers for move left */
+                        p->anc = p->left;  /* the root will be in the direction we are heading */
+                        p->left = p->right;
+                        p->right = q;
+                        }
+                    else 
+                        {
+                        /* rotate p clockwise - prepare pointers for move right */
+                        p->anc = p->right;  /* the root will be in the direction we are heading */
+                        p->right = p->left;
+                        p->left = q;  
+                        }
+                    /* OK - let's move!; p->anc points in the right direction
+                    don't forget to move the branch lengths as well */
+                    q = p;
+                    p = p->anc;
+                    q->length = p->length;
+                    q->upDateTi = YES;
+                    }
+                /* rotations finished, take care of u */
+                if (u->left == v)
+                    u->left = u->anc;
+                else
+                    u->right = u->anc;
+                u->length = x;
+                /* now swap the subtrees of u and b */
+                if (a->left == b)
+                    a->left = u;
+                else
+                    a->right = u;
+                u->anc = a;
+                v->anc = b;
+                if (b->left == a)
+                    b->left = v;
+                else
+                    b->right = v;
+                }
+            }
+        }
+
+    /* move around and potentially swap in crown subtree */
+    nCrownNodes = 0;
+    if (moveInRoot == NO)       
+        {
+        x = v->length;  /* save v length in case there is a move */
+        for (nCrownNodes=0; nCrownNodes==0 || RandomNumber(seed)<extensionProb; nCrownNodes++) 
+            {
+            if (c->left == NULL || c->isLocked == YES)
+                break;  /* can't go further */
+
+            topologyHasChanged = YES;
+            
+            /* prepare d for move */
+            d->anc = c;
+            d->length = c->length;
+            d->upDateTi = YES;
+            d->upDateCl = YES;
+            if (d->isLocked == YES)
+                {
+                c->isLocked = YES;
+                d->isLocked = NO;
+                c->lockID = d->lockID;
+                d->lockID = -1;
+                }
+            
+            /* go left or right with equal probability */
+            if (RandomNumber(seed) < 0.5) 
+                {
+                /* rotate c anticlockwise - prepare pointers for move left */
+                c->anc = c->left;  /* the root will be in the direction we are heading */
+                c->left = c->right;
+                c->right = d;
+                }
+            else 
+                {
+                /* rotate c clockwise - prepare pointers for move right */
+                c->anc = c->right;  /* the root will be in the direction we are heading */
+                c->right = c->left;
+                c->left = d;
+                }
+            /* OK - let's move!; c->anc points in the right direction */
+            d = c;
+            c = c->anc;
+            }
+
+        /* swap the crown subtrees */
+        if (nCrownNodes > 0)
+            {
+            d->anc = u;
+            d->length = x;
+            if (u->left == v)
+                u->left = d;
+            else
+                u->right = d;
+
+            c->anc = v;
+            if (directionLeft == YES)
+                v->left = c;
+            else
+                v->right = c;
+            }
+        }
+
+    /* modify branch lengths */
+    if (nCrownNodes > 0)
+        {
+        p = c;
+        q = d;
+        }
+    else if (nRootNodes > 0)
+        {
+        if (directionUp == YES)
+            {
+            p = v;
+            q = a;
+            }
+        else
+            {
+            p = v;
+            q = u;
+            }
+        }
+    else
+        {
+        p = v;
+        if (RandomNumber(seed) < 0.5)
+            {
+            if (RandomNumber(seed) < 0.5)
+                q = u;
+            else
+                {
+                if (u->left == v)
+                    q = u->right;
+                else
+                    q = u->left;
+                }
+            }
+        else
+            {
+            if (RandomNumber(seed) < 0.5)
+                q = v->left;
+            else
+                q = v->right;
+            }
+        }
+
+    if (p != NULL)
+        {
+        m = p->length;
+        x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV)
+                x = minV * minV / x;
+            else if (x > maxV)
+                x = maxV * maxV / x;
+            }
+        p->length = x;
+        p->upDateTi = YES;
+
+        /* update proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / m);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (m - x);
+        }
+
+    if (q != NULL && q->anc != NULL)
+        {
+        m = q->length;
+        x = m * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV)
+                x = minV * minV / x;
+            else if (x > maxV)
+                x = maxV * maxV / x;
+            }
+        q->length = x;
+        q->upDateTi = YES;
+
+        /* update proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / m);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (m - x);
+        }
+
+    /* set flags for update of cond likes from v and down to root */
+    p = v;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+
+    if (topologyHasChanged == YES)
+        {
+        /* set flags for update of cond likes from u and down to root */
+        p = u;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+#   if defined (DEBUG_ExtSS)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+    printf ("Proposal ratio: %f\n",exp(*lnProposalRatio));
+    printf ("v: %d  u: %d  c: %d  d: %d  a: %d  b: %d\n",v->index, u->index, 
+        c->index, d->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("No. nodes moved in crown subtree: %d\n",nCrownNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    printf ("directionUp = %d -- directionLeft = %d\n", directionUp, directionLeft);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+int Move_ExtSSClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change branch lengths and topology (potentially) using SS-type move 
+       with extension probability (rather than window, attachment rate or similar). */
+
+    /* This move picks a branch at random. It then moves away from this branch, one 
+       one node at a time, with a probability determined by the extensionProb parameter.
+       The process stops when a tip is reached or when a move further upwards would break
+       the clock assumption. When the extension process stops, the subtrees supported by
+       the two chosen branches are swapped. Since 2010-11-01, the move is Metropolized for
+       increased efficiency. */
+    /* Note: this move is not compatible with fossilized birth-death model with ancestral fossils */
+    
+    int         i, *nEvents, numFreeOld, numFreeNew;
+    MrBFlt      x, oldALength, oldCLength, extensionProb, igrvar, *igrRate,
+                *tk02Rate, *brlens, nu, ran, cumulativeProb, forwardProb,
+                backwardProb, minV;
+    TreeNode    *p, *q, *a, *c;
+    Tree        *t;
+    Param       *subParm;
+
+    extensionProb = mvp[0]; /* extension probability */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get min and max brlens in relative time and subst units */
+    minV = BRLENS_MIN;
+
+    /* calculate the number of free nodes */
+    numFreeOld = t->nNodes-2;
+    if (t->nConstraints > 1)
+        {
+        numFreeOld = 0;
+        for (i=0; i<t->nNodes-2; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc->left == p)
+                q = p->anc->right;
+            else
+                q = p->anc->left;
+            if (p->anc->isLocked == NO || q->isLocked == NO)
+                numFreeOld++;
+            }
+        }
+
+    /* pick a branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes -2))];
+        if (p->anc->left == p)
+            q = p->anc->right;
+        else
+            q = p->anc->left;
+        }
+    while ((p->anc->isLocked == YES && q->isLocked == YES) || p->length < TIME_MIN || q->length < TIME_MIN);
+    /* choose subtree that can be swapped */
+
+    /* set up pointers for nodes around the picked branch */
+    a = p;
+    if (p->anc->left == p)
+        q = p->anc->right;
+    else
+        q = p->anc->left;
+    if (p->anc->anc->left == p->anc)
+        c = p->anc->anc->right;
+    else
+        c = p->anc->anc->left;
+
+    /* record branch length */
+    oldALength = a->length;
+
+    /* reset scratch variables */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = -1;
+        p->y = NO;
+        }
+
+    /* calculate distance from picked node */
+    p = a->anc;
+    p->x = 0;
+    while (p->isLocked == NO && p->anc != NULL)
+        {
+        p->anc->x = p->x + 1;
+        p = p->anc;
+        }
+    for (i=t->nIntNodes-2; i>=0; i--)
+        {
+        p = t->intDownPass[i];
+        if (p->x < 0 && p->anc->x >= 0 && p != a && p->isLocked == NO)
+            p->x = p->anc->x + 1;
+        }
+
+    /* mark the free nodes and calculate the total score */
+    cumulativeProb = 0.0; 
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        if (p != a && p->anc->x > 0 && a->anc->nodeDepth > p->nodeDepth + minV && p->anc->nodeDepth > a->nodeDepth + minV)
+            {
+            p->y = YES;
+            p->d = pow(0.5 * extensionProb, p->anc->x);
+            cumulativeProb += p->d;
+            }
+        else
+            p->d = 0.0;
+        }
+
+    /* find the target node */
+    ran = RandomNumber(seed) * cumulativeProb;
+    x = 0.0;
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->y == YES)
+            {
+            x += p->d;
+            if (x > ran)
+                break;
+            }
+        }
+    if (i == t->nNodes - 2)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* record first forward prob */
+    forwardProb = p->d / cumulativeProb;
+
+    /* record partner swap branch */
+    c = p;
+    oldCLength = c->length;
+
+    /* calculate second forward prob */
+
+    /* reset scratch variables */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = -1;
+        p->y = NO;
+        }
+
+    /* calculate distance from picked node */
+    p = c->anc;
+    p->x = 0;
+    while (p->isLocked == NO && p->anc != NULL)
+        {
+        p->anc->x = p->x + 1;
+        p = p->anc;
+        }
+    for (i=t->nIntNodes-1; i>=0; i--)
+        {
+        p = t->intDownPass[i];
+        if (p->x < 0 && p != c && p->anc->x >= 0 && p->isLocked == NO)
+            p->x = p->anc->x + 1;
+        }
+
+    /* mark the free nodes and calculate the total score */
+    cumulativeProb = 0.0; 
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        if (p != c && p->anc->x > 0 && c->anc->nodeDepth > p->nodeDepth + minV && p->anc->nodeDepth > c->nodeDepth + minV)
+            {
+            p->y = YES;
+            p->d = pow(0.5 * extensionProb, p->anc->x);
+            cumulativeProb += p->d;
+            }
+        else
+            p->d = 0.0;
+        }
+
+    /* now we can calculate second forward prob */
+    forwardProb += a->d / cumulativeProb;
+
+    /* swap subtrees */
+    if (a->anc->left == a)
+        a->anc->left = c;
+    else
+        a->anc->right = c;
+    if (c->anc->left == c)
+        c->anc->left = a;
+    else
+        c->anc->right = a;
+    p = a->anc;
+    a->anc = c->anc;
+    c->anc = p;
+    a->length = a->anc->nodeDepth - a->nodeDepth;
+    c->length = c->anc->nodeDepth - c->nodeDepth;
+
+    /* get down pass sequence */
+    GetDownPass (t);
+
+    /* set tiprobs update flags */
+    a->upDateTi = YES;
+    c->upDateTi = YES;
+
+    /* set flags for update of cond likes from a->anc and down to root */
+    p = a->anc;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* set flags for update of cond likes from c->anc and down to root */
+    p = c->anc;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* adjust prior ratio for clock tree */
+    if (LogClockTreePriorRatio(param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+
+    /* calculate first backward prob */
+
+    /* reset scratch variables */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = -1;
+        p->y = NO;
+        }
+
+    /* calculate distance from picked node */
+    p = a->anc;
+    p->x = 0;
+    while (p->isLocked == NO && p->anc != NULL)
+        {
+        p->anc->x = p->x + 1;
+        p = p->anc;
+        }
+    for (i=t->nIntNodes-1; i>=0; i--)
+        {
+        p = t->intDownPass[i];
+        if (p->x < 0 && p != a && p->anc->x >= 0 && p->isLocked == NO)
+            p->x = p->anc->x + 1;
+        }
+
+    /* mark the free nodes and calculate the total score */
+    cumulativeProb = 0.0; 
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        if (p != a && p->anc->x > 0 && a->anc->nodeDepth > p->nodeDepth + minV && p->anc->nodeDepth > a->nodeDepth + minV)
+            {
+            p->y = YES;
+            p->d = pow(0.5 * extensionProb, p->anc->x);
+            cumulativeProb += p->d;
+            }
+        else
+            p->d = 0.0;
+        }
+
+    /* calculate first backward prob */
+    backwardProb = c->d / cumulativeProb;
+
+    /* calculate second backward prob */
+
+    /* reset scratch variables */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = -1;
+        p->y = NO;
+        }
+
+    /* calculate distance from picked node */
+    p = c->anc;
+    p->x = 0;
+    while (p->isLocked == NO && p->anc != NULL)
+        {
+        p->anc->x = p->x + 1;
+        p = p->anc;
+        }
+    for (i=t->nIntNodes-1; i>=0; i--)
+        {
+        p = t->intDownPass[i];
+        if (p->x < 0 && p != c && p->anc->x >= 0 && p->isLocked == NO)
+            p->x = p->anc->x + 1;
+        }
+
+    /* mark the free nodes and calculate the total score */
+    cumulativeProb = 0.0; 
+    for (i=0; i<t->nNodes-2; i++)
+        {
+        p = t->allDownPass[i];
+        if (p != c && p->anc->x > 0 && c->anc->nodeDepth > p->nodeDepth + minV && p->anc->nodeDepth > c->nodeDepth + minV)
+            {
+            p->y = YES;
+            p->d = pow(0.5 * extensionProb, p->anc->x);
+            cumulativeProb += p->d;
+            }
+        else
+            p->d = 0.0;
+        }
+
+    /* calculate second backward prob */
+    backwardProb += a->d / cumulativeProb;
+
+    /* now we can calculate proposal ratio */
+    (*lnProposalRatio) += log (backwardProb / forwardProb);
+
+    /* adjust for number of free nodes */
+    numFreeNew = t->nNodes-2;
+    if (t->nConstraints > 1)
+        {
+        numFreeNew = 0;
+        for (i=0; i<t->nNodes-2; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc->left == p)
+                q = p->anc->right;
+            else
+                q = p->anc->left;
+            if (p->anc->isLocked == NO || q->isLocked == NO)
+                numFreeNew++;
+            }
+        (*lnProposalRatio) += log(numFreeOld / numFreeNew);
+        }
+
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+
+            /* proposal ratio */
+            (*lnProposalRatio) += nEvents[a->index] * log (a->length / oldALength);
+            (*lnProposalRatio) += nEvents[c->index] * log (c->length / oldCLength);
+
+            /* prior ratio: no effect because tree length is the same */
+
+            /* update effective evolutionary lengths */
+            if (UpdateCppEvolLengths (subParm, a, chain) == ERROR || UpdateCppEvolLengths (subParm, c, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+
+            /* no proposal ratio effect */
+
+            /* prior ratio and update of effective evolutionary lengths */
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[c->anc->index], nu*oldALength, tk02Rate[a->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[a->anc->index], nu* a->length, tk02Rate[a->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[a->anc->index], nu*oldCLength, tk02Rate[c->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[c->anc->index], nu* c->length, tk02Rate[c->index]);
+            brlens[a->index] = a->length * (tk02Rate[a->index] + tk02Rate[a->anc->index])/2.0;
+            brlens[c->index] = c->length * (tk02Rate[c->index] + tk02Rate[c->anc->index])/2.0;
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            /* get relevant parameters */
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+
+            /* prior ratio and update of effective evolutionary lengths */
+            (*lnPriorRatio) -= LnProbGamma (oldALength/igrvar, oldALength/igrvar, igrRate[a->index]);
+            (*lnPriorRatio) -= LnProbGamma (oldCLength/igrvar, oldCLength/igrvar, igrRate[c->index]);
+            (*lnPriorRatio) += LnProbGamma (a->length /igrvar, a->length /igrvar, igrRate[a->index]);
+            (*lnPriorRatio) += LnProbGamma (c->length /igrvar, c->length /igrvar, igrRate[c->index]);
+            brlens[a->index] = igrRate[a->index] * a->length;
+            brlens[c->index] = igrRate[c->index] * c->length;
+            }
+        }
+    
+    assert (*lnPriorRatio == *lnPriorRatio);
+
+    return (NO_ERROR);
+}
+
+
+int Move_ExtTBR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology (and branch lengths) using TBR with extension probability. */
+
+    /* This move picks an internal branch and two "danglies", modifies their lengths
+       independently according to the method of Larget & Simon (1999: MBE); it then
+       moves the danglies away from their original position one node at a time with
+       a probability determined by the extensionProb parameter. When the danglies are moved,
+       their direction is changed -- "reflection" necessary to enable the back move.
+
+       This move type has been tested on all combinations of rooted and unrooted,
+       constrained and unconstrained trees */
+    
+    int         i, j, topologyHasChanged, nCrownNodes, nRootNodes, directionLeft, directionUp, 
+                isVPriorExp, alwaysMoveRoot, isCrownStartConstrained, isRootStartConstrained, isStopConstrained;
+    MrBFlt      m, x, y, tuning, maxV, minV, extensionProb, brlensExp=0.0;
+    TreeNode    *p, *a, *b, *c, *d, *u, *v;
+    Tree        *t;
+    ModelParams *mp;
+
+    /* these parameters should be possible to set by user */
+    extensionProb = mvp[0]; /* extension probability */
+    tuning = mvp[1];        /* Larget & Simon's tuning parameter lambda */
+    
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+
+    topologyHasChanged = NO;
+
+#   if defined (DEBUG_ExtTBR)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+#   endif
+    
+    /* pick an internal branch */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed) * (t->nIntNodes-1))];
+        if (p->anc->left == p)
+            a = p->anc->right;
+        else
+            a = p->anc->left;
+        i = j = 0;
+        if (a->isLocked == YES || a->left == NULL)
+            i++;
+        if (p->anc->isLocked == YES || p->anc->anc->anc == NULL)
+            i++;
+        if (p->left->isLocked == YES || p->left->left == NULL)
+            j++;
+        if (p->right->isLocked == YES || p->right->left == NULL)
+            j++;
+        } while (i == 2 && j == 2);
+
+    /* determine whether to move first step unconditionally in root or in crown */
+    if (j == 2)
+        alwaysMoveRoot = YES;
+    else if (i == 2)
+        alwaysMoveRoot = NO;
+    else if (RandomNumber(seed) < 0.5)
+        alwaysMoveRoot = YES;
+    else
+        alwaysMoveRoot = NO;
+
+    /* determine any starting constraints */
+    isCrownStartConstrained = isRootStartConstrained = NO;
+    if (i >= 1)
+        isRootStartConstrained = YES;
+    if (j >= 1)
+        isCrownStartConstrained = YES;
+
+    /* set up pointers for nodes around the picked branch */
+    /* cut the tree into crown, root and attachment part */
+    /* change the relevant lengths in the attachment part */
+    /* the lengths of a and v are automatically contained in the */
+    /* "attachment" part but the length of c has to be stored in x */
+    v = p;
+    u = p->anc;
+
+    /* set up pointers for crown part */
+    /* also determine direction of move in crown part */
+    if (v->right->left == NULL || v->right->isLocked == YES)
+        directionLeft = YES;
+    else if (v->left->left == NULL || v->left->isLocked == YES)
+        directionLeft = NO;
+    else if (RandomNumber(seed) < 0.5)
+        directionLeft = YES;
+    else
+        directionLeft = NO;
+    if (directionLeft == YES)
+        {
+        c = v->left;
+        d = v->right;
+        }
+    else
+        {
+        c = v->right;
+        d = v->left;
+        }
+
+    /* cut and reconnect crown part */
+    c->anc = d;
+    d->anc = c;
+    
+    /* record c length and adjust with multiplier using reflection */
+    m = c->length;
+    x = c->length * exp(tuning * (RandomNumber(seed) - 0.5));       /* save the modified dangling branch for later use */
+    while (x < minV || x > maxV)
+        {
+        if (x < minV) x = minV * minV / x;
+        if (x > maxV) x = maxV * maxV / x;
+        }
+    
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) = log (x / m);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) = brlensExp * (m - x);
+
+    /* record v length and adjust with multiplier using reflection*/
+    m = v->length;
+    v->length *= exp(tuning * (RandomNumber(seed) - 0.5));
+    while (v->length < minV || v->length > maxV)
+        {
+        if (v->length < minV)
+            v->length = minV * minV / v->length;
+        else if (v->length > maxV)
+            v->length = maxV * maxV / v->length;
+        }
+    v->upDateTi = YES;
+
+    /* adjust proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (v->length / m);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (m - v->length);
+
+    /* mark nodes in root part */
+    /* also determine direction of move in root part */
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    if (u->anc->anc == NULL || u->isLocked == YES)
+        directionUp = YES;
+    else if (a->left == NULL || a->isLocked == YES)
+        directionUp = NO;
+    else if (RandomNumber(seed) < 0.5)
+        directionUp = YES;
+    else
+        directionUp = NO;
+    if (directionUp == NO)
+        {
+        /* switch a and b */
+        b = a;
+        a = u->anc;
+        }
+
+    /* cut root part */
+    if (directionUp == NO)
+        {
+        b->anc = a;
+        if (a->left == u)
+            a->left = b;
+        else
+            a->right = b;
+        }
+    else 
+        {
+        a->anc = b;
+        if (b->left == u)
+            b->left = a;
+        else
+            b->right = a;
+        y = a->length;
+        a->length = u->length;
+        u->length = y;
+        a->upDateTi = YES;
+        }
+
+    /* adjust length of branch to be modified */
+    /* if it is not the root branch of a rooted tree */
+    if (t->isRooted == NO || u->anc->anc != NULL) 
+        {
+        m = u->length;
+        u->length *= exp(tuning * (RandomNumber(seed) - 0.5));
+        while (u->length < minV || u->length > maxV)
+            {
+            if (u->length < minV)
+                u->length = minV * minV / u->length;
+            else if (u->length > maxV)
+                u->length = maxV * maxV / u->length;
+            }
+
+        /* adjust proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (u->length / m);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (m - u->length);
+        }
+    u->upDateTi = YES;
+
+    /* move around in root subtree */
+    for (nRootNodes=0; (alwaysMoveRoot == YES && nRootNodes == 0) || RandomNumber(seed) < extensionProb; nRootNodes++)
+        {
+        if (directionUp == YES) 
+            {   /* going up tree */
+            if (a->left == NULL || a->isLocked == YES)
+                break;      /* can't go further */
+            topologyHasChanged = YES;
+            b = a;
+            if (RandomNumber(seed) < 0.5)
+                a = a->left;
+            else
+                a = a->right;
+            if (u->isLocked == YES)
+                {
+                b->isLocked = YES;
+                u->isLocked = NO;
+                b->lockID = u->lockID;
+                u->lockID = 0;
+                }
+            }
+        else 
+            {   /* going down tree */
+            if (a->anc == NULL || u->isLocked == YES)
+                break;      /* can't go further */
+            topologyHasChanged = YES;
+            if (RandomNumber(seed)<0.5) 
+                {
+                directionUp = YES; /* switch direction */
+                /* find sister of a */
+                if (a->left == b) 
+                    {
+                    b = a;
+                    a = a->right;
+                    }
+                else 
+                    {  
+                    b = a;
+                    a = a->left;
+                    }
+                /* as long as we are moving upwards
+                the cond likes to update will be
+                flagged by the last pass from u to the root */
+                }   
+            else 
+                {   /* continue down */
+                b = a;
+                a = a->anc;
+                b->upDateCl = YES; 
+                if (b->isLocked == YES)
+                    {
+                    u->isLocked = YES;
+                    b->isLocked = NO;
+                    u->lockID = b->lockID;
+                    b->lockID = 0;
+                    }
+                }
+            }
+        }
+
+    /* adjust proposal ratio for root move if unbalanced */
+    isStopConstrained = NO;
+    if (directionUp == YES && (a->left == NULL || a->isLocked == YES))
+        isStopConstrained = YES;
+    if (directionUp == NO && (a->anc  == NULL || u->isLocked == YES))
+        isStopConstrained = YES;
+    if (nRootNodes > 0)
+        {
+        if (isRootStartConstrained == YES && isStopConstrained == NO)
+            (*lnProposalRatio) -= log (2.0 * (1.0 - extensionProb));
+        else if (isRootStartConstrained == NO && isStopConstrained == YES)
+            (*lnProposalRatio) += log (2.0 * (1.0 - extensionProb));
+        }
+
+    /* move around in crown subtree */
+    for (nCrownNodes=0; (alwaysMoveRoot == NO && nCrownNodes == 0) || RandomNumber(seed) < extensionProb; nCrownNodes++)
+        {
+        if (c->left == NULL || c->isLocked == YES)
+            break;  /* can't go further */
+        topologyHasChanged = YES;
+        if (RandomNumber(seed) < 0.5) 
+            {
+            /* rotate c anticlockwise - prepare pointers for move left */
+            c->anc = c->left;  /* the root will be in the direction we are heading */
+            c->left = c->right;
+            c->right = d;
+            }
+        else 
+            {
+            /* rotate c clockwise - prepare pointers for move right */
+            c->anc = c->right;  /* the root will be in the direction we are heading */
+            c->right = c->left;
+            c->left = d;  
+            }
+        /* OK - let's move!; c->anc points in the right direction
+        don't forget to move the branch lengths as well */
+        d = c;
+        c = c->anc;
+        d->length = c->length;
+        d->upDateCl = YES; 
+        d->upDateTi = YES;
+        }
+
+    /* adjust proposal ratio for crown move if unbalanced */
+    isStopConstrained = NO;
+    if (c->left == NULL || c->isLocked == YES)
+        isStopConstrained = YES;
+    if (nCrownNodes > 0)
+        {
+        if (isCrownStartConstrained == YES && isStopConstrained == NO)
+            (*lnProposalRatio) -= log (2.0 * (1.0 - extensionProb));
+        else if (isCrownStartConstrained == NO && isStopConstrained == YES)
+            (*lnProposalRatio) += log (2.0 * (1.0 - extensionProb));
+        }
+
+    /* combine the subtrees */
+    c->anc = v;
+    d->anc = v;
+    if (directionLeft == YES) 
+        {
+        v->left = c;
+        v->right = d;
+        }
+    else 
+        {
+        v->left = d;
+        v->right = c;
+        }
+
+    /* the dangling branch is inserted in reverted position
+       such that the back move will be possible
+       if we have moved around in crown subtree
+       otherwise it is left in its original position */
+    if (nCrownNodes > 0)
+        {
+        d->length = x;
+        d->upDateTi = YES;
+        }
+    else
+        {
+        c->length = x;
+        c->upDateTi = YES;
+        }
+
+    if (directionUp == YES) 
+        {
+        u->anc = b;
+        if (u->left == v)
+            u->right = a;
+        else 
+            u->left = a;
+        a->anc = u;
+        if (b->left == a)
+            b->left = u;
+        else
+            b->right = u;
+        /* the dangling branch is contained in u->length
+           and will automatically be inserted in the right position
+           to enable the back move regardless of whether it was
+           initially directed upwards or downwards
+           BUT if we haven't moved in root subtree, it is advantageous (necessary
+           for rooted trees) to avoid switching branches, which occurs otherwise
+           if directionUp == YES */
+        if (nRootNodes == 0) 
+            {
+            y = u->length;
+            u->length = a->length;
+            a->length = y;
+            a->upDateTi = YES;
+            u->upDateTi = NO;   /* u retains its old length */
+            }
+        }
+    else 
+        {
+        u->anc = a;
+        if (u->left == v)
+            u->right = b;
+        else
+            u->left = b;
+        b->anc = u;
+        if (a->left == b)
+            a->left = u;
+        else
+            a->right = u;
+        /* the modified branch contained in u->length will have
+           to be moved to b->length to enable back move
+           BUT if we haven't moved, it is better to keep it in place
+           (necessary for rooted trees) */
+        if (nRootNodes > 0) 
+            {
+            y = u->length;
+            u->length = b->length;
+            b->length = y;
+            b->upDateTi = YES;
+            }
+        }
+        
+    /* set flags for update of cond likes from v and down to root */
+    p = v;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+    
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+
+#   if defined (DEBUG_ExtTBR)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  c: %d  d: %d  a: %d  b: %d\n",v->index, u->index, 
+            c->index, d->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("No. nodes moved in crown subtree: %d\n",nCrownNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_GeneRate_Dir: Change gene rate multiplier using Dirichlet
+|      proposal.
+|
+----------------------------------------------------------------*/
+int Move_GeneRate_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, nRates, isValid;
+    MrBFlt      alphaPi, *value, *subValue, numSites, *alphaDir, x, y, sum,
+                rate_pot, *dirParm, *oldRate, *newRate;
+
+    /* allocate memory */
+    dirParm = (MrBFlt *) SafeCalloc (3*(numTopologies-1), sizeof(MrBFlt));
+    oldRate = dirParm + numCurrentDivisions;
+    newRate = dirParm + 2*numCurrentDivisions;
+
+    /* get number of rates */
+    nRates = param->nValues;
+
+    /* get pointer to rates and number of uncompressed chars */
+    value = GetParamVals(param, chain, state[chain]);
+    subValue = GetParamSubVals(param, chain, state[chain]);
+
+    /* get Dirichlet parameters */
+    alphaDir = subValue + nRates;
+
+    /* calculate old ratesum proportions */
+    numSites = 0.0;
+    for (i=0; i<nRates; i++)
+        numSites += subValue[i];  /* numSites should be equal to the number of sites */
+    for (i=0; i<nRates; i++)
+        oldRate[i] = value[i] * subValue[i] / numSites;
+    
+    /* get so called alphaPi parameter */
+    alphaPi = mvp[0] * nRates;
+    
+    /* multiply old ratesum proportions with some large number to get new values close to the old ones */
+    for (i=0; i<nRates; i++)
+        dirParm[i] = oldRate[i] * alphaPi;
+    
+    /* get new values */
+    DirichletRandomVariable (dirParm, newRate, nRates, seed);
+
+    /* check new values. we rely on newRate be already normalized  */
+    while (1)
+        {
+        sum = 0.0;
+        rate_pot = 1.0;
+        isValid=1;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i] <= DIR_MIN)
+                {
+                if (newRate[i] < DIR_MIN)
+                    {
+                    newRate[i] = DIR_MIN;
+                    isValid=0;
+                    }
+                rate_pot -= DIR_MIN;
+                }
+            else
+                sum += newRate[i];
+            }
+        if (isValid==1) break;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i]!=DIR_MIN)
+                newRate[i] = rate_pot * newRate[i] / sum;
+            }
+        }
+
+    /* calculate and copy new rate ratio values back */
+    for (i=0; i<nRates; i++)
+        value[i] = newRate[i] * (numSites / subValue[i]);
+    
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += newRate[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        x -= LnGamma(newRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        x += (newRate[i]*alphaPi-1.0)*log(oldRate[i]);
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += oldRate[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        y -= LnGamma(oldRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        y += (oldRate[i]*alphaPi-1.0)*log(newRate[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    x = y = 0.0;
+    for (i=0; i<nRates; i++)
+        x += (alphaDir[i]-1.0)*log(newRate[i]);
+    for (i=0; i<nRates; i++)
+        y += (alphaDir[i]-1.0)*log(oldRate[i]);
+    (*lnPriorRatio) = x - y;
+
+    /* Set update flags for all partitions that share the rate multiplier. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* may need to hit update flag for cijks when you have a covarion model */
+    for (i=0; i<param->nRelParts; i++)
+        if (modelSettings[param->relParts[i]].nCijkParts > 1)
+            modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    free (dirParm);
+
+    return (NO_ERROR);
+}
+
+
+int Move_RateShape_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change gamma/lnorm shape parameter using multiplier */
+    
+    int         i, isAPriorExp, isValidA;
+    MrBFlt      oldA, newA, minA, maxA, alphaExp=0.0, ran, factor, tuning, *rates;
+    ModelParams *mp;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get minimum and maximum values for alpha */
+    if (param->paramId == SHAPE_UNI)
+        {
+        minA = mp->shapeUni[0];
+        maxA = mp->shapeUni[1];
+        if (minA < MIN_SHAPE_PARAM)
+            minA = MIN_SHAPE_PARAM;
+        if (maxA > MAX_SHAPE_PARAM)
+            maxA = MAX_SHAPE_PARAM;
+        isAPriorExp = NO;
+        }
+    else
+        {
+        minA = MIN_SHAPE_PARAM;
+        maxA = MAX_SHAPE_PARAM;
+        alphaExp = mp->shapeExp;
+        isAPriorExp = YES;
+        }
+
+    /* get old value of alpha */
+    oldA = *GetParamVals(param, chain, state[chain]);
+
+    /* change value for alpha */
+    ran = RandomNumber(seed);
+    factor = exp(tuning * (ran - 0.5));
+    newA = oldA * factor;
+
+    /* check validity */
+    isValidA = NO;
+    do  {
+        if (newA < minA)
+            newA = minA * minA / newA;
+        else if (newA > maxA)
+            newA = maxA * maxA / newA;
+        else
+            isValidA = YES;
+        } while (isValidA == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = log(newA / oldA);
+    
+    /* get prior ratio */
+    if (isAPriorExp == NO)
+        *lnPriorRatio = 0.0;
+    else
+        *lnPriorRatio = -alphaExp * (newA - oldA);
+    
+    /* copy new alpha value back */
+    *GetParamVals(param, chain, state[chain]) = newA;
+    
+    /* now, update rate category information */
+    rates = GetParamSubVals (param, chain, state[chain]);
+    
+    if(!strcmp(mp->ratesModel, "LNorm"))
+        {
+        if (DiscreteLogNormal (rates, newA, mp->numGammaCats, 1) == ERROR)
+            return (ERROR);
+        }
+    else  /* gamma rate */
+        {
+        if (DiscreteGamma (rates, newA, newA, mp->numGammaCats, 0) == ERROR)
+            return (ERROR);
+        }
+
+    /* Set update flags for all partitions that share this alpha. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* We need to update flags when we have a covarion model */
+    for (i=0; i<param->nRelParts; i++)
+        if (modelSettings[param->relParts[i]].nCijkParts > 1)
+            modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_Growth_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    MrBFlt          oldG, newG, lambda, minG, maxG, ran, oldLnPrior, newLnPrior, curTheta;
+    ModelParams     *mp;
+    ModelInfo       *m;
+    Tree            *t;
+
+    /* get tuning parameter */
+    lambda = mvp[0];
+
+    /* get model params */
+    m = &modelSettings[param->relParts[0]];
+    mp = &modelParams[param->relParts[0]];
+    curTheta = (*GetParamVals(m->popSize, chain, state[chain])) * (*GetParamVals(m->clockRate, chain, state[chain]));
+    if (!strcmp(mp->ploidy, "Diploid"))
+        curTheta *= 4.0;
+    else if (!strcmp(mp->ploidy, "Zlinked"))
+        curTheta *= 3.0;
+    else
+        curTheta *= 2.0;
+    
+    /* get minimum and maximum values for growth */
+    minG = param->min;
+    maxG = param->max;
+    
+    /* get old value of theta */
+    newG = oldG = *GetParamVals(param, chain, state[chain]);
+    if (newG < minG)
+        newG = oldG = minG;
+
+    /* change value of growth */
+    ran = RandomNumber(seed);
+    newG = oldG * exp (lambda * (ran - 0.5));
+    
+    /* check that new value is valid */
+    while (newG < minG || newG > maxG)
+        {
+        if (newG < minG)
+            newG = minG * minG / newG;
+        else if (newG > maxG)
+            newG = maxG * maxG / newG;
+        }
+    
+    /* get proposal ratio */
+    (*lnProposalRatio) = log (newG / oldG);
+    
+    /* get prior ratio */
+    t = GetTree(modelSettings[param->relParts[0]].brlens,chain,state[chain]);
+    if (LnCoalescencePriorPr (t, &oldLnPrior, curTheta, oldG) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem calculating prior for coalescent process\n", spacer);
+        return (ERROR);
+        }
+    if (LnCoalescencePriorPr (t, &newLnPrior, curTheta, newG) == ERROR)
+        {
+        MrBayesPrint ("%s   Problem calculating prior for coalescent process\n", spacer);
+        return (ERROR);
+        }
+    (*lnPriorRatio) = newLnPrior - oldLnPrior + param->LnPriorRatio(newG, oldG, param->priorParams);
+
+    /* copy new growth value back */
+    *GetParamVals(param, chain, state[chain]) = newG;
+
+    return (NO_ERROR);
+}
+
+
+int Move_IgrBranchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move one IGR relaxed clock branch rate using multiplier */
+
+    int         i;
+    MrBFlt      newRate, oldRate, tuning, minR, maxR, igrvar, *igrRate, *brlens;
+    TreeNode    *p = NULL;
+    ModelInfo   *m;
+    Tree        *t;
+    TreeNode    *q;
+
+    /* get the tuning parameter */
+    tuning = mvp[0];
+    
+    /* get the model settings */
+    m = &modelSettings[param->relParts[0]];
+
+    /* get the IGR branch rate and effective branch length data */
+    igrRate = GetParamVals (param, chain, state[chain]);
+    brlens = GetParamSubVals (param, chain, state[chain]);
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get minimum and maximum rate */
+    minR = RATE_MIN;
+    maxR = RATE_MAX;
+    
+    /* randomly pick a branch */
+    do  {
+        i = (int) (RandomNumber(seed) * (t->nNodes -2));
+        p = t->allDownPass[i];
+        }
+    while (p->length < TIME_MIN);  // not ancestral fossil
+    
+    /* find new rate using multiplier */
+    oldRate = igrRate[p->index];
+    newRate = oldRate * exp ((0.5 - RandomNumber(seed)) * tuning);
+    
+    /* reflect if necessary */
+    while (newRate < minR || newRate > maxR)
+        {
+        if (newRate < minR)
+            newRate = minR * minR / newRate;
+        if (newRate > maxR)
+            newRate = maxR * maxR / newRate;
+        }
+    
+    igrRate[p->index] = newRate;
+
+    /* calculate prior ratio */
+    igrvar = *GetParamVals (m->igrvar, chain, state[chain]);
+    (*lnPriorRatio) = LnProbGamma (p->length/igrvar, p->length/igrvar, newRate)
+                    - LnProbGamma (p->length/igrvar, p->length/igrvar, oldRate);
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newRate / oldRate);
+    
+    /* update branch evolution lengths */
+    brlens[p->index] = newRate * p->length;
+
+    /* set update of transition probability */
+    p->upDateTi = YES;
+
+    /* set update of cond likes down to root */
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int Move_IgrBranchRate2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move one IGR relaxed clock branch rate using sliding window */
+    
+    int         i;
+    MrBFlt      newRate, oldRate, window, minR, maxR, igrvar, *igrRate, *brlens;
+    TreeNode    *p = NULL;
+    ModelInfo   *m;
+    Tree        *t;
+    TreeNode    *q;
+    
+    /* get the tuning parameter */
+    window = mvp[0];
+    
+    /* get the model settings */
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get the IGR branch rate and effective branch length data */
+    igrRate = GetParamVals (param, chain, state[chain]);
+    brlens = GetParamSubVals (param, chain, state[chain]);
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* get minimum and maximum rate */
+    minR = RATE_MIN;
+    maxR = RATE_MAX;
+    
+    /* randomly pick a branch */
+    do  {
+        i = (int) (RandomNumber(seed) * (t->nNodes -2));
+        p = t->allDownPass[i];
+        }
+    while (p->length < TIME_MIN);  // not ancestral fossil
+    
+    /* find new rate using multiplier */
+    oldRate = igrRate[p->index];
+    newRate = oldRate + window * (RandomNumber(seed) - 0.5);
+    
+    /* reflect if necessary */
+    while (newRate < minR || newRate > maxR)
+        {
+        if (newRate < minR)
+            newRate = 2 * minR - newRate;
+        if (newRate > maxR)
+            newRate = 2 * maxR - newRate;
+        }
+    
+    igrRate[p->index] = newRate;
+    
+    /* calculate prior ratio */
+    igrvar = *GetParamVals (m->igrvar, chain, state[chain]);
+    (*lnPriorRatio) = LnProbGamma (p->length/igrvar, p->length/igrvar, newRate)
+                    - LnProbGamma (p->length/igrvar, p->length/igrvar, oldRate);
+    
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = 0.0;
+    
+    /* update branch evolution lengths */
+    brlens[p->index] = newRate * p->length;
+    
+    /* set update of transition probability */
+    p->upDateTi = YES;
+    
+    /* set update of cond likes down to root */
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int Move_IgrVar (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move the variance of the IGR relaxed clock model using multiplier */
+
+    int         i, j;
+    MrBFlt      oldIgrvar, newIgrvar, minIgrvar, maxIgrvar, tuning, *igrRate;
+    Model       *mp;
+    TreeNode    *p;
+    Tree        *t;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get the min and max values */
+    minIgrvar = IGRVAR_MIN;
+    maxIgrvar = IGRVAR_MAX;
+    if (!strcmp(mp->igrvarPr,"Uniform"))
+        {
+        minIgrvar = (mp->igrvarUni[0] < IGRVAR_MIN) ? IGRVAR_MIN : mp->igrvarUni[0];
+        maxIgrvar = (mp->igrvarUni[1] > IGRVAR_MAX) ? IGRVAR_MAX : mp->igrvarUni[1];
+        }
+    
+    /* get the igr variance */
+    oldIgrvar = *GetParamVals (param, chain, state[chain]);
+
+    /* set new value */
+    newIgrvar = oldIgrvar * exp ((0.5 - RandomNumber(seed))*tuning);
+    
+    /* reflect if necessary */
+    while (newIgrvar < minIgrvar || newIgrvar > maxIgrvar)
+        {
+        if (newIgrvar < minIgrvar)
+            newIgrvar = minIgrvar * minIgrvar / newIgrvar;
+        if (newIgrvar > maxIgrvar)
+            newIgrvar = maxIgrvar * maxIgrvar / newIgrvar;
+        }
+    
+    /* store new value */
+    (*GetParamVals (param, chain, state[chain])) = newIgrvar;
+
+    /* calculate prior ratio */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        igrRate = GetParamVals (param->subParams[i], chain, state[chain]);
+        t = GetTree (param->subParams[i], chain, state[chain]);
+        for (j=0; j<t->nNodes-2; j++)
+            {
+            p = t->allDownPass[j];
+            if (p->length > 0.0)  // not ancestral fossil
+                {
+                (*lnPriorRatio) -= LnProbGamma (p->length/oldIgrvar, p->length/oldIgrvar, igrRate[p->index]);
+                (*lnPriorRatio) += LnProbGamma (p->length/newIgrvar, p->length/newIgrvar, igrRate[p->index]);
+                }
+            }
+        }
+
+    /* take prior on Igrvar into account */
+    if (!strcmp(mp->igrvarPr,"Exponential"))
+        (*lnPriorRatio) += mp->igrvarExp * (oldIgrvar - newIgrvar);
+    
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newIgrvar / oldIgrvar);
+
+    /* we do not need to update likelihoods */
+    for (i=0; i<param->nRelParts; i++)
+        {
+        modelSettings[param->relParts[i]].upDateCl = NO;
+        }
+
+    return (NO_ERROR);
+}
+
+
+int Move_MixedBranchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move one relaxed clock branch rate using multiplier */
+    
+    int         i, *rclModel=NULL;
+    MrBFlt      newRate, oldRate, tuning, minR, maxR, mxvar, *mxRate, *brlens;
+    TreeNode    *p = NULL, *q;
+    ModelInfo   *m;
+    Tree        *t;
+    
+    /* get the tuning parameter */
+    tuning = mvp[0];
+    
+    /* get the model settings */
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get the branch rate and effective branch length data */
+    mxRate = GetParamVals (param, chain, state[chain]);
+    brlens = GetParamSubVals (param, chain, state[chain]);
+    rclModel = GetParamIntVals(param, chain, state[chain]);
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* get minimum and maximum rate */
+    minR = RATE_MIN;
+    maxR = RATE_MAX;
+    
+    /* randomly pick a length */
+    do  {
+        i = (int) (RandomNumber(seed) * (t->nNodes -2));
+        p = t->allDownPass[i];
+        }
+    while (p->length < TIME_MIN);  // not ancestral fossil
+    
+    /* find new rate using multiplier */
+    oldRate = mxRate[p->index];
+    newRate = oldRate * exp ((0.5 - RandomNumber(seed)) * tuning);
+    
+    /* reflect if necessary */
+    while (newRate < minR || newRate > maxR)
+        {
+        if (newRate < minR)
+            newRate = minR * minR / newRate;
+        if (newRate > maxR)
+            newRate = maxR * maxR / newRate;
+        }
+    
+    mxRate[p->index] = newRate;
+
+    /* calculate prior ratio */
+    mxvar = *GetParamVals (m->mixedvar, chain, state[chain]);
+
+    if (*rclModel == RCL_TK02)
+        {
+        (*lnPriorRatio) += LnRatioTK02LogNormal (mxRate[p->anc->index], mxvar*p->length, newRate, oldRate);
+        if (p->left != NULL)
+            {
+            if (p->left->length > 0.0)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (oldRate, mxvar*p->left->length,  mxRate[p->left->index ]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (newRate, mxvar*p->left->length,  mxRate[p->left->index ]);
+                }
+            if (p->right->length > 0.0)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (oldRate, mxvar*p->right->length, mxRate[p->right->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (newRate, mxvar*p->right->length, mxRate[p->right->index]);
+                }
+            }
+        
+        /* update branch evolution lengths */
+        brlens[p->index] = p->length * (newRate + mxRate[p->anc->index]) / 2.0;
+        if (p->left != NULL)
+            {
+            brlens[p->left->index ] = p->left->length  * (mxRate[p->left->index ] + newRate) / 2.0;
+            brlens[p->right->index] = p->right->length * (mxRate[p->right->index] + newRate) / 2.0;
+            }
+        
+        /* set update of ti probs */
+        p->upDateTi = YES;
+        if (p->left != NULL)
+            {
+            p->left ->upDateTi = YES;
+            p->right->upDateTi = YES;
+            }
+        }
+    else if (*rclModel == RCL_IGR)
+        {
+        (*lnPriorRatio) -= LnProbGamma (p->length/mxvar, p->length/mxvar, oldRate);
+        (*lnPriorRatio) += LnProbGamma (p->length/mxvar, p->length/mxvar, newRate);
+        
+        brlens[p->index] = newRate * p->length;
+
+        /* set update of transition probability */
+        p->upDateTi = YES;
+        }
+    
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newRate / oldRate);
+    
+    /* set update of cond likes down to root */
+    p->upDateCl = YES;
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int Move_MixedVar (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move the variance of the mixed relaxed clock models using multiplier */
+
+    int         i, j, *rclModel=NULL;
+    MrBFlt      oldVar, newVar, minVar, maxVar, tuning, *igrRate, *tk02Rate;
+    Model       *mp;
+    TreeNode    *p;
+    Tree        *t;
+    
+    /* get tuning parameter */
+    tuning = mvp[0];
+    
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get the min and max values */
+    minVar = MIXEDVAR_MIN;
+    maxVar = MIXEDVAR_MAX;
+    if (!strcmp(mp->mixedvarPr,"Uniform"))
+        {
+        minVar = (mp->mixedvarUni[0] < MIXEDVAR_MIN) ? MIXEDVAR_MIN : mp->mixedvarUni[0];
+        maxVar = (mp->mixedvarUni[1] > MIXEDVAR_MAX) ? MIXEDVAR_MAX : mp->mixedvarUni[1];
+        }
+    
+    /* get the variance */
+    oldVar = *GetParamVals (param, chain, state[chain]);
+    
+    /* set new value */
+    newVar = oldVar * exp ((0.5 - RandomNumber(seed))*tuning);
+    
+    /* reflect if necessary */
+    while (newVar < minVar || newVar > maxVar)
+        {
+        if (newVar < minVar)
+            newVar = minVar * minVar / newVar;
+        if (newVar > maxVar)
+            newVar = maxVar * maxVar / newVar;
+        }
+    
+    /* store new value */
+    (*GetParamVals (param, chain, state[chain])) = newVar;
+    
+    /* calculate prior ratio */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        rclModel = GetParamIntVals (param->subParams[i], chain, state[chain]);
+
+        if (*rclModel == RCL_TK02)
+            {
+            tk02Rate = GetParamVals (param->subParams[i], chain, state[chain]);
+            t = GetTree (param->subParams[i], chain, state[chain]);
+            for (j=0; j<t->nNodes-2; j++)
+                {
+                p = t->allDownPass[j];
+                if (p->length > 0.0)  // not ancestral fossil
+                    {
+                    (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->anc->index], oldVar*p->length, tk02Rate[p->index]);
+                    (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], newVar*p->length, tk02Rate[p->index]);
+                    }
+                }
+            }
+        else if (*rclModel == RCL_IGR)
+            {
+            igrRate = GetParamVals (param->subParams[i], chain, state[chain]);
+            t = GetTree (param->subParams[i], chain, state[chain]);
+            for (j=0; j<t->nNodes-2; j++)
+                {
+                p = t->allDownPass[j];
+                if (p->length > 0.0)  // not ancestral fossil
+                    {
+                    (*lnPriorRatio) -= LnProbGamma (p->length/oldVar, p->length/oldVar, igrRate[p->index]);
+                    (*lnPriorRatio) += LnProbGamma (p->length/newVar, p->length/newVar, igrRate[p->index]);
+                    }
+                }
+            }
+        }
+
+    /* take prior on Mixedvar into account */
+    if (!strcmp(mp->mixedvarPr,"Exponential"))
+        (*lnPriorRatio) += mp->mixedvarExp * (oldVar - newVar);
+    
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newVar / oldVar);
+    
+    /* we do not need to update likelihoods */
+    for (i=0; i<param->nRelParts; i++)
+        {
+        modelSettings[param->relParts[i]].upDateCl = NO;
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int Move_RelaxedClockModel (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* rjMCMC move between TK02 (correlated lognormal) and IGR (independent gamma rate)  
+     //chi */
+    
+    int         i, *rclModel;
+    MrBFlt      *mxvar, *mxRate, *brlens, ratio, tk02var, igrvar;
+    Tree        *t;
+    TreeNode    *p = NULL;
+    ModelInfo   *m;
+    Model       *mp;
+
+    /* get model settings and parameters */
+    m = &modelSettings[param->relParts[0]];
+    mp = &modelParams[param->relParts[0]];
+    mxvar  = GetParamVals (m->mixedvar, chain, state[chain]);
+    mxRate = GetParamVals (param, chain, state[chain]);
+    brlens = GetParamSubVals (param, chain, state[chain]);
+    t = GetTree (param, chain, state[chain]);
+    
+    /* get current value of model indicator */
+    rclModel = GetParamIntVals(param, chain, state[chain]);
+
+    /* get tk02/igr var ratio */
+    ratio = mvp[0];
+
+    (*lnPriorRatio) = (*lnProposalRatio) = 0.0;
+    
+    /* rjMCMC between models: Pr(TK02) = Pr(IGR) = 1/2 */
+    /* the current model is TK02, move to IGR */
+    if ((*rclModel) == RCL_TK02)
+        {
+        /* move the var parameter */
+        tk02var = (*mxvar);
+     // ratio  *= RandomNumber(seed);
+        igrvar  = tk02var / ratio;
+        if (igrvar < IGRVAR_MIN || igrvar > IGRVAR_MAX)
+            {
+            abortMove = YES;
+            return (NO_ERROR);
+            }
+        
+        /* take prior on Mixedvar into account */
+        if (!strcmp(mp->mixedvarPr,"Exponential"))
+            (*lnPriorRatio) += mp->mixedvarExp * (tk02var - igrvar);
+
+        /* match the rates and change the effective branch lengths */
+        for (i = 0; i < t->nNodes -2; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->length > 0.0)  // not ancestral fossil
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (mxRate[p->anc->index], tk02var*p->length, mxRate[p->index]);
+                (*lnPriorRatio) += LnProbGamma (p->length/igrvar, p->length/igrvar, mxRate[p->index]);
+
+                brlens[p->index] = mxRate[p->index] * p->length;
+                }
+            }
+        
+        /* In this move, we simply match the parameters in each model,
+           the dimension is same, the Jacobian is 1/ratio. */
+        (*lnProposalRatio) -= log(ratio);
+            
+        /* switch model */
+        (*rclModel) = RCL_IGR;
+        (*mxvar) = igrvar;
+        }
+    /* the current model is IGR, move to TK02 */
+    else
+        {
+        /* move the var parameter */
+        igrvar  = (*mxvar);
+     // ratio  *= RandomNumber(seed);
+        tk02var = igrvar * ratio;
+        if (tk02var < TK02VAR_MIN || tk02var > TK02VAR_MAX)
+            {
+            abortMove = YES;
+            return (NO_ERROR);
+            }
+
+        /* take prior on Mixedvar into account */
+        if (!strcmp(mp->mixedvarPr,"Exponential"))
+            (*lnPriorRatio) += mp->mixedvarExp * (igrvar - tk02var);
+    
+        /* match the rates and change the effective branch lengths */
+        for (i = 0; i < t->nNodes -2; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->length > 0.0)  // not ancestral fossil
+                {
+                (*lnPriorRatio) -= LnProbGamma (p->length/igrvar, p->length/igrvar, mxRate[p->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (mxRate[p->anc->index], tk02var*p->length, mxRate[p->index]);
+
+                brlens[p->index] = p->length * (mxRate[p->index] + mxRate[p->anc->index]) /2.0;
+                }
+            }
+            
+        /* In this move, we simply match the parameters in each model,
+           the dimension is same, the Jacobian is ratio. */
+        (*lnProposalRatio) += log(ratio);
+            
+        /* switch model */
+        (*rclModel) = RCL_TK02;
+        (*mxvar) = tk02var;
+        }
+
+    /* since effective branch lengths are updated, we need to update likelihood calculation */
+    TouchAllTreeNodes(m, chain);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *seed); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Local: This proposal mechanism changes the topology and
+|      branch lengths of an unrooted tree using the LOCAL mech-
+|      anism described by Larget & Simon (1999):
+|
+|      Larget, B. L., and D. L. Simon. 1999. Markov chain 
+|         Monte Carlo algorithms for the Bayesian analysis 
+|         of phylogenetic trees. Molecular Biology and 
+|         Evolution 16:750-759.
+|
+|      Programmed by FR 2001-10-14 and partly rewritten 2002-02-21
+|      for more elegance and the ability to deal with rooted trees.
+|      Support for locked nodes added 2004-01-12 based on mb v2.01.
+|      Calculation of the Hastings ratio corrected 2004-07-01.
+|      Boundary conditions correctly taken care of 2004-09-29.
+|      NB! An alternative to reflection is to skip moves, which might
+|          be better for the LOCAL given the complexity of taking
+|          the boundary conditions into account
+|
+----------------------------------------------------------------*/
+int Move_Local (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         topologyHasChanged, isVPriorExp, directionUp, moveX;
+    MrBFlt      oldM, newM, x, y, newX, newY,
+                tuning, minV, maxV, brlensExp=0.0;
+    TreeNode    *v, *u, *a, *b, *c, *d;
+    Tree        *t;
+    ModelParams *mp;
+
+    tuning = mvp[0]; /* Larget & Simon's tuning parameter lambda */
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    topologyHasChanged = NO;
+
+#   if defined (DEBUG_LOCAL)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+#   endif
+    
+    /* pick an internal branch */
+    do
+        {
+        v = t->intDownPass[(int)(RandomNumber(seed)*t->nIntNodes)];
+        } while (v->anc->anc == NULL);
+        
+    /* set up pointers for crown part */
+    if (RandomNumber(seed) < 0.5)
+        {
+        c = v->left;
+        d = v->right;
+        }
+    else
+        {
+        c = v->right;
+        d = v->left;
+        }
+
+    /* set up pointers for root part */
+    u = v->anc;
+    if (RandomNumber(seed) < 0.5 || (t->isRooted == YES && u->anc->anc == NULL))
+        {
+        directionUp = YES;
+        if (u->left == v)
+            a = u->right;
+        else
+            a = u->left;
+        b = u->anc;
+        }
+    else
+        {
+        directionUp = NO;
+        if (u->left == v)
+            b = u->right;
+        else
+            b = u->left;
+        a = u->anc;
+        }
+
+    /* store old and new path length as well as old x and y */
+    oldM = c->length + v->length;
+    if (directionUp == YES)
+        {
+        oldM += a->length;
+        x = a->length;
+        }
+    else
+        {
+        oldM += u->length;
+        x = u->length;
+        }
+
+    y = x + v->length;
+
+    /* pick dangly to move */
+    if (RandomNumber(seed) < 0.5)
+        moveX = YES;
+    else
+        moveX = NO;
+
+    /* find new m value */
+    newM = exp(tuning * (RandomNumber(seed) - 0.5)) * oldM;
+
+    /* pick dangly to move and
+       pick new attachment point */
+    if (moveX == YES)
+        {
+        /* choose new x */
+
+        /* first update y */
+        newY = y * (newM / oldM);
+
+        /* find reinsertion point */
+        if (v->isLocked == YES) 
+            {
+            newX = RandomNumber(seed) *  newY;
+            }
+        else
+            {
+            newX = RandomNumber(seed) * newM;
+            }
+        }
+    else
+        {
+        /* choose new y */
+
+        /* first update x */
+        newX = x * (newM / oldM);
+
+        /* find reinsertion point */
+        if (v->isLocked == YES)
+            {
+            newY = RandomNumber(seed) * (newM - newX) + newX;
+            }
+        else
+            {
+            newY = RandomNumber(seed) * newM;
+            }
+        }
+
+    /* adjust proposal and prior ratio based on length modification */
+    /* and insertion mechanism */   
+    (*lnProposalRatio) += 3.0 * log (newM / oldM);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) = brlensExp * (oldM - newM);
+
+    /* make topology move if necessary and then set branch lengths */
+    if (newX > newY)
+        {
+        /* check if we need to abort */
+        if (newY < minV || newY > maxV || (newX-newY) < minV || (newX-newY) > maxV || (newM-newX) < minV || (newM-newX) > maxV)
+            {
+            abortMove = YES;
+            return NO_ERROR;
+            }
+
+        /* topology has changed */
+        topologyHasChanged = YES;
+        /* detach v and d */
+        /* this scheme differs from that used by Larget and Simon but is more
+           convenient because it avoids tree rotations */
+        if (u->left == v)
+            u->left = c;
+        else
+            u->right = c;
+        c->anc = u;
+        if (directionUp == YES)
+            {
+            /* place v and d below a */
+            if (v->left == d)
+                v->right = a;
+            else
+                v->left = a;
+            a->anc = v;
+            if (u->left == a)
+                u->left = v;
+            else
+                u->right = v;
+            /* v->anc is already u */
+            /* adjust lengths */
+            c->length = newM - newX;
+            v->length = newX - newY;
+            a->length = newY;
+            }
+        else
+            {
+            /* place v and d below u */
+            if (u->isLocked == YES)
+                {
+                v->isLocked = YES;
+                u->isLocked = NO;
+                v->lockID = u->lockID;
+                u->lockID = 0;
+                }
+            if (v->left == d)
+                v->right = u;
+            else
+                v->left = u;
+            u->anc = v;
+            v->anc = a;
+            if (a->left == u)
+                a->left = v;
+            else
+                a->right = v;
+            /* adjust lengths */
+            c->length = newM - newX;
+            u->length = newX - newY;
+            v->length = newY;
+            }
+        }
+    else
+        {
+        /* check if we need to abort */
+        if (newX < minV || newX > maxV || (newY-newX) < minV || (newY-newX) > maxV || (newM-newY) < minV || (newM-newY) > maxV)
+            {
+            abortMove = YES;
+            return NO_ERROR;
+            }
+
+        /* topology has not changed */
+        c->length = newM - newY;
+        v->length = newY - newX;
+        if (directionUp == YES)
+            a->length = newX;
+        else
+            u->length = newX;
+        }
+                
+    /* set update of transition probs */
+    c->upDateTi = YES;
+    v->upDateTi = YES;
+    if (directionUp == YES)
+        a->upDateTi = YES;
+    else
+        u->upDateTi = YES;
+        
+    /* set flags for update of cond likes from v and u down to root */
+    v->upDateCl = YES; 
+    u->upDateCl = YES; 
+    if (directionUp == YES)
+        v = b;
+    else
+        v = a;
+    while (v->anc != NULL)
+        {
+        v->upDateCl = YES; 
+        v = v->anc;
+        }
+
+    /* get downpass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+        
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+#   if defined (DEBUG_LOCAL)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, NO);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  c: %d  d: %d  a: %d  b: %d\n",v->index, u->index, 
+            c->index, d->index, a->index, b->index);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_LocalClock: This proposal mechanism changes the topology and
+|      branch lengths of a rooted tree using the LOCAL (clock) mech-
+|      anism described by Larget & Simon (1999):
+|
+|      Larget, B. L., and D. L. Simon. 1999. Markov chain 
+|         Monte Carlo algorithms for the Bayesian analysis 
+|         of phylogenetic trees. Molecular Biology and 
+|         Evolution 16:750-759.
+|
+|      Programmed by JH 2002-07-07
+|      Modified by FR 2004-05-22 to handle locked and dated trees
+|      Modified by FR 2005-11-09 to take care of erroneous
+|           Hastings ratio. The fix implemented here results in
+|           a move that does not change tree height.
+|
+----------------------------------------------------------------*/
+int Move_LocalClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i, topologyHasChanged, vIsRoot, aSister, bSister, cSister, *nEvents;
+    MrBFlt          x, y, h1, h2, h3, h[3], tempD, ran, distUv, distCv,
+                    oldALength, oldBLength, oldCLength, oldULength, oldVLength, lambda, nu,
+                    *tk02Rate=NULL, *brlens, oldTreeLength, newTreeLength;
+ // MrBFlt          newDepth, oldDepth, factor, diff;
+    TreeNode        *u, *v, *w=NULL, *a, *b, *c, *deepestChild, *p;
+    Tree            *t;
+    Param           *subParm;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+#if defined (DEBUG_LOCAL)
+    /* check branch lengths and node depths */
+    for (i=0; i<t->nNodes-2; i++) {
+        p = t->allDownPass[i];
+        /* the two checkings don't consider ancestral fossil (brl=0) in fossilized bd tree */
+        if (p->length < minV) {
+            printf ("%s   ERROR when entering LocalClock: node %d has length %lf", spacer, p->index, p->length);
+            return ERROR;
+        }
+        if (p->nodeDepth >= p->anc->nodeDepth) {
+            printf ("%s   ERROR when entering LocalClock: node %d has depth %lf larger than its ancestor %d depth %lf", spacer, p->index, p->nodeDepth, p->anc->index, p->anc->nodeDepth);
+            return ERROR;
+        }
+    }
+#endif
+
+    topologyHasChanged = NO;
+
+#   if defined (DEBUG_LOCAL)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+#   endif
+
+    /* set up pointers */
+    do
+        {
+        u = t->intDownPass[(int)(RandomNumber(seed)*(t->nIntNodes-1))];
+        } while (u->anc->anc == NULL);
+    v = u->anc;
+    a = u->left;
+    b = u->right;
+    if (v->left == u)
+        c = v->right;
+    else
+        c = v->left;
+    vIsRoot = NO;
+    if (v->anc->anc != NULL)
+        w = v->anc;
+    else
+        vIsRoot = YES;
+    
+    oldALength = a->length;
+    oldBLength = b->length;
+    oldCLength = c->length;
+    oldVLength = v->length;
+    oldULength = u->length;
+    oldTreeLength = TreeLength (param, chain);
+        
+    /* get distances from root of move (w or v) to nodes a, b, and c */
+    if (vIsRoot == NO)
+        h1 = h2 = h3 = v->length;
+    else
+        h1 = h2 = h3 = 0.0;
+    h1 += u->length + a->length;
+    h2 += u->length + b->length;
+    h3 += c->length;
+    h[0] = h1;
+    h[1] = h2;
+    h[2] = h3;
+    
+    /* we also need the distances between u <-> v and c <-> v to calculate the hastings' term */
+    distUv = u->length;
+    distCv = c->length;
+        
+    /* sort distances (simply make three comparisons and swap values, if necessary) */
+    if (h[0] > h[1])
+        {
+        tempD = h[1];
+        h[1] = h[0];
+        h[0] = tempD;
+        }
+    if (h[0] > h[2])
+        {
+        tempD = h[2];
+        h[2] = h[0];
+        h[0] = tempD;
+        }
+    if (h[1] > h[2])
+        {
+        tempD = h[2];
+        h[2] = h[1];
+        h[1] = tempD;
+        }
+        
+    /* Find the child node (a, b, or c) that is closest to the root (i.e., has smallest h_i; i=1,2,3). This
+       part deals with the possibility that some of the nodes are at the same nodeDepth and randomly assigns
+       a node to be deepest in case of ties. */
+    if (AreDoublesEqual (h1, h2, 0.00000001) == YES && AreDoublesEqual (h1, h3, 0.00000001) == YES && AreDoublesEqual (h2, h3, 0.00000001) == YES)
+        {
+        ran = RandomNumber(seed);
+        if (ran < 0.33333333)
+            deepestChild = a;
+        else if (ran > 0.66666666)
+            deepestChild = b;
+        else
+            deepestChild = c;
+        }
+    else if (AreDoublesEqual (h1, h2, 0.00000001) == YES && AreDoublesEqual (h1, h3, 0.00000001) == NO && AreDoublesEqual (h2, h3, 0.00000001) == NO)
+        {
+        if (h1 < h3)
+            {
+            ran = RandomNumber(seed);
+            if (ran < 0.5)
+                deepestChild = a;
+            else
+                deepestChild = b;
+            }
+        else
+            deepestChild = c;
+        }
+    else if (AreDoublesEqual (h1, h2, 0.00000001) == NO && AreDoublesEqual (h1, h3, 0.00000001) == YES && AreDoublesEqual (h2, h3, 0.00000001) == NO)
+        {
+        if (h1 < h2)
+            {
+            ran = RandomNumber(seed);
+            if (ran < 0.5)
+                deepestChild = a;
+            else
+                deepestChild = c;
+            }
+        else
+            deepestChild = b;
+        }
+    else if (AreDoublesEqual (h1, h2, 0.00000001) == NO && AreDoublesEqual (h1, h3, 0.00000001) == NO && AreDoublesEqual (h2, h3, 0.00000001) == YES)
+        {
+        if (h2 < h1)
+            {
+            ran = RandomNumber(seed);
+            if (ran < 0.5)
+                deepestChild = b;
+            else
+                deepestChild = c;
+            }
+        else
+            deepestChild = a;
+        }
+    else
+        {
+        if (h1 < h2 && h1 < h3)
+            deepestChild = a;
+        else if (h2 < h1 && h2 < h3)
+            deepestChild = b;
+        else
+            deepestChild = c;
+        }
+    
+    /* get x and y */
+    /* for most of the branches, the proposal ratio is 0.0 so it makes sense to set this first */
+    (*lnProposalRatio) = 0.0;
+    if (u->isDated == YES && v->isDated == YES)
+        {
+        /* this proposal is wasted, change nothing */
+        if (vIsRoot == NO)
+            {
+            y = v->length;
+            x = y + u->length;
+            }
+        else
+            {
+            y = 0.0;
+            x = u->length;
+            }
+        }
+    else if (u->isDated == YES && v->isDated == NO)
+        {
+        /* we can only change the position of v */
+        if (vIsRoot == NO)
+            {
+            /* the upper limit of v's height is determined either by u-length + v->length or by c->length + v->length (h[0]) */
+            x = v->length + u->length;
+            if (x > h[0])
+                x = h[0];
+            y = RandomNumber(seed) * x;
+            }
+        else
+            {
+            /* v is root: we leave tree height unchanged so we cannot change anything */
+            x = u->length;
+            y = 0.0;
+            }
+        }
+    else if (u->isDated == NO && v->isDated == YES)
+        {
+        /* we can only change the position of u */
+        if (vIsRoot == NO)
+            y = v->length;
+        else
+            y = 0.0;
+        if (u->isLocked == YES)
+            {
+            if (h1 > h2)
+                {
+                x = y + RandomNumber(seed) * (h2 - y);
+                }
+            else
+                {
+                x = y + RandomNumber(seed) * (h1 - y);
+                }
+            }
+        else
+            {
+            x = y + RandomNumber(seed) * (h[1] - y);
+            }
+        }
+    /* if we reach the statements down here, neither u nor v is dated */
+    else if (u->isLocked == YES)
+        {
+        if (h1 > h2)
+            {
+            y = RandomNumber(seed) * h[0];
+            x = y + RandomNumber(seed) * (h2 - y);
+            }
+        else
+            {
+            y = RandomNumber(seed) * h[0];
+            x = y + RandomNumber(seed) * (h1 - y);
+            }
+        }
+    else if (vIsRoot == NO)
+        {
+        /* this is the standard variant for nonroot v */
+        x = RandomNumber(seed) * h[1];
+        y = RandomNumber(seed) * h[0];
+        }
+    else
+        {
+        /* this is the standard variant when v is the root */
+        /*oldDepth = t->root->left->nodeDepth;
+          factor = exp((RandomNumber(seed) - 0.5) * 2.0 * log(1.2));
+          t->root->left->nodeDepth = newDepth =  factor * h[0] - h[0] + oldDepth;
+          adjust h[0], h[1], and h[2] 
+          diff = newDepth - oldDepth;
+          h[0] += diff;
+          h[1] += diff;
+          h[2] += diff;*/
+        /* set y to 0.0 and select new x */
+        y = 0.0;
+        x = RandomNumber(seed) * h[1];
+        /* Adjust proposal ratio. We deal with topology bias below. Note that this
+           proposal ratio is very different from what appeared in Larget and Simon */
+        /*(*lnProposalRatio) += (t->nIntNodes-1) * log(oldDepth / newDepth);*/
+        /*(*lnProposalRatio) += 2.0 * log (factor);*/
+        }
+        
+    /* decide which topology we will construct (cSister is what we started with) */
+    aSister = bSister = cSister = NO;
+    /* if u is locked then we cannot change topology */
+    if (u->isLocked == YES)
+        cSister = YES;
+    else if (MaximumValue (x, y) < h[0])
+        {
+        ran = RandomNumber(seed);
+        if (ran < 0.33333333)
+            aSister = YES;
+        else if (ran > 0.66666666)
+            bSister = YES;
+        else 
+            cSister = YES;
+        }
+    else
+        {
+        if (deepestChild == a)
+            aSister = YES;
+        else if (deepestChild == b)
+            bSister = YES;
+        else 
+            cSister = YES;
+        }
+    
+    /* adjust lengths of nodes u and v */
+    u->length = MaximumValue (x, y) - MinimumValue (x, y);
+    v->length = MinimumValue (x, y);
+    if (vIsRoot == NO)
+        v->nodeDepth = w->nodeDepth - v->length;
+    u->nodeDepth = v->nodeDepth - u->length;
+    
+    /* adjust pointers and lengths of nodes a, b, and c */
+    topologyHasChanged = NO;
+    if (cSister == YES)
+        {
+        if (v->left == u)
+            v->right = c;
+        else
+            v->left = c;
+        u->left = a;
+        u->right = b;
+        a->anc = b->anc = u;
+        c->anc = v;
+        a->length = u->nodeDepth - a->nodeDepth;
+        b->length = u->nodeDepth - b->nodeDepth;
+        c->length = v->nodeDepth - c->nodeDepth;
+        }
+    else if (bSister == YES)
+        {
+        if (v->left == u)
+            v->right = b;
+        else
+            v->left = b;
+        u->left = a;
+        u->right = c;
+        a->anc = c->anc = u;
+        b->anc = v;
+        a->length = u->nodeDepth - a->nodeDepth;
+        b->length = v->nodeDepth - b->nodeDepth;
+        c->length = u->nodeDepth - c->nodeDepth;
+        topologyHasChanged = YES;
+        }
+    else if (aSister == YES)
+        {
+        if (v->left == u)
+            v->right = a;
+        else
+            v->left = a;
+        u->left = b;
+        u->right = c;
+        b->anc = c->anc = u;
+        a->anc = v;
+        a->length = v->nodeDepth - a->nodeDepth;
+        b->length = u->nodeDepth - b->nodeDepth;
+        c->length = u->nodeDepth - c->nodeDepth;
+        topologyHasChanged = YES;
+        }
+
+    /* check that all branch lengths are good */
+    if (a->length < 0.0 && b->length < 0.0 && c->length < 0.0 && u->length < 0.0 && v->length < 0.0)
+        {
+        abortMove = YES;
+        return NO_ERROR;
+        }
+
+    /* calculate the proposal ratio due to asymmetric topology changes */
+    if (u->isLocked == NO)
+        {
+        if (v->isDated == YES || vIsRoot == YES)
+            {
+            if (distUv > distCv && MaximumValue (x, y) < h[0])
+                (*lnProposalRatio) += log(3.0);
+            else if (distUv < distCv && MaximumValue (x, y) > h[0])
+                (*lnProposalRatio) += log(1.0 / 3.0);
+            }
+        else
+            {
+            /* note that Larget and Simon did not have the correct Hastings ratio
+               for this case */
+            if (distUv > distCv && MaximumValue (x, y) < h[0])
+                (*lnProposalRatio) += log(3.0 / 2.0);
+            else if (distUv < distCv && MaximumValue (x, y) > h[0])
+                (*lnProposalRatio) += log(2.0 / 3.0);
+            }
+        }
+
+    /* set update of transition probs */
+    a->upDateTi = b->upDateTi = c->upDateTi = u->upDateTi = YES;
+    if (vIsRoot == NO)
+        v->upDateTi = YES;
+
+    /* set flags for update of cond likes from u down to root */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+        
+    /* get downpass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        GetDownPass (t);
+        
+    /* adjust proposal and prior ratio for relaxed clock models */
+    newTreeLength = TreeLength(param, chain);
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+            /* proposal ratio */
+            (*lnProposalRatio) += nEvents[a->index] * log (a->length / oldALength);
+            (*lnProposalRatio) += nEvents[b->index] * log (b->length / oldBLength);
+            (*lnProposalRatio) += nEvents[c->index] * log (c->length / oldCLength);
+            (*lnProposalRatio) += nEvents[u->index] * log (u->length / oldULength);
+            if (v->anc->anc != NULL && v->isDated == NO)
+                (*lnProposalRatio) += nEvents[v->index] * log (v->length / oldVLength);
+            /* prior ratio */
+            (*lnPriorRatio) += lambda * ((oldTreeLength - newTreeLength)/t->root->left->nodeDepth);
+            /* update effective evolutionary lengths */
+            if (v->anc->anc == NULL || v->isDated == YES)
+                {
+                if (UpdateCppEvolLengths (subParm, v->left, chain) == ERROR ||
+                    UpdateCppEvolLengths (subParm, v->right, chain) == ERROR)
+                    {
+                    abortMove = YES;
+                    return (NO_ERROR);
+                    }
+                }
+            else
+                {
+                if (UpdateCppEvolLengths (subParm, v, chain) == ERROR)
+                    {
+                    abortMove = YES;
+                    return (NO_ERROR);
+                    }
+                }
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            nu /= t->root->left->nodeDepth;     /* variance increase measured relative to tree height */
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            /* no proposal ratio effect */
+            /* prior ratio and update of effective evolutionary lengths */
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[u->index], nu*oldALength, tk02Rate[a->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[u->index], nu*u->left->length, tk02Rate[u->left->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[u->index], nu*oldBLength, tk02Rate[b->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[u->index], nu*u->right->length, tk02Rate[u->right->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[v->index], nu*oldCLength, tk02Rate[c->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[v->index], nu*oldULength, tk02Rate[u->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[v->index], nu*v->left->length, tk02Rate[v->left->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[v->index], nu*v->right->length, tk02Rate[v->right->index]);
+            brlens[a->index] = a->length * (tk02Rate[a->index] + tk02Rate[a->anc->index])/2.0;
+            brlens[b->index] = a->length * (tk02Rate[a->index] + tk02Rate[a->anc->index])/2.0;
+            brlens[c->index] = c->length * (tk02Rate[c->index] + tk02Rate[c->anc->index])/2.0;
+            brlens[u->index] = u->length * (tk02Rate[u->index] + tk02Rate[u->anc->index])/2.0;
+            if (v->anc->anc != NULL && v->isDated == NO)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[w->index], nu*oldVLength, tk02Rate[v->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[w->index], nu*v->length, tk02Rate[v->index]);
+                brlens[v->index] = v->length * (tk02Rate[v->index] + tk02Rate[v->anc->index])/2.0;
+                }
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            /* to do */
+            }
+        }
+
+    /* calculate and adjust prior ratio for clock tree */
+    if (LogClockTreePriorRatio (param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+    
+#   if defined (DEBUG_LOCAL)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, YES);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+
+    /* check branch lengths and node depths */
+    for (i=0; i<t->nNodes-2; i++) {
+        p = t->allDownPass[i];
+        if (p->length < minV) {
+            printf ("%s   ERROR when leaving LocalClock: node %d has length %lf", spacer, p->index, p->length);
+            return ERROR;
+        }
+        if (p->nodeDepth >= p->anc->nodeDepth) {
+            printf ("%s   ERROR when leaving LocalClock: node %d has depth %lf larger than its ancestor %d depth %lf", spacer, p->index, p->nodeDepth, p->anc->index, p->anc->nodeDepth);
+            return ERROR;
+        }
+    }
+#endif
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+#if 0
+/*--------------------------------------------------------------------
+|
+|   Move_LSPR: Change topology using move based on likelihood scores
+|
+|--------------------------------------------------------------------*/
+int Move_LSPR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change branch lengths and topology (potentially) using SPR-type move 
+       biased according to likelihood scores. NOT work for constrained trees. */
+    
+    int         i, j, n, division, topologyHasChanged, isVPriorExp, nNodes;
+    BitsLong    *pA, *pV, *pP;
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, curLength=0.0, length=0.0,
+                cumulativeProb, warpFactor, sum, ran, tuning, increaseProb, decreaseProb,
+                divFactor, nStates, rateMult, temp;
+    CLFlt       *nSitesOfPat, *globalNSitesOfPat, *tempCondLikes, **tempCondLikePtr;
+    TreeNode    *p, *q, *a, *b, *u, *v, *c=NULL, *d, *candidateNodes[20], *vLeft, *vRight;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m = NULL;
+
+    temp = mvp[0];      /* tuning parameter determining how heavily to weight according to likelihood scores */
+    var = mvp[1];       /* variance of lognormal for proposing branch lengths */
+    increaseProb = decreaseProb = mvp[2];   /* reweighting probabilities */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+#   if defined (DEBUG_MLSPR)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+#   endif
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        p->x = 0;
+        p->d = 0.0;
+        }
+
+    /* pick a random branch */
+    do
+        {
+        p = t->allDownPass[(int)(RandomNumber(seed)*(t->nNodes - 1))];
+        } while (p->anc->anc == NULL || p->anc->isLocked == YES);
+        
+    /* set up pointers for nodes around the picked branch */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    vLeft = v->left;
+    vRight = vRight;
+
+    /* store the branch lengths */
+    aLength = a->length;
+    uLength = u->length;
+    vLength = v->length;
+    if (v->left != NULL)
+        {
+        vLeftLength = v->left->length;
+        vRightLength = v->right->length;
+        }
+    else
+        vLeftLength = vRightLength = 0.0;
+
+    /* get the ML branch lengths */
+    /* set initial branch lengths */
+    /* cycle through using Newton Raphson and reoptimization a fixed number of iterations */
+    for (i=0; i<5; i++)
+        {
+        }
+    
+    /* get variance of lognormal */
+    
+    /* clip tree */
+    a->anc = b;
+    if (b->left == u)
+        b->left = a;
+    else
+        b->right = a;
+
+    /* count distance to root */
+    q = b;
+    nNodes = 0;
+    while (q->anc != NULL)
+        {
+        nNodes++;
+        q = q->anc;
+        }
+    
+    /* allocate space for temporary cond likes and condlike pointers */
+    tempCondLikes = (CLFlt *) SafeCalloc (nNodes*m->numChars*m->numModelStates, sizeof (CLFlt));
+    tempCondLikePtr = (CLFlt **) SafeCalloc (nNodes, sizeof (CLFlt *));
+    if (!tempCondLikes || !tempCondLikePtr)
+        {
+        free (tempCondLikes);
+        free (tempCondLikePtr);
+        return (ERROR);
+        }
+
+    /* shift pointers over */
+    q = b;
+    j = 0;
+    while (q->anc != NULL)
+        {
+        tempCondLikePtr[j] = m->condLike[chain][q->index][q->clSpace];
+        m->condLike[chain][q->index][q->clSpace] = tempCondLikes + j*m->numChars*m->numModelStates; 
+        j++;
+        q = q->anc;
+        }
+
+    /* set length to 0.1 for now; test ML brlen later */
+    aLength = a->length;
+    a->length = 0.1;
+    uLength = u->length;
+    u->length = 0.1;
+    vLength = v->length;
+    v->length = 0.1;
+
+    /* get downpass cond likes for the root part */
+    q = b;
+    while (q->anc != NULL)
+        m->condLikeDown (q, division, chain);
+
+    /* get final pass cond likes for the root part */
+    GetLikeFPRootPath (a);
+
+    /* get downpass parsimony states for the crown part */
+    GetParsDP (t, v, chain);
+
+    /* mark all nodes in the root part of the tree */
+    t->root->left->marked = YES;
+    for (i=t->nNodes-3; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        if (p->anc->marked == YES && p != u)
+            p->marked = YES;
+        }
+
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)
+        {
+        MrBayesPrint ("%s   Problem allocating nSitesOfPat in Move_LSPR\n", spacer);
+        free (tempCondLikes);
+        free (tempCondLikePtr);
+        return (ERROR);
+        }
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+        for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }
+        }
+
+    /* cycle through the possibilities and record ln likelihood of each in p->d */
+    minLength = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO)
+            continue;
+        /* find the parsimony length */
+        p->d = 0.0;
+        for (n=0; n<t->nRelParts; n++)
+            {
+            division = t->relParts[n];
+            
+            /* Find model settings */
+            m = &modelSettings[division];
+
+            nStates = m->numModelStates;
+            if (m->dataType == STANDARD)
+                nStates = 2;
+            rateMult = GetRate(division, chain);
+
+            divFactor = warpFactor + log(nStates-1) - log (3) - log(rateMult);
+
+            /* find downpass parsimony sets for the node and its environment */
+            pP   = parsPtr[chain][p->index]      + m->parsMatrixStart + Bit(division, p->clSpace)      * parsMatrixRowSize;
+            pA   = parsPtr[chain][p->anc->index] + m->parsMatrixStart + Bit(division, p->anc->clSpace) * parsMatrixRowSize;
+            pV   = parsPtr[chain][v->index]      + m->parsMatrixStart + Bit(division, v->clSpace)      * parsMatrixRowSize;
+        
+            length = 0.0;
+            for (j=0; j<m->numChars; j++)
+                {
+                x = (pP[j] | pA[j]) & pV[j];
+                if (x == 0)
+                    length += nSitesOfPat[j];
+                }
+            p->d += divFactor * length;
+            }
+        if (i == 0)
+            minLength = p->d;
+        else if (p->d < minLength)
+            minLength = p->d;
+        if (p == a)
+            curLength = p->d;
+        }
+
+    /* find the sum given the warp factor */
+    sum = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES)
+            {
+            p->d = exp (minLength - p->d);
+            sum += p->d;
+            }
+        }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed);
+
+    /* select the appropriate reattachment point */
+    cumulativeProb = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES)
+            {
+            c = p;
+            cumulativeProb += p->d / sum;
+            if (cumulativeProb > ran)
+                break;
+            }
+        }
+    if (c->marked != YES)
+        {
+        printf ("Could not select node\n");
+        getchar();
+        }
+
+    /* calculate the proposal ratio */
+    if (c == a)
+        (*lnProposalRatio) = 0.0;
+    else
+        (*lnProposalRatio) = c->d - curLength;
+
+    /* reattach */
+    d = c->anc;
+    c->anc = u;
+    if (u->left == v)
+        u->right = c;
+    else
+        u->left = c;
+    if (d->left == c)
+        d->left = u;
+    else
+        d->right = u;
+    u->anc = d;
+
+    /* reassign branch lengths */
+    if (c != a)
+        {
+        topologyHasChanged = YES;
+        if (RandomNumber(seed) < 0.5)
+            {
+            x = u->length;
+            u->length = a->length;
+            a->length = x;
+            }
+        if (RandomNumber(seed) < 0.5)
+            {
+            x = c->length;
+            c->length = u->length;
+            u->length = x;
+            }
+        /* hit c length with multiplier (a and u dealt with below) */
+        x = c->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV)
+                x = minV * minV / x;
+            else if (x > maxV)
+                x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / c->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (c->length - x);
+        c->length = x;
+        }
+    
+    /* hit a length with multiplier (even if no topology change was made) */
+    x = a->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV)
+            x = minV * minV / x;
+        else if (x > maxV)
+            x = maxV * maxV / x;
+        }
+
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / a->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (a->length - x);
+    a->length = x;
+
+    /* hit u length with multiplier (even if no topology change was made) */
+    x = u->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV)
+            x = minV * minV / x;
+        else if (x > maxV)
+            x = maxV * maxV / x;
+        }
+
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / u->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (u->length - x);
+    u->length = x;
+
+    /* set tiprobs update flags */
+    a->upDateTi = YES;
+    u->upDateTi = YES;
+    c->upDateTi = YES;  /* could be same as a but that does not matter */
+
+    /* set flags for update of cond likes from u and down to root */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* set flags for update of cond likes from b and down to root */
+    p = b;
+    while (p->anc != NULL && p->upDateCl == NO)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    free (nSitesOfPat);
+
+#   if defined (DEBUG_MLSPR)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  a: %d  b: %d\n",v->index, u->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+/*--------------------------------------------------------------------
+|
+|  Move_LSPR1: Change topology using move based on likelihood scores
+|
+|--------------------------------------------------------------------*/
+int Move_LSPR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change branch lengths and topology (potentially) using SPR-type move 
+       biased according to likelihood scores. NOT work for constrained trees. */
+    
+    int         i, j, n, division, topologyHasChanged, isVPriorExp, nNodes;
+    BitsLong    *pA, *pV, *pP;
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, curLength=0.0, length=0.0,
+                cumulativeProb, warpFactor, sum, ran, tuning, increaseProb, decreaseProb,
+                divFactor, nStates, rateMult, temp;
+    CLFlt       *nSitesOfPat, *globalNSitesOfPat, *tempCondLikes, **tempCondLikePtr;
+    TreeNode    *p, *q, *a, *b, *u, *v, *c=NULL, *d, *candidateNodes[20], *vLeft, *vRight;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m = NULL;
+
+    temp = mvp[0];      /* tuning parameter determining how heavily to weight according to likelihood scores */
+    var = mvp[1];       /* variance of lognormal for proposing branch lengths */
+    increaseProb = decreaseProb = mvp[2];   /* reweighting probabilities */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+#   if defined (DEBUG_MLSPR)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+#   endif
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        p->x = 0;
+        p->d = 0.0;
+        }
+
+    /* pick a random branch */
+    do
+        {
+        p = t->allDownPass[(int)(RandomNumber(seed)*(t->nNodes - 1))];
+        } while (p->anc->anc == NULL || p->anc->isLocked == YES);
+        
+    /* set up pointers for nodes around the picked branch */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    vLeft = v->left;
+    vRight = vRight;
+
+    /* store the branch lengths */
+    aLength = a->length;
+    uLength = u->length;
+    vLength = v->length;
+    if (v->left != NULL)
+        {
+        vLeftLength = v->left->length;
+        vRightLength = v->right->length;
+        }
+    else
+        vLeftLength = vRightLength = 0.0;
+
+    /* save DP cond likes */
+    /* count distance to root */
+    q = b;
+    nNodes = 0;
+    while (q->anc != NULL)
+        {
+        nNodes++;
+        q = q->anc;
+        }
+    
+    /* allocate space for temporary cond likes and condlike pointers */
+    tempCondLikes = (CLFlt *) SafeCalloc (nNodes*m->numChars*m->numModelStates, sizeof (CLFlt));
+    tempCondLikePtr = (CLFlt **) SafeCalloc (nNodes, sizeof (CLFlt *));
+    if (!tempCondLikes || !tempCondLikePtr)
+        {
+        free (tempCondLikes);
+        free (tempCondLikePtr);
+        return (ERROR);
+        }
+
+    /* shift pointers over */
+    q = b;
+    j = 0;
+    while (q->anc != NULL)
+        {
+        tempCondLikePtr[j] = m->condLike[chain][q->index][q->clSpace];
+        m->condLike[chain][q->index][q->clSpace] = tempCondLikes + j*m->numChars*m->numModelStates; 
+        j++;
+        q = q->anc;
+        }
+    
+    /* get cond like uppass up to b */
+    getLikeUPRootPath (t, b);
+
+    /* get ML branch lengths */
+    NRBrlenOptimizer (t, v, 5, 3);
+
+    /* cycle through using Newton Raphson and reoptimization a fixed number of iterations */
+    for (i=0; i<numIterations; i++)
+        {
+        if (v->left != NULL)
+            {
+            getBaseLikeUpLeft (t, v);   /* store instead of DP */
+            NewtonRaphsonBrlen (t, v->left, chain);
+            getBaseLikeUpRight (t, v);
+            GetNewtonRaphsonBrlen (t, v->right, chain);
+            m->CondLikeDown (v);
+            }
+        if (u->left == v)
+            getBaseLikeUpLeft (t, u);
+        else
+            getBaseLikeUpRight (t, u);
+        NewtonRaphsonBrlen (t, v, chain);
+        if (u->left == v)
+            getBaseLikeUpRight (t, u);
+        else
+            getBaseLikeUpLeft (t, u);
+        NewtonRaphsonBrlen (t, a->length, chain);
+        m->CondLikeDown (t, u);
+        if (b->left == u)
+            getBaseLikeUpLeft (t, b);
+        else
+            getBaseLikeUpRight (t, b);
+        NewtonRaphsonBrlen (t, u->length, chain);
+        getLikeUp(t, u);
+        getLikeUp(t, v);
+        }
+    
+    /* get variance of lognormal for forward move */
+    f = log (a->length) - log (aLength);
+    fvar = f*f;
+    f = log (v->length) - log (vLength);
+    fvar += f*f;
+    f = log (u->length) - log (uLength);
+    fvar += f*f;
+    if (v->left != NULL)
+        {
+        f = log (v->left->length) - log (vLeftLength);
+        fvar += f*f;
+        f = log (v->right->length) - log (vRightLength);
+        fvar += f*f;
+        fvar /= 5.0;
+        }
+    else
+        fvar /= 3.0;
+
+    /* clip tree */
+    a->anc = b;
+    if (b->left == u)
+        b->left = a;
+    else
+        b->right = a;
+
+    /* get ML branch length for a */
+    NewtonRaphsonBrlen (t, a, chain, 3);
+
+    /* propose new length for a */
+    f = PointNormal(RandomNumber(seed));
+    f *= fvar;
+    f += log (a->length);
+    a->length = f;
+
+    /* get downpass cond likes for the root part */
+    q = b;
+    while (q->anc != NULL)
+        m->condLikeDown (q, division, chain);
+
+    /* get uppass cond likes for the root part */
+    GetLikeUp (t, t->root->left);
+
+    /* cycle through the possibilities and record ln likelihood of each in p->d */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO)
+            continue;
+        /* attach crown tree here */
+        pLength = p->length;
+        /* find ml branch lengths */
+        NewtonRaphsonBrlens5 (t, v, chain, 5, 3);
+        /* find score */
+        m->CondLikeDown (t, v);
+        m->CondLikeRoot (t, u);
+        m->Likelihood (t, u, &lnL);
+        p->d = lnL * warp;
+        if (i == 0)
+            maxLnL = p->d;
+        else if (p->d > maxLnL)
+            maxLnL = p->d;
+        if (p == a)
+            curLnL = p->d;
+        /* detach crown tree */
+        /* restore p->length */
+        p->length = pLength;
+        }
+
+    /* find the sum given the warp factor */
+    sum = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES)
+            {
+            p->d = exp (maxLnL - p->d);
+            sum += p->d;
+            }
+        }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed);
+
+    /* select the appropriate reattachment point */
+    cumulativeProb = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES)
+            {
+            c = p;
+            cumulativeProb += p->d / sum;
+            if (cumulativeProb > ran)
+                break;
+            }
+        }
+    if (c->marked != YES)
+        {
+        printf ("Could not select node\n");
+        getchar();
+        }
+
+    /* calculate the proposal ratio based on biased reattachment */
+    if (c == a)
+        (*lnProposalRatio) = 0.0;
+    else
+        (*lnProposalRatio) = (maxLnL - log(c->d)) - curLnL;
+
+    /* reattach */
+    if (c != a)
+        topologyHasChanged = YES;
+    d = c->anc;
+    c->anc = u;
+    if (u->left == v)
+        u->right = c;
+    else
+        u->left = c;
+    if (d->left == c)
+        d->left = u;
+    else
+        d->right = u;
+    u->anc = d;
+
+    /* optimize branch lengths */
+    NewtonRaphsonBrlens5 (t, v, chain, 5, 5);
+
+    /* calculate variance of lognormal for back move */
+    f = log (a->length) - log (aLength);
+    fvarNew = f*f;
+    f = log (v->length) - log (vLength);
+    fvarNew += f*f;
+    f = log (u->length) - log (uLength);
+    fvarNew += f*f;
+    if (v->left != NULL)
+        {
+        f = log (v->left->length) - log (vLeftLength);
+        fvarNew += f*f;
+        f = log (v->right->length) - log (vRightLength);
+        fvarNew += f*f;
+        fvarNew /= 5.0;
+        }
+    else
+        fvarNew /= 3.0;
+    
+    /* draw new branch lengths */
+    c->length = fvar * PointNormal(RandomNumber(seed)) + log(c->length);
+    u->length = fvar * PointNormal(RandomNumber(seed)) + log(u->length);
+    v->length = fvar * PointNormal(RandomNumber(seed)) + log(v->length);
+    if (v->left != NULL)
+        {
+        v->left->length = fvar * PointNormal(RandomNumber(seed)) + log(v->left->length);
+        v->right->length = fvar * PointNormal(RandomNumber(seed)) + log(v->right->length);
+        }
+
+    /* calculate proposal ratio for branch lengths */
+
+    /* set tiprobs update flags */
+    a->upDateTi = YES;
+    u->upDateTi = YES;
+    c->upDateTi = YES;  /* could be same as a but that does not matter */
+    v->upDateTi = YES;
+    if (v->left != NULL)
+        {
+        v->left->upDateTi = YES;
+        v->right->upDateTi = YES;
+        }
+
+    /* set flags for update of cond likes from v and down to root */
+    q = v;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES; 
+        q = q->anc;
+        }
+
+    /* set flags for update of cond likes from b and down to root */
+    q = b;
+    while (q->anc != NULL && q->upDateCl == NO)
+        {
+        q->upDateCl = YES; 
+        q = q->anc;
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* restore old conditional likelihoods */
+
+#   if defined (DEBUG_MLSPR)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  a: %d  b: %d\n",v->index, u->index, a->index, b->index);
+    printf ("No. nodes moved in root subtree: %d\n",nRootNodes);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+}
+#endif
+
+
+/* Move_NNI, change topology using NNI move */
+int Move_NNI (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    TreeNode    *p, *u, *v, *a, *b, *c;
+    Tree        *t;
+    
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* pick an internal branch */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed) * t->nIntNodes)];
+        }
+    while (p->anc->anc == NULL || p->isLocked == YES);
+        
+    /* set up area of rearrangement */
+    u = p;
+    v = u->anc;
+    a = u->left;
+    b = u->right;
+    if (v->left == u)
+        c = v->right;
+    else
+        c = v->left;
+        
+    /* change topology */
+    if (RandomNumber(seed) < 0.5)
+        {
+        if (v->left == u)
+            v->right = b;
+        else
+            v->left = b;
+        u->left = a;
+        u->right = c;
+        a->anc = c->anc = u;
+        b->anc = v;
+        }
+    else
+        {
+        if (v->left == u)
+            v->right = a;
+        else
+            v->left = a;
+        u->left = b;
+        u->right = c;
+        b->anc = c->anc = u;
+        a->anc = v;
+        }
+
+    /* set update of cond likes */
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+    
+    GetDownPass (t);
+    
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+int Move_NNIClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change clock tree using NNI move */
+    
+    int         i, *nEvents, numFreeOld, numFreeNew;
+    MrBFlt      x, *tk02Rate=NULL, *brlens, *igrRate=NULL, igrvar=0.0, nu=0.0, oldALength, oldCLength;
+    TreeNode    *p, *q, *a, *c, *u, *v;
+    Tree        *t;
+    Param       *subParm;
+
+    /* no tuning parameter */
+
+    /* make absolutely sure the proposal ratio and prior ratio are reset */
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+#   if defined (DEBUG_NNIClock)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+#   endif
+    
+    /* count number of free interior branches */
+    numFreeOld = 0;
+    for (i=0; i<t->nIntNodes-1; i++)
+        {
+        p = t->intDownPass[i];
+        if (p->anc->left == p)
+            q = p->anc->right;
+        else
+            q = p->anc->left;
+        if (p->isLocked == NO && p->nodeDepth >= q->nodeDepth + BRLENS_MIN)
+            numFreeOld++;
+        }
+
+    /* In extremely constrained trees, it might be impossible to change the tree before nodes have changed in position */
+    if (numFreeOld == 0)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* pick an interior branch, around which it is possible to make an NNI */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed) * (t->nIntNodes-1))];
+        if (p->anc->left == p)
+            q = p->anc->right;
+        else
+            q = p->anc->left;
+        }
+    while (p->isLocked == YES || p->nodeDepth < q->nodeDepth + BRLENS_MIN);
+        
+    /* set up pointers for nodes around the picked branch */
+    /* consider ancestral fossil (brl=0) in fossilized bd tree */
+    if (p->left->length < TIME_MIN)
+        a = p->right;
+    else if (p->right->length < TIME_MIN)
+        a = p->left;
+    else if (RandomNumber(seed) < 0.5)
+        a = p->left;
+    else
+        a = p->right;
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        c = u->right;
+    else
+        c = u->left;
+
+    /* record branch lengths */
+    oldALength = a->length;
+    oldCLength = c->length;
+    
+    /* make topology change */
+    a->anc = u;
+    c->anc = v;
+    if (v->left == a)
+        v->left = c;
+    else
+        v->right = c;
+    if (u->left == c)
+        u->left = a;
+    else
+        u->right = a;
+
+    /* adjust branch lengths */
+    a->length = u->nodeDepth - a->nodeDepth;
+    c->length = v->nodeDepth - c->nodeDepth;
+    assert (a->length > BRLENS_MIN);
+    assert (c->length > BRLENS_MIN);
+
+    /* no reassignment of CPP events or branch rates necessary */
+
+    /* set tiprobs update flags */
+    a->upDateTi = YES;
+    c->upDateTi = YES;
+
+    /* set flags for update of cond likes from v and down to root */
+    p = v;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+
+    /* get down pass sequence */
+    GetDownPass (t);
+
+    /* count number of free interior branches after the move */
+    numFreeNew = 0;
+    for (i=0; i<t->nIntNodes-1; i++)
+        {
+        p = t->intDownPass[i];
+        if (p->anc->left == p)
+            q = p->anc->right;
+        else
+            q = p->anc->left;
+        if (p->isLocked == NO && p->nodeDepth >= q->nodeDepth + BRLENS_MIN)
+            numFreeNew++;
+        }
+        
+    /* get proposal ratio if number of free branches has changed */
+    if (numFreeNew != numFreeOld)
+        (*lnProposalRatio) = log((MrBFlt)numFreeOld / (MrBFlt)numFreeNew);
+
+    /* calculate and adjust prior ratio for clock trees */
+    if (LogClockTreePriorRatio(param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            /* proposal ratio */
+            (*lnProposalRatio) += nEvents[a->index] * log (a->length / oldALength);
+            (*lnProposalRatio) += nEvents[c->index] * log (c->length / oldCLength);
+            /* prior ratio: no effect because tree length is the same */
+            /* update effective evolutionary lengths */
+            if (UpdateCppEvolLengths (subParm, a, chain) == ERROR || UpdateCppEvolLengths (subParm, c, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            /* prior ratio and update of effective evolutionary lengths */
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[v->index], nu*oldALength, tk02Rate[a->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[u->index], nu* a->length, tk02Rate[a->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[u->index], nu*oldCLength, tk02Rate[c->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[v->index], nu* c->length, tk02Rate[c->index]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = a->length * (tk02Rate[a->index] + tk02Rate[a->anc->index])/2.0;
+            brlens[c->index] = c->length * (tk02Rate[c->index] + tk02Rate[c->anc->index])/2.0;
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            /* prior ratio and update of effective evolutionary lengths */
+            (*lnPriorRatio) -= LnProbGamma (oldALength/igrvar, oldALength/igrvar, igrRate[a->index]);
+            (*lnPriorRatio) -= LnProbGamma (oldCLength/igrvar, oldCLength/igrvar, igrRate[c->index]);
+            (*lnPriorRatio) += LnProbGamma (a->length /igrvar, a->length /igrvar, igrRate[a->index]);
+            (*lnPriorRatio) += LnProbGamma (c->length /igrvar, c->length /igrvar, igrRate[c->index]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = igrRate[a->index] * a->length;
+            brlens[c->index] = igrRate[c->index] * c->length;
+            }
+        }
+    
+#   if defined (DEBUG_NNIClock)
+    printf ("After:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  a: %d  b: %d\n",v->index, u->index, a->index, b->index);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/* Move_NNI_Hetero, change topology with unlinked brlens using NNI */
+int Move_NNI_Hetero (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, brIndex, moveType;
+    TreeNode    *p, *u, *v, *a, *b, *c;
+    Tree        *t;
+    
+    (*lnPriorRatio) = (*lnProposalRatio) = 0.0;
+        
+    /* get first tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* pick an internal branch */
+    do
+        {
+        brIndex = (int) (RandomNumber(seed) * t->nIntNodes);
+        p = t->intDownPass[brIndex];
+        } while (p->anc->anc == NULL || p->isLocked == YES);
+        
+    /* decide on how to change the tree */
+    if (RandomNumber(seed) < 0.5)
+        moveType = 0;
+    else
+        moveType = 1;
+    
+    /* cycle through trees */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        /* get tree */
+        t = GetTree (param->subParams[i], chain, state[chain]);
+            
+        /* find p */
+        p = t->intDownPass[brIndex];
+
+        /* set up area of rearrangement */
+        u = p;
+        v = u->anc;
+        a = u->left;
+        b = u->right;
+        if (v->left == u)
+            c = v->right;
+        else
+            c = v->left;
+
+        /* change topology */
+        if (moveType == 0)
+            {
+            if (v->left == u)
+                v->right = b;
+            else
+                v->left = b;
+            u->left = a;
+            u->right = c;
+            a->anc = c->anc = u;
+            b->anc = v;
+            }
+        else if (moveType == 1)
+            {
+            if (v->left == u)
+                v->right = a;
+            else
+                v->left = a;
+            u->left = b;
+            u->right = c;
+            b->anc = c->anc = u;
+            a->anc = v;
+            }
+
+        /* set update of ti probs */
+        a->upDateTi = YES;
+        b->upDateTi = YES;
+        c->upDateTi = YES;
+        u->upDateTi = YES;
+        v->upDateTi = YES;
+        
+        /* set update of conditional likelihoods */
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES; 
+            p = p->anc;
+            }
+
+        /* reset tree downpass sequences */
+        GetDownPass (t);
+        
+        }
+    
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *mvp); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/*-----------------------------------------------------------------------------------
+|
+|   Move_NodeSlider: move the position of one node without changing topology
+|
+-------------------------------------------------------------------------------------*/
+int Move_NodeSlider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    MrBFlt      tuning, maxV, minV, oldM, newM, brlensPrExp=0.0, newMin, newMax, oldMin, oldMax;
+    TreeNode    *p, *q;
+    ModelParams *mp;
+    Tree        *t;
+    int isVPriorExp;
+    
+    tuning = mvp[0]; /* Larget & Simon's tuning parameter lambda */
+
+    mp = &modelParams[param->relParts[0]];
+
+    /* max and min brlen (time) */
+    if (param->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else if (param->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensPrExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+
+    /* pick an interior branch */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed) * t->nIntNodes)];
+        }
+    while (p->anc == NULL || (t->isRooted == YES && p->anc->anc == NULL));
+
+    /* pick one descendant branch */
+    if (RandomNumber(seed) < 0.5)
+        q = p->left;
+    else
+        q = p->right;
+    
+    /* determine new length */
+    oldM = (q->length + p->length);
+    newM = oldM * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (newM < 2.0 * minV || newM > 2.0 * maxV)
+        {
+        if (newM < 2.0 * minV)
+            newM = 4.0 * minV * minV / newM;
+        else if (newM > 2.0 * maxV)
+            newM = 4.0 * maxV * maxV / newM;
+        }
+
+    /* determine new lengths of p and q */
+    newMin = minV > newM - maxV ? minV : newM - maxV;
+    newMax = maxV < newM - minV ? maxV : newM - minV;
+    oldMin = minV > oldM - maxV ? minV : oldM - maxV;
+    oldMax = maxV < oldM - minV ? maxV : oldM - minV;
+
+    q->length = newMin + RandomNumber(seed) * (newMax - newMin);
+    p->length = newM - q->length;
+
+    /* the proposal ratio for two sliding windows */
+    (*lnProposalRatio) = log ((newMax - newMin) / (oldMax - oldMin));
+    
+    /* The proposal ratio for shrinking/expanding two variables (x1 = p->length, x2 = q->length)
+       by the same factor c = newM/oldM is c^2. This can be derived by variable transformation:
+       y1 = x1, y2 = x2/x1. The proposal ratio in the transformed variables is c, the Jacobian is y1,
+       so the proposal ratio in the original variables is c*c = c^2.
+       (see Move_TreeLen for m variables and Yang 2006 CME P171 S5.4.4 for details) */
+    (*lnProposalRatio) += 2.0 * log(newM / oldM);
+
+    /* set flags for update of transition probabilities at p and q */
+    p->upDateTi = YES;
+    q->upDateTi = YES;
+    p->upDateCl = YES;
+
+    /* set flags for update of cond likes from p->anc and down to root */
+    while (p->anc->anc != NULL)
+        {
+        p = p->anc;
+        p->upDateCl = YES;
+        }
+
+    /* update prior if exponential prior on branch lengths */
+    if (param->paramId == BRLENS_EXP)
+        (*lnPriorRatio) = brlensPrExp * (oldM - newM);
+    /* Dirichlet or twoExp prior */
+    else if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+
+    return (NO_ERROR);
+    
+}
+
+
+/*-----------------------------------------------------------------------------------
+|
+|   Move_NodeSliderClock: Move the position of one (root or nonroot) node in clock tree.
+|      In calibrated trees, we need to move also calibrated terminal nodes.
+|
+-------------------------------------------------------------------------------------*/
+int Move_NodeSliderClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, *nEvents;
+    MrBFlt      window, minDepth, maxDepth, oldDepth, newDepth, minL, minR,
+                oldLeftLength=0.0, oldRightLength=0.0, oldPLength=0.0, x, clockRate,
+                lambda=0.0, nu=0.0, igrvar=0.0, *brlens=NULL, *tk02Rate=NULL, *igrRate=NULL;
+    TreeNode    *p, *q;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Tree        *t;
+    Param       *subParm;
+    Calibration *calibrationPtr;
+
+    window = mvp[0]; /* window size */
+    m = &modelSettings[param->relParts[0]];
+    mp = &modelParams[param->relParts[0]];
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get clock rate */
+    if (m->clockRate == NULL)
+        clockRate = 1.0;
+    else
+        clockRate = *GetParamVals (m->clockRate, chain, state[chain]);
+
+    /* check whether or not we can change root */
+    if ((t->root->left->isDated == YES && t->root->left->calibration->prior == fixed) ||
+        ((!strcmp(mp->clockPr, "Uniform") || !strcmp(mp->clockPr, "Fossilization")) && mp->treeAgePr.prior == fixed))
+        i = t->nNodes - 2;
+    else
+        i = t->nNodes - 1;
+
+    /* pick a node that can be changed in position */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * i)];
+        }
+    while ((p->left == NULL && p->isDated == NO) ||
+           (p->left == NULL && p->length < TIME_MIN) ||
+           (p->isDated == YES && p->calibration->prior == fixed));
+
+#if defined (DEBUG_CSLIDER)
+    printf ("Before node slider (clock):\n");
+    printf ("Picked branch with index %d and depth %f\n", p->index, p->nodeDepth);
+    if (p->anc->anc == NULL)
+        printf ("Old clock rate: %f\n", clockRate);
+    ShowNodes (t->root, 0, t->isRooted);
+    getchar();
+#endif
+
+    /* store values needed later for prior calculation (relaxed clocks) */
+    oldPLength = p->length;
+    if (p->left != NULL)
+        {
+        oldLeftLength = p->left->length;
+        oldRightLength = p->right->length;
+        }
+    else
+        oldLeftLength = oldRightLength = 0.0;
+
+    /* determine lower and upper bound */
+    if (p->left == NULL)
+        minDepth = 0.0;
+    else      // internal node
+        {
+        if (p->left->length > 0.0)
+            minL = p->left->nodeDepth + BRLENS_MIN;
+        else  // ancestral fossil
+            {
+            assert (p->left->calibration != NULL);
+            minL = p->left->calibration->min * clockRate;
+            }
+        if (p->right->length > 0.0)
+            minR = p->right->nodeDepth + BRLENS_MIN;
+        else  // ancestral fossil
+            {
+            assert (p->right->calibration != NULL);
+            minR = p->right->calibration->min * clockRate;
+            }
+        if (minL > minR)
+            minDepth = minL;
+        else
+            minDepth = minR;
+        }
+    
+    if (p->anc->anc == NULL)
+        maxDepth = TREEHEIGHT_MAX;
+    else
+        maxDepth = p->anc->nodeDepth - BRLENS_MIN;
+    if (p->left != NULL && p->left->length < TIME_MIN)
+        {
+        assert (p->left->calibration != NULL);
+        if (maxDepth > p->left->calibration->max * clockRate)
+            maxDepth = p->left->calibration->max * clockRate;
+        }
+    if (p->right != NULL && p->right->length < TIME_MIN)
+        {
+        assert (p->right->calibration != NULL);
+        if (maxDepth > p->right->calibration->max * clockRate)
+            maxDepth = p->right->calibration->max * clockRate;
+        }
+    
+    if (p->isDated == YES)
+        calibrationPtr = p->calibration;
+    else if (p->anc->anc == NULL && (!strcmp(mp->clockPr,"Uniform") || !strcmp(mp->clockPr, "Fossilization")))
+        calibrationPtr = &mp->treeAgePr;
+    else
+        calibrationPtr = NULL;
+    if (calibrationPtr != NULL)
+        {
+        if (maxDepth > calibrationPtr->max * clockRate)
+            maxDepth = calibrationPtr->max * clockRate;
+        if (minDepth < calibrationPtr->min * clockRate)
+            minDepth = calibrationPtr->min * clockRate;
+        }
+
+    /* abort if impossible */
+    if (minDepth > maxDepth -BRLENS_MIN)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* save some reflection time */
+    if (maxDepth-minDepth < window)
+        {
+        window = maxDepth-minDepth;
+        }
+
+    /* pick the new node depth */
+    oldDepth = p->nodeDepth;
+    newDepth = oldDepth + (RandomNumber(seed) - 0.5) * window;
+    /* reflect the new node depth */
+    while (newDepth < minDepth || newDepth > maxDepth)
+        {
+        if (newDepth < minDepth)
+            newDepth = 2.0 * minDepth - newDepth;
+        if (newDepth > maxDepth)
+            newDepth = 2.0 * maxDepth - newDepth;
+        }
+
+    p->nodeDepth = newDepth;
+
+    /* determine new branch lengths around p and set update of transition probabilities */
+    if (p->left != NULL)
+        {
+        if (p->left->length > 0.0) {
+            p->left->length = p->nodeDepth - p->left->nodeDepth;
+            p->left->upDateTi = YES;
+            }
+        else
+            p->left->nodeDepth = p->nodeDepth;
+        if (p->right->length > 0.0) {
+            p->right->length = p->nodeDepth - p->right->nodeDepth;
+            p->right->upDateTi = YES;
+            }
+        else
+            p->right->nodeDepth = p->nodeDepth;
+        }
+    if (p->anc->anc != NULL)
+        {
+        p->length = p->anc->nodeDepth - p->nodeDepth;
+        p->upDateTi = YES;
+        }
+
+    /* adjust age of p if dated */
+    if (calibrationPtr != NULL)
+        p->age = p->nodeDepth / clockRate;
+    if ((p->left != NULL) && (p->left->length < TIME_MIN))
+        p->left->age = p->nodeDepth / clockRate;
+    if ((p->right != NULL) && (p->right->length < TIME_MIN))
+        p->right->age = p->nodeDepth / clockRate;
+
+    /* set flags for update of cond likes from p and down to root */
+    q = p;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* calculate and adjust prior ratio for clock tree */
+    if (LogClockTreePriorRatio (param, chain, &x) == ERROR)
+        return (ERROR);
+    (*lnPriorRatio) += x;
+
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        subParm = param->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+            /* proposal ratio */
+            if (p->left != NULL)
+                {
+                (*lnProposalRatio) += nEvents[p->left->index ] * log (p->left->length  / oldLeftLength);
+                (*lnProposalRatio) += nEvents[p->right->index] * log (p->right->length / oldRightLength);
+                }
+            if (p->anc->anc != NULL)
+                (*lnProposalRatio) += nEvents[p->index] * log (p->length / oldPLength);
+
+            /* prior ratio */
+            if (p->anc->anc == NULL) // two branches changed in same direction
+                (*lnPriorRatio) += lambda * (2.0 * (oldDepth - newDepth));
+            else if (p->left != NULL) // two branches changed in one direction, one branch in the other direction
+                (*lnPriorRatio) += lambda * (oldDepth - newDepth);
+            else /* if (p->left == NULL) */ // one branch changed
+                (*lnPriorRatio) += lambda * (newDepth - oldDepth);
+
+            /* update effective evolutionary lengths */
+            if (UpdateCppEvolLengths (subParm, p, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+
+            /* prior ratio & update effective evolutionary lengths */
+            if (p->left != NULL)
+                {
+                if (p->left->length > 0.0)
+                    {
+                    (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->index], nu*oldLeftLength, tk02Rate[p->left->index]);
+                    (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->index], nu*p->left->length, tk02Rate[p->left->index]);
+                    brlens[p->left->index] = p->left->length * (tk02Rate[p->left->index]+tk02Rate[p->index])/2.0;
+                    }
+                if (p->right->length > 0.0)
+                    {
+                    (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->index], nu*oldRightLength, tk02Rate[p->right->index]);
+                    (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->index], nu*p->right->length, tk02Rate[p->right->index]);
+                    brlens[p->right->index] = p->right->length * (tk02Rate[p->right->index]+tk02Rate[p->index])/2.0;
+                    }
+                }
+            if (p->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*oldPLength, tk02Rate[p->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*p->length, tk02Rate[p->index]);
+                brlens[p->index] = p->length * (tk02Rate[p->index]+tk02Rate[p->anc->index])/2.0;
+                }
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+                
+            /* prior ratio & update effective evolutionary lengths */
+            if (p->left != NULL)
+                {
+                if (p->left->length > 0.0)
+                    {
+                    (*lnPriorRatio) -= LnProbGamma (oldLeftLength/igrvar, oldLeftLength/igrvar, igrRate[p->left->index ]);
+                    (*lnPriorRatio) += LnProbGamma (p->left->length/igrvar, p->left->length/igrvar, igrRate[p->left->index ]);
+                    brlens[p->left->index ] = igrRate[p->left->index ] * p->left->length;
+                    }
+                if (p->right->length > 0.0)
+                    {
+                    (*lnPriorRatio) -= LnProbGamma (oldRightLength/igrvar, oldRightLength/igrvar, igrRate[p->right->index]);
+                    (*lnPriorRatio) += LnProbGamma (p->right->length/igrvar, p->right->length/igrvar, igrRate[p->right->index]);
+                    brlens[p->right->index] = igrRate[p->right->index] * p->right->length;
+                    }
+                }
+            if (p->anc->anc != NULL)
+                {
+                (*lnPriorRatio) -= LnProbGamma (oldPLength/igrvar, oldPLength/igrvar, igrRate[p->index]);
+                (*lnPriorRatio) += LnProbGamma (p->length /igrvar, p->length /igrvar, igrRate[p->index]);
+                brlens[p->index] = igrRate[p->index] * p->length;
+                }
+            }
+        }
+
+#if defined (DEBUG_CSLIDER)
+    printf ("After node slider (clock):\n");
+    printf ("Old depth: %f -- New depth: %f -- LnPriorRatio %f -- LnProposalRatio %f\n",
+        oldDepth, newDepth, (*lnPriorRatio), (*lnProposalRatio));
+    ShowNodes (t->root, 0, t->isRooted);
+    getchar();
+#endif
+
+    return (NO_ERROR);
+}
+
+
+int Move_Nu (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move the variance of the TK02 relaxed clock lognormal using multiplier */
+
+    int         i, j;
+    MrBFlt      oldNu, newNu, minNu, maxNu, tuning, *tk02Rate;
+    Model       *mp;
+    TreeNode    *p;
+    Tree        *t;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get the min and max values */
+    minNu = TK02VAR_MIN;
+    maxNu = TK02VAR_MAX;
+    if (!strcmp(mp->tk02varPr,"Uniform"))
+        {
+        minNu = (mp->tk02varUni[0] < TK02VAR_MIN) ? TK02VAR_MIN : mp->tk02varUni[0];
+        maxNu = (mp->tk02varUni[1] > TK02VAR_MAX) ? TK02VAR_MAX : mp->tk02varUni[1];
+        }
+    
+    /* get the TK02 lognormal variance */
+    oldNu = *GetParamVals (param, chain, state[chain]);
+
+    /* set new value */
+    newNu = oldNu * exp ((0.5 - RandomNumber(seed))*tuning);
+    
+    /* reflect if necessary */
+    while (newNu < minNu || newNu > maxNu)
+        {
+        if (newNu < minNu)
+            newNu = minNu * minNu / newNu;
+        if (newNu > maxNu)
+            newNu = maxNu * maxNu / newNu;
+        }
+    
+    /* store new value */
+    (*GetParamVals (param, chain, state[chain])) = newNu;
+
+    /* calculate prior ratio */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        tk02Rate = GetParamVals (param->subParams[i], chain, state[chain]);
+        t = GetTree (param->subParams[i], chain, state[chain]);
+        for (j=0; j<t->nNodes-2; j++)
+            {
+            p = t->allDownPass[j];
+            if (p->length > 0.0)  // not ancestral fossil
+                {
+                (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->anc->index], oldNu*p->length, tk02Rate[p->index]);
+                (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], newNu*p->length, tk02Rate[p->index]);
+                }
+            }
+        }
+
+    /* take prior on nu into account */
+    if (!strcmp(mp->tk02varPr,"Exponential"))
+        (*lnPriorRatio) += mp->tk02varExp * (oldNu - newNu);
+    
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newNu / oldNu);
+
+    /* we do not need to update likelihoods */
+    for (i=0; i<param->nRelParts; i++)
+        {
+        modelSettings[param->relParts[i]].upDateCl = NO;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Omega: Change the nonysnonymous/synonymous rate ratio
+|      Note that this is appropriate when omegavar=equal
+|
+----------------------------------------------------------------*/
+int Move_Omega (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change omega using sliding window */
+    
+    int         i, isValidO;
+    MrBFlt      oldO, newO, window, minO, maxO, ran, *alphaDir, oldPropRatio, newPropRatio, x, y;
+    ModelParams *mp;
+
+    /* get size of window, centered on current omega value */
+    window = mvp[0];
+    
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get minimum and maximum values for omega */
+    minO = OMEGA_MIN;
+    maxO = OMEGA_MAX;
+
+    /* get old value of omega */
+    oldO = *GetParamVals(param, chain, state[chain]);
+
+    /* get Dirichlet parameters */
+    alphaDir = mp->tRatioDir;
+
+    /* change value for omega */
+    ran = RandomNumber(seed);
+    if (maxO-minO < window)
+        {
+        window = maxO-minO;
+        }
+    newO = oldO + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidO = NO;
+    do  {
+        if (newO < minO)
+            newO = 2.0 * minO - newO;
+        else if (newO > maxO)
+            newO = 2.0 * maxO - newO;
+        else
+            isValidO = YES;
+        }
+    while (isValidO == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* get prior ratio from Dirichlet */
+    oldPropRatio = oldO / (oldO + 1.0);
+    newPropRatio = newO / (newO + 1.0);
+    x = ((alphaDir[0] - 1.0) * log(newPropRatio)) + ((alphaDir[1] - 1.0) * log (1.0 - newPropRatio));
+    y = ((alphaDir[0] - 1.0) * log(oldPropRatio)) + ((alphaDir[1] - 1.0) * log (1.0 - oldPropRatio));
+    (*lnPriorRatio) = x - y;
+    
+    /* copy new omega value back */
+    *GetParamVals(param, chain, state[chain]) = newO;
+
+    /* Set update flags for all partitions that share this kappa. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Omega_M: Change the nonysnonymous/synonymous rate ratio
+|      using multiplier. Note that this is appropriate when
+|      omegavar=equal
+|
+----------------------------------------------------------------*/
+int Move_Omega_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change omega using multiplier */
+    
+    int         i, isValidO;
+    MrBFlt      oldO, newO, minO, maxO, tuning, ran, factor, *alphaDir, oldPropRatio, newPropRatio, x, y;
+    ModelParams *mp;
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get minimum and maximum values for omega */
+    minO = OMEGA_MIN;
+    maxO = OMEGA_MAX;
+
+    /* get old value of omega */
+    oldO = *GetParamVals(param, chain, state[chain]);
+
+    /* get Dirichlet parameters */
+    alphaDir = mp->omegaDir;
+
+    /* change value for omega */
+    ran = RandomNumber(seed);
+    factor = exp(tuning * (ran - 0.5));
+    newO = oldO * factor;
+    
+    /* check that new value is valid */
+    isValidO = NO;
+    do
+        {
+        if (newO < minO)
+            newO = minO * minO / newO;
+        else if (newO > maxO)
+            newO = maxO * maxO / newO;
+        else
+            isValidO = YES;
+        } while (isValidO == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = log(newO / oldO);
+    
+    /* get prior ratio from Dirichlet */
+    oldPropRatio = oldO / (oldO + 1.0);
+    newPropRatio = newO / (newO + 1.0);
+    x = ((alphaDir[0] - 1.0) * log(newPropRatio)) + ((alphaDir[1] - 1.0) * log (1.0 - newPropRatio));
+    y = ((alphaDir[0] - 1.0) * log(oldPropRatio)) + ((alphaDir[1] - 1.0) * log (1.0 - oldPropRatio));
+    (*lnPriorRatio) = x - y;
+    
+    /* copy new omega value back */
+    *GetParamVals(param, chain, state[chain]) = newO;
+
+    /* Set update flags for all partitions that share this omega. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_OmegaBeta_M: Change parameters of the beta distribution
+|      using multiplier for the M10 model. Note that this is 
+|      appropriate when omegavar=M10
+|
+----------------------------------------------------------------*/
+int Move_OmegaBeta_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isValidVal, whichParam;
+    MrBFlt      oldVal, newVal, minVal, maxVal, *vals, *subVals, tuning, ran, factor;
+    ModelParams *mp;
+    
+    /* do we pick alpha or beta of the Beta distribution to change */
+    if (RandomNumber(seed) < 0.5)
+        whichParam = 0;
+    else
+        whichParam = 1;
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get minimum and maximum values for omega */
+    minVal = 0.05;
+    maxVal = 100.0;
+
+    /* get old value of omega */
+    vals = GetParamVals(param, chain, state[chain]);
+    subVals = GetParamSubVals(param, chain, state[chain]);
+    oldVal = subVals[mp->numM10BetaCats + mp->numM10GammaCats + 4 + whichParam];
+
+    /* change value for alpha/beta */
+    ran = RandomNumber(seed);
+    factor = exp(tuning * (ran - 0.5));
+    newVal = oldVal * factor;
+    
+    /* check that new value is valid */
+    isValidVal = NO;
+    do
+        {
+        if (newVal < minVal)
+            newVal = minVal * minVal / newVal;
+        else if (newVal > maxVal)
+            newVal = maxVal * maxVal / newVal;
+        else
+            isValidVal = YES;
+        } while (isValidVal == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = log(newVal / oldVal);
+    
+    /* get prior ratio */
+    if (!strcmp(mp->m10betapr, "Exponential"))
+        (*lnPriorRatio) = (log(mp->m10betaExp) - newVal * mp->m10betaExp) - (log(mp->m10betaExp) - oldVal * mp->m10betaExp);
+    else
+        (*lnPriorRatio) = 0.0;
+    
+    /* copy new omega value back */
+    subVals[mp->numM10BetaCats + mp->numM10GammaCats + 4 + whichParam] = newVal;
+    
+    /* update the omega values */
+    BetaBreaks (subVals[mp->numM10BetaCats + mp->numM10GammaCats + 4], subVals[mp->numM10BetaCats + mp->numM10GammaCats + 5], &vals[0], mp->numM10BetaCats);
+
+    /* Set update flags for all partitions that share this kappa. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_OmegaGamma_M: Change parameters of the gamma distribution
+|      using multiplier for the M10 model. Note that this is 
+|      appropriate whenomegavar=M10
+|
+----------------------------------------------------------------*/
+int Move_OmegaGamma_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isValidVal, whichParam;
+    MrBFlt      oldVal, newVal, minVal, maxVal, *vals, *subVals, tuning, ran, factor, quantile95;
+    ModelParams *mp;
+    
+    /* do we pick alpha or beta of the Gamma distribution to change */
+    if (RandomNumber(seed) < 0.5)
+        whichParam = 0;
+    else
+        whichParam = 1;
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get minimum and maximum values for omega */
+    minVal = 0.05;
+    maxVal = 100.0;
+
+    /* get values */
+    vals = GetParamVals(param, chain, state[chain]);
+    subVals = GetParamSubVals(param, chain, state[chain]);
+    oldVal = subVals[mp->numM10BetaCats + mp->numM10GammaCats + 6 + whichParam];
+
+    /* change value for alpha/beta */
+    do
+        {
+        ran = RandomNumber(seed);
+        factor = exp(tuning * (ran - 0.5));
+        newVal = oldVal * factor;
+        
+        /* check that new value is valid */
+        isValidVal = NO;
+        do
+            {
+            if (newVal < minVal)
+                newVal = minVal * minVal / newVal;
+            else if (newVal > maxVal)
+                newVal = maxVal * maxVal / newVal;
+            else
+                isValidVal = YES;
+            } while (isValidVal == NO);
+
+        /* check that the distribution does not go too far to the right */
+        if (whichParam == 0)
+            quantile95 = QuantileGamma (0.95, newVal, subVals[mp->numM10BetaCats + mp->numM10GammaCats + 7]);
+        else
+            quantile95 = QuantileGamma (0.95, subVals[mp->numM10BetaCats + mp->numM10GammaCats + 6], newVal);
+
+        } while (quantile95 > 100.0);
+        
+    /* get proposal ratio */
+    *lnProposalRatio = log(newVal / oldVal);
+    
+    /* get prior ratio */
+    if (!strcmp(mp->m10gammapr, "Exponential"))
+        (*lnPriorRatio) = (log(mp->m10gammaExp) - newVal * mp->m10gammaExp) - (log(mp->m10gammaExp) - oldVal * mp->m10gammaExp);
+    else
+        (*lnPriorRatio) = 0.0;
+    
+    /* copy new value back */
+    subVals[mp->numM10BetaCats + mp->numM10GammaCats + 6 + whichParam] = newVal;
+    
+    /* update the omega values */
+    if (DiscreteGamma (&vals[mp->numM10BetaCats], subVals[mp->numM10BetaCats + mp->numM10GammaCats + 6],
+                       subVals[mp->numM10BetaCats + mp->numM10GammaCats + 7], mp->numM10GammaCats, 0) == ERROR)
+        return (ERROR);
+    for (i=0; i<mp->numM10GammaCats; i++)
+        vals[mp->numM10BetaCats + i] += 1.0;
+
+    /* Set update flags for all partitions that share this kappa. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_OmegaCat (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, localNumCats, numBetaAndGammaCats;
+    MrBFlt      dirichletParameters[3], *newSubVals, *oldSubVals, *newFreqs, *oldFreqs, *priorParams, sum, alpha, x, y;
+    ModelParams *mp;
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* how many categories are there */
+    localNumCats = 3;
+    numBetaAndGammaCats = 0;
+    if (!strcmp(mp->omegaVar, "M10"))
+        {
+        localNumCats = 2;
+        numBetaAndGammaCats = mp->numM10BetaCats + mp->numM10GammaCats;
+        }
+        
+    /* get the values we need */
+    newSubVals = GetParamSubVals (param, chain, state[chain]);
+    oldSubVals = GetParamSubVals (param, chain, state[chain] ^ 1);
+    if (!strcmp(mp->omegaVar, "M10"))
+        {
+        newFreqs = newSubVals + numBetaAndGammaCats;
+        oldFreqs = oldSubVals + numBetaAndGammaCats;
+        priorParams = newSubVals + (numBetaAndGammaCats + 2);
+        }
+    else
+        {
+        newFreqs = newSubVals + 0;
+        oldFreqs = oldSubVals + 0;
+        priorParams = newFreqs + 3;
+        }
+
+    /* get parameter of proposal mechanism */
+    alpha = mvp[0];
+
+    /* multiply old values with some large number to get new values close to the old ones */
+    for (i=0; i<localNumCats; i++)
+        dirichletParameters[i] = oldFreqs[i] * alpha;
+
+    /* get the new category frequencies */
+    DirichletRandomVariable (dirichletParameters, newFreqs, localNumCats, seed);
+    sum = 0.0;
+    for (i=0; i<localNumCats; i++)
+        {
+        if (newFreqs[i] < 0.0001)
+            newFreqs[i] = 0.0001;
+        sum += newFreqs[i];
+        }
+    for (i=0; i<localNumCats; i++)
+        newFreqs[i] /= sum;
+        
+    /* and get the new frequencies of the omega values, if we have another
+       distribution for omega too */
+    if (!strcmp(mp->omegaVar, "M10"))
+        {
+        for (i=0; i<mp->numM10BetaCats; i++)
+            newSubVals[i] = newFreqs[0] / mp->numM10BetaCats;
+        for (i=mp->numM10BetaCats; i<mp->numM10BetaCats+mp->numM10GammaCats; i++)
+            newSubVals[i] = newFreqs[1] / mp->numM10GammaCats;
+        }
+
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<localNumCats; i++)
+        sum += newFreqs[i]*alpha;
+    x = LnGamma(sum);
+    for (i=0; i<localNumCats; i++)
+        x -= LnGamma(newFreqs[i]*alpha);
+    for (i=0; i<localNumCats; i++)
+        x += (newFreqs[i]*alpha-1.0)*log(oldFreqs[i]);
+    sum = 0.0;
+    for (i=0; i<localNumCats; i++)
+        sum += oldFreqs[i]*alpha;
+    y = LnGamma(sum);
+    for (i=0; i<localNumCats; i++)
+        y -= LnGamma(oldFreqs[i]*alpha);
+    for (i=0; i<localNumCats; i++)
+        y += (oldFreqs[i]*alpha-1.0)*log(newFreqs[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    x = y = 0.0;        /* ignore the gamma part, it is identical */
+    for (i=0; i<localNumCats; i++)
+        x += (priorParams[i]-1.0)*log(newFreqs[i]);
+    for (i=0; i<localNumCats; i++)
+        y += (priorParams[i]-1.0)*log(oldFreqs[i]);
+    (*lnPriorRatio) = x - y;
+        
+    /* Set update flags for all partitions that share this omega. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_OmegaM3: Change the nonysnonymous/synonymous rate ratio
+|      of one class of the M3 model
+|
+----------------------------------------------------------------*/
+int Move_OmegaM3 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isValidO, whichOmega;
+    MrBFlt      newO, window, minO, maxO, ran, *value, *oldValue, x, y;
+
+    /* get size of window, centered on current omega value */
+    window = mvp[0];
+
+    /* get old value of omega */
+    value = GetParamVals(param, chain, state[chain]);
+    oldValue = GetParamVals(param, chain, state[chain] ^ 1);
+    whichOmega = (int) (RandomNumber(seed)*3.0);
+    
+    /* get minimum and maximum values for omega */
+    if (whichOmega == 0)
+        minO = 0.0;
+    else
+        minO = value[whichOmega-1];
+    if (whichOmega == 2)
+        maxO = OMEGA_MAX;
+    else
+        maxO = value[whichOmega+1];
+
+    /* change value for omega */
+    ran = RandomNumber(seed);
+     if (maxO-minO < window)
+        {
+        window = maxO-minO;
+        }
+    newO = oldValue[whichOmega] + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidO = NO;
+    do
+        {
+        if (newO < minO)
+            newO = 2* minO - newO;
+        else if (newO > maxO)
+            newO = 2 * maxO - newO;
+        else
+            isValidO = YES;
+        } while (isValidO == NO);
+
+    /* copy new omega value back */
+    value[whichOmega] = newO;
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* get prior ratio */
+    x = LogOmegaPrior (value[0], value[1], value[2]);
+    y = LogOmegaPrior (oldValue[0], oldValue[1], oldValue[2]);
+    *lnPriorRatio = x - y;
+
+    /* Set update flags for all partitions that share this omega. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_OmegaNeu: Change the nonysnonymous/synonymous rate ratio
+|      for neutral sites
+|
+----------------------------------------------------------------*/
+int Move_OmegaNeu (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isOPriorExp, isValidO;
+    MrBFlt      oldO, newO, window, minO, maxO, ran, *value, x, y;
+
+    /* get size of window, centered on current omega value */
+    window = mvp[0];
+
+    /* get old value of omega */
+    value = GetParamVals(param, chain, state[chain]);
+    newO = oldO = value[1];
+
+    /* get minimum and maximum values for omega */
+    minO = value[0];
+    maxO = value[2];
+    
+    /* the only way we would be updating the middle category (omega2) is
+       if we have an exponential prior on all three omegas */
+    isOPriorExp = YES;
+
+    /* change value for omega */
+    ran = RandomNumber(seed);
+    if (maxO-minO < window)
+        {
+        window = maxO-minO;
+        }
+    newO = oldO + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidO = NO;
+    do
+        {
+        if (newO < minO)
+            newO = 2 * minO - newO;
+        else if (newO > maxO)
+            newO = 2 * maxO - newO;
+        else
+            isValidO = YES;
+        } while (isValidO == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* copy new omega value back */
+    value[1] = newO;
+
+    /* get prior ratio */
+    if (isOPriorExp == NO)
+        {
+        *lnPriorRatio = 0.0;
+        }
+    else
+        {
+        x = LogOmegaPrior (value[0], newO, value[2]);
+        y = LogOmegaPrior (value[0], oldO, value[2]);
+        *lnPriorRatio = x - y;
+        }
+
+    /* Set update flags for all partitions that share this omega. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_OmegaPos: Change the nonysnonymous/synonymous rate ratio
+|      for positively selected sites
+|
+----------------------------------------------------------------*/
+int Move_OmegaPos (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isValidO, omegaUni, omegaExp1, omegaExp2;
+    MrBFlt      oldO, newO, window, minO=0.0, maxO=0.0, ran, *value, x, y;
+    ModelParams *mp;
+
+    /* get size of window, centered on current omega value */
+    window = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get old value of omega */
+    value = GetParamVals(param, chain, state[chain]);
+    newO = oldO = value[2];
+    
+    /* determine prior for omega */
+    omegaUni = omegaExp1 = omegaExp2 = NO;
+    if (param->paramId == OMEGA_BUD || param->paramId == OMEGA_BUF || param->paramId == OMEGA_FUD || param->paramId == OMEGA_FUF)
+        omegaUni = YES;
+    else if (param->paramId == OMEGA_BED || param->paramId == OMEGA_BEF || param->paramId == OMEGA_FED || param->paramId == OMEGA_FEF)
+        omegaExp1 = YES;
+    else if (param->paramId == OMEGA_ED || param->paramId == OMEGA_EF)
+        omegaExp2 = YES;
+        
+    /* get minimum and maximum values for omega */
+    if (omegaUni == YES)
+        {
+        minO = mp->ny98omega3Uni[0];
+        if (minO < value[1])
+            minO = value[1];
+        maxO = mp->ny98omega3Uni[1];
+        if (maxO > KAPPA_MAX)
+            maxO = KAPPA_MAX;
+        }
+    else if (omegaExp1 == YES || omegaExp2 == YES)
+        {
+        minO = value[1];
+        maxO = KAPPA_MAX;
+        }
+
+    /* change value for omega */
+    ran = RandomNumber(seed);
+    if (maxO-minO < window)
+        {
+        window = maxO-minO;
+        }
+    newO = oldO + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidO = NO;
+    do
+        {
+        if (newO < minO)
+            newO = 2* minO - newO;
+        else if (newO > maxO)
+            newO = 2 * maxO - newO;
+        else
+            isValidO = YES;
+        } while (isValidO == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* copy new omega value back */
+    value[2] = newO;
+
+    /* get prior ratio (part 2) */
+    if (omegaUni == YES)
+        {
+        *lnPriorRatio = 0.0;
+        }
+    else if (omegaExp1 == YES)
+        {
+        *lnPriorRatio = mp->ny98omega3Exp * (oldO - newO);
+        }
+    else if (omegaExp2 == YES)
+        {
+        x = LogOmegaPrior (value[0], value[1], newO);
+        y = LogOmegaPrior (value[0], value[1], oldO);
+        *lnPriorRatio = x - y;
+        }
+
+    /* Set update flags for all partitions that share this omega. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_OmegaPur: Change the nonysnonymous/synonymous rate ratio
+|      for purifying selection sites
+|
+----------------------------------------------------------------*/
+int Move_OmegaPur (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isOPriorExp, isValidO;
+    MrBFlt      oldO, newO, window, minO, maxO, ran, *value, x, y;
+
+    /* get size of window, centered on current omega value */
+    window = mvp[0];
+
+    /* get old value of omega */
+    value = GetParamVals(param, chain, state[chain]);
+    newO = oldO = value[0];
+    
+    /* get minimum and maximum values for omega */
+    minO = 0.0;
+    maxO = value[1];
+    
+    /* get prior for omega */
+    if (param->paramId == OMEGA_BUD || param->paramId == OMEGA_BUF || param->paramId == OMEGA_BED || 
+        param->paramId == OMEGA_BEF || param->paramId == OMEGA_BFD || param->paramId == OMEGA_BFF) 
+        isOPriorExp = NO;
+    else
+        isOPriorExp = YES;
+
+    /* change value for omega */
+    ran = RandomNumber(seed);
+    if (maxO-minO < window)
+        {
+        window = maxO-minO;
+        }
+    newO = oldO + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidO = NO;
+    do
+        {
+        if (newO < minO)
+            newO = 2* minO - newO;
+        else if (newO > maxO)
+            newO = 2 * maxO - newO;
+        else
+            isValidO = YES;
+        } while (isValidO == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* copy new omega value back */
+    value[0] = newO;
+
+    /* get prior ratio (part 2) */
+    if (isOPriorExp == NO)
+        {
+        *lnPriorRatio = 0.0;
+        }
+    else
+        {
+        x = LogOmegaPrior (newO, value[1], value[2]);
+        y = LogOmegaPrior (oldO, value[1], value[2]);
+        *lnPriorRatio = x - y;
+        }
+
+    /* Set update flags for all partitions that share this omega. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_ParsEraser1: This proposal mechanism changes the topology and
+|      branch lengths of an unrooted tree. A randomly chosen region of
+|      the tree is erased. Parsimony is used to guide the selection of
+|      a new topology for the erased part of the tree. The parsimony
+|      branch lengths are used to guide the proposal of new branch
+|      lengths. This variant (1) uses exhaustive enumeration.
+|
+|      Programmed by FR 2004-10-23--
+|
+----------------------------------------------------------------*/
+int Move_ParsEraser1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, j, isVPriorExp, nSubTerminals, nEmbeddedTrees;
+    MrBFlt      alphaPi, warp, minV, maxV, minP, maxP, brlensExp=0.0, newM, oldM, maxLen,
+                *brlensCur, *brlensNew, *parslensCur, *parslensNew,
+                curLength, newLength, lnJacobian, lnRandomRatio, alpha[2], prob[2],
+                minLenCur, minLenNew, f;
+    TreeNode    *p=NULL;
+    Tree        *t, *subtree, *subtree1, memTree[2];
+    ModelParams *mp;
+    ModelInfo   *m;
+    TreeInfo    tInfo;
+
+    /* set pointers to NULL */
+    subtree = subtree1 = NULL;
+    brlensCur = NULL;
+    for (i=0; i<2; i++)
+        {
+        memTree[i].allDownPass = NULL;
+        memTree[i].intDownPass = NULL;
+        memTree[i].nodes = NULL;
+        }
+    tInfo.leaf = NULL;
+
+    /* Set alpha Pi for Dirichlet p generator */
+    alphaPi = mvp[0];
+    alphaPi = 0.05;
+    
+    /* Set the parsimony warp factor */
+    warp = mvp[1];
+    warp = 0.2;
+    
+    /* Set the number of terminals (nSubTerminals, column 3) in erased tree */
+    /* Erased Nodes => Leaves => Terminals => Embedded trees => Embedded histories => New trees
+                  2 => 3      => 4         => 2              => 2 = 2!             => 3 = 1*3
+                  3 => 4      => 5         => 5              => 6 = 3!             => 15 = 1*3*5
+                  4 => 5      => 6         => 14             => 24 = 4!            => 105 = 1*3*5*7
+                  5 => 6      => 7         => 42             => 120 = 5!           => 945 = 1*3*5*7*9
+                  etc               */  
+    nSubTerminals = (int) (RandomNumber(seed) * 4) + 4;
+    nSubTerminals = 7;
+
+    /* initialize log prior and log proposal probabilities */
+    *lnPriorRatio = *lnProposalRatio = 0.0;
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+    minP = 3.0 * ((1.0 / 4.0) - ((1.0 / 4.0) * exp (-4.0 * minV / 3.0)));
+    maxP = 3.0 * ((1.0 / 4.0) - ((1.0 / 4.0) * exp (-4.0 * maxV / 3.0)));
+
+    /* allocate some memory for this move */
+    brlensCur = (MrBFlt *) SafeMalloc (8 * nSubTerminals * sizeof (MrBFlt));
+    if (!brlensCur)
+        {
+        MrBayesPrint ("%s   ERROR: Could not allocate brlensCur\n", spacer);
+        goto errorExit;
+        }
+    brlensNew = brlensCur + 2*nSubTerminals;
+    parslensCur = brlensCur + 4 * nSubTerminals;
+    parslensNew = brlensCur + 6 * nSubTerminals;
+
+    subtree = &memTree[0];
+    subtree->nNodes = 2 * nSubTerminals - 2;
+    subtree->nIntNodes = nSubTerminals - 2;
+    subtree->nodes = (TreeNode *) SafeCalloc (subtree->nNodes, sizeof (TreeNode));
+    subtree->allDownPass = (TreeNode **) SafeCalloc (subtree->nNodes, sizeof (TreeNode *));
+    subtree->intDownPass = (TreeNode **) SafeCalloc (subtree->nIntNodes, sizeof (TreeNode *));
+    if (!subtree->nodes || !subtree->intDownPass || !subtree->allDownPass)
+        {
+        MrBayesPrint ("%s   ERROR: Could not allocate subtree\n", spacer);
+        goto errorExit;
+        }
+
+    subtree1 = &memTree[1];
+    subtree1->nNodes = 2 * nSubTerminals - 2;
+    subtree1->nIntNodes = nSubTerminals - 2;
+    subtree1->nodes = (TreeNode *) SafeCalloc (subtree1->nNodes, sizeof (TreeNode));
+    subtree1->allDownPass = (TreeNode **) SafeCalloc (subtree1->nNodes, sizeof (TreeNode *));
+    subtree1->intDownPass = (TreeNode **) SafeCalloc (subtree1->nIntNodes, sizeof (TreeNode *));
+    if (!subtree1->nodes || !subtree1->intDownPass || !subtree1->allDownPass)
+        {
+        MrBayesPrint ("%s   ERROR: Could not allocate subtree1\n", spacer);
+        goto errorExit;
+        }
+
+    tInfo.leaf = (TreeNode **) SafeCalloc (t->nNodes, sizeof(TreeNode *));
+    if (!tInfo.leaf)
+        {
+        MrBayesPrint ("%s   ERROR: Could not allocate tInfo.leaf\n", spacer);
+        goto errorExit;
+        }
+    tInfo.vertex = tInfo.leaf + t->nNodes - t->nIntNodes;
+
+    /* Select a random embedded subtree with nSubTerminals terminals */
+    if (GetRandomEmbeddedSubtree (t, nSubTerminals, seed, &nEmbeddedTrees) == ERROR)
+        {
+        MrBayesPrint ("%s   ERROR: Could not get subtree\n", spacer);
+        goto errorExit;
+        }
+
+    /* Set update flags (We'd better do it before the marked nodes disappear) */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        if (p->marked == YES)
+            {
+            p->upDateCl = YES; 
+            p->upDateTi = YES;
+            }
+        else if (p->left->upDateCl == YES || p->right->upDateCl == YES)
+                p->upDateCl = YES; 
+        }
+
+    /* Fill in subtrees */
+    CopyTreeToSubtree (t, subtree); 
+    CopyTreeToSubtree (t, subtree1);
+
+    /* Calculate downstates and upstate of root node of subtree */
+    GetParsDP (t, t->root->left, chain);
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        if (p->marked == YES && p->anc->marked == NO)
+            break;
+        }
+    GetParsimonySubtreeRootstate (t, p->anc, chain);
+
+    /* Get parsimony length of current tree */
+    curLength = GetParsimonyLength (subtree, chain);
+    
+    /* Get the Markov and parsimony branch lengths of the current subtree */
+    GetParsimonyBrlens (subtree, chain, parslensCur);
+    for (i=0; i<subtree->nNodes-1; i++)
+        brlensCur[i] = subtree->allDownPass[i]->length;
+
+    /* Calculate parsimony score of all trees relative to shortest tree (1.0) */
+    tInfo.totalScore = 0.0;
+    tInfo.stopScore = -1.0;
+    tInfo.minScore = curLength;
+    tInfo.warp = warp;
+    ExhaustiveParsimonySearch (subtree, chain, &tInfo);
+        
+    /* Choose one of these trees randomly based on its score */
+    tInfo.stopScore = RandomNumber(seed) * tInfo.totalScore;
+    tInfo.totalScore = 0.0;
+    ExhaustiveParsimonySearch (subtree1, chain, &tInfo);
+    /* ShowNodes (subtree1->root, 0 , NO); */
+    /* getchar(); */
+
+    /* Get length of that tree */
+
+    newLength = GetParsimonyLength (subtree1, chain);
+
+    /* Get the parsimony branch lengths of the new subtree */
+    GetParsimonyBrlens (subtree1, chain, parslensNew);
+
+    /* Find the maximum length of a branch */
+    maxLen = 0.0;
+    for (i=0; i<t->nRelParts; i++)
+        {
+        j = t->relParts[i];
+        m = &modelSettings[j];
+        maxLen += m->numUncompressedChars;
+        }
+    
+    /* Find the Markov branch lengths of the new subtree */
+    /* Calculate Jacobian and prob ratio for the Dirichlet random number generator */
+    lnJacobian = lnRandomRatio = 0.0;
+    minLenCur = minLenNew = 0.0;
+    for (i=0; i<subtree1->nNodes-1; i++)
+        {
+        minLenCur += parslensCur[i];
+        minLenNew += parslensNew[i];
+        }
+    for (i=0; i<subtree1->nNodes-1; i++)
+        {
+        p = subtree1->allDownPass[i];
+        f = newLength / minLenNew;
+        alpha[0] = parslensNew[i] * f * alphaPi + 1.0;
+        alpha[1] = (maxLen - parslensNew[i] * f) * alphaPi + 1.0;
+        DirichletRandomVariable (alpha, prob, 2, seed);
+        if (prob[0] >= maxP || prob[0] <= minP)
+            {
+            abortMove = YES;
+            return NO_ERROR;
+            }
+
+        p->length = (-3.0 / 4.0) * log (1.0 - 4.0 * prob[0] / 3.0);
+        lnJacobian += (-4.0 * brlensCur[i] / 3.0) - log (1.0 - 4.0 * prob[0] / 3.0);
+        lnRandomRatio -= log (pow (prob[0], alpha[0] - 1.0) * pow (prob[1], alpha[1] - 1.0));
+        f = curLength / minLenNew;
+        alpha[0] = parslensCur[i] * f * alphaPi + 1.0;
+        alpha[1] = (maxLen - parslensCur[i] * f) * alphaPi + 1.0;
+        prob[0] = 3.0 * ((1.0 / 4.0) - ((1.0 / 4.0) * exp (-4.0 * brlensCur[i] / 3.0)));
+        prob[1] = 1.0 - prob[0];
+        lnRandomRatio += log (pow (prob[0], alpha[0] - 1.0) * pow (prob[1], alpha[1] - 1.0));
+        }
+
+    /* Store the new Markov branch lengths */
+    for (i=0; i<subtree1->nNodes-1; i++)
+        brlensNew[i] = subtree1->allDownPass[i]->length;
+
+    /* Calculate the proposal ratio */
+    (*lnProposalRatio) = lnJacobian + lnRandomRatio + log (warp/3.0) * (curLength - newLength) + log (1.0-warp) * (newLength - curLength);
+
+    /* Calculate the prior ratio */
+    if (isVPriorExp == YES)
+        {
+        newM = oldM = 0.0;
+        for (i=0; i<subtree->nNodes-1; i++)
+            {
+            oldM += brlensCur[i];
+            newM += brlensNew[i];
+            }
+        (*lnPriorRatio) += brlensExp * (oldM - newM);
+        }
+
+    /* Copy subtree into tree */
+    CopySubtreeToTree (subtree1, t);
+    /* ShowNodes (subtree1->root, 0, NO); */
+    /* ShowNodes (t->root, 0, NO); */
+
+    /* Update node sequences */
+    GetDownPass (t);
+    
+    /* correct for difference in number of embedded subtrees */
+    if (GetRandomEmbeddedSubtree (t, nSubTerminals, seed, &i) == ERROR)
+        {
+        MrBayesPrint ("%s   Could not count number of subtrees in Move_ParsEraser1\n", spacer);
+        goto errorExit;
+        }
+    if (i != nEmbeddedTrees)
+        (*lnProposalRatio) += log ((MrBFlt) nEmbeddedTrees / (MrBFlt) i);
+
+    /* Free memory allocated for this move */
+    free (subtree->allDownPass);
+    free (subtree->intDownPass);
+    free (subtree->nodes);
+    free (subtree1->allDownPass);
+    free (subtree1->intDownPass);
+    free (subtree1->nodes);
+    free (brlensCur);
+    free (tInfo.leaf);
+
+    return (NO_ERROR);
+
+errorExit:
+
+    free (subtree->allDownPass);
+    free (subtree->intDownPass);
+    free (subtree->nodes);
+    free (subtree1->allDownPass);
+    free (subtree1->intDownPass);
+    free (subtree1->nodes);
+    free (brlensCur);
+    free (tInfo.leaf);
+
+    return (ERROR);
+}
+
+
+int Move_ParsSPR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology (and branch lengths) using SPR (asymmetric) biased according to parsimony scores. */
+
+    int         i, j, n, division, topologyHasChanged, isVPriorExp;
+    BitsLong    *pA, *pV, *pP, y[2];
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, length=0.0,
+                cumulativeProb, warpFactor, ran, tuning, increaseProb, decreaseProb,
+                divFactor, nStates, rateMult, v_typical, sum1, sum2, tempsum, tempc, tempy;
+    CLFlt       *nSitesOfPat, *nSites, *globalNSitesOfPat;
+    TreeNode    *p, *q, *a, *b, *u, *v, *c=NULL, *d;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m = NULL;
+
+    warpFactor = mvp[0];                  /* tuning parameter determining how heavily to weight according to parsimony scores */
+    increaseProb = decreaseProb = mvp[1]; /* reweighting probabilities */
+    v_typical = mvp[2];                   /* typical branch length for conversion of parsimony score to log prob ratio */
+    tuning = mvp[3];                      /* multiplier tuning parameter */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+
+#   if defined (DEBUG_ParsSPR)
+    // WriteTopologyToFile (stdout, t->root->left, t->isRooted);  fprintf (stdout, ";\t");
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+#   endif
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        p->d = 0;
+        }
+
+    /* pick a random branch */
+    p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes -2))];
+    q = p->anc->right;
+    if (q == p)
+        q = p->anc->left;
+    if ((p->anc->anc->anc == NULL || p->anc->isLocked == YES) && (q->left == NULL || q->isLocked == YES))
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+        
+    /* set up pointers for nodes around the picked branch */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+
+    /* clip tree */
+    a->anc = b;
+    if (b->left == u)
+        b->left = a;
+    else
+        b->right = a;
+
+    /* get final parsimony states for the root part */
+    GetParsDP (t, t->root->left, chain);
+    GetParsFP (t, t->root->left, chain);
+
+    /* get downpass parsimony states for the crown part */
+    GetParsDP (t, v, chain);
+
+    /* mark all nodes in the root part of the tree, taking constraints into account */
+    /* first mark a */
+    a->marked = YES;
+    /* then move down towards root */
+    if (u->isLocked == NO)
+        {
+        p = a->anc;
+        while (p->anc != NULL)
+            {
+            p->marked = YES;
+            if (p->isLocked == YES)
+                break;
+            p = p->anc;
+            }
+        }
+
+    /* finally move up */
+    for (i=t->nNodes-2; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO && p->anc->marked == YES && p->anc->isLocked == NO && p != u)
+            p->marked = YES;
+        }
+
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)
+        {
+        MrBayesPrint ("%s   Problem allocating nSitesOfPat in Move_ParsSPR\n", spacer);
+        return (ERROR);
+        }
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+        for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }
+        }
+
+    /* cycle through the possibilities and record the parsimony length */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO)
+            continue;
+        /* find the parsimony length */
+        p->d = 0.0;
+        for (n=0; n<t->nRelParts; n++)
+            {
+            division = t->relParts[n];
+            
+            /* Find model settings */
+            m = &modelSettings[division];
+
+            /* find nSitesOfPat */
+            nSites = nSitesOfPat + m->compCharStart;
+
+            /* find downpass parsimony sets for the node and its environment */
+            pP   = m->parsSets[p->index];
+            pA   = m->parsSets[p->anc->index];
+            pV   = m->parsSets[v->index];
+        
+            length = 0.0;
+            if (m->nParsIntsPerSite == 1)
+                {
+                for (j=0; j<m->numChars; j++)
+                    {
+                    y[0] = (pP[j] | pA[j]) & pV[j];
+                    if (y[0] == 0)
+                        length += nSites[j];
+                    }
+                }
+            else /* if (m->nParsIntsPerSite == 2) */
+                {
+                for (j=0; j<2*m->numChars; j+=2)
+                    {
+                    y[0] = (pP[j] | pA[j]) & pV[j];
+                    y[1] = (pP[j+1] | pA[j+1]) & pV[j+1];
+                    if ((y[0] | y[1]) == 0)
+                        length += nSites[j/2];
+                    }
+                }
+
+            /* find nStates and ratemult */
+            nStates = m->numModelStates;
+            if (m->dataType == STANDARD)
+                nStates = 2;
+            rateMult = GetRate(division, chain);
+
+            /* get division warp factor */
+            divFactor = - warpFactor * log((1.0/nStates) - exp(-nStates/(nStates-1)*v_typical*rateMult)/nStates);
+
+            p->d += divFactor * length;
+            }
+        }
+
+    /* find the min length and the sum for the forward move */    
+    minLength = -1.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO || p == a)
+            continue;
+        if (minLength < 0.0 || p->d < minLength)
+            minLength = p->d;
+        }
+    sum1 = 0.0; tempc = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES && p != a)
+            {
+            /* Kahan summation to reduce numerical error */
+            tempy = exp (minLength - p->d) - tempc;
+            tempsum = sum1 + tempy;
+            tempc = (tempsum - sum1) - tempy;
+            sum1 = tempsum;
+            }
+        }
+    
+    /* generate a random uniform */
+    ran = RandomNumber(seed) * sum1;
+
+    /* select the appropriate reattachment point */
+    cumulativeProb = 0.0; tempc = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES && p != a)
+            {
+            c = p;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp (minLength - p->d) - tempc;
+            tempsum = cumulativeProb + tempy;
+            tempc = (tempsum - cumulativeProb) - tempy;
+            cumulativeProb = tempsum;
+            if (cumulativeProb > ran)
+                break;
+            }
+        }
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) = c->d - minLength + log(sum1);
+
+    /* find the min length and the sum for the backward move */
+    minLength = -1.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO || p == c)
+            continue;
+        if (minLength < 0.0 || p->d < minLength)
+            minLength = p->d;
+        }
+    sum2 = 0.0; tempc = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES && p != c)
+            {
+            /* Kahan summation to reduce numerical error */
+            tempy = exp (minLength - p->d) - tempc;
+            tempsum = sum2 + tempy;
+            tempc = (tempsum - sum2) - tempy;
+            sum2 = tempsum;
+            }
+        }
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) += minLength - a->d - log(sum2);
+
+    /* reattach */
+    d = c->anc;
+    c->anc = u;
+    if (u->left == v)
+        u->right = c;
+    else
+        u->left = c;
+    if (d->left == c)
+        d->left = u;
+    else
+        d->right = u;
+    u->anc = d;
+
+    /* c cannot be a, as a is skiped in the selection for reattachment point */
+    assert (c != a);
+    /* transfer lock if necessary */
+    /* if u is locked, then we have moved upwards and need to leave the u lock behind */
+    if (u->isLocked == YES)
+        {
+        u->isLocked = NO;
+        a->isLocked = YES;
+        a->lockID = u->lockID;
+        u->lockID = -1;
+        }
+    /* if c is on root path and locked, we need to transfer lock to u */
+    p = b;
+    while (p != NULL)
+        {
+        if (p == c)
+            break;
+        p = p->anc;
+        }
+    if (p == c && c->isLocked == YES)
+        {
+        u->isLocked = YES;
+        u->lockID = c->lockID;
+        c->isLocked = NO;
+        c->lockID = -1;
+        }
+
+    /* reassign branch lengths */
+    p = c;
+    while (p->anc->anc != NULL)
+        {
+        if (p == a)
+            break;
+        p = p->anc;
+        }
+    if (p == a)
+        {
+        /* c is descendant to a so move a->length and not u->length */
+        x = u->length;
+        u->length = a->length;
+        a->length = x;
+        }
+    p = a;
+    while (p->anc->anc != NULL)
+        {
+        if (p == c)
+            break;
+        p = p->anc;
+        }
+    if (p == c)
+        {
+        /* c is ancestor to a so insert above instead of below */
+        x = c->length;
+        c->length = u->length;
+        u->length = x;
+        }
+
+    topologyHasChanged = YES;
+
+    /* hit c length with multiplier (a and u dealt with below) */
+    x = c->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV)
+            x = minV * minV / x;
+        else if (x > maxV)
+            x = maxV * maxV / x;
+        }
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / c->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (c->length - x);
+    c->length = x;
+    
+    /* hit a length with multiplier */
+    x = a->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV)
+            x = minV * minV / x;
+        else if (x > maxV)
+            x = maxV * maxV / x;
+        }
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / a->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (a->length - x);
+    a->length = x;
+
+    /* hit u length with multiplier */
+    x = u->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV)
+            x = minV * minV / x;
+        else if (x > maxV)
+            x = maxV * maxV / x;
+        }
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / u->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (u->length - x);
+    u->length = x;
+
+    /* set tiprobs update flags */
+    a->upDateTi = YES;
+    u->upDateTi = YES;
+    c->upDateTi = YES;  /* could be same as a but that does not matter */
+
+    /* set flags for update of cond likes from u and down to root */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+
+    /* set flags for update of cond likes from b and down to root */
+    p = b;
+    while (p->anc != NULL && p->upDateCl == NO)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+#   if defined (DEBUG_ParsSPR)
+    // WriteTopologyToFile (stdout, t->root->left, t->isRooted);
+    // fprintf (stdout, ";\t");  fprintf (stdout, "%lf\n", *lnProposalRatio);
+    printf ("After:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+    printf ("Proposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  a: %d  b: %d\n",v->index, u->index, a->index, b->index);
+    printf ("Has topology changed? %d\n",topologyHasChanged);
+    getchar();
+#   endif
+
+    free (nSitesOfPat);
+
+    return (NO_ERROR);
+}
+
+
+int Move_ParsSPR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology (and branch lengths) using SPR (symmetric) biased according to parsimony scores,
+       controlled by a window defined by a certain node distance radius. Note: w = e^{-S} */
+    
+    int         i, j, k, n, division, topologyHasChanged, moveInRoot, nNeighbor, nRoot, nCrown, iA, jC, isVPriorExp;
+    BitsLong    *pA, *pB, *pP, *pC, *pD, y[2];
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, length=0.0, *parLength=NULL, prob, ran, tuning, warpFactor,
+                sum1, sum2, tempsum, tempc, tempy;
+    CLFlt       *nSites, *nSitesOfPat=NULL, *globalNSitesOfPat;
+    TreeNode    *p, *q, *r, *a, *b, *u, *v, *c, *d, *newB, *newA, *newC, **pRoot=NULL, **pCrown=NULL;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m=NULL;
+    
+    warpFactor = mvp[0];                  /* tuning parameter determining how heavily to weight according to parsimony scores */
+//  increaseProb = decreaseProb = mvp[1]; /* reweighting probabilities */
+//  v_typical = mvp[2];                   /* typical branch length for conversion of parsimony score to log prob ratio */
+    tuning = mvp[3];                      /* multiplier tuning parameter */
+    nNeighbor = (int)mvp[4];              /* distance to move picked branch in root and crown part */
+    
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+    
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* pick a random branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes -1))];
+        q = p->anc->right;  if (q == p) q = p->anc->left;
+        i = j = 0;
+        if (p->left == NULL)
+            j = 2;
+        if (p->anc->anc == NULL)
+            i = 2;
+        if (p->anc->anc != NULL && (p->anc->isLocked == YES || p->anc->anc->anc == NULL))
+            i++;
+        if (p->anc->anc != NULL && (q->isLocked == YES || q->left == NULL))
+            i++;
+        if (p->left != NULL && (p->left->isLocked == YES || p->left->left == NULL))
+            j++;
+        if (p->left != NULL && (p->right->isLocked == YES || p->right->left == NULL))
+            j++;
+        } while (i == 2 && j == 2);
+    
+    /* determine moving direction */
+    if (j == 2)
+        moveInRoot = YES;
+    else if (i == 2)
+        moveInRoot = NO;
+    else if (RandomNumber(seed) < 0.5)
+        moveInRoot = YES;
+    else
+        moveInRoot = NO;
+
+    /* set up pointers for nodes around the picked branch */
+    /* should never change u, v, a, b, c, d pointers */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    c = v->left;
+    d = v->right;
+
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = 0;
+        p->marked = NO;
+        }
+
+    /* mark nodes nNeighbor away in root (negative) or crown (positive) respecting constraints */
+    nRoot = nCrown = 1;
+    if (moveInRoot == YES)
+        {
+        /* clip root part of tree */
+        a->anc = b;
+        if (b->left == u)
+            b->left = a;
+        else
+            b->right = a;
+    
+        /* mark the root part */
+        if (u->isLocked == NO )
+            {
+            p = a; q = b; n = 0;
+            while (q->anc != NULL)
+                {
+                q->marked = YES;
+                q->x = n;    // temporary, for MarkDistance below
+                if (q->left == p)
+                    MarkDistance(q->right, YES, nNeighbor, &nRoot);
+                else
+                    MarkDistance(q->left,  YES, nNeighbor, &nRoot);
+                q->x = --n;  // final
+                nRoot++;
+                if (q->isLocked == YES || abs(q->x) >= nNeighbor)
+                    break;
+                p = q; q = q->anc;
+                }
+            }
+        if (a->isLocked == NO)
+            {
+            MarkDistance(a->left,  YES, nNeighbor, &nRoot);
+            MarkDistance(a->right, YES, nNeighbor, &nRoot);
+            }
+            
+        /* get final parsimony states for the root part */
+        GetParsDP (t, t->root->left, chain);
+        GetParsFP (t, t->root->left, chain);
+        /* get final parsimony states for the crown part */
+        GetParsDP (t, v, chain);
+        GetParsFP (t, v, chain);
+        }
+    else  /* moveInRoot == NO */
+        {
+        /* clip crown part of tree */
+        c->anc = d;
+        d->anc = c;
+
+        /* mark the crown part */
+        if (c->isLocked == NO)
+            {
+            MarkDistance(c->left,  NO, nNeighbor, &nCrown);
+            MarkDistance(c->right, NO, nNeighbor, &nCrown);
+            }
+        if (d->isLocked == NO)
+            {
+            MarkDistance(d->left,  NO, nNeighbor, &nCrown);
+            MarkDistance(d->right, NO, nNeighbor, &nCrown);
+            }
+        
+        /* get final parsimony states for the root part */
+        if (u->anc != NULL) {
+            a->anc = b;  /* clip */
+            if (b->left == u) b->left = a;
+            else             b->right = a;
+            GetParsDP (t, t->root->left, chain);
+            GetParsFP (t, t->root->left, chain);
+            a->anc = u;  /* change back */
+            if (b->left == a) b->left = u;
+            else             b->right = u;
+            }
+        /* get final parsimony states for the crown part */
+        GetParsDP (t, c, chain);
+        GetParsDP (t, d, chain);
+        GetParsFP (t, c, chain);
+        GetParsFP (t, d, chain);
+        }
+    
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)  goto errorExit;
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+    /*  for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }  // this is slow at the moment */
+        }
+
+    /* need to alloc a matrix for parsimony lengths, an array of pointers to crown part,
+       and an array of pointers to root part. */
+    parLength = (MrBFlt *) SafeCalloc ((size_t)nRoot * (size_t)nCrown, sizeof(MrBFlt));
+    pRoot  = (TreeNode **) SafeCalloc(nRoot,  sizeof(TreeNode *));
+    pCrown = (TreeNode **) SafeCalloc(nCrown, sizeof(TreeNode *));
+    if (!parLength || !pRoot || !pCrown)  goto errorExit;
+    
+    /* starting position */
+    pRoot[0] = a; pCrown[0] = c;
+    for (i=j=1, n=t->nNodes-2; n>=0; n--)
+        {  /* and the rest */
+        p = t->allDownPass[n];
+        if (p->marked == YES && p->x < 0)
+            pRoot[i++] = p;
+        if (p->marked == YES && p->x > 0)
+            pCrown[j++] = p;
+        }
+    assert (i==nRoot && j==nCrown);
+    
+    /* cycle through the possibilities and record the parsimony length */
+    for (j=0; j<nCrown; j++)
+        {
+        for (i=0; i<nRoot; i++)
+            {
+            parLength[i+j*nRoot] = 0.0;
+            for (n=0; n<t->nRelParts; n++)
+                {
+                division = t->relParts[n];
+                
+                /* Find model settings */
+                m = &modelSettings[division];
+                
+                /* find nSitesOfPat */
+                nSites = nSitesOfPat + m->compCharStart;
+                
+                /* find parsimony length for each candidate position */
+                length = 0.0;
+                if (moveInRoot == YES)
+                    {
+                    pA = m->parsSets[pRoot[i]->index];
+                    pB = m->parsSets[pRoot[i]->anc->index];
+                    pP = m->parsSets[v->index];
+                    
+                    if (m->nParsIntsPerSite == 1)
+                        {
+                        for (k=0; k<m->numChars; k++)
+                            {
+                            y[0] = (pA[k] | pB[k]) & pP[k];
+                            if (y[0] == 0)
+                                length += nSites[k];
+                            }
+                        }
+                    else /* if (m->nParsIntsPerSite == 2) */
+                        {
+                        for (k=0; k<2*m->numChars; k+=2)
+                            {
+                            y[0] = (pA[k] | pB[k]) & pP[k];
+                            y[1] = (pA[k+1] | pB[k+1]) & pP[k+1];
+                            if ((y[0] | y[1]) == 0)
+                                length += nSites[k/2];
+                            }
+                        }
+                    }
+                else if (u->anc == NULL)
+                    {
+                    pP = m->parsSets[u->index];
+                    pC = m->parsSets[pCrown[j]->index];
+                    pD = m->parsSets[pCrown[j]->anc->index];
+                    
+                    if (m->nParsIntsPerSite == 1)
+                        {
+                        for (k=0; k<m->numChars; k++)
+                            {
+                            y[0] = pP[k] & (pC[k] | pD[k]);
+                            if (y[0] == 0)
+                                length += nSites[k];
+                            }
+                        }
+                    else /* if (m->nParsIntsPerSite == 2) */
+                        {
+                        for (k=0; k<2*m->numChars; k+=2)
+                            {
+                            y[0] = pP[k] & (pC[k] | pD[k]);
+                            y[1] = pP[k+1] & (pC[k+1] | pD[k+1]);
+                            if ((y[0] | y[1]) == 0)
+                                length += nSites[k/2];
+                            }
+                        }
+                    }
+                else
+                    {
+                    pA = m->parsSets[a->index];
+                    pB = m->parsSets[b->index];
+                    pC = m->parsSets[pCrown[j]->index];
+                    pD = m->parsSets[pCrown[j]->anc->index];
+                    
+                    if (m->nParsIntsPerSite == 1)
+                        {
+                        for (k=0; k<m->numChars; k++)
+                            {
+                            y[0] = (pA[k] | pB[k]) & (pC[k] | pD[k]);
+                            if (y[0] == 0)
+                                length += nSites[k];
+                            }
+                        }
+                    else /* if (m->nParsIntsPerSite == 2) */
+                        {
+                        for (k=0; k<2*m->numChars; k+=2)
+                            {
+                            y[0] = (pA[k] | pB[k]) & (pC[k] | pD[k]);
+                            y[1] = (pA[k+1] | pB[k+1]) & (pC[k+1] | pD[k+1]);
+                            if ((y[0] | y[1]) == 0)
+                                length += nSites[k/2];
+                            }
+                        }
+                    }
+                
+                /* get division warp factor */
+                parLength[i+j*nRoot] += warpFactor * length;
+                }
+            }
+        }
+    
+    /* find the min length and the sum for the forward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum1 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum1 + tempy;  tempc = (tempsum - sum1) - tempy;
+            sum1 = tempsum;
+            // sum1 += exp(minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed) * sum1;
+    
+    /* select the appropriate reattachment point */
+    newA = a; newC = c;
+    prob = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            // prob += exp (minLength - parLength[i+j*nRoot]);
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = prob + tempy;  tempc = (tempsum - prob) - tempy;
+            prob = tempsum;
+            if (prob > ran) {
+                /* proposed new attaching position */
+                newA = pRoot[i];
+                newC = pCrown[j];
+                goto outLoop;
+                }
+            }
+outLoop:;
+    iA = i; jC = j;
+    
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) = parLength[i+j*nRoot] - minLength + log(sum1);
+    
+    /* find the min length and the sum for the backward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum2 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum2 + tempy;  tempc = (tempsum - sum2) - tempy;
+            sum2 = tempsum;
+            // sum2 += exp (minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+    
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) += minLength - parLength[0] - log(sum2);
+    
+    if (moveInRoot == YES)  /* root part has changed */
+        {
+        /* reattach the root part */
+        newB = newA->anc;
+        newA->anc = u;
+        if (u->left == v)
+            u->right = newA;
+        else
+            u->left = newA;
+        u->anc = newB;
+        if (newB->left == newA)
+            newB->left = u;
+        else
+            newB->right = u;
+
+        /* if u is locked, then we have moved upwards and need to leave the u lock behind */
+        if (u->isLocked == YES)
+            {
+            u->isLocked = NO;
+            a->isLocked = YES;
+            a->lockID = u->lockID;
+            u->lockID = -1;
+            }
+        
+        p = newA;
+        while (p->anc != NULL)
+            {
+            if (p == a) break;
+            p = p->anc;
+            }
+        if (p == a)
+            {
+            /* newA is descendant to a so move a->length not u->length */
+            x = u->length;
+            u->length = a->length;
+            a->length = x;
+            }
+
+        p = b;
+        while (p->anc != NULL)
+            {
+            if (p == newA) break;
+            p = p->anc;
+            }
+        if (p == newA)
+            {
+            /* newA is ancestor to a so insert above instead of below */
+            x = newA->length;
+            newA->length = u->length;
+            u->length = x;
+            /* newA is on root path and locked, we need to transfer lock to u */
+            if (newA->isLocked == YES) {
+                u->isLocked = YES;
+                u->lockID = newA->lockID;
+                newA->isLocked = NO;
+                newA->lockID = -1;
+                }
+            }
+        
+        /* hit a length with multiplier */
+        x = a->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / a->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (a->length - x);
+        a->length = x;
+
+        /* hit u length with multiplier */
+        x = u->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / u->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (u->length - x);
+        u->length = x;
+
+        /* hit newA length with multiplier */
+        x = newA->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newA->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newA->length - x);
+        newA->length = x;
+         
+        /* set tiprobs update flags */
+        newA->upDateTi = YES;
+        a->upDateTi = YES;
+        u->upDateTi = YES;
+            
+        /* set flags for update of cond likes */
+        p = u;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        p = b;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        }
+    
+    if (moveInRoot == NO)  /* crown part has changed */
+        {
+        r = newC;
+        q = newB = newC->anc;
+        /* rotate nodes from newC to c or d (whichever is closest) */
+        tempc = r->length;
+        while (r != c && r != d)
+            {
+            p = q->anc;
+            /* rotate pointers of q */
+            if (q->left == r)
+                q->left = p;
+            else
+                q->right = p;
+            q->anc = r;
+            /* swap q and old */
+            tempy = q->length;
+            q->length = tempc;
+            q->upDateTi = YES;
+            tempc = tempy;
+            /* make sure we get q and r initialized for next round */
+            r = q;
+            q = p;
+            }
+        newB->length = tempc;
+            
+        /* hit q length with multiplier while we are at it */
+        x = q->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }        
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / q->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (q->length - x);
+        q->length = x;
+        q->upDateTi = YES;
+
+        /* hit newB length with multiplier */
+        x = newB->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newB->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newB->length - x);
+        newB->length = x;
+        newB->upDateTi = YES;
+
+        /* hit newC length with multiplier */
+        x = newC->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newC->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newC->length - x);
+        newC->length = x;
+        newC->upDateTi = YES;
+        /* reattach the crown part */
+        v->left = newC;
+        v->right = newB;
+        newC->anc = newB->anc = v;
+        
+        /* set flags for update of cond likes */
+        p = newC;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        p = r;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        }
+    
+    topologyHasChanged = YES;
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+    
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+    /* free up local memory */
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+    
+    return (NO_ERROR);
+    
+errorExit:
+    MrBayesPrint ("%s   Problem allocating memory in Move_ParsSPR\n", spacer);
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+    
+    return (ERROR);
+}
+
+
+int Move_ParsSPR2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology (and branch lengths) using SPR (symmetric) biased according to parsimony scores,
+       controlled by a window defined by a certain node distance radius. Note: S/N */
+    
+    int         i, j, k, n, division, topologyHasChanged, moveInRoot, nNeighbor, nRoot, nCrown, iA, jC, isVPriorExp;
+    BitsLong    *pA, *pB, *pP, *pC, *pD, y[2];
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, length=0.0, *parLength=NULL, prob, ran, tuning, warpFactor,
+                v_typical, divFactor, nStates, sum1, sum2, tempsum, tempc, tempy;
+    CLFlt       *nSites, *nSitesOfPat=NULL, *globalNSitesOfPat;
+    TreeNode    *p, *q, *r, *a, *b, *u, *v, *c, *d, *newB, *newA, *newC, **pRoot=NULL, **pCrown=NULL;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m=NULL;
+    
+    warpFactor = mvp[0];                  /* tuning parameter determining how heavily to weight according to parsimony scores */
+//  increaseProb = decreaseProb = mvp[1]; /* reweighting probabilities */
+    v_typical = mvp[2];                   /* typical branch length for conversion of parsimony score to log prob ratio */
+    tuning = mvp[3];                      /* multiplier tuning parameter */
+    nNeighbor = (int)mvp[4];              /* distance to move picked branch in root and crown part */
+    
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+    
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* pick a random branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes -1))];
+        q = p->anc->right;  if (q == p) q = p->anc->left;
+        i = j = 0;
+        if (p->left == NULL)
+            j = 2;
+        if (p->anc->anc == NULL)
+            i = 2;
+        if (p->anc->anc != NULL && (p->anc->isLocked == YES || p->anc->anc->anc == NULL))
+            i++;
+        if (p->anc->anc != NULL && (q->isLocked == YES || q->left == NULL))
+            i++;
+        if (p->left != NULL && (p->left->isLocked == YES || p->left->left == NULL))
+            j++;
+        if (p->left != NULL && (p->right->isLocked == YES || p->right->left == NULL))
+            j++;
+        } while (i == 2 && j == 2);
+    
+    /* pick an internal branch
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed)*(t->nIntNodes-1))];
+        q = p->anc->left;  if (q == p)  q = p->anc->right;
+        i = j = 0;
+        if (q->isLocked == YES || q->left == NULL)
+            i++;
+        if (p->anc->isLocked == YES || p->anc->anc->anc == NULL)
+            i++;
+        if (p->left->isLocked == YES || p->left->left == NULL)
+            j++;
+        if (p->right->isLocked == YES || p->right->left == NULL)
+            j++;
+        } while (i == 2 && j == 2);
+    */
+
+    /* determine moving direction */
+    if (j == 2)
+        moveInRoot = YES;
+    else if (i == 2)
+        moveInRoot = NO;
+    else if (RandomNumber(seed) < 0.5)
+        moveInRoot = YES;
+    else
+        moveInRoot = NO;
+
+    /* set up pointers for nodes around the picked branch */
+    /* should never change u, v, a, b, c, d pointers */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+    c = v->left;
+    d = v->right;
+
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = 0;
+        p->marked = NO;
+        }
+
+    /* mark nodes nNeighbor away in root (negative) or crown (positive) respecting constraints */
+    nRoot = nCrown = 1;
+    if (moveInRoot == YES)
+        {
+        /* clip root part of tree */
+        a->anc = b;
+        if (b->left == u)
+            b->left = a;
+        else
+            b->right = a;
+    
+        /* mark the root part */
+        if (u->isLocked == NO )
+            {
+            p = a; q = b; n = 0;
+            while (q->anc != NULL)
+                {
+                q->marked = YES;
+                q->x = n;    // temporary, for MarkDistance below
+                if (q->left == p)
+                    MarkDistance(q->right, YES, nNeighbor, &nRoot);
+                else
+                    MarkDistance(q->left,  YES, nNeighbor, &nRoot);
+                q->x = --n;  // final
+                nRoot++;
+                if (q->isLocked == YES || abs(q->x) >= nNeighbor)
+                    break;
+                p = q; q = q->anc;
+                }
+            }
+        if (a->isLocked == NO)
+            {
+            MarkDistance(a->left,  YES, nNeighbor, &nRoot);
+            MarkDistance(a->right, YES, nNeighbor, &nRoot);
+            }
+            
+        /* get final parsimony states for the root part */
+        GetParsDP (t, t->root->left, chain);
+        GetParsFP (t, t->root->left, chain);
+        /* get final parsimony states for the crown part */
+        GetParsDP (t, v, chain);
+        GetParsFP (t, v, chain);
+        }
+    else  /* moveInRoot == NO */
+        {
+        /* clip crown part of tree */
+        c->anc = d;
+        d->anc = c;
+
+        /* mark the crown part */
+        if (c->isLocked == NO)
+            {
+            MarkDistance(c->left,  NO, nNeighbor, &nCrown);
+            MarkDistance(c->right, NO, nNeighbor, &nCrown);
+            }
+        if (d->isLocked == NO)
+            {
+            MarkDistance(d->left,  NO, nNeighbor, &nCrown);
+            MarkDistance(d->right, NO, nNeighbor, &nCrown);
+            }
+        
+        /* get final parsimony states for the root part */
+        if (u->anc != NULL) {
+            a->anc = b;  /* clip */
+            if (b->left == u) b->left = a;
+            else             b->right = a;
+            GetParsDP (t, t->root->left, chain);
+            GetParsFP (t, t->root->left, chain);
+            a->anc = u;  /* change back */
+            if (b->left == a) b->left = u;
+            else             b->right = u;
+            }
+        /* get final parsimony states for the crown part */
+        GetParsDP (t, c, chain);
+        GetParsDP (t, d, chain);
+        GetParsFP (t, c, chain);
+        GetParsFP (t, d, chain);
+        }
+    
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)  goto errorExit;
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+    /*  for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }  // this is slow at the moment */
+        }
+
+    /* need to alloc a matrix for parsimony lengths, an array of pointers to crown part,
+       and an array of pointers to root part. */
+    parLength = (MrBFlt *) SafeCalloc ((size_t)nRoot * (size_t)nCrown, sizeof(MrBFlt));
+    pRoot  = (TreeNode **) SafeCalloc(nRoot,  sizeof(TreeNode *));
+    pCrown = (TreeNode **) SafeCalloc(nCrown, sizeof(TreeNode *));
+    if (!parLength || !pRoot || !pCrown)  goto errorExit;
+    
+    /* starting position */
+    pRoot[0] = a; pCrown[0] = c;
+    for (i=j=1, n=t->nNodes-2; n>=0; n--)
+        {  /* and the rest */
+        p = t->allDownPass[n];
+        if (p->marked == YES && p->x < 0)
+            pRoot[i++] = p;
+        if (p->marked == YES && p->x > 0)
+            pCrown[j++] = p;
+        }
+    assert (i==nRoot && j==nCrown);
+    
+    /* cycle through the possibilities and record the parsimony length */
+    for (j=0; j<nCrown; j++)
+        {
+        for (i=0; i<nRoot; i++)
+            {
+            parLength[i+j*nRoot] = 0.0;
+            for (n=0; n<t->nRelParts; n++)
+                {
+                division = t->relParts[n];
+                
+                /* Find model settings */
+                m = &modelSettings[division];
+                
+                /* find nSitesOfPat */
+                nSites = nSitesOfPat + m->compCharStart;
+                
+                /* find parsimony length for each candidate position */
+                length = 0.0;
+                if (moveInRoot == YES)
+                    {
+                    pA = m->parsSets[pRoot[i]->index];
+                    pB = m->parsSets[pRoot[i]->anc->index];
+                    pP = m->parsSets[v->index];
+                    
+                    if (m->nParsIntsPerSite == 1)
+                        {
+                        for (k=0; k<m->numChars; k++)
+                            {
+                            y[0] = (pA[k] | pB[k]) & pP[k];
+                            if (y[0] == 0)
+                                length += nSites[k];
+                            }
+                        }
+                    else /* if (m->nParsIntsPerSite == 2) */
+                        {
+                        for (k=0; k<2*m->numChars; k+=2)
+                            {
+                            y[0] = (pA[k] | pB[k]) & pP[k];
+                            y[1] = (pA[k+1] | pB[k+1]) & pP[k+1];
+                            if ((y[0] | y[1]) == 0)
+                                length += nSites[k/2];
+                            }
+                        }
+                    }
+                else if (u->anc == NULL)
+                    {
+                    pP = m->parsSets[u->index];
+                    pC = m->parsSets[pCrown[j]->index];
+                    pD = m->parsSets[pCrown[j]->anc->index];
+                    
+                    if (m->nParsIntsPerSite == 1)
+                        {
+                        for (k=0; k<m->numChars; k++)
+                            {
+                            y[0] = pP[k] & (pC[k] | pD[k]);
+                            if (y[0] == 0)
+                                length += nSites[k];
+                            }
+                        }
+                    else /* if (m->nParsIntsPerSite == 2) */
+                        {
+                        for (k=0; k<2*m->numChars; k+=2)
+                            {
+                            y[0] = pP[k] & (pC[k] | pD[k]);
+                            y[1] = pP[k+1] & (pC[k+1] | pD[k+1]);
+                            if ((y[0] | y[1]) == 0)
+                                length += nSites[k/2];
+                            }
+                        }
+                    }
+                else
+                    {
+                    pA = m->parsSets[a->index];
+                    pB = m->parsSets[b->index];
+                    pC = m->parsSets[pCrown[j]->index];
+                    pD = m->parsSets[pCrown[j]->anc->index];
+                    
+                    if (m->nParsIntsPerSite == 1)
+                        {
+                        for (k=0; k<m->numChars; k++)
+                            {
+                            y[0] = (pA[k] | pB[k]) & (pC[k] | pD[k]);
+                            if (y[0] == 0)
+                                length += nSites[k];
+                            }
+                        }
+                    else /* if (m->nParsIntsPerSite == 2) */
+                        {
+                        for (k=0; k<2*m->numChars; k+=2)
+                            {
+                            y[0] = (pA[k] | pB[k]) & (pC[k] | pD[k]);
+                            y[1] = (pA[k+1] | pB[k+1]) & (pC[k+1] | pD[k+1]);
+                            if ((y[0] | y[1]) == 0)
+                                length += nSites[k/2];
+                            }
+                        }
+                    }
+                
+                /* find nStates and ratemult */
+                nStates = m->numModelStates;
+                if (m->dataType == STANDARD)
+                    nStates = 2;
+                v_typical = length/m->numUncompressedChars + 0.0001;
+                
+                /* get division warp factor (prop. to prob. of change) */
+                divFactor = - warpFactor * log(1.0/nStates - exp(-nStates/(nStates-1)*v_typical)/nStates);
+                parLength[i+j*nRoot] += divFactor * length;
+                }
+            }
+        }
+    
+    /* find the min length and the sum for the forward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum1 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum1 + tempy;  tempc = (tempsum - sum1) - tempy;
+            sum1 = tempsum;
+            // sum1 += exp(minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed) * sum1;
+    
+    /* select the appropriate reattachment point */
+    newA = a; newC = c;
+    prob = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            // prob += exp (minLength - parLength[i+j*nRoot]);
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = prob + tempy;  tempc = (tempsum - prob) - tempy;
+            prob = tempsum;
+            if (prob > ran) {
+                /* proposed new attaching position */
+                newA = pRoot[i];
+                newC = pCrown[j];
+                goto outLoop;
+                }
+            }
+outLoop:;
+    iA = i; jC = j;
+    
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) = parLength[i+j*nRoot] - minLength + log(sum1);
+    
+    /* find the min length and the sum for the backward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum2 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum2 + tempy;  tempc = (tempsum - sum2) - tempy;
+            sum2 = tempsum;
+            // sum2 += exp (minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+    
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) += minLength - parLength[0] - log(sum2);
+    
+    if (moveInRoot == YES)  /* root part has changed */
+        {
+        /* reattach the root part */
+        newB = newA->anc;
+        newA->anc = u;
+        if (u->left == v)
+            u->right = newA;
+        else
+            u->left = newA;
+        u->anc = newB;
+        if (newB->left == newA)
+            newB->left = u;
+        else
+            newB->right = u;
+
+        /* if u is locked, then we have moved upwards and need to leave the u lock behind */
+        if (u->isLocked == YES)
+            {
+            u->isLocked = NO;
+            a->isLocked = YES;
+            a->lockID = u->lockID;
+            u->lockID = -1;
+            }
+        
+        p = newA;
+        while (p->anc != NULL)
+            {
+            if (p == a) break;
+            p = p->anc;
+            }
+        if (p == a)
+            {
+            /* newA is descendant to a so move a->length not u->length */
+            x = u->length;
+            u->length = a->length;
+            a->length = x;
+            }
+
+        p = b;
+        while (p->anc != NULL)
+            {
+            if (p == newA) break;
+            p = p->anc;
+            }
+        if (p == newA)
+            {
+            /* newA is ancestor to a so insert above instead of below */
+            x = newA->length;
+            newA->length = u->length;
+            u->length = x;
+            /* newA is on root path and locked, we need to transfer lock to u */
+            if (newA->isLocked == YES) {
+                u->isLocked = YES;
+                u->lockID = newA->lockID;
+                newA->isLocked = NO;
+                newA->lockID = -1;
+                }
+            }
+        
+        /* hit a length with multiplier */
+        x = a->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / a->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (a->length - x);
+        a->length = x;
+
+        /* hit u length with multiplier */
+        x = u->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / u->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (u->length - x);
+        u->length = x;
+
+        /* hit newA length with multiplier */
+        x = newA->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newA->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newA->length - x);
+        newA->length = x;
+         
+        /* set tiprobs update flags */
+        newA->upDateTi = YES;
+        a->upDateTi = YES;
+        u->upDateTi = YES;
+            
+        /* set flags for update of cond likes */
+        p = u;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        p = b;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        }
+    
+    if (moveInRoot == NO)  /* crown part has changed */
+        {
+        r = newC;
+        q = newB = newC->anc;
+        /* rotate nodes from newC to c or d (whichever is closest) */
+        tempc = r->length;
+        while (r != c && r != d)
+            {
+            p = q->anc;
+            /* rotate pointers of q */
+            if (q->left == r)
+                q->left = p;
+            else
+                q->right = p;
+            q->anc = r;
+            /* swap q and old */
+            tempy = q->length;
+            q->length = tempc;
+            q->upDateTi = YES;
+            tempc = tempy;
+            /* make sure we get q and r initialized for next round */
+            r = q;
+            q = p;
+            }
+        newB->length = tempc;
+            
+        /* hit q length with multiplier while we are at it */
+        x = q->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }        
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / q->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (q->length - x);
+        q->length = x;
+        q->upDateTi = YES;
+
+        /* hit newB length with multiplier */
+        x = newB->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newB->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newB->length - x);
+        newB->length = x;
+        newB->upDateTi = YES;
+
+        /* hit newC length with multiplier */
+        x = newC->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newC->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newC->length - x);
+        newC->length = x;
+        newC->upDateTi = YES;
+        /* reattach the crown part */
+        v->left = newC;
+        v->right = newB;
+        newC->anc = newB->anc = v;
+        
+        /* set flags for update of cond likes */
+        p = newC;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        p = r;
+        while (p->anc != NULL)
+            {
+            p->upDateCl = YES;
+            p = p->anc;
+            }
+        }
+    
+    topologyHasChanged = YES;
+
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+    
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+    /* free up local memory */
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+    
+    return (NO_ERROR);
+    
+errorExit:
+    MrBayesPrint ("%s   Problem allocating memory in Move_ParsSPR\n", spacer);
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+    
+    return (ERROR);
+}
+
+
+int Move_ParsSPRClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change branch lengths and topology (potentially) using SPR-type move, parsimony-biased */
+
+    /* This move picks a branch and then chooses a reattachment point based on
+       the parsimony score. On the ending branch, the attachment point is reinserted
+       randomly along the branch (below the minimum age of the node). Since 2010-11-02
+       the move is Metropolized to improve efficiency. */
+    
+    int         i, j, n, division, n1=0, n2=0, n3=0, n4=0, n5=0, *nEvents;
+    BitsLong    *pA, *pV, *pP, y[2];
+    MrBFlt      x, oldBrlen=0.0, newBrlen=0.0, v1=0.0, v2=0.0, v3=0.0, v4=0.0, v5=0.0,
+                v3new=0.0, lambda, **position=NULL, **rateMultiplier=NULL, *brlens,
+                igrvar, *igrRate=NULL, nu, *tk02Rate=NULL, minLength=0.0, length=0.0,
+                cumulativeProb, warpFactor, sum1, sum2, ran, increaseProb, decreaseProb,
+                divFactor, nStates, rateMult, v_typical, minV;
+    CLFlt       *nSitesOfPat, *nSites, *globalNSitesOfPat;
+    TreeNode    *p, *a, *b, *u, *v, *c=NULL, *d;
+    Tree        *t;
+    ModelInfo   *m=NULL;
+    Param       *subParm;
+
+    warpFactor = mvp[0];                  /* tuning parameter determining how heavily to weight according to parsimony scores */
+    increaseProb = decreaseProb = mvp[1]; /* reweighting probabilities */
+    v_typical = mvp[2];                   /* typical branch length for converting parsimony scores to log prob ratios */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    /* get model params and model info */
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get min and max brlen in relative time and subst units */
+    minV = BRLENS_MIN;
+
+#   if defined (DEBUG_ParsSPRClock)
+    printf ("Before:\n");
+    ShowNodes (t->root, 2, YES);
+    getchar();
+#   endif
+    
+    /* pick a branch */
+    do  {
+        p = t->allDownPass[(int)(RandomNumber(seed) * (t->nNodes - 2))];
+        a = p->anc->left;
+        b = p->anc->right;
+        }
+    while (p->anc->isLocked == YES || p->anc->anc->anc == NULL
+           || (p == b && a->length < TIME_MIN) || (p == a && b->length < TIME_MIN));
+    /* skip constraints, siblings of root (and root); and consider ancestral fossils in fbd tree */
+
+    /* set up pointers for nodes around the picked branch */
+    v = p;
+    u = p->anc;
+    if (u->left == v)
+        a = u->right;
+    else
+        a = u->left;
+    b = u->anc;
+
+    /* record branch length for insertion in back move */
+    if (v->length > 0.0)  /* side branch, not anc fossil */
+        {
+        if (v->nodeDepth > a->nodeDepth)
+            oldBrlen = b->nodeDepth - v->nodeDepth - 2.0*minV;
+        else
+            oldBrlen = b->nodeDepth - a->nodeDepth - 2.0*minV;
+        }
+    v1 = a->length;
+    v2 = u->length;
+    v3 = v->length;
+
+    /* reassign events for CPP and adjust prior and proposal ratios for relaxed clock models */
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            position = subParm->position[2*chain+state[chain]];
+            rateMultiplier = subParm->rateMult[2*chain+state[chain]];
+            n1 = nEvents[a->index];
+            n2 = nEvents[u->index];
+            n3 = nEvents[v->index];
+            if (n2 > 0)
+                {
+                position[a->index] = (MrBFlt *) SafeRealloc ((void *) position[a->index], (n1+n2) * sizeof (MrBFlt));
+                rateMultiplier[a->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[a->index], (n1+n2) * sizeof (MrBFlt));
+                }
+            for (j=0; j<n1; j++)
+                position[a->index][j] *= v1 / (v1+v2);
+            for (j=n1; j<n1+n2; j++)
+                {
+                position[a->index][j] = (position[u->index][j-n1] * v2 + v1) / (v1+v2);
+                rateMultiplier[a->index][j] = rateMultiplier[u->index][j-n1];
+                }
+            nEvents[a->index] = n1+n2;
+            nEvents[u->index] = 0;
+            if (n2 > 0)
+                {
+                free (position[u->index]);
+                free (rateMultiplier[u->index]);
+                position[u->index] = rateMultiplier[u->index] = NULL;
+                }
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] += brlens[u->index];   /* only change in effective branch lengths so far */
+            }   /* end CPP events parm */
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            /* adjust prior ratio */
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            if (v->length > 0.0)
+                (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[v->anc->index], nu*v->length, tk02Rate[v->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[a->anc->index], nu*a->length, tk02Rate[a->index]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*u->length, tk02Rate[u->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*(a->length+u->length), tk02Rate[a->index]);
+            
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = (tk02Rate[a->index] + tk02Rate[b->index]) / 2.0 * (a->length + u->length);
+            }   /* end tk02 branch rate parameter */
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+
+            /* adjust prior ratio for old branches */
+            if (v->length > 0.0)
+                (*lnPriorRatio) -= LnProbGamma(v->length/igrvar, v->length/igrvar, igrRate[v->index]);
+            (*lnPriorRatio) -= LnProbGamma(a->length/igrvar, a->length/igrvar, igrRate[a->index]);
+            (*lnPriorRatio) -= LnProbGamma(u->length/igrvar, u->length/igrvar, igrRate[u->index]);
+            (*lnPriorRatio) += LnProbGamma((a->length+u->length)/igrvar, (a->length+u->length)/igrvar, igrRate[a->index]);
+
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[a->index] = igrRate[a->index] * (a->length + u->length);
+            }
+        }   /* next subparameter */
+
+    /* cut tree */
+    a->anc = b;
+    if (b->left == u)
+        b->left = a;
+    else
+        b->right = a;
+    a->length += u->length;
+    a->upDateTi = YES;
+
+    /* get final parsimony states for the root part */
+    GetParsDP (t, t->root->left, chain);
+    GetParsFP (t, t->root->left->left, chain);
+    GetParsFP (t, t->root->left->right, chain);
+
+    /* get downpass parsimony states for the crown part */
+    GetParsDP (t, v, chain);
+
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        p->d = 0.0;
+        }
+
+    /* mark nodes in the root part of the tree, first mark a */
+    a->marked = YES;
+    /* then move down towards root taking constraints into account */
+    p = b;
+    while (p->isLocked == NO && p->anc->anc != NULL)
+        {
+        p->marked = YES;
+        p = p->anc;
+        }
+    /* make sure sisters of last node are marked otherwise it will not be marked in the uppass */
+    p->left->marked = YES;
+    p->right->marked = YES;
+    /* finally move up, skip constraints and ancestral fossil */
+    for (i=t->nNodes-2; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        if (p != u && p->marked == NO && p->anc->marked == YES && p->anc->isLocked == NO
+            && p->anc->nodeDepth > v->nodeDepth + minV && p->length > 0.0)
+            p->marked = YES;
+        }
+
+    /* unmark nodes if the picked branch is 0 (ancestral fossil) */
+    if (v->length < TIME_MIN)
+        {
+        n = 0;
+        for (i=0; i<t->nNodes-1; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->nodeDepth > v->nodeDepth - minV || p->anc->nodeDepth < v->nodeDepth + minV)
+                p->marked = NO;
+            if (p->marked == YES)
+                n++;
+            }
+        if (n < 2)  /* no new position to move */
+            {
+            abortMove = YES;
+            return (NO_ERROR);
+            }
+        }
+    
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)
+        {
+        MrBayesPrint ("%s   Problem allocating nSitesOfPat in Move_ParsSPRClock\n", spacer);
+        return (ERROR);
+        }
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+        for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }
+        }
+
+    /* cycle through the possibilities and record the parsimony length */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO)
+            continue;
+        /* find the parsimony length */
+        p->d = 0.0;
+        for (n=0; n<t->nRelParts; n++)
+            {
+            division = t->relParts[n];
+            
+            /* Find model settings */
+            m = &modelSettings[division];
+
+            /* find nStates and ratemult */
+            nStates = m->numModelStates;
+            if (m->dataType == STANDARD)
+                nStates = 2;
+            rateMult = GetRate(division, chain);
+
+            /* find nSitesOfPat */
+            nSites = nSitesOfPat + m->compCharStart;
+
+            /* get division warp factor */
+            divFactor = - warpFactor * log((1.0/nStates) - exp(-nStates/(nStates-1)*v_typical*rateMult)/nStates);
+
+            /* find downpass parsimony sets for the node and its environment */
+            pP   = m->parsSets[p->index     ];
+            pA   = m->parsSets[p->anc->index];
+            pV   = m->parsSets[v->index     ];
+            
+            length = 0.0;
+            if (m->nParsIntsPerSite == 1)
+                {
+                for (j=0; j<m->numChars; j++)
+                    {
+                    y[0] = (pP[j] | pA[j]) & pV[j];
+                    if (y[0] == 0)
+                        length += nSites[j];
+                    }
+                }
+            else /* if (m->nParsIntsPerSite == 2) */
+                {
+                for (j=0; j<2*m->numChars; j+=2)
+                    {
+                    y[0] = (pP[j] | pA[j]) & pV[j];
+                    y[1] = (pP[j+1] | pA[j+1]) & pV[j+1];
+                    if ((y[0] | y[1]) == 0)
+                        length += nSites[j/2];
+                    }
+                }
+            p->d += divFactor * length;
+            }
+        }
+
+    /* find the min length and the sum for the forward move */
+    minLength = -1.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO || p == a)
+            continue;
+        if (minLength < 0.0 || p->d < minLength)
+            minLength = p->d;
+        }
+    sum1 = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES && p != a)
+            sum1 += exp (minLength - p->d);
+        }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed) * sum1;
+
+    /* select the appropriate reattachment point (not a!) */
+    cumulativeProb = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES && p != a)
+            {
+            c = p;
+            cumulativeProb += exp (minLength - p->d);
+            if (cumulativeProb > ran)
+                break;
+            }
+        }
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) = c->d - minLength + log(sum1);
+
+    /* find the min length and the sum for the backward move */
+    minLength = -1.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO || p == c)
+            continue;
+        if (minLength < 0.0 || p->d < minLength)
+            minLength = p->d;
+        }
+    sum2 = 0.0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == YES && p != c)
+            sum2 += exp (minLength - p->d);
+        }
+    
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) += minLength - a->d - log(sum2);
+
+    /* reattach u */
+    d = c->anc;
+    c->anc = u;
+    if (u->left == v)
+        u->right = c;
+    else
+        u->left = c;
+    u->anc = d;
+    if (d->left == c)
+        d->left = u;
+    else
+        d->right = u;
+
+    if (v->length > 0.0)  /* side branch, not anc fossil */
+        {
+        if (c->nodeDepth > v->nodeDepth)
+            newBrlen = d->nodeDepth - c->nodeDepth - 2.0*minV;
+        else
+            newBrlen = d->nodeDepth - v->nodeDepth - 2.0*minV;
+        if (newBrlen <= 0.0)
+            {
+            abortMove = YES;
+            free (nSitesOfPat);
+            return (NO_ERROR);
+            }
+
+        /* adjust lengths */
+        u->nodeDepth = d->nodeDepth - minV - RandomNumber(seed) * newBrlen;
+        v->length = u->nodeDepth - v->nodeDepth;
+            
+        /* calculate proposal ratio for tree change */
+        (*lnProposalRatio) += log (newBrlen / oldBrlen);
+        }
+    u->length = d->nodeDepth - u->nodeDepth;
+    c->length = u->nodeDepth - c->nodeDepth;
+    
+    v3new = v->length;
+    v4 = c->length;
+    v5 = u->length;
+
+    /* reassign events for CPP and adjust prior and proposal ratios for relaxed clock models */
+    for (i=0; i<param->subParams[0]->nSubParams; i++)
+        {
+        subParm = param->subParams[0]->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            position = subParm->position[2*chain+state[chain]];
+            rateMultiplier = subParm->rateMult[2*chain+state[chain]];
+            for (j=0; j<nEvents[c->index]; j++)
+                {
+                if (position[c->index][j] > v4 / (v4+v5))
+                    break;
+                }
+            n4 = j;
+            n5 = nEvents[c->index] - j;
+            nEvents[u->index] = n5;
+            if (n5 > 0)
+                {
+                position[u->index] = (MrBFlt *) SafeRealloc ((void *) position[u->index], n5 * sizeof (MrBFlt));
+                rateMultiplier[u->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[u->index], n5 * sizeof (MrBFlt));            
+                for (j=n4; j<nEvents[c->index]; j++)
+                    {
+                    position[u->index][j-n4] = (position[c->index][j] * (v4+v5) - v4) / v5;
+                    rateMultiplier[u->index][j-n4] = rateMultiplier[c->index][j];
+                    }
+                if (n4 > 0)
+                    {
+                    position[c->index] = (MrBFlt *) SafeRealloc ((void *) position[c->index], n4 * sizeof (MrBFlt));
+                    rateMultiplier[c->index] = (MrBFlt *) SafeRealloc ((void *) rateMultiplier[c->index], n4 * sizeof (MrBFlt));
+                    for (j=0; j<n4; j++)
+                        position[c->index][j] *= ((v4+v5) / v4);
+                    }
+                else
+                    {
+                    free (position[c->index]);
+                    free (rateMultiplier[c->index]);
+                    position[c->index] = rateMultiplier[c->index] = NULL;
+                    }
+                nEvents[c->index] = n4;
+                }
+            else
+                {
+                for (j=0; j<nEvents[c->index]; j++)
+                    position[c->index][j] *= ((v4+v5) / v4);
+                }
+
+            /* adjust proposal ratio */
+            (*lnProposalRatio) += n3 * log (v3new / v3);
+
+            /* adjust prior ratio */
+            lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+            (*lnPriorRatio) += lambda * (v3 - v3new);
+
+            /* update effective branch lengths */
+            if (UpdateCppEvolLengths (subParm, a, chain) == ERROR)
+                {
+                abortMove = YES;
+                free (nSitesOfPat);
+                return (NO_ERROR);
+                }
+
+            if (UpdateCppEvolLengths (subParm, u, chain) == ERROR)
+                {
+                abortMove = YES;
+                free (nSitesOfPat);
+                return (NO_ERROR);
+                }
+            }   /* end cpp events parameter */
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            /* adjust prior ratio */
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            (*lnPriorRatio) -= LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*(c->length+u->length), tk02Rate[c->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[c->anc->index], nu*c->length, tk02Rate[c->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[u->anc->index], nu*u->length, tk02Rate[u->index]);
+            if (v->length > 0.0)
+                (*lnPriorRatio) += LnProbTK02LogNormal(tk02Rate[v->anc->index], nu*v->length, tk02Rate[v->index]);
+
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[c->index] = c->length * (tk02Rate[c->index] + tk02Rate[c->anc->index]) / 2.0;
+            brlens[v->index] = v->length * (tk02Rate[v->index] + tk02Rate[v->anc->index]) / 2.0;
+            brlens[u->index] = u->length * (tk02Rate[u->index] + tk02Rate[u->anc->index]) / 2.0;
+            }   /* end tk02 branch rate parameter */
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            /* adjust prior ratio */
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            (*lnPriorRatio) -= LnProbGamma ((c->length+u->length)/igrvar, (c->length+u->length)/igrvar, igrRate[c->index]);
+            (*lnPriorRatio) += LnProbGamma (c->length/igrvar, c->length/igrvar, igrRate[c->index]);
+            (*lnPriorRatio) += LnProbGamma (u->length/igrvar, u->length/igrvar, igrRate[u->index]);
+            if (v->length > 0.0)
+                (*lnPriorRatio) += LnProbGamma (v->length/igrvar, v->length/igrvar, igrRate[v->index]);
+
+            /* adjust effective branch lengths */
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            brlens[v->index] = igrRate[v->index] * v->length;
+            brlens[u->index] = igrRate[u->index] * u->length;
+            brlens[c->index] = igrRate[c->index] * c->length;
+            }   /* end igr branch rate parameter */
+        }   /* next subparameter */
+
+    /* set tiprobs update flags */
+    c->upDateTi = YES;
+    u->upDateTi = YES;
+    v->upDateTi = YES;
+
+    /* set flags for update of cond likes down to root */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+    p = b;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES; 
+        p = p->anc;
+        }
+
+    /* get down pass sequence */
+    GetDownPass (t);
+
+    /* adjust prior ratio for clock tree */
+    if (LogClockTreePriorRatio (param, chain, &x) == ERROR)
+        {
+        free (nSitesOfPat);
+        return (ERROR);
+        }
+    (*lnPriorRatio) += x;
+
+#   if defined (DEBUG_ParsSPRClock)
+    ShowNodes (t->root, 2, YES);
+    printf ("After\nProposal ratio: %f\n",(*lnProposalRatio));
+    printf ("v: %d  u: %d  a: %d  b: %d c: %d\n",v->index, u->index, a->index, b->index, c->index);
+    getchar();
+#   endif
+
+    free (nSitesOfPat);
+    return (NO_ERROR);
+}
+
+
+int Move_ParsTBR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology and map branch lengths using TBR-type move biased according to parsimony scores,
+       controlled by a window defined by a certain node distance radius. */
+    
+    int         i, j, k, n, division, topologyHasChanged, nNeighbor, nRoot, nCrown, iA, jC, isVPriorExp;
+    BitsLong    *pA, *pB, *pC, *pD, y[2];
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, length=0.0, *parLength=NULL, prob, ran, tuning, warpFactor,
+                sum1, sum2, tempsum, tempc, tempy;
+    CLFlt       *nSites, *nSitesOfPat=NULL, *globalNSitesOfPat;
+    TreeNode    *p, *q, *r, *a, *b, *u, *v, *c, *d, *newB, *newA, *newC, **pRoot=NULL, **pCrown=NULL;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m=NULL;
+    
+    warpFactor = mvp[0];                  /* tuning parameter determining how heavily to weight according to parsimony scores */
+//  increaseProb = decreaseProb = mvp[1]; /* reweighting probabilities */
+//  v_typical = mvp[2];                   /* typical branch length for conversion of parsimony score to log prob ratio */
+    tuning = mvp[3];                      /* multiplier tuning parameter */
+    nNeighbor = (int)mvp[4];              /* distance to move picked branch in root and crown part */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+    
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = 0;
+        p->marked = NO;
+        }
+
+    /* pick an internal branch */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed)*(t->nIntNodes-1))];
+        q = p->anc->left;
+        if (q == p)  q = p->anc->right;
+        i = j = 0;
+        if (q->isLocked == YES || q->left == NULL)
+            i++;
+        if (p->anc->isLocked == YES || p->anc->anc->anc == NULL)
+            i++;
+        if (p->left->isLocked == YES || p->left->left == NULL)
+            j++;
+        if (p->right->isLocked == YES || p->right->left == NULL)
+            j++;
+        }
+    while (i == 2 && j == 2);
+    
+    /* set up pointers for nodes around the picked branch */
+    v = p;            u = p->anc;
+    c = p->left;      d = p->right;
+    if (u->left == v) a = u->right;
+    else              a = u->left;
+    b = u->anc;
+    /* clip root part of tree */
+    a->anc = b;
+    if (b->left == u) b->left = a;
+    else              b->right = a;
+    /* clip crown part of tree */
+    c->anc = d;
+    d->anc = c;
+    /* should never change u, v, a, b, c, d pointers */
+
+    /* mark nodes nNeighbor away in root (negative) and crown (positive) respecting constraints */
+    /* first move down towards root */
+    nRoot = nCrown = 0;
+    if (u->isLocked == NO)
+        {
+        p = a; q = b; n = 0;
+        while (q->anc != NULL)
+            {
+            q->marked = YES;
+            q->x = n;    // temporary, for MarkDistance below
+            if (q->left == p)
+                MarkDistance(q->right, YES, nNeighbor, &nRoot);
+            else
+                MarkDistance(q->left,  YES, nNeighbor, &nRoot);
+            q->x = --n;  // final
+            nRoot++;
+            if (q->isLocked == YES || abs(q->x) >= nNeighbor)
+                break;
+            p = q; q = q->anc;
+            }
+        }
+    /* then move up in root part */
+    a->marked = YES; nRoot++;
+    if (a->isLocked == NO)
+        {
+        MarkDistance(a->left,  YES, nNeighbor, &nRoot);
+        MarkDistance(a->right, YES, nNeighbor, &nRoot);
+        }
+    /* finally in crown part */
+    c->marked = YES; nCrown++;
+    if (c->isLocked == NO)
+        {
+        MarkDistance(c->left,  NO, nNeighbor, &nCrown);
+        MarkDistance(c->right, NO, nNeighbor, &nCrown);
+        }
+    if (d->isLocked == NO)
+        {
+        MarkDistance(d->left,  NO, nNeighbor, &nCrown);
+        MarkDistance(d->right, NO, nNeighbor, &nCrown);
+        }
+
+    /* need to alloc a matrix for parsimony lengths, an array of pointers to crown part,
+       and an array of pointers to root part. */
+    parLength = (MrBFlt *) SafeCalloc ((size_t)nRoot * (size_t)nCrown, sizeof(MrBFlt));
+    pRoot  = (TreeNode **) SafeCalloc(nRoot,  sizeof(TreeNode *));
+    pCrown = (TreeNode **) SafeCalloc(nCrown, sizeof(TreeNode *));
+    if (!parLength || !pRoot || !pCrown)  goto errorExit;
+    /* starting position */
+    pRoot[0] = a; pCrown[0] = c;
+    for (i=j=1, n=t->nNodes-2; n>=0; n--)
+        {  /* and the rest */
+        p = t->allDownPass[n];
+        if (p->marked == YES && p->x < 0)
+            pRoot[i++] = p;
+        if (p->marked == YES && p->x > 0)
+            pCrown[j++] = p;
+        }
+    assert (i==nRoot && j==nCrown);
+
+    /* get final parsimony state sets for the root part */
+    GetParsDP (t, t->root->left, chain);
+    GetParsFP (t, t->root->left, chain);
+    /* get final parsimony state sets for the crown part */
+    GetParsDP (t, c, chain);
+    GetParsDP (t, d, chain);
+    GetParsFP (t, c, chain);
+    GetParsFP (t, d, chain);
+
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)  goto errorExit;
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+    /*  for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }  // this is not used at the moment */
+        }
+
+    /* cycle through the possibilities and record the parsimony length */
+    for (j=0; j<nCrown; j++)
+        {
+        for (i=0; i<nRoot; i++)
+            {
+            parLength[i+j*nRoot] = 0.0;
+            for (n=0; n<t->nRelParts; n++)
+                {
+                division = t->relParts[n];
+                
+                /* Find model settings */
+                m = &modelSettings[division];
+                
+                /* find nSitesOfPat */
+                nSites = nSitesOfPat + m->compCharStart;
+                    
+                /* find downpass parsimony sets for the potential new connection nodes and their environment */
+                pA = m->parsSets[pRoot[i]->index];
+                pB = m->parsSets[pRoot[i]->anc->index];
+                pC = m->parsSets[pCrown[j]->index];
+                pD = m->parsSets[pCrown[j]->anc->index];
+                    
+                length = 0.0;
+                if (m->nParsIntsPerSite == 1)
+                    {
+                    for (k=0; k<m->numChars; k++)
+                        {
+                        y[0] = (pC[k] | pD[k]) & (pA[k] | pB[k]);
+                        if (y[0] == 0)
+                            length += nSites[k];
+                        }
+                    }
+                else /* if (m->nParsIntsPerSite == 2) */
+                    {
+                    for (k=0; k<2*m->numChars; k+=2)
+                        {
+                        y[0] = (pC[k] | pD[k]) & (pA[k] | pB[k]);
+                        y[1] = (pC[k+1] | pD[k+1]) & (pA[k+1] | pB[k+1]);;
+                        if ((y[0] | y[1]) == 0)
+                            length += nSites[k/2];
+                        }
+                    }
+                parLength[i+j*nRoot] += warpFactor * length;
+                }
+            }
+        }
+
+    /* find the min length and the sum for the forward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum1 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum1 + tempy;  tempc = (tempsum - sum1) - tempy;
+            sum1 = tempsum;
+            // sum1 += exp(minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed) * sum1;
+
+    /* select the appropriate reattachment point */
+    newA = a; newC = c;
+    prob = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            // prob += exp (minLength - parLength[i+j*nRoot]);
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = prob + tempy;  tempc = (tempsum - prob) - tempy;
+            prob = tempsum;
+            if (prob > ran) {
+                /* proposed new attaching position */
+                newA = pRoot[i];
+                newC = pCrown[j];
+                goto outLoop;
+                }
+            }
+outLoop:;
+    iA = i; jC = j;
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) = parLength[i+j*nRoot] - minLength + log(sum1);
+
+    /* find the min length and the sum for the backward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum2 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum2 + tempy;  tempc = (tempsum - sum2) - tempy;
+            sum2 = tempsum;
+            // sum2 += exp (minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) += minLength - parLength[0] - log(sum2);
+
+    /* reattach the root part */
+    newB = newA->anc;
+    newA->anc = u;
+    if (u->left == v)
+        u->right = newA;
+    else
+        u->left = newA;
+    u->anc = newB;
+    if (newB->left == newA)
+        newB->left = u;
+    else
+        newB->right = u;
+
+    /* transfer lock and reassign branch lengths, if necessary */
+    if (newA != a)
+        {
+        /* if u is locked, then we have moved upwards and need to leave the u lock behind */
+        if (u->isLocked == YES)
+            {
+            u->isLocked = NO;
+            a->isLocked = YES;
+            a->lockID = u->lockID;
+            u->lockID = -1;
+            }
+
+        p = newA;
+        while (p->anc != NULL)
+            {
+            if (p == a) break;
+            p = p->anc;
+            }
+        if (p == a)
+            {
+            /* newA is descendant to a so move a->length not u->length */
+            x = u->length;
+            u->length = a->length;
+            a->length = x;
+            }
+
+        p = b;
+        while (p->anc != NULL)
+            {
+            if (p == newA) break;
+            p = p->anc;
+            }
+        if (p == newA)
+            {
+            /* newA is ancestor to a so insert above instead of below */
+            x = newA->length;
+            newA->length = u->length;
+            u->length = x;
+            /* newA is on root path and locked, we need to transfer lock to u */
+            if (newA->isLocked == YES) {
+                u->isLocked = YES;
+                u->lockID = newA->lockID;
+                newA->isLocked = NO;
+                newA->lockID = -1;
+                }
+            }
+            
+        /* hit u length with multiplier */
+        x = u->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / u->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (u->length - x);
+        u->length = x;
+
+        /* set tiprobs update flags */
+        u->upDateTi = YES;
+        newA->upDateTi = YES;
+        a->upDateTi = YES;
+        }
+    
+    r = newC;
+    q = newB = newC->anc;
+    if (newC != c)  // crown part has changed
+        {
+        /* rotate nodes from newC to c or d (whichever is closest) */
+        tempc = r->length;
+        while (r != c && r != d)
+            {
+            p = q->anc;
+            /* rotate pointers of q */
+            if (q->left == r)
+                q->left = p;
+            else
+                q->right = p;
+            q->anc = r;
+            /* swap q and old */
+            tempy = q->length;
+            q->length = tempc;
+            q->upDateTi = YES;
+            tempc = tempy;
+            /* make sure we get q and r initialized for next round */
+            r = q;
+            q = p;
+            }
+        newB->length = tempc;
+        
+        /* hit newB length with multiplier */
+        x = newB->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newB->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newB->length - x);
+        newB->length = x;
+        newB->upDateTi = YES;
+        }
+    
+    /* reattach the crown part */
+    v->left = newC;
+    v->right = newB;
+    newC->anc = newB->anc = v;
+    
+    topologyHasChanged = YES;
+    
+    /* hit v length with multiplier */
+    x = v->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV) x = minV * minV / x;
+        if (x > maxV) x = maxV * maxV / x;
+        }
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / v->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (v->length - x);
+    v->length = x;
+    v->upDateTi = YES;
+    /* set flags for update of cond likes */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    p = b;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    p = newC;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    p = r;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+    /* free up local memory */
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+
+    return (NO_ERROR);
+
+errorExit:
+    MrBayesPrint ("%s   Problem allocating memory in Move_ParsTBR\n", spacer);
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+
+    return (ERROR);
+}
+
+
+int Move_ParsTBR2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* Change topology and map branch lengths using TBR-type move biased according to parsimony scores,
+       controlled by a window defined by a certain node distance radius. */
+    
+    int         i, j, k, n, division, topologyHasChanged, nNeighbor, nRoot, nCrown, iA, jC, isVPriorExp;
+    BitsLong    *pA, *pB, *pC, *pD, y[2];
+    MrBFlt      x, minV, maxV, brlensExp=0.0, minLength=0.0, length=0.0, *parLength=NULL, prob, ran, tuning, warpFactor,
+                v_typical, divFactor, nStates, sum1, sum2, tempsum, tempc, tempy;
+    CLFlt       *nSites, *nSitesOfPat=NULL, *globalNSitesOfPat;
+    TreeNode    *p, *q, *r, *a, *b, *u, *v, *c, *d, *newB, *newA, *newC, **pRoot=NULL, **pCrown=NULL;
+    Tree        *t;
+    ModelParams *mp;
+    ModelInfo   *m=NULL;
+    
+    warpFactor = mvp[0];                  /* tuning parameter determining how heavily to weight according to parsimony scores */
+//  increaseProb = decreaseProb = mvp[1]; /* reweighting probabilities */
+    v_typical = mvp[2];                   /* typical branch length for conversion of parsimony score to log prob ratio */
+    tuning = mvp[3];                      /* multiplier tuning parameter */
+    nNeighbor = (int)mvp[4];              /* distance to move picked branch in root and crown part */
+
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+    
+    /* get model params and model info */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* max and min brlen */
+    if (param->subParams[0]->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0] > BRLENS_MIN ? mp->brlensUni[0] : BRLENS_MIN;
+        maxV = mp->brlensUni[1] < BRLENS_MAX ? mp->brlensUni[1] : BRLENS_MAX;
+        isVPriorExp = NO;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->subParams[0]->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+    
+    /* set topologyHasChanged to NO */
+    topologyHasChanged = NO;
+    
+    /* reset node variables that will be used */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = 0;
+        p->marked = NO;
+        }
+
+    /* pick an internal branch */
+    do  {
+        p = t->intDownPass[(int)(RandomNumber(seed)*(t->nIntNodes-1))];
+        q = p->anc->left;
+        if (q == p)  q = p->anc->right;
+        i = j = 0;
+        if (q->isLocked == YES || q->left == NULL)
+            i++;
+        if (p->anc->isLocked == YES || p->anc->anc->anc == NULL)
+            i++;
+        if (p->left->isLocked == YES || p->left->left == NULL)
+            j++;
+        if (p->right->isLocked == YES || p->right->left == NULL)
+            j++;
+        }
+    while (i == 2 && j == 2);
+    
+    /* set up pointers for nodes around the picked branch */
+    v = p;            u = p->anc;
+    c = p->left;      d = p->right;
+    if (u->left == v) a = u->right;
+    else              a = u->left;
+    b = u->anc;
+    /* clip root part of tree */
+    a->anc = b;
+    if (b->left == u) b->left = a;
+    else              b->right = a;
+    /* clip crown part of tree */
+    c->anc = d;
+    d->anc = c;
+    /* should never change u, v, a, b, c, d pointers */
+
+    /* mark nodes nNeighbor away in root (negative) and crown (positive) respecting constraints */
+    /* first move down towards root */
+    nRoot = nCrown = 0;
+    if (u->isLocked == NO)
+        {
+        p = a; q = b; n = 0;
+        while (q->anc != NULL)
+            {
+            q->marked = YES;
+            q->x = n;    // temporary, for MarkDistance below
+            if (q->left == p)
+                MarkDistance(q->right, YES, nNeighbor, &nRoot);
+            else
+                MarkDistance(q->left,  YES, nNeighbor, &nRoot);
+            q->x = --n;  // final
+            nRoot++;
+            if (q->isLocked == YES || abs(q->x) >= nNeighbor)
+                break;
+            p = q; q = q->anc;
+            }
+        }
+    /* then move up in root part */
+    a->marked = YES; nRoot++;
+    if (a->isLocked == NO)
+        {
+        MarkDistance(a->left,  YES, nNeighbor, &nRoot);
+        MarkDistance(a->right, YES, nNeighbor, &nRoot);
+        }
+    /* finally in crown part */
+    c->marked = YES; nCrown++;
+    if (c->isLocked == NO)
+        {
+        MarkDistance(c->left,  NO, nNeighbor, &nCrown);
+        MarkDistance(c->right, NO, nNeighbor, &nCrown);
+        }
+    if (d->isLocked == NO)
+        {
+        MarkDistance(d->left,  NO, nNeighbor, &nCrown);
+        MarkDistance(d->right, NO, nNeighbor, &nCrown);
+        }
+
+    /* need to alloc a matrix for parsimony lengths, an array of pointers to crown part,
+       and an array of pointers to root part. */
+    parLength = (MrBFlt *) SafeCalloc ((size_t)nRoot * (size_t)nCrown, sizeof(MrBFlt));
+    pRoot  = (TreeNode **) SafeCalloc(nRoot,  sizeof(TreeNode *));
+    pCrown = (TreeNode **) SafeCalloc(nCrown, sizeof(TreeNode *));
+    if (!parLength || !pRoot || !pCrown)  goto errorExit;
+    /* starting position */
+    pRoot[0] = a; pCrown[0] = c;
+    for (i=j=1, n=t->nNodes-2; n>=0; n--)
+        {  /* and the rest */
+        p = t->allDownPass[n];
+        if (p->marked == YES && p->x < 0)
+            pRoot[i++] = p;
+        if (p->marked == YES && p->x > 0)
+            pCrown[j++] = p;
+        }
+    assert (i==nRoot && j==nCrown);
+
+    /* get final parsimony state sets for the root part */
+    GetParsDP (t, t->root->left, chain);
+    GetParsFP (t, t->root->left, chain);
+    /* get final parsimony state sets for the crown part */
+    GetParsDP (t, c, chain);
+    GetParsDP (t, d, chain);
+    GetParsFP (t, c, chain);
+    GetParsFP (t, d, chain);
+
+    /* find number of site patterns and modify randomly */
+    globalNSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains) * numCompressedChars + m->compCharStart;
+    nSitesOfPat = (CLFlt *) SafeCalloc (numCompressedChars, sizeof(CLFlt));
+    if (!nSitesOfPat)  goto errorExit;
+    for (i=0; i<numCompressedChars; i++)
+        {
+        nSitesOfPat[i] = globalNSitesOfPat[i];
+    /*  for (j=0; j<globalNSitesOfPat[i]; j++)
+            {
+            ran = RandomNumber(seed);
+            if (ran < decreaseProb)
+                nSitesOfPat[i]--;
+            else if (ran > 1.0 - increaseProb)
+                nSitesOfPat[i]++;
+            }  // this is not used at the moment */
+        }
+
+    /* cycle through the possibilities and record the parsimony length */
+    for (j=0; j<nCrown; j++)
+        {
+        for (i=0; i<nRoot; i++)
+            {
+            parLength[i+j*nRoot] = 0.0;
+            for (n=0; n<t->nRelParts; n++)
+                {
+                division = t->relParts[n];
+                
+                /* Find model settings */
+                m = &modelSettings[division];
+                
+                /* find nSitesOfPat */
+                nSites = nSitesOfPat + m->compCharStart;
+                
+                /* find downpass parsimony sets for the potential new connection nodes and their environment */
+                pA = m->parsSets[pRoot[i]->index];
+                pB = m->parsSets[pRoot[i]->anc->index];
+                pC = m->parsSets[pCrown[j]->index];
+                pD = m->parsSets[pCrown[j]->anc->index];
+                    
+                length = 0.0;
+                if (m->nParsIntsPerSite == 1)
+                    {
+                    for (k=0; k<m->numChars; k++)
+                        {
+                        y[0] = (pC[k] | pD[k]) & (pA[k] | pB[k]);
+                        if (y[0] == 0)
+                            length += nSites[k];
+                        }
+                    }
+                else /* if (m->nParsIntsPerSite == 2) */
+                    {
+                    for (k=0; k<2*m->numChars; k+=2)
+                        {
+                        y[0] = (pC[k] | pD[k]) & (pA[k] | pB[k]);
+                        y[1] = (pC[k+1] | pD[k+1]) & (pA[k+1] | pB[k+1]);;
+                        if ((y[0] | y[1]) == 0)
+                            length += nSites[k/2];
+                        }
+                    }
+                    
+                /* find nStates and ratemult */
+                nStates = m->numModelStates;
+                if (m->dataType == STANDARD)
+                    nStates = 2;
+                v_typical = length/m->numUncompressedChars + 0.0001;
+                
+                /* get division warp factor (prop. to prob. of change) */
+                divFactor = - warpFactor * log(1.0/nStates - exp(-nStates/(nStates-1)*v_typical)/nStates);
+                parLength[i+j*nRoot] += divFactor * length;
+                }
+            }
+        }
+
+    /* find the min length and the sum for the forward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum1 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum1 + tempy;  tempc = (tempsum - sum1) - tempy;
+            sum1 = tempsum;
+            // sum1 += exp(minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+
+    /* generate a random uniform */
+    ran = RandomNumber(seed) * sum1;
+
+    /* select the appropriate reattachment point */
+    newA = a; newC = c;
+    prob = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == 0 && j == 0)  // exclude original position
+                continue;
+            // prob += exp (minLength - parLength[i+j*nRoot]);
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = prob + tempy;  tempc = (tempsum - prob) - tempy;
+            prob = tempsum;
+            if (prob > ran) {
+                /* proposed new attaching position */
+                newA = pRoot[i];
+                newC = pCrown[j];
+                goto outLoop;
+                }
+            }
+outLoop:;
+    iA = i; jC = j;
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) = parLength[i+j*nRoot] - minLength + log(sum1);
+
+    /* find the min length and the sum for the backward move */
+    minLength = -1.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            if (minLength > parLength[i+j*nRoot] || minLength < 0.0)
+                minLength = parLength[i+j*nRoot];
+            }
+    sum2 = 0.0; tempc = 0.0;
+    for (j=0; j<nCrown; j++)
+        for (i=0; i<nRoot; i++)
+            {
+            if (i == iA && j == jC)  // exclude new position
+                continue;
+            /* Kahan summation to reduce numerical error */
+            tempy = exp(minLength - parLength[i+j*nRoot]) - tempc;
+            tempsum = sum2 + tempy;  tempc = (tempsum - sum2) - tempy;
+            sum2 = tempsum;
+            // sum2 += exp (minLength - parLength[i+j*nRoot]);
+            // printf("%d %d %lf\n", i, j, exp(minLength - parLength[i+j*nRoot]));
+            }
+
+    /* calculate the proposal ratio */
+    (*lnProposalRatio) += minLength - parLength[0] - log(sum2);
+
+    /* reattach the root part */
+    newB = newA->anc;
+    newA->anc = u;
+    if (u->left == v)
+        u->right = newA;
+    else
+        u->left = newA;
+    u->anc = newB;
+    if (newB->left == newA)
+        newB->left = u;
+    else
+        newB->right = u;
+
+    /* transfer lock and reassign branch lengths, if necessary */
+    if (newA != a)
+        {
+        /* if u is locked, then we have moved upwards and need to leave the u lock behind */
+        if (u->isLocked == YES)
+            {
+            u->isLocked = NO;
+            a->isLocked = YES;
+            a->lockID = u->lockID;
+            u->lockID = -1;
+            }
+
+        p = newA;
+        while (p->anc != NULL)
+            {
+            if (p == a) break;
+            p = p->anc;
+            }
+        if (p == a)
+            {
+            /* newA is descendant to a so move a->length not u->length */
+            x = u->length;
+            u->length = a->length;
+            a->length = x;
+            }
+
+        p = b;
+        while (p->anc != NULL)
+            {
+            if (p == newA) break;
+            p = p->anc;
+            }
+        if (p == newA)
+            {
+            /* newA is ancestor to a so insert above instead of below */
+            x = newA->length;
+            newA->length = u->length;
+            u->length = x;
+            /* newA is on root path and locked, we need to transfer lock to u */
+            if (newA->isLocked == YES) {
+                u->isLocked = YES;
+                u->lockID = newA->lockID;
+                newA->isLocked = NO;
+                newA->lockID = -1;
+                }
+            }
+            
+        /* hit u length with multiplier */
+        x = u->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / u->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (u->length - x);
+        u->length = x;
+
+        /* set tiprobs update flags */
+        u->upDateTi = YES;
+        newA->upDateTi = YES;
+        a->upDateTi = YES;
+        }
+    
+    r = newC;
+    q = newB = newC->anc;
+    if (newC != c)  // crown part has changed
+        {
+        /* rotate nodes from newC to c or d (whichever is closest) */
+        tempc = r->length;
+        while (r != c && r != d)
+            {
+            p = q->anc;
+            /* rotate pointers of q */
+            if (q->left == r)
+                q->left = p;
+            else
+                q->right = p;
+            q->anc = r;
+            /* swap q and old */
+            tempy = q->length;
+            q->length = tempc;
+            q->upDateTi = YES;
+            tempc = tempy;
+            /* make sure we get q and r initialized for next round */
+            r = q;
+            q = p;
+            }
+        newB->length = tempc;
+        
+        /* hit newB length with multiplier */
+        x = newB->length * exp(tuning * (RandomNumber(seed) - 0.5));
+        while (x < minV || x > maxV)
+            {
+            if (x < minV) x = minV * minV / x;
+            if (x > maxV) x = maxV * maxV / x;
+            }
+        /* calculate proposal and prior ratio based on length modification */
+        (*lnProposalRatio) += log (x / newB->length);
+        if (isVPriorExp == YES)
+            (*lnPriorRatio) += brlensExp * (newB->length - x);
+        newB->length = x;
+        newB->upDateTi = YES;
+        }
+    
+    /* reattach the crown part */
+    v->left = newC;
+    v->right = newB;
+    newC->anc = newB->anc = v;
+    
+    topologyHasChanged = YES;
+    
+    /* hit v length with multiplier */
+    x = v->length * exp(tuning * (RandomNumber(seed) - 0.5));
+    while (x < minV || x > maxV)
+        {
+        if (x < minV) x = minV * minV / x;
+        if (x > maxV) x = maxV * maxV / x;
+        }
+    /* calculate proposal and prior ratio based on length modification */
+    (*lnProposalRatio) += log (x / v->length);
+    if (isVPriorExp == YES)
+        (*lnPriorRatio) += brlensExp * (v->length - x);
+    v->length = x;
+    v->upDateTi = YES;
+    /* set flags for update of cond likes */
+    p = u;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    p = b;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    p = newC;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    p = r;
+    while (p->anc != NULL)
+        {
+        p->upDateCl = YES;
+        p = p->anc;
+        }
+    
+    /* get down pass sequence if tree topology has changed */
+    if (topologyHasChanged == YES)
+        {
+        GetDownPass (t);
+        }
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+    
+    /* free up local memory */
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+
+    return (NO_ERROR);
+
+errorExit:
+    MrBayesPrint ("%s   Problem allocating memory in Move_ParsTBR\n", spacer);
+    free (parLength); free (pRoot); free (pCrown); free (nSitesOfPat);
+
+    return (ERROR);
+}
+
+
+int Move_Pinvar (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change proportion of invariable sites (pInvar) */
+
+    int             i, c, isValidP, *rateCat, nGammaCats;
+    MrBFlt          oldP, newP, window, minP, maxP, ran, lnInvarRatio, lnVarRatio;
+    CLFlt           *nSitesOfPat;
+    ModelParams     *mp;
+    ModelInfo       *m;
+
+    /* get size of window, centered on current pInvar value */
+    window = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get minimum and maximum values for pInvar */
+    minP = mp->pInvarUni[0];
+    maxP = mp->pInvarUni[1];
+
+    /* get old value of pInvar */
+    newP = oldP = *GetParamVals(param, chain, state[chain]);
+
+    /* change value for pInvar */
+    ran = RandomNumber(seed);
+    if (maxP-minP < window)
+        {
+        window = maxP-minP;
+        }
+
+    newP = oldP + window * (ran - 0.5);
+
+    /* check validity */
+    isValidP = NO;
+    do
+        {
+        if (newP < minP)
+            newP = 2* minP - newP;
+        else if (newP > maxP)
+            newP = 2 * maxP - newP;
+        else
+            isValidP = YES;
+        } while (isValidP == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* get prior ratio */
+    *lnPriorRatio = 0.0;
+    lnInvarRatio = log(newP) - log(oldP);
+    lnVarRatio = log(1.0-newP) - log(1.0-oldP);
+    for (i=0; i<param->nRelParts; i++)
+        {
+        m = &modelSettings[param->relParts[i]];
+        if (m->gibbsGamma == YES)
+            {
+            /* find rate category index and number of gamma categories */
+            rateCat = m->tiIndex + chain * m->numChars;
+            nGammaCats = m->numGammaCats;
+
+            /* find nSitesOfPat */
+            nSitesOfPat = numSitesOfPat + (chainId[chain] % chainParams.numChains)*numCompressedChars + m->compCharStart;
+            
+            /* loop over characters */
+            for (c=0; c<m->numChars; c++)
+                {
+                if (rateCat[c] < nGammaCats)
+                    *lnPriorRatio += lnVarRatio * nSitesOfPat[c];
+                else
+                    *lnPriorRatio += lnInvarRatio * nSitesOfPat[c];
+                }
+            }
+        }
+    
+    /* copy new pInvar value back */
+    *GetParamVals(param, chain, state[chain]) = newP;
+
+    /* Set update flags for all partitions that share this pInvar. Note that the conditional
+       likelihood update flags for divisions have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+    
+    /* However, you do need to update cijk flags if this is a covarion model */
+    /* TO DO */
+    
+    return (NO_ERROR);
+}
+
+
+int Move_PopSize_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             isValidN, valIndex;
+    MrBFlt          *valPtr, oldN, newN, tuning, minN, maxN, ran, oldLnPrior, newLnPrior, growth,
+                    oldT, newT, clockRate;
+    ModelParams     *mp;
+    ModelInfo       *m;
+    Tree            *t;
+
+    /* get multiplier tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get model settings */
+    m = &modelSettings[param->relParts[0]];
+
+    /* get minimum and maximum values for population size */
+    if (param->paramId == POPSIZE_UNI)
+        {
+        minN = mp->popSizeUni[0];
+        maxN = mp->popSizeUni[1];
+        }
+    else
+        {
+        minN = 0.00001;
+        maxN = 10000000;
+        }
+
+    /* get pointer to value to be changed */
+    valIndex = (int)(RandomNumber(seed) * param->nValues);
+    valPtr = GetParamVals(param, chain, state[chain]) + valIndex;
+
+    /* get old value of population size */
+    oldN = *valPtr;
+
+    /* get old prior for species tree coalescence */
+    if (m->brlens->paramId == BRLENS_CLOCK_SPCOAL)
+        {
+        oldLnPrior = LnSpeciesTreeProb(chain);
+        }
+    
+    /* change value for theta */
+    ran = RandomNumber(seed);
+    newN = oldN * exp(tuning * (ran - 0.5));
+    
+    /* check that new value is valid */
+    isValidN = NO;
+    do {
+        if (newN < minN)
+            newN = 2* minN - newN;
+        else if (newN > maxN)
+            newN = 2 * maxN - newN;
+        else
+            isValidN = YES;
+        }
+    while (isValidN == NO);
+
+    /* copy new population size value back */
+    (*valPtr) = newN;
+
+    /* get proposal ratio */
+    *lnProposalRatio = log (newN / oldN);
+    
+    /* get prior ratio */
+    if (m->brlens->paramId == BRLENS_CLOCK_SPCOAL)
+        {
+        newLnPrior = LnSpeciesTreeProb(chain);
+        }
+    else
+        {
+        t = GetTree(modelSettings[param->relParts[0]].brlens,chain,state[chain]);
+        m = &modelSettings[param->relParts[0]];
+        clockRate = *GetParamVals(m->clockRate, chain, state[chain]);
+        if (!strcmp(mp->ploidy, "Diploid"))
+            clockRate *= 4.0;
+        else if (!strcmp(mp->ploidy, "Zlinked"))
+            clockRate *= 3.0;
+        else
+            clockRate *= 2.0;
+        newT = oldN * clockRate;
+        oldT = newN * clockRate;
+        if (!strcmp(mp->growthPr, "Fixed"))
+            growth = mp->growthFix;
+        else
+            growth = *(GetParamVals (m->growthRate, chain, state[chain]));
+        if (LnCoalescencePriorPr (t, &oldLnPrior, oldT, growth) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for coalescent process\n", spacer);
+            return (ERROR);
+            }
+        if (LnCoalescencePriorPr (t, &newLnPrior, newT, growth) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for coalescent process\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    (*lnPriorRatio) = param->LnPriorRatio(newN, oldN, param->priorParams);
+    (*lnPriorRatio) += newLnPrior - oldLnPrior;
+
+    return (NO_ERROR);
+}
+
+
+/* Generalized lognormal move for positive real random variables */
+int Move_PosRealLognormal (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i;
+    MrBFlt      oldX, newX, minX, maxX, tuning, u, z;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get minimum and maximum values for X */
+    minX = param->min;
+    maxX = param->max;
+
+    /* get old value of X */
+    newX = oldX = *GetParamVals(param, chain, state[chain]);
+
+    /* change value of X */
+    u = RandomNumber(seed);
+    z = PointNormal(u);
+
+    newX = exp (log(oldX) + z * tuning);
+    
+    /* check that new value is valid */
+    if (newX < minX || newX > maxX) {
+        abortMove = YES;
+        return (NO_ERROR);
+    }
+    
+    /* get proposal ratio */
+    (*lnProposalRatio) = log (newX / oldX);
+    
+    /* get prior ratio */
+    (*lnPriorRatio) = param->LnPriorRatio(newX, oldX, param->priorParams);
+    
+    /* copy new value back */
+    (*GetParamVals(param, chain, state[chain])) = newX;
+
+    /* Set update flags for tree nodes if relevant */
+    if (param->affectsLikelihood == YES)
+        {
+        for (i=0; i<param->nRelParts; i++)
+            TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* Generalized multiplier move for positive real random variables */
+int Move_PosRealMultiplier (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, isValid;
+    MrBFlt      oldX, newX, minX, maxX, tuning, ran, factor;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get minimum and maximum values for X */
+    minX = param->min;
+    maxX = param->max;
+
+    /* get old value of X */
+    newX = oldX = *GetParamVals(param, chain, state[chain]);
+
+    /* change value of X */
+    ran = RandomNumber(seed);
+    factor = exp(tuning * (ran - 0.5));
+    newX = oldX * factor;
+    
+    /* check that new value is valid */
+    isValid = NO;
+    do
+        {
+        if (newX < minX)
+            newX = minX * minX / newX;
+        else if (newX > maxX)
+            newX = maxX * maxX / newX;
+        else
+            isValid = YES;
+        } while (isValid == NO);
+
+    /* get proposal ratio */
+    (*lnProposalRatio) = log (newX / oldX);
+    
+    /* get prior ratio */
+    (*lnPriorRatio) = param->LnPriorRatio(newX, oldX, param->priorParams);
+    
+    /* copy new value back */
+    *(GetParamVals(param, chain, state[chain])) = newX;
+
+    /* Set update flags for tree nodes if relevant */
+    if (param->affectsLikelihood == YES)
+        {
+        for (i=0; i<param->nRelParts; i++)
+            TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_RateMult_Dir: Change rate multiplier using Dirichlet
+|      proposal.
+|
+----------------------------------------------------------------*/
+int Move_RateMult_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, nRates, isValid;
+    MrBFlt      alphaPi, *value, *subValue, numSites, *alphaDir, x, y, sum,
+                rate_pot, *dirParm, *oldRate, *newRate;
+
+    /* allocate memory */
+    dirParm = (MrBFlt *) SafeCalloc (3*numCurrentDivisions, sizeof(MrBFlt));
+    oldRate = dirParm + numCurrentDivisions;
+    newRate = dirParm + 2*numCurrentDivisions;
+
+    /* get number of rates */
+    nRates = param->nValues;
+
+    /* get pointer to rates and number of uncompressed chars */
+    value = GetParamVals(param, chain, state[chain]);
+    subValue = GetParamSubVals(param, chain, state[chain]);
+
+    /* get Dirichlet parameters */
+    alphaDir = subValue + nRates;
+
+    /* calculate old ratesum proportions */
+    numSites = 0.0;
+    for (i=0; i<nRates; i++)
+        numSites += subValue[i];  /* numSites should be equal to the number of sites */
+    for (i=0; i<nRates; i++)
+        oldRate[i] = value[i] * subValue[i] / numSites;
+    
+    /* get alphaPi tuning parameter */
+    alphaPi = mvp[0] * nRates;
+
+    /* multiply old ratesum proportions with some large number to get new values close to the old ones */
+    for (i=0; i<nRates; i++)
+        dirParm[i] = oldRate[i] * alphaPi;
+    
+    /* get new values */
+    DirichletRandomVariable (dirParm, newRate, nRates, seed);
+    
+    /* check new values. we rely on newRate be already normalized  */
+    while (1)
+        {
+        sum = 0.0;
+        rate_pot = 1.0;
+        isValid=1;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i] <= DIR_MIN)
+                {
+                if (newRate[i] < DIR_MIN)
+                    {
+                    newRate[i] = DIR_MIN;
+                    isValid=0;
+                    }
+                rate_pot -= DIR_MIN;
+                }
+            else
+                sum += newRate[i];
+            }
+        if (isValid==1) break;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i]!=DIR_MIN)
+                newRate[i] = rate_pot * newRate[i] / sum;
+            }
+        }
+
+    /* calculate and copy new rate ratio values back */
+    for (i=0; i<nRates; i++)
+        value[i] = newRate[i] * (numSites / subValue[i]);
+    
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += newRate[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        x -= LnGamma(newRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        x += (newRate[i]*alphaPi-1.0)*log(oldRate[i]);
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += oldRate[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        y -= LnGamma(oldRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        y += (oldRate[i]*alphaPi-1.0)*log(newRate[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    x = y = 0.0;
+    for (i=0; i<nRates; i++)
+        x += (alphaDir[i]-1.0)*log(newRate[i]);
+    for (i=0; i<nRates; i++)
+        y += (alphaDir[i]-1.0)*log(oldRate[i]);
+    (*lnPriorRatio) = x - y;
+
+    /* Set update flags for all partitions that share the rate multiplier. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* may need to hit update flag for cijks when you have a covarion model */
+    for (i=0; i<param->nRelParts; i++)
+        if (modelSettings[param->relParts[i]].nCijkParts > 1)
+            modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    free (dirParm);
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_RateMult_Slider: Change rate multiplier using slider
+|      proposal.
+|
+----------------------------------------------------------------*/
+int Move_RateMult_Slider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, indexI, indexJ, nRates;
+    MrBFlt      delta, *value, *subValue, sum, numSites, *alphaDir, x, y,
+                oldRate[2], newRate[2], min, max;
+
+    /* get number of rates */
+    nRates = param->nValues;
+
+    /* get pointer to rates and number of uncompressed chars */
+    value = GetParamVals(param, chain, state[chain]);
+    subValue = GetParamSubVals(param, chain, state[chain]);
+
+    /* get Dirichlet prior parameters */
+    alphaDir = subValue + nRates;
+
+    /* randomly select two rates */
+    indexI = (int) (RandomNumber(seed) * nRates);
+    indexJ = (int) (RandomNumber(seed) * (nRates - 1));
+    if (indexJ == indexI)
+        indexJ = nRates - 1;
+
+    /* calculate old ratesum proportions */
+    numSites = 0.0;
+    for (i=0; i<nRates; i++)
+        numSites += subValue[i];  /* numSites should be equal to the number of sites */
+    oldRate[0] = value[indexI] * subValue[indexI] / numSites;
+    oldRate[1] = value[indexJ] * subValue[indexJ] / numSites;
+    sum = oldRate[0] + oldRate[1];
+    
+    /* get delta tuning parameter */
+    delta = mvp[0];
+
+    /* reflect */
+    min = DIR_MIN / sum;
+    max = 1.0 - min;
+    if (delta > max-min) /* we do it to avoid following long while loop in case if delta is high */
+        delta = max-min;
+
+    x = oldRate[0] / sum;
+    y = x + delta * (RandomNumber(seed) - 0.5);
+    while (y < min || y > max)
+        {
+        if (y < min)
+            y = 2.0 * min - y;
+        if (y > max)
+            y = 2.0 * max - y;
+        }
+    
+    /* set the new values */
+    newRate[0] = y * sum;
+    newRate[1] = sum - newRate[0];
+    value[indexI] = newRate[0] * numSites / subValue[indexI];
+    value[indexJ] = newRate[1] * numSites / subValue[indexJ];
+
+    /* get proposal ratio */
+    (*lnProposalRatio) = 0.0;
+
+    /* get prior ratio */
+    (*lnPriorRatio)  = (alphaDir[indexI]-1.0) * (log(newRate[0]) - log(oldRate[0]));
+    (*lnPriorRatio) += (alphaDir[indexJ]-1.0) * (log(newRate[1]) - log(oldRate[1]));
+
+    /* Set update flags for all partitions that share the rate multiplier. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* may need to hit update flag for cijks when you have a covarion model */
+    for (i=0; i<param->nRelParts; i++)
+        if (modelSettings[param->relParts[i]].nCijkParts > 1)
+            modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Revmat_Dir: Change rate matrix using Dirichlet proposal
+|      mechanism.
+|
+----------------------------------------------------------------*/
+int Move_Revmat_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change revMat using Dirichlet proposal */
+    
+    int             i, nRates,isValid;
+    MrBFlt          oldRate[200], newRate[200], dirParm[200], *value, sum, x, y, rate_pot, *alphaDir, alphaPi;
+    ModelParams     *mp;
+    ModelInfo       *m;
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+    m  = &modelSettings[param->relParts[0]];
+
+    /* get rates and nRates */
+    value = GetParamVals(param, chain, state[chain]);
+    nRates = param->nValues;
+
+    /* get so called alpha_pi parameter and adjust for number of components */
+    alphaPi = mvp[0] * nRates;
+
+    /* get Dirichlet parameters */
+    if (m->dataType == PROTEIN)
+        alphaDir = mp->aaRevMatDir;
+    else
+        alphaDir = mp->revMatDir;
+
+    /* copy old rates */
+    for (i=0; i<nRates; i++)
+        oldRate[i] = value[i];
+    
+    /* multiply old ratesum props with some large number to get new values close to the old ones */
+    for (i=0; i<nRates; i++)
+        dirParm[i] = oldRate[i] * alphaPi;
+    
+    /* get new values */
+    DirichletRandomVariable (dirParm, newRate, nRates, seed);
+
+    /* check new values. we rely on newRate be already normalized  */
+    while (1)
+        {
+        sum = 0.0;
+        rate_pot = 1.0;
+        isValid=1;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i] <= RATE_MIN)
+                {
+                if (newRate[i] < RATE_MIN)
+                    {
+                    newRate[i] = RATE_MIN;
+                    isValid=0;
+                    }
+                rate_pot -= RATE_MIN;
+                }
+            else
+                sum += newRate[i];
+            }
+        if (isValid==1) break;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i]!=RATE_MIN)
+                newRate[i] = rate_pot * newRate[i] / sum;
+            }
+        }
+
+    /* copy new rate ratio values back */
+    for (i=0; i<nRates; i++)
+        value[i] = newRate[i];
+    
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += newRate[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        x -= LnGamma(newRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        x += (newRate[i]*alphaPi-1.0)*log(oldRate[i]);
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += oldRate[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        y -= LnGamma(oldRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        y += (oldRate[i]*alphaPi-1.0)*log(newRate[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    x = y = 0.0;
+    for (i=0; i<nRates; i++)
+        x += (alphaDir[i]-1.0)*log(newRate[i]);
+    for (i=0; i<nRates; i++)
+        y += (alphaDir[i]-1.0)*log(oldRate[i]);
+    (*lnPriorRatio) = x - y;
+
+    /* Set update flags for all partitions that share this revmat. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Revmat_DirMix: Dirichlet proposal for REVMAT_MIX. From
+|      Huelsenbeck et al. (2004), but note that the prior density
+|      is different in that paper because they set the rate sum
+|      to 6, not to 1.
+|
+----------------------------------------------------------------*/
+int Move_Revmat_DirMix (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, j, k, isValid, *growthFxn, nRates, groupSize[6];
+    MrBFlt      *value, dirParm[6], newRate[6], oldRate[6], alphaPi, symDir, sum, rate_pot, x, y;
+    ModelParams *mp;
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get growthFunction and nRates */
+    value     = GetParamVals (param, chain, state[chain]);
+    growthFxn = GetParamIntVals (param, chain, state[chain]);
+    nRates    = GetKFromGrowthFxn(growthFxn);
+
+    /* we can't do anything if there is only one rate */
+    if (nRates == 1)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* extract unique rates from value vector */
+    for (i=0; i<nRates; i++)
+        oldRate[i] = 0.0;
+    for (i=0; i<6; i++)
+        oldRate[growthFxn[i]] += value[i];
+
+    /* get so called alpha_pi parameter and adjust for number of components */
+    alphaPi = mvp[0] * nRates;
+
+    /* get symmetric dirichlet parameter */
+    symDir  = mp->revMatSymDir;
+
+    /* multiply old ratesum props with some large number to get new values close to the old ones */
+    for (i=0; i<nRates; i++)
+        dirParm[i] = oldRate[i] * alphaPi;
+
+    /* get new values */
+    DirichletRandomVariable (dirParm, newRate, nRates, seed);
+
+    /* check new values. we rely on newRate be already normalized  */
+    while (1)
+        {
+        sum = 0.0;
+        rate_pot = 1.0;
+        isValid=1;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i] <= RATE_MIN)
+                {
+                if (newRate[i] < RATE_MIN)
+                    {
+                    newRate[i] = RATE_MIN;
+                    isValid=0;
+                    }
+                rate_pot -= RATE_MIN;
+                }
+            else
+                sum += newRate[i];
+            }
+        if (isValid==1) break;
+        for (i=0; i<nRates; i++)
+            {
+            if (newRate[i]!=RATE_MIN)
+                newRate[i] = rate_pot * newRate[i] / sum;
+            }
+        }
+
+    /* copy new unique rate ratio values back into the value array */
+    for (i=0; i<nRates; i++)
+        {
+        k = 0;
+        for (j=i; j<6; j++)
+            {
+            if (growthFxn[j] == i)
+                k++;
+            }
+        for (j=i; j<6; j++)
+            {
+            if (growthFxn[j] == i)
+                value[j] = newRate[i] / (MrBFlt) k;
+            }
+        }
+    
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += newRate[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        x -= LnGamma(newRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        x += (newRate[i]*alphaPi-1.0)*log(oldRate[i]);
+    sum = 0.0;
+    for (i=0; i<nRates; i++)
+        sum += oldRate[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<nRates; i++)
+        y -= LnGamma(oldRate[i]*alphaPi);
+    for (i=0; i<nRates; i++)
+        y += (oldRate[i]*alphaPi-1.0)*log(newRate[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get group sizes, needed for prior ratio */
+    for (i=0; i<nRates; i++)
+        groupSize[i] = 0;
+    for (i=0; i<6; i++)
+        groupSize[growthFxn[i]]++;
+
+    /* get prior ratio */
+    x = y = 0.0;
+    for (i=0; i<nRates; i++)
+        x += (groupSize[i]*symDir-1.0)*log(newRate[i]);
+    for (i=0; i<nRates; i++)
+        y += (groupSize[i]*symDir-1.0)*log(oldRate[i]);
+    (*lnPriorRatio) = x - y;
+
+    /* Set update flags for all partitions that share this revmat. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Revmat_Slider: Change rate matrix using sliding window
+|       move. Choose a pair of rates (e.g. r(A<>C), and r(A<>G)) at
+|       random and denote them rA, and rB. Let oldProp = rA/(rA + rB)
+|       and newProp = oldProp + delta(U - 0.5), where U is a uniform
+|       random variable on the interval (0, 1] and delta is a tuning
+|       parameter. Values that fall outside the boundaries are reflected
+|       back in. Then set new_rA = newProp*(rA+rB) and new_rB =
+|       (1-newProp)*(piA+piB). The Hastings ratio of this move is 1.0.
+|
+----------------------------------------------------------------*/
+int Move_Revmat_Slider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, j, nRates;
+    MrBFlt      delta, *newRate, *oldRate, *priorAlpha, x, y, sum, min, max;
+    ModelParams *mp;
+    ModelInfo   *m;
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+    m  = &modelSettings[param->relParts[0]];
+
+    /* get Dirichlet parameters */
+    if (m->dataType == PROTEIN)
+        priorAlpha = mp->aaRevMatDir;
+    else
+        priorAlpha = mp->revMatDir;
+
+    /* get the values we need */
+    nRates = param->nValues;
+    newRate = GetParamVals (param, chain, state[chain]);
+    oldRate = GetParamVals (param, chain, state[chain] ^ 1);
+
+    /* choose a pair to change */
+    i = (int) (RandomNumber(seed) * nRates);
+    j = (int) (RandomNumber(seed) * (nRates-1));
+    if (i == j)
+        j = nRates-1;
+    
+    /* find new proportion */
+    sum = oldRate[i] + oldRate[j];
+
+    /* get window size */
+    delta = mvp[0];
+
+    /* reflect */
+    min = RATE_MIN / sum;
+    max = 1.0 - min;
+    if (delta > max-min) /* we do it to avoid following long while loop in case if delta is high */
+        delta = max-min;
+
+    x = oldRate[i] / sum;
+    y = x + delta * (RandomNumber(seed) - 0.5);
+    while (y < min || y > max)
+        {
+        if (y < min)
+            y = 2.0 * min - y;
+        if (y > max)
+            y = 2.0 * max - y;
+        }
+    
+    /* set the new values */
+    newRate[i] = y * sum;
+    newRate[j] = sum - newRate[i];
+
+    /* get proposal ratio */
+    (*lnProposalRatio) = 0.0;
+
+    /* get prior ratio */
+    (*lnPriorRatio)  = (priorAlpha[i]-1.0) * (log(newRate[i]) - log(oldRate[i]));
+    (*lnPriorRatio) += (priorAlpha[j]-1.0) * (log(newRate[j]) - log(oldRate[j]));
+
+    /* Set update for entire tree */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for many models we do want to update the cijk flag, as the transition
+       probability matrices require diagonalizing the rate matrix. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Revmat_SplitMerge1: Split or merge rates of rate matrix.
+|      See Huelsenbeck et al. (2004). Note that the prior used
+|      here is different from theirs. Also, a Beta proposal is
+|      used instead of a uniform to propose new rate proportions.
+|
+----------------------------------------------------------------*/
+int Move_Revmat_SplitMerge1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, j, k, index_i, index_j, n_i, n_j, foundFirstI, foundFirstJ,
+                *newGrowthFxn, *oldGrowthFxn, nOldRates, nNewRates, merge,
+                groupSize[6], nCompositeRates;
+    MrBFlt      R, R_i, R_j, *newValue, *oldValue, newRate[6], oldRate[6], symDir,
+                prob_split, prob_merge, dirParm[2], rateProps[2], x, alphaPi;
+    ModelParams *mp;
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get the values we need */
+    oldValue     = GetParamVals(param, chain, state[chain] ^ 1);
+    newValue     = GetParamVals(param, chain, state[chain]);
+    oldGrowthFxn = GetParamIntVals(param, chain, state[chain] ^ 1);
+    newGrowthFxn = GetParamIntVals (param, chain, state[chain]);
+    nOldRates    = GetKFromGrowthFxn(oldGrowthFxn);
+    symDir       = mp->revMatSymDir;
+    alphaPi      = mvp[0];      /* tuning parameter alpha */
+
+    /* get the old rates */
+    for (i=0; i<nOldRates; i++)
+        oldRate[i] = 0.0;
+    for (i=0; i<6; i++)
+        oldRate[oldGrowthFxn[i]] += oldValue[i];
+
+    /* decide whether to split or merge */
+    if (nOldRates == 1)
+        merge = NO;
+    else if (nOldRates == 6)
+        merge = YES;
+    else if (RandomNumber(seed) < 0.5)
+        merge = YES;
+    else
+        merge = NO;
+
+    /* now split or merge */
+    R = R_i = R_j = 0.0;
+    if (merge == YES)
+        {
+        /* merge two rates */
+        nNewRates = nOldRates - 1;
+
+        /* determine split and merge probs */
+        if (nNewRates == 1)
+            prob_split = 1.0;
+        else
+            prob_split = 0.5;
+        if (nOldRates == 6)
+            prob_merge = 1.0;
+        else
+            prob_merge = 0.5;
+
+        /* select two rates randomly */
+        index_i = (int) (RandomNumber(seed) * nOldRates);
+        index_j = (int) (RandomNumber(seed) * (nOldRates - 1));
+        if (index_j == index_i)
+            index_j = nOldRates - 1;
+
+        /* make sure index_i is lower index */
+        if (index_i > index_j)
+            {
+            i = index_i;
+            index_i = index_j;
+            index_j = i;
+            }
+
+        /* find group sizes */
+        n_i = n_j = 0;
+        for (i=0; i<6; i++)
+            {
+            if (oldGrowthFxn[i] == index_i)
+                n_i++;
+            else if (oldGrowthFxn[i] == index_j)
+                n_j++;
+            }
+
+        /* adjust growth function */
+        for (i=0; i<6; i++)
+            {
+            if (oldGrowthFxn[i] == index_j)
+                newGrowthFxn[i] = index_i;
+            else if (oldGrowthFxn[i] > index_j)
+                newGrowthFxn[i] = oldGrowthFxn[i] - 1;
+            else
+                newGrowthFxn[i] = oldGrowthFxn[i];
+            }
+
+        /* find the new rates */
+        for (i=0; i<nNewRates; i++)
+            {
+            if (i == index_i)
+                newRate[i] = (oldRate[index_i] + oldRate[index_j]);
+            else if (i < index_j)
+                newRate[i] = oldRate[i];
+            else if (i >= index_j)
+                newRate[i] = oldRate[i+1];
+            }
+
+        /* copy new unique rate values back into the value array */
+        for (i=0; i<nNewRates; i++)
+            {
+            k = 0;
+            for (j=i; j<6; j++)
+                {
+                if (newGrowthFxn[j] == i)
+                    k++;
+                }
+            for (j=i; j<6; j++)
+                {
+                if (newGrowthFxn[j] == i)
+                    newValue[j] = newRate[i] / (MrBFlt) k;
+                }
+            }
+
+        /* get the new and old rates (sum over parts) */
+        R_i = oldRate[index_i];
+        R_j = oldRate[index_j];
+        R   = R_i + R_j;
+
+        /* check group sizes after merge (before split in back move) */
+        for (i=0; i<nNewRates; i++)
+            groupSize[i] = 0;
+        for (i=0; i<6; i++)
+            groupSize[newGrowthFxn[i]]++;
+        nCompositeRates = 0;
+        for (i=0; i<nNewRates; i++)
+            {
+            if (groupSize[i] > 1)
+                nCompositeRates++;
+            }
+
+        /* calculate prior ratio (different in the paper) */
+        (*lnPriorRatio) = LnGamma(n_i * symDir) + LnGamma(n_j * symDir) - LnGamma ((n_i + n_j) * symDir);
+        (*lnPriorRatio) += ((n_i + n_j) * symDir - 1.0) * log(R) - (n_i * symDir - 1.0) * log(R_i) - (n_j * symDir - 1.0) * log(R_j);
+
+        /* calculate proposal ratio */
+        (*lnProposalRatio) = log ((prob_split / prob_merge) * ((nOldRates * (nOldRates - 1)) / (2.0 * nCompositeRates)) * (1.0 / ((pow(2, n_i + n_j - 1) - 1))));
+
+        /* adjust for Beta proposal in back move */
+        dirParm[0] = alphaPi * n_i;
+        dirParm[1] = alphaPi * n_j;
+        rateProps[0] = R_i / R;
+        rateProps[1] = R_j / R;
+        x  = LnGamma(dirParm[0] + dirParm[1]);
+        x -= LnGamma(dirParm[0]);
+        x -= LnGamma(dirParm[1]);
+        x += (dirParm[0] - 1.0) * log(rateProps[0]);
+        x += (dirParm[1] - 1.0) * log(rateProps[1]);
+        (*lnProposalRatio) += x;
+
+        /* Jacobian for the rate proportion */
+        (*lnProposalRatio) -= log(R);
+        }
+    else
+        {
+        /* split two rates */
+        nNewRates = nOldRates + 1;
+
+        /* determine split and merge probs */
+        if (nNewRates == 6)
+            prob_merge = 1.0;
+        else
+            prob_merge = 0.5;
+        if (nOldRates == 1)
+            prob_split = 1.0;
+        else
+            prob_split = 0.5;
+
+        /* check group sizes before split */
+        for (i=0; i<nOldRates; i++)
+            groupSize[i] = 0;
+        for (i=0; i<6; i++)
+            groupSize[oldGrowthFxn[i]]++;
+        nCompositeRates = 0;
+        for (i=0; i<nOldRates; i++)
+            {
+            if (groupSize[i] > 1)
+                nCompositeRates++;
+            }
+
+        /* randomly select a rate with two or more components to split */
+        k = (int) (RandomNumber(seed) * nCompositeRates);
+
+        for (i=j=0; i<nOldRates; i++)
+            {
+            if (groupSize[i] > 1)
+                {
+                if (k == j)
+                    break;
+                j++;
+                }
+            }
+        assert (i < nOldRates && groupSize[i] > 1);
+        index_i = i;
+
+        /* adjust growth function */
+        do {
+            foundFirstI = foundFirstJ = NO;
+            k = 0;
+            index_j = -1;
+            for (i=0; i<6; i++)
+                {
+                if (oldGrowthFxn[i] == index_i)
+                    {
+                    if (foundFirstI == NO)
+                        {
+                        newGrowthFxn[i] = index_i;
+                        foundFirstI = YES;
+                        }
+                    else
+                        {
+                        if (RandomNumber(seed) < 0.5)
+                            {
+                            if (foundFirstJ == NO)
+                                {
+                                foundFirstJ = YES;
+                                index_j = k + 1;    /* one more than previous max */
+                                newGrowthFxn[i] = index_j;
+                                }
+                            else
+                                {
+                                newGrowthFxn[i] = index_j;
+                                }
+                            }
+                        else
+                            newGrowthFxn[i] = index_i;
+                        }
+                    }
+                else if (foundFirstJ == YES && oldGrowthFxn[i] >= index_j)
+                    newGrowthFxn[i] = oldGrowthFxn[i] + 1;
+                else
+                    newGrowthFxn[i] = oldGrowthFxn[i];
+                if (foundFirstJ == NO && oldGrowthFxn[i] > k)
+                    k = oldGrowthFxn[i];
+                }
+            } while (foundFirstJ == NO);
+
+        /* find group sizes */
+        n_i = n_j = 0;
+        for (i=0; i<6; i++)
+            {
+            if (newGrowthFxn[i] == index_i)
+                n_i++;
+            else if (newGrowthFxn[i] == index_j)
+                n_j++;
+            }
+
+        /* find old rate */
+        R = oldRate[index_i];
+
+        /* propose new rates */
+        dirParm[0] = alphaPi * n_i;
+        dirParm[1] = alphaPi * n_j;
+
+        DirichletRandomVariable(dirParm, rateProps, 2, seed);
+        R_i = rateProps[0] * R;
+        R_j = rateProps[1] * R;
+
+        if (R_i/n_i < RATE_MIN)
+            {
+            R_i = RATE_MIN*n_i;
+            rateProps[0] = R_i/R;
+            rateProps[1] = 1-rateProps[0];
+            R_j = rateProps[1] * R;
+            assert (R_j/n_j < RATE_MIN);
+            }
+        else if (R_j/n_j < RATE_MIN)
+            {
+            R_j = RATE_MIN*n_j;
+            rateProps[1] = R_j/R;
+            rateProps[0] = 1-rateProps[1];
+            R_i = rateProps[0] * R;
+            assert (R_i/n_i < RATE_MIN);
+            }
+
+        /* set the new rates */
+        for (i=0; i<nNewRates; i++)
+            {
+            if (i == index_i)
+                newRate[i] = R_i;
+            else if (i == index_j)
+                newRate[i] = R_j;
+            else if (i > index_j)
+                newRate[i] = oldRate[i-1];
+            else
+                newRate[i] = oldRate[i];
+            }
+
+        /* copy new unique rate values back into the value array */
+        for (i=0; i<nNewRates; i++)
+            {
+            k = 0;
+            for (j=i; j<6; j++)
+                {
+                if (newGrowthFxn[j] == i)
+                    k++;
+                }
+            for (j=i; j<6; j++)
+                {
+                if (newGrowthFxn[j] == i)
+                    newValue[j] = newRate[i] / (MrBFlt) k;
+                }
+            }
+
+        /* calculate prior ratio (different in the paper) */
+        (*lnPriorRatio) = LnGamma((n_i + n_j) * symDir) - LnGamma(n_i * symDir) - LnGamma(n_j * symDir);
+        (*lnPriorRatio) += (n_i * symDir - 1.0) * log(R_i) + (n_j * symDir - 1.0) * log(R_j) - ((n_i + n_j) * symDir - 1.0) * log(R);;
+
+        /* calculate proposal ratio */
+        (*lnProposalRatio) = log ((prob_merge / prob_split) * ((2.0 * nCompositeRates) / (nNewRates * (nNewRates - 1))) * ((pow(2, n_i + n_j - 1) - 1)));
+        
+        /* adjust for Beta proposal */
+        x  = LnGamma(dirParm[0] + dirParm[1]);
+        x -= LnGamma(dirParm[0]);
+        x -= LnGamma(dirParm[1]);
+        x += (dirParm[0] - 1.0) * log(rateProps[0]);
+        x += (dirParm[1] - 1.0) * log(rateProps[1]);
+        (*lnProposalRatio) -= x;
+
+        /* Jacobian for rate proportion */
+        (*lnProposalRatio) += log (R);
+        }
+
+#if defined (DEBUG_SPLITMERGE)
+    if (*lnPriorRatio != *lnPriorRatio)
+        {
+        printf ("prob_merge=%f prob_split=%f nCompositeRates=%d nOldRates=%d nNewRates=%d\n", prob_merge, prob_split, nCompositeRates, nOldRates, nNewRates);
+        printf ("merge=%s n_i=%d n_j=%d rateProps[0]=%f R=%f R_i=%f R_j=%f\n", merge == NO ? "NO" : "YES", n_i, n_j, rateProps[0], R, R_i, R_j);
+        printf ("Old rates={%f,%f,%f,%f,%f,%f}\n", oldValue[0], oldValue[1], oldValue[2], oldValue[3], oldValue[4], oldValue[5]);
+        printf ("Old growth fxn={%d,%d,%d,%d,%d,%d}\n", oldGrowthFxn[0], oldGrowthFxn[1], oldGrowthFxn[2], oldGrowthFxn[3], oldGrowthFxn[4], oldGrowthFxn[5]);
+        printf ("New rates={%f,%f,%f,%f,%f,%f}\n", newValue[0], newValue[1], newValue[2], newValue[3], newValue[4], newValue[5]);
+        printf ("New growth fxn={%d,%d,%d,%d,%d,%d}\n", newGrowthFxn[0], newGrowthFxn[1], newGrowthFxn[2], newGrowthFxn[3], newGrowthFxn[4], newGrowthFxn[5]);
+        printf ("lnPriorRatio=%f  lnProposalRatio=%f\n", *lnPriorRatio, *lnProposalRatio);
+        getchar();
+        }
+#endif
+
+    /* Set update flags for all partitions that share this revmat. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Revmat_SplitMerge2: Componentwise split or merge move.
+|
+----------------------------------------------------------------*/
+int Move_Revmat_SplitMerge2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, k, n_i, n_j, index_i, index_j, groupIndex_i, groupIndex_j,
+                *newGrowthFxn, *oldGrowthFxn;
+    MrBFlt      R_i, R_j, r_j, alphaPi, *newValue, *oldValue, symDir,
+                dirParm[2], rateProps[2], x;
+    ModelParams *mp;
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get the values we need */
+    oldValue     = GetParamVals(param, chain, state[chain] ^ 1);
+    newValue     = GetParamVals(param, chain, state[chain]);
+    oldGrowthFxn = GetParamIntVals(param, chain, state[chain] ^ 1);
+    newGrowthFxn = GetParamIntVals (param, chain, state[chain]);
+    symDir       = mp->revMatSymDir;
+    alphaPi      = mvp[0];      /* tuning parameter */
+
+    /* pick two component rates at random without replacement */
+    index_i = (int) (RandomNumber(seed) * 6);
+    index_j = (int) (RandomNumber(seed) * 5);
+    if (index_j == index_i)
+        index_j = 5;
+    groupIndex_i = oldGrowthFxn[index_i];
+    groupIndex_j = oldGrowthFxn[index_j];
+
+    if (oldGrowthFxn[index_i] != oldGrowthFxn[index_j])
+        {
+        /* the rates are different, so merge them */
+
+        /* calculate n_i, n_j, R_i and R_j before merge */
+        n_i = n_j = 0;
+        R_i = R_j = 0.0;
+        for (i=0; i<6; i++)
+            {
+            if (oldGrowthFxn[i] == groupIndex_i)
+                {
+                n_i++;
+                R_i += oldValue[i];
+                }
+            if (oldGrowthFxn[i] == groupIndex_j)
+                {
+                n_j++;
+                R_j += oldValue[i];
+                }
+            }
+
+        /* merge component rates by adding j to i */
+        newGrowthFxn[index_j] = oldGrowthFxn[index_i];
+
+        /* select a new rate for r_j */
+        if (n_j == 1)
+            r_j = oldValue[index_j];
+        else
+            {
+            dirParm[0] = alphaPi * 1;
+            dirParm[1] = alphaPi * (n_j - 1);
+
+            DirichletRandomVariable(dirParm, rateProps, 2, seed);
+            r_j = rateProps[0] * R_j;
+
+            if (R_j - r_j < RATE_MIN)
+                {
+                r_j = R_j - RATE_MIN;
+                rateProps[0] = r_j/R_j;
+                rateProps[1] = 1 - rateProps[0];
+                }
+            }
+
+        /* update new growth function */
+        UpdateGrowthFxn(newGrowthFxn);
+
+        /* we divide R_i + r_j equally among components of merged group,
+           and R_j - r_j equally among split group */
+        for (i=0; i<6; i++)
+            {
+            if (oldGrowthFxn[i] == oldGrowthFxn[index_i] || i == index_j)
+                newValue[i] = (R_i + r_j) / (MrBFlt)(n_i + 1);
+            else if (oldGrowthFxn[i] == oldGrowthFxn[index_j])
+                newValue[i] = (R_j - r_j) / (MrBFlt)(n_j - 1);
+            else
+                newValue[i] = oldValue[i];
+            }
+
+        /* calculate prior ratio */
+        if (n_j > 1)
+            {
+            /* no category disappeared */
+            (*lnPriorRatio) += LnGamma (n_i * symDir) + LnGamma(n_j * symDir);
+            (*lnPriorRatio) -= LnGamma((n_i +1)* symDir) + LnGamma((n_j-1) * symDir);
+            (*lnPriorRatio) += ((n_i + 1) * symDir - 1.0) * log(R_i + r_j) + ((n_j - 1) * symDir - 1.0) * log(R_j - r_j);
+            (*lnPriorRatio) -= (n_i * symDir - 1.0) * log(R_i) + (n_j * symDir - 1.0) * log(R_j);
+            }
+        else
+            {
+            /* j category disappeared */
+            (*lnPriorRatio) += LnGamma (n_i * symDir) + LnGamma(n_j * symDir);
+            (*lnPriorRatio) -= LnGamma((n_i +1)* symDir);
+            (*lnPriorRatio) += ((n_i + 1) * symDir - 1.0) * log(R_i + r_j);
+            (*lnPriorRatio) -= (n_i * symDir - 1.0) * log(R_i) + (n_j * symDir - 1.0) * log(R_j);
+            }
+
+        /* calculate proposal ratio; this is the probability of choosing the right category for rate j when splitting */
+        k = GetKFromGrowthFxn(newGrowthFxn);
+        (*lnProposalRatio) = log (1.0 / k);
+
+        /* adjust for Beta proposal in back move */
+        dirParm[0] = alphaPi * 1;
+        dirParm[1] = alphaPi * n_i;
+        rateProps[0] = r_j / (R_i + r_j);
+        rateProps[1] = 1.0 - rateProps[0];
+        x  = LnGamma(dirParm[0] + dirParm[1]);
+        x -= LnGamma(dirParm[0]);
+        x -= LnGamma(dirParm[1]);
+        x += (dirParm[0] - 1.0) * log(rateProps[0]);
+        x += (dirParm[1] - 1.0) * log(rateProps[1]);
+        (*lnProposalRatio) += x;
+
+        /* adjust for Beta proposal in forward move */
+        if (n_j > 1)
+            {
+            dirParm[0] = alphaPi * 1;
+            dirParm[1] = alphaPi * n_j;
+            rateProps[0] = r_j / R_j;
+            rateProps[1] = 1.0 - rateProps[0];
+            x  = LnGamma(dirParm[0] + dirParm[1]);
+            x -= LnGamma(dirParm[0]);
+            x -= LnGamma(dirParm[1]);
+            x += (dirParm[0] - 1.0) * log(rateProps[0]);
+            x += (dirParm[1] - 1.0) * log(rateProps[1]);
+            (*lnProposalRatio) -= x;
+            }
+
+        /* Jacobian */
+        (*lnProposalRatio) -= log (R_i + r_j);
+        if (n_j > 1)
+            (*lnProposalRatio) += log (R_j);
+        }
+    else
+        {
+        /* split component rates because they are the same */
+
+        /* split component rates by selecting new group for j from (0,K), with j starting a new group if index becomes the same */
+        k = GetKFromGrowthFxn(oldGrowthFxn);
+        newGrowthFxn[index_j] = (int) (RandomNumber(seed) * k);
+        if (newGrowthFxn[index_j] == oldGrowthFxn[index_j])
+            newGrowthFxn[index_j] = k + 1;
+
+        /* update growth function and group indices */
+        UpdateGrowthFxn(newGrowthFxn);
+        groupIndex_i = newGrowthFxn[index_i];
+        groupIndex_j = newGrowthFxn[index_j];
+
+        /* calculate n_i, n_j, R_i and R_j after split */
+        n_i = n_j = 0;
+        R_i = R_j = 0.0;
+        for (i=0; i<6; i++)
+            {
+            if (i == index_j)
+                {
+                R_i += oldValue[i];
+                n_i++;
+                }
+            else if (newGrowthFxn[i] == groupIndex_i)
+                {
+                n_i++;
+                R_i += oldValue[i];
+                }
+            else if (newGrowthFxn[i] == groupIndex_j)
+                {
+                n_j++;
+                R_j += oldValue[i];
+                }
+            }
+
+        /* select a new rate for r_j */
+        dirParm[0] = alphaPi * 1;
+        dirParm[1] = alphaPi * (n_i - 1);
+
+        DirichletRandomVariable(dirParm, rateProps, 2, seed);
+        r_j = rateProps[0] * R_i;
+
+        if (R_i-r_j < RATE_MIN)
+            {
+            r_j = R_i - RATE_MIN;
+            rateProps[0] = r_j/R_i;
+            rateProps[1] = 1 - rateProps[0];
+            }
+
+        /* update n_i, n_j, R_i and R_j after split */
+        n_i -= 1;
+        n_j += 1;
+        R_i -= r_j;
+        R_j += r_j;
+
+        /* we divide R_i equally among remaining components of split group,
+           and R_j equally among new or expanded group */
+        for (i=0; i<6; i++)
+            {
+            if (newGrowthFxn[i] == groupIndex_i)
+                newValue[i] = R_i / (MrBFlt)(n_i);
+            else if (newGrowthFxn[i] == groupIndex_j)
+                newValue[i] = R_j / (MrBFlt)(n_j);
+            else
+                newValue[i] = oldValue[i];
+            }
+
+        /* calculate prior ratio */
+        if (n_j > 1)
+            {
+            /* no new category created by split */
+            (*lnPriorRatio) += LnGamma((n_i +1)* symDir) + LnGamma((n_j-1) * symDir);
+            (*lnPriorRatio) -= LnGamma (n_i * symDir) + LnGamma(n_j * symDir);
+            (*lnPriorRatio) += (n_i * symDir - 1.0) * log(R_i) + (n_j * symDir - 1.0) * log(R_j);
+            (*lnPriorRatio) -= ((n_i + 1) * symDir - 1.0) * log(R_i + r_j) + ((n_j - 1) * symDir - 1.0) * log(R_j - r_j);
+            }
+        else
+            {
+            /* new category created by split */
+            (*lnPriorRatio) += LnGamma((n_i +1)* symDir);
+            (*lnPriorRatio) -= LnGamma (n_i * symDir) + LnGamma(n_j * symDir);
+            (*lnPriorRatio) += (n_i * symDir - 1.0) * log(R_i) + (n_j * symDir - 1.0) * log(R_j);
+            (*lnPriorRatio) -= ((n_i + 1) * symDir - 1.0) * log(R_i + r_j);
+            }
+
+        /* calculate proposal ratio; this is one over the probability of choosing the right category for rate j when splitting */
+        k = GetKFromGrowthFxn(oldGrowthFxn);
+        (*lnProposalRatio) = log (k);
+
+        /* adjust for Beta proposal in back move */
+        if (n_j > 1)
+            {
+            dirParm[0] = alphaPi * 1;
+            dirParm[1] = alphaPi * (n_j - 1);
+            rateProps[0] = r_j / R_j;
+            rateProps[1] = 1.0 - rateProps[0];
+            x  = LnGamma(dirParm[0] + dirParm[1]);
+            x -= LnGamma(dirParm[0]);
+            x -= LnGamma(dirParm[1]);
+            x += (dirParm[0] - 1.0) * log(rateProps[0]);
+            x += (dirParm[1] - 1.0) * log(rateProps[1]);
+            (*lnProposalRatio) += x;
+            }
+
+        /* adjust for Beta proposal in forward move */
+        dirParm[0] = alphaPi * 1;
+        dirParm[1] = alphaPi * n_i;
+        rateProps[0] = r_j / (R_i + r_j);
+        rateProps[1] = 1.0 - rateProps[0];
+        x  = LnGamma(dirParm[0] + dirParm[1]);
+        x -= LnGamma(dirParm[0]);
+        x -= LnGamma(dirParm[1]);
+        x += (dirParm[0] - 1.0) * log(rateProps[0]);
+        x += (dirParm[1] - 1.0) * log(rateProps[1]);
+        (*lnProposalRatio) -= x;
+
+        /* Jacobian */
+        (*lnProposalRatio) += log (R_i + r_j);
+        if (n_j > 1)
+            (*lnProposalRatio) -= log (R_j);
+        }
+
+    /* Set update flags for all partitions that share this revmat. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_Speciation (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change speciation rate using sliding window */
+    
+    int         isLPriorExp, isValidL, valIndex;
+    MrBFlt      *valPtr, oldL, newL, minL, maxL, lambdaExp=0.0, *sR, *eR, sF, *fR, oldLnPrior, newLnPrior,
+                window, clockRate;
+    char        *sS;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Tree        *t;
+
+    /* get size of window, centered on current value */
+    window = mvp[0];
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get minimum and maximum values */
+    if (param->paramId == SPECRATE_UNI)
+        {
+        minL = mp->speciationUni[0];
+        maxL = mp->speciationUni[1];
+        isLPriorExp = NO;
+        }
+    else
+        {
+        minL = 0.000001;
+        maxL = 1000.0;
+        lambdaExp = mp->speciationExp;
+        isLPriorExp = YES;
+        }
+
+    /* get pointer to value to be changed */
+    valIndex = (int)(RandomNumber(seed) * param->nValues);
+    valPtr = GetParamVals(param, chain, state[chain]) + valIndex;
+    
+    /* get old value */
+    oldL = *valPtr;
+
+    /* change value */
+    if (maxL-minL < window)
+        window = maxL-minL;
+    newL = oldL + window * (RandomNumber(seed) - 0.5);
+    
+    /* check that new value is valid */
+    isValidL = NO;
+    do  {
+        if (newL < minL)
+            newL = 2 * minL - newL;
+        else if (newL > maxL)
+            newL = 2 * maxL - newL;
+        else
+            isValidL = YES;
+        } while (isValidL == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* calculate prior ratio */
+    t  = GetTree(modelSettings[param->relParts[0]].brlens,chain,state[chain]);
+    sR = GetParamVals (param, chain, state[chain]);
+    eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+    sF = mp->sampleProb;
+    sS = mp->sampleStrat;
+    clockRate = *GetParamVals (m->clockRate, chain, state[chain]);
+    
+    if (!strcmp(mp->clockPr,"Birthdeath"))
+        {
+        if (LnBirthDeathPriorPr (t, clockRate, &oldLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        *valPtr = newL;  // update with new value
+        if (LnBirthDeathPriorPr (t, clockRate, &newLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        }
+    else if (!strcmp(mp->clockPr,"Fossilization"))
+        {
+        fR = GetParamVals (m->fossilizationRates, chain, state[chain]);
+        if (LnFossilizationPriorPr (t, clockRate, &oldLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        *valPtr = newL;  // update with new value
+        // for (i=0; i<param->nValues; i++)  *(GetParamVals(param, chain, state[chain]) + i) = newL;
+        if (LnFossilizationPriorPr (t, clockRate, &newLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        }
+    else {
+        MrBayesPrint ("%s   Move_Speciation not applicable\n", spacer);
+        return (ERROR);
+        }
+
+    if (isLPriorExp == NO)
+        *lnPriorRatio = newLnPrior - oldLnPrior;
+    else
+        *lnPriorRatio = -lambdaExp * (newL - oldL) + (newLnPrior - oldLnPrior);
+    
+    return (NO_ERROR);
+}
+
+
+int Move_Speciation_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change speciation rate using multiplier */
+    
+    int         isLPriorExp, isValidL, valIndex;
+    MrBFlt      *valPtr, oldL, newL, minL, maxL, lambdaExp=0.0, *sR, *eR, sF, *fR, oldLnPrior, newLnPrior,
+                tuning, clockRate;
+    char        *sS;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Tree        *t;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params and settings */
+    mp = &modelParams[param->relParts[0]];
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get minimum and maximum values */
+    if (param->paramId == SPECRATE_UNI)
+        {
+        minL = mp->speciationUni[0];
+        maxL = mp->speciationUni[1];
+        isLPriorExp = NO;
+        }
+    else
+        {
+        minL = 0.000001;
+        maxL = 1000.0;
+        lambdaExp = mp->speciationExp;
+        isLPriorExp = YES;
+        }
+
+    /* get pointer to value to be changed */
+    valIndex = (int)(RandomNumber(seed) * param->nValues);
+    valPtr = GetParamVals(param, chain, state[chain]) + valIndex;
+    
+    /* get old value */
+    oldL = *valPtr;
+
+    /* change value */
+    newL = oldL * exp(tuning * (RandomNumber(seed) - 0.5));
+    
+    /* check that new value is valid */
+    isValidL = NO;
+    do  {
+        if (newL < minL)
+            newL = minL * minL / newL;
+        else if (newL > maxL)
+            newL = maxL * maxL / newL;
+        else
+            isValidL = YES;
+        } while (isValidL == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = log (newL / oldL);
+    
+    /* calculate prior ratio */
+    t  = GetTree(modelSettings[param->relParts[0]].brlens,chain,state[chain]);
+    sR = GetParamVals (param, chain, state[chain]);
+    eR = GetParamVals (m->extinctionRates, chain, state[chain]);
+    sF = mp->sampleProb;
+    sS = mp->sampleStrat;
+    clockRate = *GetParamVals(m->clockRate, chain, state[chain]);
+    
+    if (!strcmp(mp->clockPr,"Birthdeath"))
+        {
+        if (LnBirthDeathPriorPr (t, clockRate, &oldLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        *valPtr = newL;  // update with new value
+        if (LnBirthDeathPriorPr (t, clockRate, &newLnPrior, *sR, *eR, sS, sF) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for birth-death process\n", spacer);
+            return (ERROR);
+            }
+        }
+    else if (!strcmp(mp->clockPr,"Fossilization"))
+        {
+        fR = GetParamVals (m->fossilizationRates, chain, state[chain]);
+        if (LnFossilizationPriorPr (t, clockRate, &oldLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        *valPtr = newL;  // update with new value
+        // for (i=0; i<param->nValues; i++)  *(GetParamVals(param, chain, state[chain]) + i) = newL;
+        if (LnFossilizationPriorPr (t, clockRate, &newLnPrior, sR, eR, sF, fR, sS) == ERROR)
+            {
+            MrBayesPrint ("%s   Problem calculating prior for fossilized birth-death process\n", spacer);
+            return (ERROR);
+            }
+        }
+    else {
+        MrBayesPrint ("%s   Move_Speciation_M not applicable\n", spacer);
+        return (ERROR);
+        }
+
+    if (isLPriorExp == NO)
+        *lnPriorRatio = newLnPrior - oldLnPrior;
+    else
+        *lnPriorRatio = -lambdaExp * (newL - oldL) + (newLnPrior - oldLnPrior);
+    
+    return (NO_ERROR);
+}
+
+
+int Move_Statefreqs (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change pi */
+    int         i, nStates, isValid;
+    MrBFlt      dirichletParameters[64], *newPi, *oldPi, *priorAlpha, sum, alphaPi, x, y;
+
+    /* get the values we need */
+    nStates = param->nSubValues;
+    priorAlpha = GetParamVals(param, chain, state[chain]);
+    newPi = GetParamSubVals (param, chain, state[chain]);
+    oldPi = GetParamSubVals (param, chain, state[chain] ^ 1);
+        
+    /* tuning parameter */
+    alphaPi = mvp[0]*nStates;
+
+    /* multiply old values with some large number to get new values close to the old ones */
+    for (i=0; i<nStates; i++)
+        dirichletParameters[i] = oldPi[i] * alphaPi;
+
+    do  {
+        DirichletRandomVariable (dirichletParameters, newPi, nStates, seed);
+        isValid = YES;
+        for (i=0; i<nStates; i++)
+            {
+            if (newPi[i] < PI_MIN)
+                {
+                isValid = NO;
+                break;
+                }
+            }
+        } while (isValid == NO);
+
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<nStates; i++)
+        sum += newPi[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<nStates; i++)
+        x -= LnGamma(newPi[i]*alphaPi);
+    for (i=0; i<nStates; i++)
+        x += (newPi[i]*alphaPi-1.0)*log(oldPi[i]);
+    sum = 0.0;
+    for (i=0; i<nStates; i++)
+        sum += oldPi[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<nStates; i++)
+        y -= LnGamma(oldPi[i]*alphaPi);
+    for (i=0; i<nStates; i++)
+        y += (oldPi[i]*alphaPi-1.0)*log(newPi[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    y = x = 0.0;                    /* the Gamma part of the prior is the same */
+    for (i=0; i<nStates; i++)
+        x += (priorAlpha[i]-1.0)*log(newPi[i]);
+    for (i=0; i<nStates; i++)
+        y += (priorAlpha[i]-1.0)*log(oldPi[i]);
+    (*lnPriorRatio) = x - y;
+        
+    /* Touch the entire tree */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for many models we do want to update the cijk flag, as the transition
+       probability matrices require diagonalizing the rate matrix. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Move_Statefreqs_Slider: Change state frequencies using Slider proposal
+|       mechanism.
+|       Choose pairs of the parameter values (e.g. pi(A), and pi(G)) at
+|       random and denote them piA, and piB. Let oldProp = piA/(piA + piB)
+|       and newProp = oldProp + delta(U - 0.5), where U is a uniform random variable
+|       on the interval (0, 1] and delta is a tuning parameter. Values
+|       that fall outside the boundaries are reflected back in. Then
+|       set newPiA = newProp*(piA+piB) and newPiB = (1-newProp)*(piA+piB).
+|       The Hastings ratio of this move is 1.0.
+|
+----------------------------------------------------------------*/
+int Move_Statefreqs_Slider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, j, nStates, isValid;
+    MrBFlt      delta, *newPi, *oldPi, *priorAlpha, x, y, sum, min, max;
+
+    /* get the values we need */
+    nStates = param->nSubValues;
+    priorAlpha = GetParamVals(param, chain, state[chain]);
+    newPi = GetParamSubVals (param, chain, state[chain]);
+    oldPi = GetParamSubVals (param, chain, state[chain] ^ 1);
+
+    /* get window size */
+    delta = mvp[0];
+
+    /* choose a pair to change */
+    i = (int) (RandomNumber(seed) * nStates);
+    j = (int) (RandomNumber(seed) * (nStates-1));
+    if (i == j)
+        j = nStates-1;
+    
+    /* find new proportion */
+    sum = oldPi[i] + oldPi[j];
+
+    /* reflect */
+    isValid = NO;
+    min = PI_MIN / sum;
+    max = 1.0 - min;
+
+    x   = oldPi[i] / sum;
+    if (delta > max-min) /* we do it to avoid following long while loop in case if delta is high */
+        {
+        delta = max-min;
+        }
+    y = x + delta * (RandomNumber(seed) - 0.5);
+
+    do {
+        if (y < min)
+            y = 2.0 * min - y;
+        else if (y > max)
+            y = 2.0 * max - y;
+        else
+            isValid = YES;
+        } while (isValid == NO);
+
+    /* set the new values */
+    newPi[i] = y * sum;
+    newPi[j] = sum - newPi[i];
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+
+    /* get prior ratio */
+    /* (the Gamma part of the prior is the same) */
+    x = (priorAlpha[i]-1.0)*log(newPi[i]);
+    x += (priorAlpha[j]-1.0)*log(newPi[j]);
+    y = (priorAlpha[i]-1.0)*log(oldPi[i]);
+    y += (priorAlpha[j]-1.0)*log(oldPi[j]);
+    (*lnPriorRatio) = x - y;
+
+    /* Set update for entire tree */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for many models we do want to update the cijk flag, as the transition
+       probability matrices require diagonalizing the rate matrix. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_StatefreqsSymDirMultistate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change state freqs of multistate characters */
+    /* ideally, we would let the likelihood calculator deal with only the affected character
+       but we do not have the mechanism for doing that in the current version of mrbayes, so
+       take the hit of updating all chars of the morph partition(s). */
+    int     i, nStates, charIndex;
+    MrBFlt  dirichletParameters[10], symDirAlphai, *newPi, *oldPi, sum, alphaPi, x, y;
+    Model   *mp;
+
+    /* tuning parameters */
+    alphaPi = mvp[0];
+
+    /* get model paramaters */
+    mp = &modelParams[param->relParts[0]];
+
+    /* select one character at random */
+    charIndex = (int) (RandomNumber(seed) * param->nSympi);
+    
+    /* get the values we need */
+    symDirAlphai = *GetParamVals(param, chain, state[chain]);
+    newPi = GetParamStdStateFreqs (param, chain, state[chain]);
+    oldPi = GetParamStdStateFreqs (param, chain, state[chain] ^ 1);
+    newPi += 2 * mp->numBetaCats;
+    oldPi += 2 * mp->numBetaCats;
+    for (i=0; i<charIndex; i++)
+        {
+        oldPi += param->sympinStates[i];
+        newPi += param->sympinStates[i];
+        }
+    nStates = param->sympinStates[charIndex];
+    
+    /* multiply old values with some large number to get new values close to the old ones */
+    for (i=0; i<nStates; i++)
+        dirichletParameters[i] = oldPi[i] * alphaPi;
+
+    DirichletRandomVariable (dirichletParameters, newPi, nStates, seed);
+
+    sum = 0.0;
+    for (i=0; i<nStates; i++)
+        {
+        if (newPi[i] < 0.0001)
+            newPi[i] = 0.0001;
+        sum += newPi[i];
+        }
+    for (i=0; i<nStates; i++)
+        newPi[i] /= sum;
+
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<nStates; i++)
+        sum += newPi[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<nStates; i++)
+        x -= LnGamma(newPi[i]*alphaPi);
+    for (i=0; i<nStates; i++)
+        x += (newPi[i]*alphaPi-1.0)*log(oldPi[i]);
+    sum = 0.0;
+    for (i=0; i<nStates; i++)
+        sum += oldPi[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<nStates; i++)
+        y -= LnGamma(oldPi[i]*alphaPi);
+    for (i=0; i<nStates; i++)
+        y += (oldPi[i]*alphaPi-1.0)*log(newPi[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    y = x = 0.0;    /* the Gamma part of the prior is the same */
+    for (i=0; i<nStates; i++)
+        x += (symDirAlphai-1.0)*log(newPi[i]);
+    for (i=0; i<nStates; i++)
+        y += (symDirAlphai-1.0)*log(oldPi[i]);
+    (*lnPriorRatio) = x - y;
+        
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        
+    /* Set update flags for cijks for all affected partitions. Only cijks for the changed character 
+       actually need to be updated but we can't do that in the current version of the program. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_SwitchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change switch rate of covarion model using sliding window */
+    
+    int         i, isSPriorExp, isValidS, whichRate;
+    MrBFlt      oldS, newS, window, minS, maxS, sExp=0.0, ran, *value;
+    ModelParams *mp;
+
+    /* decide which switching rate to change */
+    if (RandomNumber(seed) < 0.5)
+        whichRate = 0;
+    else
+        whichRate = 1;
+        
+    /* get size of window, centered on current switching rates value */
+    window = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get minimum and maximum values for switching rate */
+    if (param->paramId == SWITCH_UNI)
+        {
+        minS = mp->covswitchUni[0];
+        maxS = mp->covswitchUni[1];
+        isSPriorExp = NO;
+        }
+    else
+        {
+        minS = 0.01;
+        maxS = KAPPA_MAX;
+        sExp = mp->covswitchExp;
+        isSPriorExp = YES;
+        }
+
+    /* get old value of switching rate */
+    value = GetParamVals(param, chain, state[chain]);
+    newS = oldS = value[whichRate];
+
+    /* change value for switching rate */
+    ran = RandomNumber(seed);
+    if (maxS-minS < window)
+        {
+        window = maxS-minS;
+        }
+    newS = oldS + window * (ran - 0.5);
+    
+    /* check that new value is valid */
+    isValidS = NO;
+    do
+        {
+        if (newS < minS)
+            newS = 2* minS - newS;
+        else if (newS > maxS)
+            newS = 2 * maxS - newS;
+        else
+            isValidS = YES;
+        } while (isValidS == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = 0.0;
+    
+    /* get prior ratio */
+    if (isSPriorExp == NO)
+        *lnPriorRatio = 0.0;
+    else
+        *lnPriorRatio = -sExp * (newS - oldS);
+    
+    /* copy new switching rate value back */
+    value[whichRate] = newS;
+
+    /* Set update flags for all partitions that share this switching rate. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_SwitchRate_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change switch rate of covarion model using multiplier */
+
+    int         i, isSPriorExp, isValidS, whichRate;
+    MrBFlt      oldS, newS, minS, maxS, sExp=0.0, tuning, ran, factor, *value;
+    ModelParams *mp;
+
+    /* decide which switching rate to change */
+    if (RandomNumber(seed) < 0.5)
+        whichRate = 0;
+    else
+        whichRate = 1;
+        
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+    
+    /* get minimum and maximum values for switching rate */
+    if (param->paramId == SWITCH_UNI)
+        {
+        minS = mp->covswitchUni[0];
+        maxS = mp->covswitchUni[1];
+        isSPriorExp = NO;
+        }
+    else
+        {
+        minS = 0.01;
+        maxS = KAPPA_MAX;
+        sExp = mp->covswitchExp;
+        isSPriorExp = YES;
+        }
+
+    /* get old value of switching rate */
+    value = GetParamVals(param, chain, state[chain]);
+    newS = oldS = value[whichRate];
+
+    /* change value for switching rate */
+    ran = RandomNumber(seed);
+    factor = exp(tuning * (ran - 0.5));
+    newS = oldS * factor;
+    
+    /* check that new value is valid */
+    isValidS = NO;
+    do
+        {
+        if (newS < minS)
+            newS = minS * minS / newS;
+        else if (newS > maxS)
+            newS = maxS * maxS / newS;
+        else
+            isValidS = YES;
+        } while (isValidS == NO);
+
+    /* get proposal ratio */
+    *lnProposalRatio = log (newS / oldS);
+    
+    /* get prior ratio */
+    if (isSPriorExp == NO)
+        *lnPriorRatio = 0.0;
+    else
+        *lnPriorRatio = -sExp * (newS - oldS);
+    
+    /* copy new switching rate value back */
+    value[whichRate] = newS;
+
+    /* Set update flags for all partitions that share this switching rate. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+int Move_TK02BranchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* move one TK02 relaxed clock branch rate using multiplier */
+    
+    int         i;
+    MrBFlt      newRate, oldRate, tuning, minR, maxR, nu, *tk02Rate, *brlens;
+    TreeNode    *p = NULL;
+    ModelInfo   *m;
+    Tree        *t;
+    TreeNode    *q;
+    
+    /* get model settings */
+    m = &modelSettings[param->relParts[0]];
+    
+    /* get the tuning parameter */
+    tuning = mvp[0];
+    
+    /* get the TK02 branch rate and effective branch length data */
+    tk02Rate = GetParamVals (param, chain, state[chain]);
+    brlens   = GetParamSubVals (param, chain, state[chain]);
+    
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+    
+    /* get minimum and maximum rate */
+    minR = RATE_MIN;
+    maxR = RATE_MAX;
+    
+    /* randomly pick a rate */
+    do  {
+        i = (int) (RandomNumber(seed) * (t->nNodes -2));
+        p = t->allDownPass[i];
+        }
+    while (p->length < TIME_MIN);  // not ancestral fossil
+    
+    /* find new rate */
+    oldRate = tk02Rate[p->index];
+    newRate = oldRate * exp ((0.5 - RandomNumber(seed)) * tuning);
+    
+    /* reflect if necessary */
+    while (newRate < minR || newRate > maxR)
+        {
+        if (newRate < minR)
+            newRate = minR * minR / newRate;
+        if (newRate > maxR)
+            newRate = maxR * maxR / newRate;
+        }
+    
+    tk02Rate[p->index] = newRate;
+    
+    /* calculate prior ratio */
+    nu = *GetParamVals (m->tk02var, chain, state[chain]);
+    (*lnPriorRatio) = LnRatioTK02LogNormal (tk02Rate[p->anc->index], nu*p->length, newRate, oldRate);
+    if (p->left != NULL)
+        {
+        if (p->left->length > 0.0)
+            {
+            (*lnPriorRatio) -= LnProbTK02LogNormal (oldRate, nu*p->left->length,  tk02Rate[p->left->index ]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (newRate, nu*p->left->length,  tk02Rate[p->left->index ]);
+            }
+        if (p->right->length > 0.0)
+            {
+            (*lnPriorRatio) -= LnProbTK02LogNormal (oldRate, nu*p->right->length, tk02Rate[p->right->index]);
+            (*lnPriorRatio) += LnProbTK02LogNormal (newRate, nu*p->right->length, tk02Rate[p->right->index]);
+            }
+        }
+    
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = log (newRate / oldRate);
+    
+    /* update branch evolution lengths */
+    brlens[p->index] = p->length * (newRate + tk02Rate[p->anc->index]) / 2.0;
+    if (p->left != NULL)
+        {
+        if (p->left->length > 0.0)
+            {
+            brlens[p->left->index] = p->left->length  * (tk02Rate[p->left->index] + newRate) / 2.0;
+            }
+        if (p->right->length > 0.0)
+            {
+            brlens[p->right->index] = p->right->length * (tk02Rate[p->right->index] + newRate) / 2.0;
+            }
+        }
+    
+    /* set update of ti probs */
+    p->upDateTi = YES;
+    if (p->left != NULL)
+        {
+        p->left ->upDateTi = YES;
+        p->right->upDateTi = YES;
+        }
+    
+    /* set update of cond likes down to root */
+    /* update of crowntree set in UpdateCppEvolLengths */
+    p->upDateCl = YES;
+    q = p->anc;
+    while (q->anc != NULL)
+        {
+        q->upDateCl = YES;
+        q = q->anc;
+        }
+    
+    return (NO_ERROR);
+}
+
+
+int Move_Tratio_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change tratio using Dirichlet proposal */
+    
+    int         i;
+    MrBFlt      oldK, alphaPi, *alphaDir, oldProp[2], newProp[2], dirParm[2], sum, x, y;
+    ModelParams *mp;
+
+    /* get model params */
+    mp = &modelParams[param->relParts[0]];
+
+    /* get so called alphaPi parameter */
+    alphaPi = mvp[0];
+
+    /* get old value of kappa */
+    oldK = *GetParamVals(param, chain, state[chain]);
+
+    /* get Dirichlet parameters */
+    alphaDir = mp->tRatioDir;
+
+    /* calculate old ratesum proportions */
+    oldProp[0] = oldK / (oldK + 1.0);
+    oldProp[1] = 1.0 - oldProp[0];
+    
+    /* multiply old ratesum props with some large number to get new values close to the old ones */
+    dirParm[0] = oldProp[0] * alphaPi;
+    dirParm[1] = oldProp[1] * alphaPi;
+    
+    /* get new values */
+    DirichletRandomVariable (dirParm, newProp, 2, seed);
+
+    if (newProp[0] < DIR_MIN)
+        {
+        newProp[0] = DIR_MIN;
+        newProp[1] = 1.0-DIR_MIN;
+        }
+    else if (newProp[1] < DIR_MIN)
+        {
+        newProp[1] = DIR_MIN;
+        newProp[0] = 1.0-DIR_MIN;
+        }
+
+    /* calculate and copy new kappa value back */
+    *GetParamVals(param, chain, state[chain]) = newProp[0] / newProp[1];
+
+    /* get proposal ratio */
+    sum = 0.0;
+    for (i=0; i<2; i++)
+        sum += newProp[i]*alphaPi;
+    x = LnGamma(sum);
+    for (i=0; i<2; i++)
+        x -= LnGamma(newProp[i]*alphaPi);
+    for (i=0; i<2; i++)
+        x += (newProp[i]*alphaPi-1.0)*log(oldProp[i]);
+    sum = 0.0;
+    for (i=0; i<2; i++)
+        sum += oldProp[i]*alphaPi;
+    y = LnGamma(sum);
+    for (i=0; i<2; i++)
+        y -= LnGamma(oldProp[i]*alphaPi);
+    for (i=0; i<2; i++)
+        y += (oldProp[i]*alphaPi-1.0)*log(newProp[i]);
+    (*lnProposalRatio) = x - y;
+
+    /* get prior ratio */
+    x = y = 0.0;
+    for (i=0; i<2; i++)
+        x += (alphaDir[i]-1.0)*log(newProp[i]);
+    for (i=0; i<2; i++)
+        y += (alphaDir[i]-1.0)*log(oldProp[i]);
+    (*lnPriorRatio) = x - y;
+        
+    /* Set update flags for all partitions that share this kappa. Note that the conditional
+       likelihood update flags have been set before we even call this function. */
+    for (i=0; i<param->nRelParts; i++)
+        TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+
+    /* Set update flags for cijks for all affected partitions. If this is a simple 4 X 4 model,
+       we don't take any hit, because we will never go into a general transition probability
+       calculator. However, for covarion, doublet, and codon models, we do want to update
+       the cijk flag. */
+    for (i=0; i<param->nRelParts; i++)
+        modelSettings[param->relParts[i]].upDateCijk = YES;
+
+    return (NO_ERROR);
+}
+
+
+/* Code added by Jeremy Brown and modified by Maxim Teslenko */
+int Move_TreeLen (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    /* change all branch lengths */
+
+    MrBFlt      begin_tl, treescaler, tuning, maxV, minV, brlensPrExp=0.0;
+    TreeNode    *p;
+    ModelParams *mp;
+    Tree        *t;
+    int i,branch_counter,  isVPriorExp;
+
+    tuning = mvp[0]; /* Larget & Simon's tuning parameter lambda */
+
+    mp = &modelParams[param->relParts[0]];
+
+    /* max and min brlen */
+    if (param->paramId == BRLENS_UNI)
+        {
+        minV = mp->brlensUni[0];
+        maxV = mp->brlensUni[1];
+        isVPriorExp = NO;
+        }
+    else if (param->paramId == BRLENS_GamDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 2;
+        }
+    else if (param->paramId == BRLENS_iGmDir)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 3;
+        }
+    else if (param->paramId == BRLENS_twoExp)
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        isVPriorExp = 4;
+        }
+    else
+        {
+        minV = BRLENS_MIN;
+        maxV = BRLENS_MAX;
+        brlensPrExp = mp->brlensExp;
+        isVPriorExp = YES;
+        }
+
+    /* get tree */
+    t = GetTree (param, chain, state[chain]);
+
+    assert (t->isRooted == NO);
+
+    /* Dirichlet or twoExp prior */
+    if (isVPriorExp > 1)
+        (*lnPriorRatio) = -LogDirPrior(t, mp, isVPriorExp);
+
+    treescaler = exp(tuning * (RandomNumber(seed) - 0.5));
+    
+    begin_tl = 0.0;
+    branch_counter=0;
+
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            {
+            if (p->length*treescaler < minV || p->length*treescaler > maxV)
+                {
+                abortMove = YES;
+                return NO_ERROR;
+                }
+            begin_tl += p->length;
+            branch_counter++;               
+            }
+        }
+    assert (branch_counter==t->nNodes-1);
+    
+    /* iterate scaling over all branches */
+    for (i=0; i < t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            {
+            /* set new length */
+            p->length *= treescaler;
+
+            /* set flags for update of transition probabilities at p */
+            p->upDateTi = YES;
+            p->anc->upDateCl = YES; 
+            }
+        }
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = branch_counter * log(treescaler);
+
+    /* update prior if exponential prior on branch lengths */
+    if (param->paramId == BRLENS_EXP)
+        (*lnPriorRatio) = brlensPrExp * (begin_tl* (1 - treescaler));
+    /* Dirichlet or twoExp prior */
+    else if (isVPriorExp > 1)
+        (*lnPriorRatio) += LogDirPrior(t, mp, isVPriorExp);
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------------------------
+|
+|   Move_TreeStretch: Shrink or grow a clock tree
+|
+-------------------------------------------------------------------------------------*/
+int Move_TreeStretch (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int         i, j, *nEvents, numChangedNodes;
+    MrBFlt      minV, maxV, tuning, factor, lambda=0.0, x,
+                *brlens=NULL, nu=0.0, igrvar=0.0, *tk02Rate=NULL, *igrRate=NULL;
+    TreeNode    *p, *q;
+    ModelParams *mp;
+    ModelInfo   *m;
+    Tree        *t, *oldT;
+    Param       *subParm;
+    Calibration *calibrationPtr;
+
+    tuning = mvp[0]; /* Larget & Simon tuning parameter lambda */
+    (*lnProposalRatio) = (*lnPriorRatio) = 0.0;
+
+    m = &modelSettings[param->relParts[0]];
+    mp = &modelParams[param->relParts[0]];
+
+    /* get trees */
+    t = GetTree (param, chain, state[chain]);
+    oldT = GetTree (param, chain, 1^state[chain]);
+
+    /* min and max branch lengths in relative time and substitution units */
+    minV = BRLENS_MIN;
+    maxV = BRLENS_MAX;
+
+    /* determine multiplication factor */
+    factor = exp(tuning * (RandomNumber(seed) - 0.5));
+
+    /* multiply all changeable ages and node depths by this factor */
+    numChangedNodes = 0;
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+            
+        /* skip extant tip and fixed calibration */
+        if (p->left == NULL && p->isDated == NO)
+            continue;
+        if (p->isDated == YES)
+            calibrationPtr = p->calibration;
+        else if (p->anc->anc == NULL && (!strcmp(mp->clockPr,"Uniform") || !strcmp(mp->clockPr,"Fossilization")))
+            calibrationPtr = &mp->treeAgePr;
+        else
+            calibrationPtr = NULL;
+        if (calibrationPtr != NULL && calibrationPtr->prior == fixed)
+            continue;
+        
+        /* now stretch the node */
+        if (calibrationPtr != NULL)
+            {
+            p->age *= factor;
+            if (p->age < calibrationPtr->min || p->age > calibrationPtr->max)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+        p->nodeDepth *= factor;
+        numChangedNodes++;
+        
+        /* deal with ancestral fossils */
+        if (p->left != NULL)
+            {
+            if (p->left->length < TIME_MIN)
+                {
+                p->left->length = 0.0;
+                p->nodeDepth = p->left->nodeDepth;
+                if (calibrationPtr != NULL)
+                    {
+                    assert (p->left->calibration != NULL);
+                    p->age = p->left->age;
+                    if (p->age < calibrationPtr->min || p->age > calibrationPtr->max)
+                        {
+                        abortMove = YES;
+                        return (NO_ERROR);
+                        }
+                    }
+                numChangedNodes--;
+                }
+            if (p->right->length < TIME_MIN)
+                {
+                p->right->length = 0.0;
+                p->nodeDepth = p->right->nodeDepth;
+                if (calibrationPtr != NULL)
+                    {
+                    assert (p->right->calibration != NULL);
+                    p->age = p->right->age;
+                    if (p->age < calibrationPtr->min || p->age > calibrationPtr->max)
+                        {
+                        abortMove = YES;
+                        return (NO_ERROR);
+                        }
+                    }
+                numChangedNodes--;
+                }
+            assert (!(p->left->length == 0.0 && p->right->length == 0.0));
+            }
+        }
+    
+    /* update brls */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left != NULL)
+            {
+            if (p->left->length > 0.0)
+                p->left->length = p->nodeDepth - p->left->nodeDepth;
+            if (p->right->length > 0.0)
+                p->right->length = p->nodeDepth - p->right->nodeDepth;
+            }
+        }
+
+    /* check that all branch lengths are proper, which need not be the case */
+    for (i = 0; i < t->nNodes -2; i++)
+        {
+        p = t->allDownPass[i];
+        q = oldT->allDownPass[i];
+        if (p->length < 0.0 || p->length > maxV || (q->length > minV && p->length < minV) || (q->length < TIME_MIN && p->length > TIME_MIN))
+            {  /* consider ancestral fossil (brl=0) in fossilized bd tree */
+            abortMove = YES;
+            return NO_ERROR;
+            }
+        }
+
+    /* calculate proposal ratio */
+    (*lnProposalRatio) = numChangedNodes * log(factor);
+
+    /* calculate prior ratio */
+    if (LogClockTreePriorRatio(param, chain, &x) == ERROR)
+        return ERROR;
+    (*lnPriorRatio) += x;
+
+    /* adjust proposal and prior ratio for relaxed clock models */
+    for (i=0; i<param->nSubParams; i++)
+        {
+        subParm = param->subParams[i];
+        if (subParm->paramType == P_CPPEVENTS)
+            {
+            nEvents = subParm->nEvents[2*chain+state[chain]];
+            lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]);
+            /* proposal ratio */
+            for (j=0; j<t->nNodes-2; j++)
+                {
+                p = t->allDownPass[j];
+                q = oldT->allDownPass[j];
+                (*lnProposalRatio) += nEvents[p->index ] * log (p->length  / q->length);
+                }
+            /* prior ratio */
+            (*lnPriorRatio) += lambda * (TreeLen(oldT) - TreeLen(t));
+            /* update effective evolutionary lengths */
+            if (UpdateCppEvolLengths (subParm, t->root->left, chain) == ERROR)
+                {
+                abortMove = YES;
+                return (NO_ERROR);
+                }
+            }
+        else if ( subParm->paramType == P_TK02BRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02))
+            {
+            if (subParm->paramType == P_TK02BRANCHRATES)
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]);
+            else
+                nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            tk02Rate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+
+            /* prior ratio and update of brlens */
+            for (j=0; j<t->nNodes-2; j++)
+                {
+                p = t->allDownPass[j];
+                q = oldT->allDownPass[j];
+                if (p->length > 0.0)  // not ancestral fossil
+                    {
+                    (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[q->anc->index], nu*q->length, tk02Rate[q->index]);
+                    (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*p->length, tk02Rate[p->index]);
+                    brlens[p->index] = p->length * (tk02Rate[p->anc->index]+tk02Rate[p->index])/2.0;
+                    if (brlens[p->index] < RELBRLENS_MIN || brlens[p->index] > RELBRLENS_MAX)
+                        {
+                        abortMove = YES;
+                        return (NO_ERROR);
+                        }
+                    }
+                }
+            }
+        else if ( subParm->paramType == P_IGRBRANCHRATES ||
+                 (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR))
+            {
+            if (subParm->paramType == P_IGRBRANCHRATES)
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]);
+            else
+                igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]);
+            igrRate = GetParamVals (subParm, chain, state[chain]);
+            brlens = GetParamSubVals (subParm, chain, state[chain]);
+            
+            /* prior ratio and update of igr branch lengths and rates (stretched in the same way as tree) */
+            for (j=0; j<t->nNodes-2; j++)
+                {
+                p = t->allDownPass[j];
+                q = oldT->allDownPass[j];
+                if (p->length > 0.0)  // not ancestral fossil
+                    {
+                    (*lnPriorRatio) -= LnProbGamma (q->length/igrvar, q->length/igrvar, igrRate[q->index]);
+                    (*lnPriorRatio) += LnProbGamma (p->length/igrvar, p->length/igrvar, igrRate[p->index]);
+                    brlens[p->index] = p->length * igrRate[p->index];
+                    if (brlens[p->index] < RELBRLENS_MIN || brlens[p->index] > RELBRLENS_MAX)
+                        {
+                        abortMove = YES;
+                        return (NO_ERROR);
+                        }
+                    }
+                }
+            }
+        }
+
+    TouchAllTreeNodes(m, chain);
+
+#if defined (DEBUG_TREESTRETCH)
+    printf ("After treestretch:\n");
+    printf ("Old tree height: %f -- New tree height: %f -- lnPriorRatio = %f -- lnProposalRatio = %f\n",
+        oldT->root->left->nodeDepth, t->root->left->nodeDepth, (*lnPriorRatio), (*lnProposalRatio));
+#endif
+
+    return (NO_ERROR);
+}
+
+
+/* Generalized normal move for real random variables */
+int Move_RealNormal (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i;
+    MrBFlt          oldX, newX, tuning, minX, maxX, u, z;
+
+    /* get tuning parameter */
+    tuning = mvp[0];
+
+    /* get minimum and maximum values for X */
+    minX = param->min;
+    maxX = param->max;
+
+    /* get old value of X */
+    newX = oldX = *GetParamVals(param, chain, state[chain]);
+
+    /* change value */
+    u = RandomNumber(seed);
+    z = PointNormal(u);
+    newX = oldX + z * tuning;
+    
+    /* check that new value is valid */
+    if (newX < minX || newX > maxX)
+        {
+        abortMove = YES;
+        return (NO_ERROR);
+        }
+
+    /* get proposal ratio */
+    (*lnProposalRatio) = 0.0;
+    
+    /* get prior ratio */
+    (*lnPriorRatio) = param->LnPriorRatio(newX, oldX, param->priorParams);
+
+    /* copy new value back */
+    *GetParamVals(param, chain, state[chain]) = newX;
+
+    /* Set update flags for tree nodes if relevant */
+    if (param->affectsLikelihood == YES)
+        {
+        for (i=0; i<param->nRelParts; i++)
+            TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* Generalized slider move for real random variables */
+int Move_RealSlider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp)
+{
+    int             i, isValid;
+    MrBFlt          oldX, newX, window, minX, maxX, u;
+
+    /* get size of window, centered on current value */
+    window = mvp[0];
+
+    /* get minimum and maximum values for X */
+    minX = param->min;
+    maxX = param->max;
+
+    /* get old value of X */
+    newX = oldX = *GetParamVals(param, chain, state[chain]);
+
+    /* change value */
+    u = RandomNumber(seed);
+    newX = oldX + window * (u - 0.5);
+    
+    /* check that new value is valid */
+    isValid = NO;
+    do
+        {
+        if (newX < minX)
+            newX = 2* minX - newX;
+        else if (newX > maxX)
+            newX = 2 * maxX - newX;
+        else
+            isValid = YES;
+        } while (isValid == NO);
+
+    /* get proposal ratio */
+    (*lnProposalRatio) = 0.0;
+    
+    /* get prior ratio */
+    (*lnPriorRatio) = param->LnPriorRatio(newX, oldX, param->priorParams);
+
+    /* copy new value back */
+    *GetParamVals(param, chain, state[chain]) = newX;
+
+    /* Set update flags for tree nodes if relevant */
+    if (param->affectsLikelihood == YES)
+        {
+        for (i=0; i<param->nRelParts; i++)
+            TouchAllTreeNodes(&modelSettings[param->relParts[i]],chain);
+        }
+
+    return (NO_ERROR);
+}
+
+
+void TouchAllTreeNodes (ModelInfo *m, int chain)
+{
+    int         i;
+    Tree        *t;
+    TreeNode    *p;
+    
+    t = GetTree(m->brlens, chain, state[chain]);
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->upDateCl = YES;
+        p->upDateTi = YES;
+        }
+    m->upDateAll = YES;
+}
+
diff --git a/src/proposal.h b/src/proposal.h
new file mode 100644 (file)
index 0000000..f598523
--- /dev/null
@@ -0,0 +1,83 @@
+#ifndef __PROPOSAL_H__
+#define __PROPOSAL_H__
+
+int     Move_Aamodel (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_AddBranch (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Adgamma (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_AddDeleteCPPEvent (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Beta (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Beta_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_BrLen (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ClockRate_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_CPPEventPosition (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_CPPRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_CPPRateMultiplier_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_CPPRateMultiplierRnd (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_DelBranch (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Extinction (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Fossilization (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ExtSPR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ExtSPR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ExtSPRClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ExtSS (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ExtSSClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ExtTBR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_GeneRate_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Growth_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_IgrVar (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_IgrBranchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Local (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_LocalClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_MixedVar (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_MixedBranchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_NNI (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_NNIClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_NNI_Hetero (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_NodeSlider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_NodeSliderClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Nu (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Omega (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Omega_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaBeta_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaCat (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaGamma_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaM3 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaNeu (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaPos (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_OmegaPur (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsEraser1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsSPR (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsSPR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsSPR2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsSPRClock (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsTBR1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_ParsTBR2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_PopSize (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_PosRealLognormal (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_PosRealMultiplier (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_PopSize_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Pinvar (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_RateMult_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_RateMult_Slider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_RateShape_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_RealNormal (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_RealSlider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_RelaxedClockModel (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Revmat_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Revmat_DirMix (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Revmat_Slider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Revmat_SplitMerge1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Revmat_SplitMerge2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Speciation (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Speciation_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Statefreqs (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Statefreqs_Slider (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_StatefreqsSymDirMultistate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_SwitchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_SwitchRate_M (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_TK02BranchRate (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_Tratio_Dir (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_TreeStretch (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+int     Move_TreeLen (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp);
+
+#endif  /* __PROPOSAL_H__ */
diff --git a/src/sumpt.c b/src/sumpt.c
new file mode 100644 (file)
index 0000000..4f9618b
--- /dev/null
@@ -0,0 +1,8525 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "command.h"
+#include "mcmc.h"
+#include "sumpt.h"
+#include "utils.h"
+#if defined(__MWERKS__)
+#include "SIOUX.h"
+#endif
+
+const char* const svnRevisionSumptC = "$Rev: 1072 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+
+typedef struct partctr
+    {
+    struct partctr  *left, *right;
+    BitsLong        *partition;
+    int             totCount;
+    int             *count;
+    MrBFlt          **length;
+    MrBFlt          **height;
+    MrBFlt          **age;
+    int             ***nEvents; /* nEvents[0,nESets][0,numRuns][0,count[RunID]] */
+    MrBFlt          ***bRate;   /* bRate  [0,nBSets][0,numRuns][0,count[RunID]] */
+    MrBFlt          ***bLen;    /* bLen   [0,nBSets][0,numRuns][0,count[RunID]] */
+    MrBFlt          **popSize;  /* popSize[0,numRuns][0,count[RunID]]           */
+    }
+    PartCtr;
+
+typedef struct treectr
+    {
+    struct treectr  *left, *right;
+    int             count;
+    int             *order;
+    }
+    TreeCtr;
+
+typedef struct
+    {
+    int     longestLineLength;
+    int     numTreeBlocks;
+    int     lastTreeBlockBegin;
+    int     lastTreeBlockEnd;
+    int     numTreesInLastBlock;
+    }
+    SumtFileInfo;
+
+#define ALLOC_LEN               100     /* number of values to allocate each time in partition counter nodes */
+
+#if defined (PRINT_RATEMUL_CPP)
+FILE     *rateMultfp=NULL;
+#endif
+
+#undef  DEBUG_CONTREE
+
+extern int inSumtCommand;
+extern int inComparetreeCommand;
+extern int DoUserTree (void);
+extern int DoUserTreeParm (char *parmName, char *tkn);
+extern int SafeFclose(FILE **);
+
+extern int  SetUpPartitionCounters (void);
+extern int  AddTreeToPartitionCounters (Tree *tree, int treeId, int runId);
+extern void CalcTopoConvDiagn2 (int *nTrees);
+extern void FreeChainMemory (void);
+
+/* local prototypes */
+int      CompareModelProbs (const void *x, const void *y);
+int      PrintModelStats (char *fileName, char **headerNames, int nHeaders, ParameterSample *parameterSamples, int nRuns, int nSamples);
+int      PrintOverlayPlot (MrBFlt **xVals, MrBFlt **yVals, int nRows, int startingFrom, int nSamples);
+int      PrintParamStats (char *fileName, char **headerNames, int nHeaders, ParameterSample *parameterSamples, int nRuns, int nSamples);
+void     PrintPlotHeader (void);
+
+PartCtr *AddSumtPartition (PartCtr *r, PolyTree *t, PolyNode *p, int runId);
+TreeCtr *AddSumtTree (TreeCtr *r, int *order);
+PartCtr *AllocPartCtr (void);
+TreeCtr *AllocTreeCtr (void);
+void     CalculateTreeToTreeDistance (Tree *tree1, Tree *tree2, MrBFlt *d1, MrBFlt *d2, MrBFlt *d3);
+int      ConTree (PartCtr **treeParts, int numTreeParts);
+MrBFlt   CppEvolRate (PolyTree *t, PolyNode *p, int eSet);
+int      ExamineSumtFile (char *fileName, SumtFileInfo *sumtFileInfo, char *treeName, int *brlensDef);
+void     FreePartCtr (PartCtr *r);
+void     FreeSumtParams (void);
+void     FreeTreeCtr (TreeCtr *r);
+int      Label (PolyNode *p, int addIndex, char *label, int maxLength);
+int      OpenBrlensFile (int treeNo);
+int      OpenComptFiles (void);
+int      OpenSumtFiles (int treeNo);
+void     PartCtrUppass (PartCtr *r, PartCtr **uppass, int *index);
+int      PrintBrlensToFile (PartCtr **treeParts, int numTreeParts, int treeNo);
+void     PrintConTree (FILE *fp, PolyTree *t);
+void     PrintFigTreeConTree (FILE *fp, PolyTree *t, PartCtr **treeParts);
+void     PrintFigTreeNodeInfo (FILE *fp, PartCtr *x, MrBFlt length);
+void     PrintSumtTableLine (int numRuns, int *rowCount, Stat *theStats, MrBFlt *numPSRFSamples, MrBFlt *maxPSRF, MrBFlt *sumPSRF);
+void     PrintSumtTaxaInfo (void);
+void     Range (MrBFlt *vals, int nVals, MrBFlt *min, MrBFlt *max);
+void     ResetTaxonSet (void);
+int      ShowConPhylogram (FILE *fp, PolyTree *t, int screenWidth);
+void     ShowSomeParts (FILE *fp, BitsLong *p, int offset, int nTaxaToShow);
+void     SortPartCtr (PartCtr **item, int left, int right);
+void     SortTerminalPartCtr (PartCtr **item, int len);
+void     SortTreeCtr (TreeCtr **item, int left, int right);
+int      StoreSumtTree (PackedTree *treeList, int index, PolyTree *t);
+void     TreeCtrUppass (TreeCtr *r, TreeCtr **uppass, int *index);
+int      TreeProb (void);
+void     WriteConTree (PolyNode *p, FILE *fp, int showSupport);
+void     WriteFigTreeConTree (PolyNode *p, FILE *fp, PartCtr **treeParts);
+
+/* local (to this file) */
+static int          numUniqueSplitsFound, numUniqueTreesFound, numPackedTrees[2], numAsterices;  /* length of local to this file variables */
+static FILE        *fpParts=NULL, *fpTstat=NULL, *fpVstat, *fpCon=NULL, *fpTrees=NULL, *fpDists=NULL;  /* file pointers */
+static PartCtr     *partCtrRoot = NULL;        /* binary tree for holding splits info      */
+static TreeCtr     *treeCtrRoot = NULL;        /* binary tree for holding unique tree info */
+static PackedTree  *packedTreeList[2];         /* list of trees in packed format           */
+
+
+/* AllocateParameterSamples: Allocate space for parameter samples */
+int AllocateParameterSamples (ParameterSample **parameterSamples, int numRuns, int numRows, int numColumns)
+{
+    int     i, j;
+    
+    (*parameterSamples) = (ParameterSample *) SafeCalloc (numColumns, sizeof(ParameterSample));
+    if (!(*parameterSamples))
+        return ERROR;
+    (*parameterSamples)[0].values = (MrBFlt **) SafeCalloc (numColumns * numRuns, sizeof (MrBFlt *));
+    if (!((*parameterSamples)[0].values))
+        {
+        FreeParameterSamples(*parameterSamples);
+        return ERROR;
+        }
+    (*parameterSamples)[0].values[0] = (MrBFlt *) SafeCalloc (numColumns * numRuns * numRows, sizeof (MrBFlt));
+    for (i=1; i<numColumns; i++)
+        (*parameterSamples)[i].values = (*parameterSamples)[0].values + i*numRuns;
+    for (i=1; i<numRuns; i++)
+        (*parameterSamples)[0].values[i] = (*parameterSamples)[0].values[0] + i*numRows;
+    for (i=1; i<numColumns; i++)
+        {
+        for (j=0; j<numRuns; j++)
+            {
+            (*parameterSamples)[i].values[j] = (*parameterSamples)[0].values[0] + i*numRuns*numRows + j*numRows;
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/** Compare function (ModelProb) for qsort. Note reverse sort order (from larger to smaller probs) */
+int CompareModelProbs (const void *x, const void *y) {
+
+    if ((*((ModelProb *)(x))).prob > (*((ModelProb *)(y))).prob)
+        return -1;
+    else if ((*((ModelProb *)(x))).prob < (*((ModelProb *)(y))).prob)
+        return 1;
+    else
+        return 0;
+}
+
+
+int DoSump (void)
+{
+    int             i, n, nHeaders=0, numRows, numColumns, numRuns, whichIsX, whichIsY,
+                    unreliable, oneUnreliable, burnin, longestHeader, len;
+    MrBFlt          mean, harm_mean;
+    char            **headerNames=NULL, temp[120];
+    SumpFileInfo    fileInfo, firstFileInfo;
+    ParameterSample *parameterSamples=NULL;
+    FILE            *fpLstat=NULL;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return NO_ERROR;
+#   endif
+
+    /* tell user we are ready to go */
+    if (sumpParams.numRuns == 1)
+        MrBayesPrint ("%s   Summarizing parameters in file %s.p\n", spacer, sumpParams.sumpFileName);
+    else if (sumpParams.numRuns == 2)
+        MrBayesPrint ("%s   Summarizing parameters in files %s.run1.p and %s.run2.p\n", spacer, sumpParams.sumpFileName, sumpParams.sumpFileName);
+    else /* if (sumpParams.numRuns > 2) */
+        {
+        MrBayesPrint ("%s   Summarizing parameters in %d files (%s.run1.p,\n", spacer, sumpParams.numRuns, sumpParams.sumpFileName);
+        MrBayesPrint ("%s      %s.run2.p, etc)\n", spacer, sumpParams.sumpFileName);
+        }
+    MrBayesPrint ("%s   Writing summary statistics to file %s.pstat\n", spacer, sumpParams.sumpFileName);
+
+    if (chainParams.relativeBurnin == YES)
+        MrBayesPrint ("%s   Using relative burnin ('relburnin=yes'), discarding the first %.0f %% of samples\n",
+            spacer, chainParams.burninFraction*100.0, chainParams.burninFraction);
+    else
+        MrBayesPrint ("%s   Using absolute burnin ('relburnin=no'), discarding the first %d samples\n",
+            spacer, chainParams.chainBurnIn, chainParams.chainBurnIn);
+
+    /* Initialize to silence warning. */
+    firstFileInfo.numRows = 0;
+    firstFileInfo.numColumns = 0;
+
+    /* examine input file(s) */
+    for (i=0; i<sumpParams.numRuns; i++)
+        {
+        if (sumpParams.numRuns == 1)
+            sprintf (temp, "%s.p", sumpParams.sumpFileName);
+        else
+            sprintf (temp, "%s.run%d.p", sumpParams.sumpFileName, i+1);
+
+        if (ExamineSumpFile (temp, &fileInfo, &headerNames, &nHeaders) == ERROR)
+            goto errorExit;
+
+        if (i==0)
+            {
+            if (fileInfo.numRows == 0 || fileInfo.numColumns == 0)
+                {
+                MrBayesPrint ("%s   The number of rows or columns in file %d is equal to zero\n", spacer, temp);
+                goto errorExit;
+                }
+            firstFileInfo = fileInfo;
+            }
+        else
+            {
+            if (firstFileInfo.numRows != fileInfo.numRows || firstFileInfo.numColumns != fileInfo.numColumns)
+                {
+                MrBayesPrint ("%s   First file had %d rows and %d columns while file %s had %d rows and %d columns\n",
+                    spacer, firstFileInfo.numRows, firstFileInfo.numColumns, temp, fileInfo.numRows, fileInfo.numColumns);
+                MrBayesPrint ("%s   MrBayes expects the same number of rows and columns in all files\n", spacer);
+                goto errorExit;
+                }
+            }
+        }
+
+    numRows = fileInfo.numRows;
+    numColumns = fileInfo.numColumns;
+    numRuns = sumpParams.numRuns;
+
+    /* allocate space to hold parameter information */
+    if (AllocateParameterSamples (&parameterSamples, numRuns, numRows, numColumns) == ERROR)
+        return ERROR;
+
+    /* read samples */
+    for (i=0; i<sumpParams.numRuns; i++)
+        {
+        /* derive file name */
+        if (sumpParams.numRuns == 1)
+            sprintf (temp, "%s.p", sumpParams.sumpFileName);
+        else
+            sprintf (temp, "%s.run%d.p", sumpParams.sumpFileName, i+1);
+        
+        /* read samples */    
+        if (ReadParamSamples (temp, &fileInfo, parameterSamples, i) == ERROR)
+            goto errorExit;
+        }
+
+    /* get length of longest header */
+    longestHeader = 9; /* 9 is the length of the word "parameter" (for printing table) */
+    for (i=0; i<nHeaders; i++)
+        {
+        len = (int) strlen(headerNames[i]);
+        if (len > longestHeader)
+            longestHeader = len;
+        }
+
+    /* Print header */
+    PrintPlotHeader ();
+
+    /* Print trace plots */
+    if (FindHeader("Gen", headerNames, nHeaders, &whichIsX) == ERROR)
+        {
+        MrBayesPrint ("%s   Could not find the 'Gen' column\n", spacer);
+        return ERROR;
+        }
+    if (FindHeader("LnL", headerNames, nHeaders, &whichIsY) == ERROR)
+        {
+        MrBayesPrint ("%s   Could not find the 'LnL' column\n", spacer);
+        return ERROR;
+        }
+
+    if (sumpParams.numRuns > 1)
+        {
+        if (sumpParams.allRuns == YES)
+            {
+            for (i=0; i<sumpParams.numRuns; i++)
+                {
+                MrBayesPrint ("\n%s   Samples from run %d:\n", spacer, i+1);
+                if (PrintPlot (parameterSamples[whichIsX].values[i], parameterSamples[whichIsY].values[i], numRows) == ERROR)
+                    goto errorExit;
+                }
+            }
+        else
+            {
+            if (PrintOverlayPlot (parameterSamples[whichIsX].values, parameterSamples[whichIsY].values, numRuns, 0, numRows) == ERROR)
+                goto errorExit;
+            }
+        }
+    else
+        {
+        if (PrintPlot (parameterSamples[whichIsX].values[0], parameterSamples[whichIsY].values[0], numRows) == ERROR)
+            goto errorExit;
+        }
+            
+    /* calculate arithmetic and harmonic means of likelihoods */
+
+    /* open output file */
+    strncpy (temp, sumpParams.sumpOutfile, 90);
+    strcat (temp, ".lstat");
+    fpLstat = OpenNewMBPrintFile (temp);
+    if (!fpLstat)
+        goto errorExit;
+
+    /* print unique identifier to the output file */
+    if (strlen(stamp) > 1)
+        MrBayesPrintf (fpLstat, "[ID: %s]\n", stamp);
+
+    /* print header */
+    if (sumpParams.numRuns == 1)
+        MrBayesPrintf (fpLstat, "arithmetic_mean\tharmonic_mean\tvalues_discarded\n");
+    else
+        MrBayesPrintf (fpLstat, "run\tarithmetic_mean\tharmonic_mean\tvalues_discarded\n");
+
+    oneUnreliable = NO;
+    for (n=0; n<sumpParams.numRuns; n++)
+        {
+        unreliable = NO;
+        if (HarmonicArithmeticMeanOnLogs (parameterSamples[whichIsY].values[n], numRows, &mean, &harm_mean) == ERROR)
+            {
+            unreliable = YES;
+            oneUnreliable = YES;
+            }
+        if (sumpParams.numRuns == 1)
+            {
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   Estimated marginal likelihoods for run sampled in file \"%s.p\":\n", spacer, sumpParams.sumpFileName);
+            MrBayesPrint ("%s      (Use the harmonic mean for Bayes factor comparisons of models)\n", spacer, sumpParams.sumpFileName);
+            MrBayesPrint ("%s      (Values are saved to the file %s.lstat)\n\n", spacer, sumpParams.sumpOutfile);
+            MrBayesPrint ("%s   Arithmetic mean   Harmonic mean\n", spacer);
+            MrBayesPrint ("%s   --------------------------------\n", spacer);
+            if (unreliable == NO)
+                MrBayesPrint ("%s     %9.2lf        %9.2lf\n", spacer, mean, harm_mean);
+            else
+                MrBayesPrint ("%s     %9.2lf *      %9.2lf *\n", spacer, mean, harm_mean);
+
+            /* print to file */
+            MrBayesPrintf (fpLstat, "%s\t", MbPrintNum(mean));
+            MrBayesPrintf (fpLstat, "%s\t", MbPrintNum(harm_mean));
+            if (unreliable == YES)
+                MrBayesPrintf (fpLstat, "yes\n");
+            else
+                MrBayesPrintf (fpLstat, "no\n");
+            }
+        else
+            {
+            if (n == 0)
+                {
+                MrBayesPrint ("\n");
+                MrBayesPrint ("%s   Estimated marginal likelihoods for runs sampled in files\n", spacer);
+                if (sumpParams.numRuns > 2)
+                    MrBayesPrint ("%s      \"%s.run1.p\", \"%s.run2.p\", etc:\n", spacer, sumpParams.sumpFileName, sumpParams.sumpFileName);
+                else /* if (sumpParams.numRuns == 2) */
+                    MrBayesPrint ("%s      \"%s.run1.p\" and \"%s.run2.p\":\n", spacer, sumpParams.sumpFileName, sumpParams.sumpFileName);
+                MrBayesPrint ("%s      (Use the harmonic mean for Bayes factor comparisons of models)\n\n", spacer, sumpParams.sumpFileName);
+                MrBayesPrint ("%s      (Values are saved to the file %s.lstat)\n\n", spacer, sumpParams.sumpOutfile);
+                MrBayesPrint ("%s   Run   Arithmetic mean   Harmonic mean\n", spacer);
+                MrBayesPrint ("%s   --------------------------------------\n", spacer);
+                }
+            if (unreliable == NO)
+                MrBayesPrint ("%s   %3d     %9.2lf        %9.2lf\n", spacer, n+1, mean, harm_mean);
+            else
+                MrBayesPrint ("%s   %3d     %9.2lf *      %9.2lf *\n", spacer, n+1, mean, harm_mean);
+
+            /* print to file */
+            MrBayesPrintf (fpLstat, "%d\t", n+1);
+            MrBayesPrintf (fpLstat, "%s\t", MbPrintNum(mean));
+            MrBayesPrintf (fpLstat, "%s\t", MbPrintNum(harm_mean));
+            if (unreliable == YES)
+                MrBayesPrintf (fpLstat, "yes\n");
+            else
+                MrBayesPrintf (fpLstat, "no\n");
+            }                   
+        }   /* next run */
+    if (sumpParams.numRuns == 1)
+        {
+        MrBayesPrint ("%s   --------------------------------\n", spacer);
+        }
+    else
+        {
+        if (HarmonicArithmeticMeanOnLogs (parameterSamples[whichIsY].values[0], sumpParams.numRuns*numRows, &mean, &harm_mean) == ERROR)
+            {
+            unreliable = YES;
+            oneUnreliable = YES;
+            }
+        else
+            unreliable = NO;
+        MrBayesPrint ("%s   --------------------------------------\n", spacer);
+        if (unreliable == YES)
+            MrBayesPrint ("%s   TOTAL   %9.2lf *      %9.2lf *\n", spacer, mean, harm_mean);
+        else
+            MrBayesPrint ("%s   TOTAL   %9.2lf        %9.2lf\n", spacer, mean, harm_mean);
+        MrBayesPrint ("%s   --------------------------------------\n", spacer);
+
+        /* print total to file */
+        MrBayesPrintf (fpLstat, "all\t");
+        MrBayesPrintf (fpLstat, "%s\t", MbPrintNum(mean));
+        MrBayesPrintf (fpLstat, "%s\t", MbPrintNum(harm_mean));
+        if (unreliable == YES)
+            MrBayesPrintf (fpLstat, "yes\n");
+        else
+            MrBayesPrintf (fpLstat, "no\n");
+        }
+    if (oneUnreliable == YES)
+        {
+        MrBayesPrint ("%s   * These estimates may be unreliable because \n", spacer);
+        MrBayesPrint ("%s     some extreme values were excluded\n\n", spacer);
+        }
+    else
+        {
+        MrBayesPrint ("\n");
+        }
+    SafeFclose(&fpLstat);
+
+    /* Calculate burnin */
+    burnin = fileInfo.firstParamLine - fileInfo.headerLine;
+
+    /* Print parameter information to screen and to file. */
+    if (sumpParams.numRuns > 1 && sumpParams.allRuns == YES)
+        {
+        for (i=0; i<sumpParams.numRuns; i++)
+            {
+            /* print table header */
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   Model parameter summaries for run sampled in file \"%s.run%d.p\":\n", spacer, sumpParams.sumpFileName, i+1);
+            MrBayesPrint ("%s      (Based on %d samples out of a total of %d samples from this analysis)\n\n", spacer, numRows, numRows + burnin);
+            if (PrintParamStats (sumpParams.sumpOutfile, headerNames, nHeaders, parameterSamples, numRuns, numRows) == ERROR)
+                goto errorExit;
+            if (PrintModelStats (sumpParams.sumpOutfile, headerNames, nHeaders, parameterSamples, numRuns, numRows) == ERROR)
+                goto errorExit;
+            }
+        }
+
+    MrBayesPrint ("\n");
+    if (sumpParams.numRuns == 1)
+        MrBayesPrint ("%s   Model parameter summaries for run sampled in file \"%s\":\n", spacer, sumpParams.sumpFileName);
+    else if (sumpParams.numRuns == 2)
+        {
+        MrBayesPrint ("%s   Model parameter summaries over the runs sampled in files\n", spacer);
+        MrBayesPrint ("%s      \"%s.run1.p\" and \"%s.run2.p\":\n", spacer, sumpParams.sumpFileName, sumpParams.sumpFileName);
+        }
+    else
+        {
+        MrBayesPrint ("%s   Model parameter summaries over all %d runs sampled in files\n", spacer, sumpParams.numRuns);
+        MrBayesPrint ("%s      \"%s.run1.p\", \"%s.run2.p\" etc:\n", spacer, sumpParams.sumpFileName, sumpParams.sumpFileName);
+        }
+
+    if (sumpParams.numRuns == 1)
+        {
+        MrBayesPrint ("%s      Based on a total of %d samples out of a total of %d samples\n", spacer, numRows, numRows + burnin);
+        MrBayesPrint ("%s         from this analysis.\n", spacer);
+        }
+    else
+        {
+        MrBayesPrint ("%s      Summaries are based on a total of %d samples from %d runs.\n", spacer, sumpParams.numRuns*numRows, sumpParams.numRuns);
+        MrBayesPrint ("%s      Each run produced %d samples of which %d samples were included.\n", spacer, numRows + burnin, numRows);
+        }
+    MrBayesPrint ("%s      Parameter summaries saved to file \"%s.pstat\".\n", spacer, sumpParams.sumpOutfile);
+
+    if (PrintParamStats (sumpParams.sumpOutfile, headerNames, nHeaders, parameterSamples, numRuns, numRows) == ERROR)
+        goto errorExit;
+    if (PrintModelStats (sumpParams.sumpOutfile, headerNames, nHeaders, parameterSamples, numRuns, numRows) == ERROR)
+        goto errorExit;
+
+    /* free memory */
+    FreeParameterSamples(parameterSamples);
+    for (i=0; i<nHeaders; i++)
+        free (headerNames[i]);
+    free (headerNames);
+
+    expecting = Expecting(COMMAND);
+    strcpy (spacer, "");
+    
+    return (NO_ERROR);
+    
+errorExit:
+
+    /* free memory */
+    FreeParameterSamples (parameterSamples);
+    for (i=0; i<nHeaders; i++)
+        free (headerNames[i]);
+    free (headerNames);
+
+    if (fpLstat)
+        SafeFclose (&fpLstat);
+
+    expecting = Expecting(COMMAND);    
+    strcpy (spacer, "");
+
+    return (ERROR);
+}
+
+
+int DoSumSs (void)
+{
+    int             i, nHeaders=0, numRows, numColumns, numRuns, whichIsX, whichIsY,
+                    longestHeader, len;
+    char            **headerNames=NULL, temp[120];
+    SumpFileInfo    fileInfo, firstFileInfo;
+    ParameterSample *parameterSamples=NULL;
+    int             stepIndexSS,numSamplesInStepSS, stepBeginSS, stepBurnin;
+    MrBFlt          *lnlp, *nextSteplnlp, *firstlnlp;
+    MrBFlt          *marginalLnLSS=NULL,stepScalerSS,stepAcumulatorSS, stepLengthSS, tmpMfl; 
+    int             beginPrint, countPrint;
+    float           tmpf;
+    MrBFlt          **plotArrayY=NULL,**plotArrayX=NULL;
+    int             j, k, count;
+    MrBFlt          sum;
+    int             firstPass = YES;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return NO_ERROR;
+#   endif
+
+    chainParams.isSS=YES;
+
+    /* tell user we are ready to go */
+    if (sumssParams.numRuns == 1)
+        MrBayesPrint ("%s   Summarizing parameters in file %s.p\n", spacer, sumpParams.sumpFileName);
+    else if (sumssParams.numRuns == 2)
+        MrBayesPrint ("%s   Summarizing parameters in files %s.run1.p and %s.run2.p\n", spacer, sumpParams.sumpFileName, sumpParams.sumpFileName);
+    else /* if (sumssParams.numRuns > 2) */
+        {
+        MrBayesPrint ("%s   Summarizing parameters in %d files (%s.run1.p,\n", spacer, sumssParams.numRuns, sumpParams.sumpFileName);
+        MrBayesPrint ("%s      %s.run2.p, etc)\n", spacer, sumpParams.sumpFileName);
+        }
+    //MrBayesPrint ("%s   Writing summary statistics to file %s.pstat\n", spacer, sumpParams.sumpFileName);
+
+    if (chainParams.relativeBurnin == YES)
+        MrBayesPrint ("%s   Using relative burnin ('relburnin=yes'), discarding the first %.0f %% of samples within each step.\n",
+            spacer, chainParams.burninFraction*100.0, chainParams.burninFraction);
+    else
+        MrBayesPrint ("%s   Using absolute burnin ('relburnin=no'), discarding the first %d samples within each step.\n",
+            spacer, chainParams.chainBurnIn, chainParams.chainBurnIn);
+
+    /* Initialize to silence warning. */
+    firstFileInfo.numRows = 0;
+    firstFileInfo.numColumns = 0;
+
+    /* examine input file(s) */
+    for (i=0; i<sumssParams.numRuns; i++)
+        {
+        if (sumssParams.numRuns == 1)
+            sprintf (temp, "%s.p", sumpParams.sumpFileName);
+        else
+            sprintf (temp, "%s.run%d.p", sumpParams.sumpFileName, i+1);
+
+        if (ExamineSumpFile (temp, &fileInfo, &headerNames, &nHeaders) == ERROR)
+            goto errorExit;
+
+        if (i==0)
+            {
+            if (fileInfo.numRows == 0 || fileInfo.numColumns == 0)
+                {
+                MrBayesPrint ("%s   The number of rows or columns in file %d is equal to zero\n", spacer, temp);
+                goto errorExit;
+                }
+            firstFileInfo = fileInfo;
+            }
+        else
+            {
+            if (firstFileInfo.numRows != fileInfo.numRows || firstFileInfo.numColumns != fileInfo.numColumns)
+                {
+                MrBayesPrint ("%s   First file had %d rows and %d columns while file %s had %d rows and %d columns\n",
+                    spacer, firstFileInfo.numRows, firstFileInfo.numColumns, temp, fileInfo.numRows, fileInfo.numColumns);
+                MrBayesPrint ("%s   MrBayes expects the same number of rows and columns in all files\n", spacer);
+                goto errorExit;
+                }
+            }
+        }
+
+    numRows = fileInfo.numRows;
+    numColumns = fileInfo.numColumns;
+    numRuns = sumssParams.numRuns;
+
+    /* allocate space to hold parameter information */
+    if (AllocateParameterSamples (&parameterSamples, numRuns, numRows, numColumns) == ERROR)
+        goto errorExit;
+
+    /* read samples */
+    for (i=0; i<sumssParams.numRuns; i++)
+        {
+        /* derive file name */
+        if (sumssParams.numRuns == 1)
+            sprintf (temp, "%s.p", sumpParams.sumpFileName);
+        else
+            sprintf (temp, "%s.run%d.p", sumpParams.sumpFileName, i+1);
+        
+        /* read samples */    
+        if (ReadParamSamples (temp, &fileInfo, parameterSamples, i) == ERROR)
+            goto errorExit;
+        }
+
+    /* get length of longest header */
+    longestHeader = 9; /* 9 is the length of the word "parameter" (for printing table) */
+    for (i=0; i<nHeaders; i++)
+        {
+        len = (int) strlen(headerNames[i]);
+        if (len > longestHeader)
+            longestHeader = len;
+        }
+
+    /* Print trace plots */
+    if (FindHeader("Gen", headerNames, nHeaders, &whichIsX) == ERROR)
+        {
+        MrBayesPrint ("%s   Could not find the 'Gen' column\n", spacer);
+        goto errorExit;
+        }
+    if (FindHeader("LnL", headerNames, nHeaders, &whichIsY) == ERROR)
+        {
+        MrBayesPrint ("%s   Could not find the 'LnL' column\n", spacer);
+        goto errorExit;
+        }
+
+    if (chainParams.burninSS > 0)
+        {
+        stepBeginSS = chainParams.burninSS + 1;
+        }
+    else
+        {
+        numSamplesInStepSS = (numRows-1)/(chainParams.numStepsSS-chainParams.burninSS);
+        stepBeginSS = numSamplesInStepSS + 1;
+        }
+
+    numSamplesInStepSS = (numRows - stepBeginSS)/chainParams.numStepsSS;
+    if ((numRows - stepBeginSS)%chainParams.numStepsSS!=0)
+        {
+        MrBayesPrint ("%s   Error:  Number of samples could not be evenly devided among steps (%d samples among %d steps). \n", spacer,(numRows - stepBeginSS),chainParams.numStepsSS);
+        goto errorExit;
+        }
+
+    if (chainParams.relativeBurnin == YES)
+        {
+        stepBurnin = (int)(numSamplesInStepSS*chainParams.burninFraction);
+        }
+    else
+        {
+        stepBurnin = chainParams.chainBurnIn;
+        if (stepBurnin >= numSamplesInStepSS)
+            {
+            MrBayesPrint ("%s   Error:  Burnin in each step(%d) is longer then the step itself(%d). \n", spacer,stepBurnin, numSamplesInStepSS);
+            goto errorExit;               
+            }
+        }
+
+    marginalLnLSS = (MrBFlt *) SafeCalloc (sumssParams.numRuns, sizeof(MrBFlt));
+        /*Preparing and printing joined plot.*/
+    plotArrayY = (MrBFlt **) SafeCalloc (sumssParams.numRuns+1, sizeof(MrBFlt*));
+    for (i=0; i<sumssParams.numRuns+1; i++)
+        plotArrayY[i] = (MrBFlt *) SafeCalloc (numSamplesInStepSS, sizeof(MrBFlt));
+
+    plotArrayX = (MrBFlt **) SafeCalloc (sumssParams.numRuns, sizeof(MrBFlt*));
+    for (i=0; i<sumssParams.numRuns; i++)
+        {
+        plotArrayX[i] = (MrBFlt *) SafeCalloc (numSamplesInStepSS, sizeof(MrBFlt));
+        for (j=0; j<numSamplesInStepSS; j++)
+            plotArrayX[i][j]=j+1;
+        }
+
+    MrBayesPrint ("%s   In total %d sampls are red from .p files.\n", spacer, numRows);
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   Marginal likelihood (in natural log units) is estimated using stepping-stone sampling\n", spacer);
+    MrBayesPrint ("%s   based on %d steps with %d samples within each step. \n", spacer, chainParams.numStepsSS, numSamplesInStepSS);
+    MrBayesPrint ("%s   First %d samples (including generation 0) are discarded as initial burn-in.\n", spacer, stepBeginSS);
+        if (chainParams.startFromPriorSS==YES)
+            MrBayesPrint ("%s   Sampling is assumed have being done from prior to posterior.\n", spacer);
+        else
+            {
+            MrBayesPrint ("%s   Sampling is assumed have being done from posterior to prior.\n", spacer);
+            }
+
+sumssTable:
+
+    MrBayesPrint ("\n\n%s   Step contribution table.\n\n",spacer);
+    MrBayesPrint ("   Columns in the table: \n");
+    MrBayesPrint ("   Step -- Index of the step \n");
+    MrBayesPrint ("   runX -- Contribution to the marginal log likelihood of run X, i.e. marginal \n"); 
+    MrBayesPrint ("           log likelihood for run X is the sum across all steps in column runX.\n\n");
+
+    if (firstPass == YES && chainParams.relativeBurnin == YES)
+        MrBayesPrint ("%s   The table entrances are based on samples excluding burn-in %d samples  (%d%%)    \n", spacer, stepBurnin,(int)(100*chainParams.burninFraction));
+    else
+        MrBayesPrint ("%s   The table entrances are based on samples excluding burn-in %d samples      \n", spacer, stepBurnin);
+    MrBayesPrint ("%s   discarded at the begining of each step.  \n\n", spacer);
+
+    //MrBayesPrint ("%s       Run   Marginal likelihood (ln)\n",spacer);
+    //MrBayesPrint ("%s       ------------------------------\n",spacer);
+    MrBayesPrint ("   Step");
+    for (j=0; j<sumssParams.numRuns ; j++)
+        {
+        if (j<9)
+            MrBayesPrint (" ");
+        MrBayesPrint ("      run%d", j+1);
+        }
+    MrBayesPrint ("\n");
+    for (i=0; i<sumssParams.numRuns; i++)
+        {
+        marginalLnLSS[i] = 0.0;  
+        }
+    for (stepIndexSS = chainParams.numStepsSS-1; stepIndexSS>=0; stepIndexSS--)   
+        {
+        if (chainParams.startFromPriorSS==YES)
+            {
+            stepLengthSS = BetaQuantile(chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-stepIndexSS)/(MrBFlt)chainParams.numStepsSS) - BetaQuantile(chainParams.alphaSS, 1.0, (MrBFlt)(chainParams.numStepsSS-1-stepIndexSS)/(MrBFlt)chainParams.numStepsSS);
+            }
+        else
+            {
+            stepLengthSS = BetaQuantile(chainParams.alphaSS, 1.0, (MrBFlt)(stepIndexSS+1)/(MrBFlt)chainParams.numStepsSS) - BetaQuantile(chainParams.alphaSS, 1.0, (MrBFlt)stepIndexSS/(MrBFlt)chainParams.numStepsSS);
+            }
+        MrBayesPrint ("   %3d   ", chainParams.numStepsSS-stepIndexSS);
+        for (i=0; i<sumssParams.numRuns; i++)
+            {
+            lnlp = parameterSamples[whichIsY].values[i] + stepBeginSS + (chainParams.numStepsSS-stepIndexSS-1)*numSamplesInStepSS;
+            nextSteplnlp = lnlp+numSamplesInStepSS;
+            lnlp+= stepBurnin;
+            stepAcumulatorSS = 0.0;
+            stepScalerSS = *lnlp*stepLengthSS;
+            while (lnlp < nextSteplnlp)
+                {
+               if (*lnlp*stepLengthSS > stepScalerSS + 200.0)
+                    {
+                    // adjust scaler;
+                    stepAcumulatorSS /= exp(*lnlp*stepLengthSS - 100.0 - stepScalerSS); 
+                    stepScalerSS= *lnlp*stepLengthSS - 100.0;
+                    }
+                stepAcumulatorSS += exp(*lnlp*stepLengthSS - stepScalerSS);
+                lnlp++;
+                }
+            tmpMfl = (log(stepAcumulatorSS/(numSamplesInStepSS-stepBurnin)) + stepScalerSS);
+            MrBayesPrint (" %10.3lf", tmpMfl);
+            marginalLnLSS[i] += tmpMfl;
+            }
+        MrBayesPrint ("\n");
+        //MrBayesPrint ("%s       %3d    %9.2f   \n", spacer, i+1, marginalLnLSS);
+        }
+    MrBayesPrint ("         ");
+    for (j=0; j<sumssParams.numRuns ; j++)
+        {
+        if (j<9)
+            MrBayesPrint ("-");
+        MrBayesPrint ("----------");
+        }
+    MrBayesPrint ("\n");
+    MrBayesPrint ("   Sum:  ");
+    for (j=0; j<sumssParams.numRuns ; j++)
+        MrBayesPrint (" %10.3lf", marginalLnLSS[j]);
+        
+    MrBayesPrint ("\n");
+
+    /*
+        if (sumssParams.numRuns > 1)
+            {
+            MrBayesPrint ("%s   Below are rough plots of the generations (x-axis) during burn in  \n", spacer);
+            MrBayesPrint ("%s   phase versus the log probability of observing the data (y-axis).  \n", spacer);
+            MrBayesPrint ("%s   You can use these graphs to determine if the burn in for your SS  \n", spacer);
+            MrBayesPrint ("%s   analysis was sufficiant. The log probability suppose to plateau   \n", spacer);
+            MrBayesPrint ("%s   indicating that you may be at stationarity by the time you finish \n", spacer);
+            MrBayesPrint ("%s   burn in phase. This burn in, unlike burn in within each step, is  \n", spacer);
+            MrBayesPrint ("%s   fixed and can not be changed.                                     \n", spacer);
+            }
+        else
+            {
+            MrBayesPrint ("%s   Below is a rough plot of the generations (x-axis) during burn in  \n", spacer);
+            MrBayesPrint ("%s   phase versus the log probability of observing the data (y-axis).  \n", spacer);
+            MrBayesPrint ("%s   You can use these graph to determine if the burn in for your SS   \n", spacer);
+            MrBayesPrint ("%s   analysis was sufficiant. The log probability suppose to plateau   \n", spacer);
+            MrBayesPrint ("%s   indicating that you may be at stationarity by the time you finish \n", spacer);
+            MrBayesPrint ("%s   burn in phase. This burn in, unlike burn in within each step, is  \n", spacer);
+            MrBayesPrint ("%s   fixed and can not be changed.                                     \n", spacer);
+            }
+    */
+
+    if (firstPass == NO)
+        goto sumssExitOptions;
+
+    sumssStepPlot:
+
+    MrBayesPrint ("\n\n%s   Step plot(s).\n",spacer);
+    while (1)
+        {
+         MrBayesPrint ("\n");
+        if (sumssParams.stepToPlot == 0)
+            {
+            beginPrint=(int)(sumssParams.discardFraction*stepBeginSS);
+            countPrint=stepBeginSS-beginPrint;
+            MrBayesPrint ("%s   Ploting step 0, i.e initial burn-in phase consisting of %d samples.\n", spacer,stepBeginSS);
+            MrBayesPrint ("%s   According to 'Discardfrac=%.2f', first %d samples are not ploted.\n", spacer,sumssParams.discardFraction,beginPrint);
+            }
+        else
+            {
+            if (sumssParams.stepToPlot > chainParams.numStepsSS)
+                {
+                MrBayesPrint ("%s   Chosen index of step to print %d is out of range of step indices[0,...,%d].\n", spacer,sumssParams.stepToPlot,chainParams.numStepsSS);
+                goto errorExit;
+                }
+            beginPrint=stepBeginSS+(sumssParams.stepToPlot-1)*numSamplesInStepSS + (int)(sumssParams.discardFraction*numSamplesInStepSS);
+            countPrint=numSamplesInStepSS-(int)(sumssParams.discardFraction*numSamplesInStepSS);
+            MrBayesPrint ("%s   Ploting step %d consisting of %d samples.\n", spacer,sumssParams.stepToPlot,numSamplesInStepSS);
+            MrBayesPrint ("%s   According to 'Discardfrac=%.2f', first %d samples are not ploted.\n", spacer,sumssParams.discardFraction,(int)(sumssParams.discardFraction*numSamplesInStepSS));
+            }
+
+        if (sumssParams.numRuns > 1)
+            {
+            if (sumpParams.allRuns == YES)
+                {
+                for (i=0; i<sumssParams.numRuns; i++)
+                    {
+                    MrBayesPrint ("\n%s   Samples from run %d:\n", spacer, i+1);
+                    if (PrintPlot (parameterSamples[whichIsX].values[i]+beginPrint, parameterSamples[whichIsY].values[i]+beginPrint, countPrint) == ERROR)
+                        goto errorExit;
+                    }
+                }
+            else
+                {
+                if (PrintOverlayPlot (parameterSamples[whichIsX].values, parameterSamples[whichIsY].values, numRuns, beginPrint, countPrint) == ERROR)
+                    goto errorExit;
+                }
+            }
+        else
+            {
+            if (PrintPlot (parameterSamples[whichIsX].values[0]+beginPrint, parameterSamples[whichIsY].values[0]+beginPrint, countPrint) == ERROR)
+                goto errorExit;
+            }
+
+        if (sumssParams.askForMorePlots == NO || firstPass == YES)
+            break;
+
+        MrBayesPrint (" You can choose to print new step plots for different steps or discard fractions.\n");
+        MrBayesPrint (" Allowed range of 'Steptoplot' are from 0 to %d.\n", chainParams.numStepsSS);
+        MrBayesPrint (" If the next entered value is negative, 'sumss' will stop printing step plots.\n");
+        MrBayesPrint (" If the next entered value is positive, but out of range, you will be offered\n");
+        MrBayesPrint (" to change parameter 'Discardfrac' of 'sumss'.\n");
+        MrBayesPrint (" Enter new step number 'Steptoplot':");
+        k = scanf("%d",&j);
+        if (j < 0)
+            break;
+        if (j > chainParams.numStepsSS)
+            {
+            do
+                {
+                MrBayesPrint (" Enter new value for 'Discardfrac', should be in range 0.0 to 1.0:");
+                k = scanf("%f",&tmpf);
+                sumssParams.discardFraction =  (MrBFlt)tmpf;
+                }
+            while (sumssParams.discardFraction < 0.0 || sumssParams.discardFraction > 1.0);
+            }
+        else
+            sumssParams.stepToPlot=j;
+    }
+
+    if (firstPass == NO)
+        goto sumssExitOptions;
+
+    sumssJoinedPlot:
+
+    MrBayesPrint ("\n\n%s   Joined plot(s).\n",spacer);
+    while (1)
+        {
+        MrBayesPrint ("\n");
+        MrBayesPrint ("%s   Joined plot of %d samples of all steps together. 'smoothing' is set to:%d\n", spacer,numSamplesInStepSS,sumssParams.smoothing);
+        MrBayesPrint ("%s   According to step burn-in, first %d samples are not ploted.\n", spacer,stepBurnin);
+
+        for (i=0; i<sumssParams.numRuns; i++)
+            {
+            for (j=stepBurnin;j<numSamplesInStepSS;j++)
+                plotArrayY[sumssParams.numRuns][j]=0.0;
+            lnlp= parameterSamples[whichIsY].values[i] + stepBeginSS;
+            nextSteplnlp=lnlp;
+            for (stepIndexSS = chainParams.numStepsSS-1; stepIndexSS>0; stepIndexSS--)
+                {
+                firstlnlp=plotArrayY[sumssParams.numRuns] + stepBurnin;
+                lnlp+=stepBurnin;
+                nextSteplnlp += numSamplesInStepSS;
+                while (lnlp < nextSteplnlp)
+                    {
+                    *firstlnlp+=*lnlp;
+                    firstlnlp++;
+                    lnlp++;
+                    }
+                }
+            for (j=stepBurnin;j<numSamplesInStepSS;j++)
+                {
+                sum=0.0;
+                count=0;
+                for (k=j-sumssParams.smoothing;k<=j+sumssParams.smoothing;k++)
+                    {
+                    if (k>=stepBurnin && k<numSamplesInStepSS)
+                        {
+                        sum += plotArrayY[sumssParams.numRuns][k];
+                        count++;
+                        }
+                    }
+                plotArrayY[i][j] = sum/count;
+                /*
+                if (max < plotArrayY[i][j])
+                    max=plotArrayY[i][j];
+                    */
+                }
+        /*  for (j=stepBurnin;j<numSamplesInStepSS;j++)
+                {
+                plotArrayY[i][j] /= max;
+                }*/
+            }
+
+        beginPrint=stepBurnin;
+        countPrint=numSamplesInStepSS-stepBurnin;
+
+        if (sumssParams.numRuns > 1)
+            {
+            if (sumpParams.allRuns == YES)
+                {
+                for (i=0; i<sumssParams.numRuns; i++)
+                    {
+                    MrBayesPrint ("\n%s   Samples from run %d:\n", spacer, i+1);
+                    if (PrintPlot (plotArrayX[i]+beginPrint, plotArrayY[i]+beginPrint, countPrint) == ERROR)
+                        goto errorExit;
+                    }
+                }
+            else
+                {
+                if (PrintOverlayPlot (plotArrayX, plotArrayY, numRuns, beginPrint, countPrint) == ERROR)
+                    goto errorExit;
+                }
+            }
+        else
+            {
+            if (PrintPlot (plotArrayX[0]+beginPrint, plotArrayY[0]+beginPrint, countPrint) == ERROR)
+                goto errorExit;
+            }
+
+        if (sumssParams.askForMorePlots == NO || firstPass == YES)
+            break;
+
+        MrBayesPrint (" You can choose to print new joined plots with different step burn-in or smoothing.\n");
+        MrBayesPrint (" Allowed range of step burn-in values are from 0 to %d.\n", numSamplesInStepSS-1);
+        MrBayesPrint (" If the next entered value is negative, 'sumss' will stop printing joined plots.\n");
+        MrBayesPrint (" If the next entered value is positive, but out of range, you will be offered\n");
+        MrBayesPrint (" to change 'Smoothing'.\n");
+        MrBayesPrint (" Enter new step burn-in:");
+        k = scanf("%d",&j);
+        if (j < 0)
+            break;
+        if (j >= numSamplesInStepSS)
+            {
+            MrBayesPrint (" Enter new value for 'Smoothing':");
+            k = scanf("%d",&j);
+            sumssParams.smoothing = abs(j);
+            }
+        else
+            stepBurnin=j;
+    }
+
+    firstPass = NO;
+
+sumssExitOptions:
+
+    if (sumssParams.askForMorePlots == YES)
+        {
+        MrBayesPrint ("\n");
+        MrBayesPrint (" Sumss is interactive, because of parameter 'Askmore=YES' setting. \n");
+        MrBayesPrint (" What would you like to do next?\n");
+        MrBayesPrint ("   1) Print updated table according to new step burn-in.\n");
+        MrBayesPrint ("   2) Print Step plot(s).\n");
+        MrBayesPrint ("   3) Print Joined plot(s).\n");
+        MrBayesPrint ("   4) Exit 'sumss'.\n");
+        MrBayesPrint (" Enter a number that corresponds to one of the options:");
+        do
+            {
+            k = scanf("%d",&j);
+            }while (j<1 || j>4);
+
+        if (j == 1)
+            {
+            MrBayesPrint (" Allowed range of step burn-in values are from 0 to %d\n", numSamplesInStepSS-1);
+            MrBayesPrint (" Current step burn-in value is:%d\n", stepBurnin);
+            MrBayesPrint (" Enter new step burn-in:");
+            do
+                {
+                k = scanf("%d",&stepBurnin);
+                }
+            while (stepBurnin < 0 || stepBurnin > numSamplesInStepSS-1);
+            MrBayesPrint ("\n"); 
+            goto sumssTable;
+            }
+        else if (j == 2)
+            {
+            goto sumssStepPlot;
+            }
+        else if (j == 3)
+            goto sumssJoinedPlot;
+        }
+    /* free memory */
+    FreeParameterSamples(parameterSamples);
+    for (i=0; i<nHeaders; i++)
+        free (headerNames[i]);
+    free (headerNames);
+
+    expecting = Expecting(COMMAND);
+    strcpy (spacer, "");
+    chainParams.isSS=NO;
+    for (i=0; i<sumssParams.numRuns+1; i++)
+        free(plotArrayY[i]);
+    free(plotArrayY);
+    for (i=0; i<sumssParams.numRuns; i++)
+        free(plotArrayX[i]);
+    free(plotArrayX);
+    free(marginalLnLSS);
+    
+    return (NO_ERROR);
+    
+errorExit:
+
+    /* free memory */
+    FreeParameterSamples (parameterSamples);
+    if (headerNames!=NULL)
+        for (i=0; i<nHeaders; i++)
+            free (headerNames[i]);
+    free (headerNames);
+
+    expecting = Expecting(COMMAND);    
+    strcpy (spacer, "");
+    chainParams.isSS=NO;
+    if (plotArrayY!=NULL)
+        for (i=0; i<sumssParams.numRuns+1; i++)
+            free(plotArrayY[i]);
+    free(plotArrayY);
+    if (plotArrayX!=NULL)
+        for (i=0; i<sumssParams.numRuns; i++)
+            free(plotArrayX[i]);
+    free(plotArrayX);
+    free(marginalLnLSS);
+
+    return (ERROR);
+}
+
+
+int DoSumpParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        tempStr[100];
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            expecting  = Expecting(PARAMETER);
+            expecting |= Expecting(SEMICOLON);
+            }
+        /* set Filename (sumpParams.sumpFileName) ***************************************************/
+        else if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (strlen(tkn)>99 && (strchr(tkn,' ')-tkn) > 99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+                    return (ERROR);
+                    } 
+                sscanf (tkn, "%s", tempStr);
+                strcpy (sumpParams.sumpFileName, tempStr);
+                strcpy (sumpParams.sumpOutfile, tempStr);
+                MrBayesPrint ("%s   Setting sump filename and output file name to %s\n", spacer, sumpParams.sumpFileName);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Outputname (sumpParams.sumpOutfile) *******************************************************/
+        else if (!strcmp(parmName, "Outputname"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (strlen(tkn)>99 && (strchr(tkn,' ')-tkn) > 99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+                    return (ERROR);
+                    }
+                sscanf (tkn, "%s", tempStr);
+                strcpy (sumpParams.sumpOutfile, tempStr);
+                MrBayesPrint ("%s   Setting sump output file name to \"%s\"\n", spacer, sumpParams.sumpOutfile);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Relburnin (chainParams.relativeBurnin) ********************************************************/
+        else if (!strcmp(parmName, "Relburnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.relativeBurnin = YES;
+                    else
+                        chainParams.relativeBurnin = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Relburnin\n", spacer);
+                    return (ERROR);
+                    }
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using relative burnin (a fraction of samples discarded).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Using absolute burnin (a fixed number of samples discarded).\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burnin (chainParams.chainBurnIn) ***********************************************************/
+        else if (!strcmp(parmName, "Burnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.chainBurnIn = tempI;
+                MrBayesPrint ("%s   Setting burn-in to %d\n", spacer, chainParams.chainBurnIn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burninfrac (chainParams.burninFraction) ************************************************************/
+        else if (!strcmp(parmName, "Burninfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too low (< 0.01)\n", spacer);
+                    return (ERROR);
+                    }
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too high (> 0.50)\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.burninFraction = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }
+            }
+        /* set Minprob (sumpParams.minProb) ************************************************************/
+        else if (!strcmp(parmName, "Minprob"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Minprob too high (it should be smaller than 0.50)\n", spacer);
+                    return (ERROR);
+                    }
+                sumpParams.minProb = tempD;
+                MrBayesPrint ("%s   Setting minprob to %1.3f\n", spacer, sumpParams.minProb);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }
+            }
+        /* set Nruns (sumpParams.numRuns) *******************************************************/
+        else if (!strcmp(parmName, "Nruns"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Nruns must be at least 1\n", spacer);
+                    return (ERROR);
+                    }
+                else
+                    {
+                    sumpParams.numRuns = tempI;
+                    MrBayesPrint ("%s   Setting sump nruns to %d\n", spacer, sumpParams.numRuns);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Hpd (sumpParams.HPD) ********************************************************/
+        else if (!strcmp(parmName, "Hpd"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumpParams.HPD = YES;
+                    else
+                        sumpParams.HPD = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Hpd\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumpParams.HPD == YES)
+                    MrBayesPrint ("%s   Reporting 95 %% region of Highest Posterior Density (HPD).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Reporting median interval containing 95 %% of values.\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Allruns (sumpParams.allRuns) ********************************************************/
+        else if (!strcmp(parmName, "Allruns"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumpParams.allRuns = YES;
+                    else
+                        sumpParams.allRuns = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for allruns (valid arguments are 'yes' and 'no')\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumpParams.allRuns == YES)
+                    MrBayesPrint ("%s   Setting sump to print information for each run\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting sump to print only summary information for all runs\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoSumSsParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        tempStr[100];
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            expecting  = Expecting(PARAMETER);
+            expecting |= Expecting(SEMICOLON);
+            }
+        /* set Filename (sumpParams.sumpFileName) ***************************************************/
+        else if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (strlen(tkn)>99 && (strchr(tkn,' ')-tkn) > 99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+                    return (ERROR);
+                    } 
+                sscanf (tkn, "%s", tempStr);
+                strcpy (sumpParams.sumpFileName, tempStr);
+                strcpy (sumpParams.sumpOutfile, tempStr);
+                MrBayesPrint ("%s   Setting sump filename and output file name to %s\n", spacer, sumpParams.sumpFileName);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Outputname (sumpParams.sumpOutfile) *******************************************************/
+        /*else if (!strcmp(parmName, "Outputname"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (strlen(tkn)>99 && (strchr(tkn,' ')-tkn) > 99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+                    return (ERROR);
+                    }
+                sscanf (tkn, "%s", tempStr);
+                strcpy (sumpParams.sumpOutfile, tempStr);
+                MrBayesPrint ("%s   Setting sump output file name to \"%s\"\n", spacer, sumpParams.sumpOutfile);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }*/
+        /* set Relburnin (chainParams.relativeBurnin) ********************************************************/
+        else if (!strcmp(parmName, "Relburnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.relativeBurnin = YES;
+                    else
+                        chainParams.relativeBurnin = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Relburnin\n", spacer);
+                    return (ERROR);
+                    }
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using relative burnin (a fraction of samples discarded).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Using absolute burnin (a fixed number of samples discarded).\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burnin (chainParams.chainBurnIn) ***********************************************************/
+        else if (!strcmp(parmName, "Burnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.chainBurnIn = tempI;
+                MrBayesPrint ("%s   Setting burn-in to %d\n", spacer, chainParams.chainBurnIn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burninfrac (chainParams.burninFraction) ************************************************************/
+        else if (!strcmp(parmName, "Burninfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too low (< 0.01)\n", spacer);
+                    return (ERROR);
+                    }
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too high (> 0.50)\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.burninFraction = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }
+            }
+        /* set Nruns (sumssParams.numRuns) *******************************************************/
+        else if (!strcmp(parmName, "Nruns"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Nruns must be at least 1\n", spacer);
+                    return (ERROR);
+                    }
+                else
+                    {
+                    sumssParams.numRuns = tempI;
+                    MrBayesPrint ("%s   Setting sumss nruns to %d\n", spacer, sumssParams.numRuns);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Allruns (sumssParams.allRuns) ********************************************************/
+        else if (!strcmp(parmName, "Allruns"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumssParams.allRuns = YES;
+                    else
+                        sumssParams.allRuns = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for allruns (valid arguments are 'yes' and 'no')\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumssParams.allRuns == YES)
+                    MrBayesPrint ("%s   Setting sump to print information for each run\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting sump to print only summary information for all runs\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Steptoplot (sumssParams.stepToPlot) *******************************************************/
+        else if (!strcmp(parmName, "Steptoplot"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 0)
+                    {
+                    MrBayesPrint ("%s   Steptoplot must be at least 0\n", spacer);
+                    return (ERROR);
+                    }
+                else
+                    {
+                    sumssParams.stepToPlot = tempI;
+                    MrBayesPrint ("%s   Setting sumss steptoplot to %d\n", spacer, sumssParams.stepToPlot);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Smoothing (sumssParams.smoothing) *******************************************************/
+        else if (!strcmp(parmName, "Smoothing"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 0)
+                    {
+                    MrBayesPrint ("%s   Smoothing must be at least 0\n", spacer);
+                    return (ERROR);
+                    }
+                else
+                    {
+                    sumssParams.smoothing  = tempI;
+                    MrBayesPrint ("%s   Setting sumss smoothing to %d\n", spacer, sumssParams.smoothing);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Allruns (sumssParams.askForMorePlots) ********************************************************/
+        else if (!strcmp(parmName, "Askmore"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumssParams.askForMorePlots = YES;
+                    else
+                        sumssParams.askForMorePlots = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for askmore (valid arguments are 'yes' and 'no')\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumssParams.askForMorePlots == YES)
+                    MrBayesPrint ("%s   Setting sumss to be interactiva by asking for more plots of burn-in or individual steps.\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting sumss not to be interactive. It will not ask to print more plots.\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Discardfrac (sumssParams.discardFraction) ************************************************************/
+        else if (!strcmp(parmName, "Discardfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.00)
+                    {
+                    MrBayesPrint ("%s   Discard fraction too low (< 0.00)\n", spacer);
+                    return (ERROR);
+                    }
+                if (tempD > 1.00)
+                    {
+                    MrBayesPrint ("%s   Discard fraction too high (> 1.00)\n", spacer);
+                    return (ERROR);
+                    }
+                sumssParams.discardFraction = tempD;
+                MrBayesPrint ("%s   Setting discard fraction to %.2f\n", spacer, sumssParams.discardFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* ExamineSumpFile: Collect info on the parameter samples in the file */
+int ExamineSumpFile (char *fileName, SumpFileInfo *fileInfo, char ***headerNames, int *nHeaders)
+{
+    char    *sumpTokenP, sumpToken[CMD_STRING_LENGTH], *s=NULL, *headerLine, *t;
+    int     i, lineTerm, inSumpComment, lineNum, lastNonDigitLine, numParamLines, allDigitLine,
+            lastTokenWasDash, nNumbersOnThisLine, tokenType, burnin, nLines, firstNumCols;
+    MrBFlt  tempD;
+    FILE    *fp = NULL;
+
+    /* open binary file */
+    if ((fp = OpenBinaryFileR(fileName)) == NULL)
+        {
+        /* test for some simple errors */
+        if (strlen(sumpParams.sumpFileName) > 2)
+            {
+            s = sumpParams.sumpFileName + (int) strlen(sumpParams.sumpFileName) - 2;
+            if (strcmp(s, ".p") == 0)
+                {
+                MrBayesPrint ("%s   It appears that you need to remove '.p' from the 'Filename' parameter\n", spacer);
+                MrBayesPrint ("%s   Also make sure that 'Nruns' is set correctly\n", spacer);
+                return ERROR;
+                }
+            }
+        MrBayesPrint ("%s   Make sure that 'Nruns' is set correctly\n", spacer);
+        return ERROR;
+        }
+    
+    /* find out what type of line termination is used */
+    lineTerm = LineTermType (fp);
+    if (lineTerm != LINETERM_MAC && lineTerm != LINETERM_DOS && lineTerm != LINETERM_UNIX)
+        {
+        MrBayesPrint ("%s   Unknown line termination\n", spacer);
+        goto errorExit;
+        }
+        
+    /* find length of longest line */
+    fileInfo->longestLineLength = LongestLine (fp);
+    fileInfo->longestLineLength += 10;      /* better safe than sorry; if you fgets with raw longestLineLength, you run into problems */
+
+    /* allocate string long enough to hold a line */
+    s = (char *)SafeMalloc(2 * ((size_t)(fileInfo->longestLineLength) +10) * sizeof(char));
+    if (!s)
+        {
+        MrBayesPrint ("%s   Problem allocating string for reading sump file\n", spacer);
+        goto errorExit;
+        }
+    headerLine = s + fileInfo->longestLineLength + 10;
+
+    /* close binary file */
+    SafeFclose (&fp);
+    
+    /* open text file */
+    if ((fp = OpenTextFileR(fileName)) == NULL)
+        goto errorExit;
+    
+    /* Check file for appropriate blocks. We want to find the last block
+       in the file and start from there. */
+    inSumpComment = NO;
+    lineNum = lastNonDigitLine = numParamLines = 0;
+    while (fgets (s, fileInfo->longestLineLength + 2, fp) != NULL)
+        {
+        sumpTokenP = &s[0];
+        allDigitLine = YES;
+        lastTokenWasDash = NO;
+        nNumbersOnThisLine = 0;
+        do {
+            if (GetToken (sumpToken, &tokenType, &sumpTokenP))
+                goto errorExit;
+            /* printf ("%s (%d)\n", sumpToken, tokenType); */
+            if (IsSame("[", sumpToken) == SAME)
+                inSumpComment = YES;
+            if (IsSame("]", sumpToken) == SAME)
+                inSumpComment = NO;
+                    
+            if (inSumpComment == NO)
+                {
+                if (tokenType == NUMBER)
+                    {
+                    sscanf (sumpToken, "%lf", &tempD);
+                    if (lastTokenWasDash == YES)
+                        tempD *= -1.0;
+                    nNumbersOnThisLine++;
+                    lastTokenWasDash = NO;
+                    }
+                else if (tokenType == DASH)
+                    {
+                    lastTokenWasDash = YES;
+                    }
+                else if (tokenType != UNKNOWN_TOKEN_TYPE)
+                    {
+                    allDigitLine = NO;
+                    lastTokenWasDash = NO;
+                    }
+                }
+            } while (*sumpToken);
+        lineNum++;
+        
+        if (allDigitLine == NO)
+            {
+            lastNonDigitLine = lineNum;
+            numParamLines = 0;
+            }
+        else
+            {
+            if (nNumbersOnThisLine > 0)
+                numParamLines++;
+            }
+        }
+        
+    /* Now, check some aspects of the .p file. */
+    if (inSumpComment == YES)
+        {
+        MrBayesPrint ("%s   Unterminated comment in file \"%s\"\n", spacer, fileName);
+            goto errorExit;
+        }
+    if (numParamLines <= 0)
+        {
+        MrBayesPrint ("%s   No parameters were found in file or there characters not representing a number in last string of the file.\"%s\"\n", spacer, fileName);
+            goto errorExit;
+        }
+
+    /* calculate burnin */
+    if (chainParams.isSS == YES)
+        {
+        burnin = 0;
+        }
+    else
+        {
+        if (chainParams.relativeBurnin == YES)
+            burnin = (int) (chainParams.burninFraction * numParamLines);
+        else
+            burnin = chainParams.chainBurnIn;
+        }
+    
+    /* check against burnin */
+    if (burnin > numParamLines)
+        {
+        MrBayesPrint ("%s   No parameters can be sampled from file %s as the burnin (%d) exceeds the number of lines in last block (%d)\n",
+            spacer, fileName, burnin, numParamLines);
+        MrBayesPrint ("%s   Try setting burnin to a number less than %d\n", spacer, numParamLines);
+        goto errorExit;
+        }
+
+    /* Set some info in fileInfo */
+    fileInfo->firstParamLine = lastNonDigitLine + burnin;
+    fileInfo->headerLine = lastNonDigitLine;
+
+    /* Calculate and check the number of columns and rows for the file; get header line at the same time */
+    (void)fseek(fp, 0L, 0);
+    for (lineNum=0; lineNum<lastNonDigitLine; lineNum++)
+        if (fgets (s, fileInfo->longestLineLength + 2, fp)==NULL)
+            goto errorExit;
+    strcpy(headerLine, s);
+    for (; lineNum < lastNonDigitLine+burnin; lineNum++)
+        if (fgets (s, fileInfo->longestLineLength + 2, fp)==NULL)
+            goto errorExit;
+
+    inSumpComment = NO;
+    nLines = 0;
+    firstNumCols = 0;
+    while (fgets (s, fileInfo->longestLineLength + 2, fp) != NULL)
+        {
+        sumpTokenP = &s[0];
+        allDigitLine = YES;
+        lastTokenWasDash = NO;
+        nNumbersOnThisLine = 0;
+        do {
+            if (GetToken (sumpToken, &tokenType, &sumpTokenP))
+                goto errorExit;
+            if (IsSame("[", sumpToken) == SAME)
+                inSumpComment = YES;
+            if (IsSame("]", sumpToken) == SAME)
+                inSumpComment = NO;
+            if (inSumpComment == NO)
+                {
+                if (tokenType == NUMBER)
+                    {
+                    nNumbersOnThisLine++;
+                    lastTokenWasDash = NO;
+                    }
+                else if (tokenType == DASH)
+                    {
+                    lastTokenWasDash = YES;
+                    }
+                else if (tokenType != UNKNOWN_TOKEN_TYPE)
+                    {
+                    allDigitLine = NO;
+                    lastTokenWasDash = NO;
+                    }
+                }
+            } while (*sumpToken);
+        lineNum++;
+        if (allDigitLine == NO)
+            {
+            MrBayesPrint ("%s   Found a line with non-digit characters (line %d) in file %s\n", spacer, lineNum, fileName);
+            goto errorExit;
+            }
+        else
+            {
+            if (nNumbersOnThisLine > 0)
+                {
+                nLines++;
+                if (nLines == 1)
+                    firstNumCols = nNumbersOnThisLine;
+                else
+                    {
+                    if (nNumbersOnThisLine != firstNumCols)
+                        {
+                        MrBayesPrint ("%s   Number of columns is not even (%d in first line and %d in line %d of file %s)\n", spacer, firstNumCols, nNumbersOnThisLine, lineNum, fileName);
+                        goto errorExit;
+                        }
+                    }
+                }
+            }
+        }
+    fileInfo->numRows = nLines;
+    fileInfo->numColumns = firstNumCols;
+
+    /* set or check headers */
+    if ((*headerNames) == NULL)
+        {
+        GetHeaders (headerNames, headerLine, nHeaders);
+        if (*nHeaders != fileInfo->numColumns)
+            {
+            MrBayesPrint ("%s   Expected %d headers but found %d headers\n", spacer, fileInfo->numColumns, *nHeaders);
+            for (i=0; i<*nHeaders; i++)
+                SafeFree ((void **) &((*headerNames)[i]));
+            SafeFree ((void **) &(*headerNames));
+            *nHeaders=0;
+            goto errorExit;
+            }
+        }
+    else
+        {
+        if (*nHeaders != fileInfo->numColumns)
+            {
+            MrBayesPrint ("%s   Expected %d columns but found %d columns\n", spacer, *nHeaders, fileInfo->numColumns);
+            goto errorExit;
+            }
+        for (i=0, t=strtok(headerLine,"\t\n\r"); t!=NULL; t=strtok(NULL,"\t\n\r"), i++)
+            {
+            if (i == *nHeaders)
+                {
+                MrBayesPrint ("%s   Expected %d headers but found more headers.\n",
+                spacer, fileInfo->numColumns);
+                goto errorExit;
+                }             
+            if (strcmp(t,(*headerNames)[i])!=0)
+                {
+                MrBayesPrint ("%s   Expected header '%s' for column %d but the header for this column was '%s' in file '%s'\n", spacer, (*headerNames)[i], i+1, t, fileName);
+                MrBayesPrint ("%s   It could be that some parameter values are not numbers and the whole string containing \n",spacer); 
+                MrBayesPrint ("%s   this wrongly formated parameter is treated as a header.\n",spacer);
+                goto errorExit;
+                }
+            }
+        if (t != NULL)
+            {
+            MrBayesPrint ("%s   Expected %d headers but found more headers.\n",spacer, fileInfo->numColumns);
+            goto errorExit;
+            }
+        if (i < *nHeaders)
+            {
+            MrBayesPrint ("%s   Expected header '%s' for column %d but the header for this column was '%s' in file '%s'\n",
+                spacer, (*headerNames)[i], i+1, t, fileName);
+            goto errorExit;
+            }
+        }
+
+    free (s);
+    fclose(fp);
+    return (NO_ERROR);
+
+errorExit:
+
+    free(s);
+    fclose(fp);
+    return (ERROR);
+}
+
+
+/***************************************************
+|
+|   FindHeader: Find token in list
+|
+----------------------------------------------------*/
+int FindHeader (char *token, char **headerNames, int nHeaders, int *index)
+{
+    int         i, match=0, nMatches;
+
+    *index = -1;
+    nMatches = 0;
+    for (i=0; i<nHeaders; i++)
+        {
+        if (!strcmp(token,headerNames[i]))
+            {
+            nMatches++;
+            match = i;
+            }
+        }
+
+    if (nMatches != 1)
+        return (ERROR);
+
+    *index = match;
+    return (NO_ERROR);
+}
+
+
+/* FreeParameterSamples: Free parameter samples space */
+void FreeParameterSamples (ParameterSample *parameterSamples)
+{
+    if (parameterSamples != NULL)
+        {
+        free (parameterSamples[0].values[0]);
+        free (parameterSamples[0].values);
+        free (parameterSamples);
+        }
+}
+
+
+/***************************************************
+|
+|   GetHeaders: Get headers from headerLine and put
+|      them in list while updating nHeaders to reflect
+|      the number of headers
+|
+----------------------------------------------------*/
+int GetHeaders (char ***headerNames, char *headerLine, int *nHeaders)
+{
+    char        *s;
+
+    (*nHeaders) = 0;
+    for (s=strtok(headerLine," \t\n\r"); s!=NULL; s=strtok(NULL," \t\n\r"))
+        {
+        if (AddString (headerNames, *nHeaders, s) == ERROR)
+            {
+            MrBayesPrint ("%s   Error adding header to list of headers \n", spacer, s);
+            return ERROR;
+            }
+        (*nHeaders)++;
+        }
+                
+    return (NO_ERROR);  
+}
+
+
+/* PrintMargLikes: Print marginal likelihoods to screen and to .lstat file */
+int PrintMargLikes (char *fileName, char **headerNames, int nHeaders, ParameterSample *parameterSamples, int nRuns, int nSamples)
+{
+    int     i, j, len, longestHeader, *sampleCounts=NULL;
+    char    temp[100];
+    Stat    theStats;
+    FILE    *fp;
+    
+    /* calculate longest header */
+    longestHeader = 9;  /* length of 'parameter' */
+    for (i=0; i<nHeaders; i++)
+        {
+        strcpy (temp, headerNames[i]);
+        len = (int) strlen(temp);
+        for (j=0; modelIndicatorParams[j][0]!='\0'; j++)
+            if (IsSame (temp,modelIndicatorParams[j]) != DIFFERENT)
+                break;
+        if (modelIndicatorParams[j][0]!='\0')
+            continue;
+        if (!strcmp (temp, "Gen") || !strcmp (temp, "LnL") || !strcmp (temp, "LnPr"))
+            continue;
+        if (len > longestHeader)
+            longestHeader = len;
+        }
+    
+    /* open output file */
+    strncpy (temp, fileName, 90);
+    strcat (temp, ".pstat");
+    fp = OpenNewMBPrintFile (temp);
+    if (!fp)
+        return ERROR;
+
+    /* print unique identifier to the output file */
+    if (strlen(stamp) > 1)
+        MrBayesPrintf (fp, "[ID: %s]\n", stamp);
+
+    /* allocate and set nSamples */
+    sampleCounts = (int *) SafeCalloc (nRuns, sizeof(int));
+    if (!sampleCounts)
+        {
+        fclose(fp);
+        return ERROR;
+        }
+    for (i=0; i<nRuns; i++)
+        sampleCounts[i] = nSamples;
+
+    /* print the header rows */
+    MrBayesPrint ("\n");
+    if (sumpParams.HPD == YES)
+        MrBayesPrint ("%s   %*c                             95%% HPD Interval\n", spacer, longestHeader, ' ');
+    else
+        MrBayesPrint ("%s   %*c                            95%% Cred. Interval\n", spacer, longestHeader, ' ');
+    MrBayesPrint ("%s   %*c                           --------------------\n", spacer, longestHeader, ' ');
+
+    MrBayesPrint ("%s   Parameter%*c      Mean     Variance     Lower       Upper       Median", spacer, longestHeader-9, ' ');
+    if (nRuns > 1)
+        MrBayesPrint ("     PSRF+ ");
+    MrBayesPrint ("\n");
+
+    MrBayesPrint ("%s   ", spacer);
+    for (j=0; j<longestHeader+1; j++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("-----------------------------------------------------------");
+    if (nRuns > 1)
+        MrBayesPrint ("----------");
+    MrBayesPrint ("\n");
+    if (nRuns > 1)
+        MrBayesPrintf (fp, "Parameter\tMean\tVariance\tLower\tUpper\tMedian\tPSRF\n");
+    else
+        MrBayesPrintf (fp, "Parameter\tMean\tVariance\tLower\tUpper\tMedian\n");
+
+    /* print table values */
+    for (i=0; i<nHeaders; i++)
+        {
+        strcpy (temp, headerNames[i]);
+        len = (int) strlen(temp);
+        for (j=0; modelIndicatorParams[j][0]!='\0'; j++)
+            if (IsSame (temp,modelIndicatorParams[j]) != DIFFERENT)
+                break;
+        if (!strcmp (temp, "Gen") || !strcmp (temp, "LnL") || !strcmp (temp, "LnPr"))
+            continue;
+
+        GetSummary (parameterSamples[i].values, nRuns, sampleCounts, &theStats, sumpParams.HPD);
+        
+        MrBayesPrint ("%s   %-*s ", spacer, longestHeader, temp);
+        MrBayesPrint ("%10.6lf  %10.6lf  %10.6lf  %10.6lf  %10.6lf", theStats.mean, theStats.var, theStats.lower, theStats.upper, theStats.median);
+        MrBayesPrintf (fp, "%s", temp);
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.mean));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.var));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.lower));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.upper));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.median));
+        if (nRuns > 1)
+            {
+            if (theStats.PSRF < 0.0)
+                {
+                MrBayesPrint ("     NA   ");
+                MrBayesPrintf (fp, "NA");
+                }
+            else
+                {
+                MrBayesPrint ("  %7.3lf", theStats.PSRF);
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.PSRF));
+                }
+            }
+        MrBayesPrint ("\n");
+        MrBayesPrintf (fp, "\n");
+        }
+    MrBayesPrint ("%s   ", spacer);
+    for (j=0; j<longestHeader+1; j++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("-----------------------------------------------------------");
+    if (nRuns > 1)
+        MrBayesPrint ("----------");
+    MrBayesPrint ("\n");
+    if (nRuns > 1)
+        {
+        MrBayesPrint ("%s   + Convergence diagnostic (PSRF = Potential Scale Reduction Factor; Gelman\n", spacer);
+        MrBayesPrint ("%s     and Rubin, 1992) should approach 1.0 as runs converge.\n", spacer);
+        }
+
+    fclose (fp);
+    free (sampleCounts);
+
+    return (NO_ERROR);
+}
+
+
+/* PrintModelStats: Print model stats to screen and to .mstat file */
+int PrintModelStats (char *fileName, char **headerNames, int nHeaders, ParameterSample *parameterSamples, int nRuns, int nSamples)
+{
+    int         i, j, j1, j2, k, longestName, nElements, *modelCounts=NULL;
+    MrBFlt      f, *prob=NULL, *sum=NULL, *ssq=NULL, *min=NULL, *max=NULL, *stddev=NULL;
+    char        temp[100];
+    FILE        *fp;
+    ModelProb   *elem = NULL;
+
+    /* nHeaders - is a convenient synonym for number of column headers */
+
+    /* check if we have any model indicator variables and also check for longest header */
+    k = 0;
+    longestName = 0;
+    for (i=0; i<nHeaders; i++)
+        {
+        for (j=0; strcmp(modelIndicatorParams[j],"")!=0; j++)
+            {
+            if (IsSame (headerNames[i], modelIndicatorParams[j]) != DIFFERENT)
+                {
+                k++;
+                for (j1=0; strcmp(modelElementNames[j][j1],"")!=0; j1++)
+                    {
+                    j2 = (int)(strlen(headerNames[i]) + 2 + strlen(modelElementNames[j][j1]));
+                    if (j2 > longestName)
+                        longestName = j2;
+                    }
+                break;
+                }
+            }
+        }
+
+    /* return if nothing to do */
+    if (k==0)
+        return NO_ERROR;
+
+    /* open output file */
+    MrBayesPrint ("%s   Model probabilities above %1.3lf\n", spacer, sumpParams.minProb);
+    MrBayesPrint ("%s   Estimates saved to file \"%s.mstat\".\n", spacer, sumpParams.sumpOutfile);
+    strncpy (temp,fileName,90);
+    strcat (temp, ".mstat");
+    fp = OpenNewMBPrintFile(temp);
+    if (!fp)
+        return ERROR;
+    MrBayesPrint ("\n");
+
+    /* print unique identifier to the output file */
+    if (strlen(stamp) > 1)
+        MrBayesPrintf (fp, "[ID: %s]\n", stamp);
+
+    /* print header */
+    MrBayesPrintf (fp, "\n\n");
+    if (nRuns == 1)
+        {
+        MrBayesPrint ("%s        %*c        Posterior\n", spacer, longestName-5, ' ');
+        MrBayesPrint ("%s   Model%*c       Probability\n", spacer, longestName-5, ' ');
+        MrBayesPrint ("%s   -----", spacer);
+        for (i=0; i<longestName-5; i++)
+            MrBayesPrint ("-");
+        MrBayesPrint ("------------------\n");
+        MrBayesPrintf (fp, "Model\tProbability\n");
+        }
+    else
+        {
+        MrBayesPrint ("%s        %*c        Posterior      Standard         Min.           Max.   \n", spacer, longestName-5, ' ');
+        MrBayesPrint ("%s   Model%*c       Probability     Deviation     Probability    Probability\n", spacer, longestName-5, ' ');
+        MrBayesPrint ("%s   -----", spacer);
+        for (i=0; i<longestName-5; i++)
+            MrBayesPrint ("-");
+        MrBayesPrint ("---------------------------------------------------------------\n");
+        MrBayesPrintf (fp, "Model\tProbability\tStd_dev\tMin_prob\tMax_prob\n");
+        }
+
+    /* calculate and print values */
+    for (i=0; i<nHeaders; i++)
+        {
+        for (j=0; modelIndicatorParams[j][0]!='\0'; j++)
+            if (IsSame (headerNames[i], modelIndicatorParams[j]) != DIFFERENT)
+                break;
+        if (modelIndicatorParams[j][0] == '\0')
+            continue;
+
+        for (nElements=0; modelElementNames[j][nElements][0]!='\0'; nElements++)
+            ;
+        
+        modelCounts = (int *) SafeCalloc (nElements, sizeof(int));
+        if (!modelCounts)
+            {
+            fclose(fp);
+            return ERROR;
+            }
+        prob = (MrBFlt *) SafeCalloc (6*nElements, sizeof(MrBFlt));
+        if (!prob)
+            {
+            free (modelCounts);
+            fclose (fp);
+            return ERROR;
+            }
+        sum    = prob + nElements;
+        ssq    = prob + 2*nElements;
+        stddev = prob + 3*nElements;
+        min    = prob + 4*nElements;
+        max    = prob + 5*nElements;
+
+        for (j1=0; j1<nElements; j1++)
+            min[j1] = 1.0;
+
+        for (j1=0; j1<nRuns; j1++)
+            {
+            for (j2=0; j2<nElements; j2++)
+                modelCounts[j2] = 0;
+            for (j2=0; j2<nSamples; j2++)
+                modelCounts[(int)(parameterSamples[i].values[j1][j2] + 0.1)]++;
+            for (j2=0; j2<nElements; j2++)
+                {
+                f = (MrBFlt) modelCounts[j2] / (MrBFlt) nSamples;
+                sum[j2] += f;
+                ssq[j2] += f*f;
+                if (f<min[j2])
+                    min[j2] = f;
+                if (f > max[j2])
+                    max[j2] = f;
+                }
+            }
+
+        for (j1=0; j1<nElements; j1++)
+            {
+            prob[j1] = sum[j1] / (MrBFlt) nRuns;
+            f = ssq[j1] - (sum[j1] * sum[j1] / (MrBFlt) nRuns);
+            f /= (nRuns - 1);
+            if (f <= 0.0)
+                stddev[j1] = 0.0;
+            else
+                stddev[j1] = sqrt (f);
+            }
+
+        elem = (ModelProb *) SafeCalloc (nElements, sizeof(ModelProb));
+        for (j1=0; j1<nElements; j1++)
+            {
+            elem[j1].index = j1;
+            elem[j1].prob = prob[j1];
+            }
+
+        /* sort in terms of decreasing probabilities */
+        qsort((void *)elem, (size_t)nElements, sizeof(ModelProb), CompareModelProbs);
+
+        for (j1=0; j1<nElements; j1++)
+            {
+            if (elem[j1].prob <= sumpParams.minProb)
+                break;
+
+            if (nRuns == 1)
+                {
+                sprintf (temp, "%s[%s]", headerNames[i], modelElementNames[j][elem[j1].index]);
+                MrBayesPrint ("%s   %-*s          %1.3lf\n", spacer, longestName, temp, prob[elem[j1].index]);
+                MrBayesPrintf (fp, "%s\t%s\n", temp, MbPrintNum(prob[elem[j1].index])); 
+                }
+            else /* if (nRuns > 1) */
+                {
+                sprintf (temp, "%s[%s]", headerNames[i], modelElementNames[j][elem[j1].index]);
+                MrBayesPrint ("%s   %-*s          %1.3lf          %1.3lf          %1.3lf          %1.3lf\n", 
+                    spacer, longestName, temp, prob[elem[j1].index], stddev[elem[j1].index], min[elem[j1].index], max[elem[j1].index]);
+                MrBayesPrintf (fp, "%s", temp);
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(prob[elem[j1].index]));
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(stddev[elem[j1].index]));
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(min[elem[j1].index]));
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(max[elem[j1].index]));
+                MrBayesPrintf (fp, "\n");
+                }
+            }
+        free(elem);
+        elem = NULL;
+        free(modelCounts);
+        modelCounts = NULL;
+        free (prob);
+        prob = NULL;
+        }
+
+    /* print footer */
+    if (nRuns == 1)
+        {
+        MrBayesPrint ("%s   -----", spacer);
+        for (i=0; i<longestName-5; i++)
+            MrBayesPrint ("-");
+        MrBayesPrint ("------------------\n\n");
+        }
+    else
+        {
+        MrBayesPrint ("%s   -----", spacer);
+        for (i=0; i<longestName-5; i++)
+            MrBayesPrint ("-");
+        MrBayesPrint ("---------------------------------------------------------------\n\n");
+        }
+
+    /* close output file */
+    fclose (fp);
+
+    return (NO_ERROR);
+}
+
+
+/* PrintOverlayPlot: Print overlay x-y plot of log likelihood vs. generation for several runs */
+int PrintOverlayPlot (MrBFlt **xVals, MrBFlt **yVals, int nRuns,  int startingFrom, int nSamples)
+{
+    int     i, j, k, k2, n, screenHeight, screenWidth, numY[60], width;
+    char    plotSymbol[15][60];
+    MrBFlt  x, y, minX, maxX, minY, maxY, meanY[60];
+    
+    if (nRuns == 2)
+        MrBayesPrint ("\n%s   Overlay plot for both runs:\n", spacer);
+    else
+        MrBayesPrint ("\n%s   Overlay plot for all %d runs:\n", spacer, sumpParams.numRuns);
+    if (nRuns > 9)
+        MrBayesPrint ("%s   (1 = Run number 1; 2 = Run number 2 etc.; x = Run number 10 or above; * = Several runs)\n", spacer);
+    else if (nRuns > 2)
+        MrBayesPrint ("%s   (1 = Run number 1; 2 = Run number 2 etc.; * = Several runs)\n", spacer);
+    else
+        MrBayesPrint ("%s   (1 = Run number 1; 2 = Run number 2; * = Both runs)\n", spacer);
+
+    /* print overlay x-y plot of log likelihood vs. generation for all runs */
+    screenWidth = 60; /* don't change this without changing numY, meanY, and plotSymbol declared above */
+    screenHeight = 15;
+
+    /* find minX, minY, maxX, and maxY over all runs */
+    minX = minY = 1000000000.0;
+    maxX = maxY = -1000000000.0;
+    for (n=0; n<nRuns; n++)
+        {
+        for (i=startingFrom; i<startingFrom+nSamples; i++)
+            {
+            x = xVals[n][i];
+            if (x < minX)
+                minX = x;
+            if (x > maxX)
+                maxX = x;
+            }
+        }
+    for (n=0; n<nRuns; n++)
+        {
+        y = 0.0;
+        j = 0;
+        k2 = 0;
+        for (i=startingFrom; i<startingFrom+nSamples; i++)
+            {
+            x = xVals[n][i];
+            k = (int) (((x - minX) / (maxX - minX)) * screenWidth);
+            if (k <= 0)
+                k = 0;
+            if (k >= screenWidth)
+                k = screenWidth - 1;
+            if (k == j)
+                {
+                y += yVals[n][i];
+                k2 ++;
+                }
+            else
+                {
+                y /= k2;
+                if (y < minY)
+                    minY = y;
+                if (y > maxY)
+                    maxY = y;
+                k2 = 1;
+                y = yVals[n][i];
+                j++;
+                }
+            }
+        if (k2 > 0)
+            {
+            y /= k2;
+            if (y < minY)
+                minY = y;
+            if (y > maxY)
+                maxY = y;
+            }
+        }
+    
+    /* initialize the plot symbols */
+    for (i=0; i<screenHeight; i++)
+        for (j=0; j<screenWidth; j++)
+            plotSymbol[i][j] = ' ';
+
+    /* assemble the plot symbols */
+    for (n=0; n<nRuns; n++)
+        {
+        /* find the plot points for this run */
+        for (i=0; i<screenWidth; i++)
+            {
+            numY[i] = 0;
+            meanY[i] = 0.0;
+            }
+        for (i=startingFrom; i<startingFrom+nSamples; i++)
+            {
+            x = xVals[n][i];
+            y = yVals[n][i];
+            k = (int)(((x - minX) / (maxX - minX)) * screenWidth);
+            if (k >= screenWidth)
+                k = screenWidth - 1;
+            if (k <= 0)
+                k = 0;
+            meanY[k] += y;
+            numY[k]++;
+            }
+
+        /* transfer these points to the overlay */
+        for (i=0; i<screenWidth; i++)
+            {
+            if (numY[i] > 0)
+                {
+                k = (int) ((((meanY[i] / numY[i]) - minY)/ (maxY - minY)) * screenHeight);
+                if (k < 0)
+                    k = 0;
+                else if (k >= screenHeight)
+                    k = screenHeight - 1;
+                if (plotSymbol[k][i] == ' ')
+                    {
+                    if (n <= 8)
+                        plotSymbol[k][i] = '1' + n;
+                    else
+                        plotSymbol[k][i] = 'x';
+                    }
+                else
+                    plotSymbol[k][i] = '*';
+                }
+            }
+        } /* next run */
+
+    /* now print the overlay plot */
+    MrBayesPrint ("\n%s   +", spacer);
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("+ %1.2lf\n", maxY);
+    for (i=screenHeight-1; i>=0; i--)
+        {
+        MrBayesPrint ("%s   |", spacer);
+        for (j=0; j<screenWidth; j++)
+            {
+            MrBayesPrint ("%c", plotSymbol[i][j]);
+            }
+        MrBayesPrint ("|\n");
+        }
+    MrBayesPrint ("%s   +", spacer);
+    for (i=0; i<screenWidth; i++)
+        {
+        if (i % (screenWidth/10) == 0 && i != 0)
+            MrBayesPrint ("+");
+        else
+            MrBayesPrint ("-");
+        }
+    MrBayesPrint ("+ %1.2lf\n", minY);
+    MrBayesPrint ("%s   ^", spacer);
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("^\n");
+    MrBayesPrint ("%s   %1.0lf", spacer, minX);
+    if ((int)minX>0)
+        width=(int)(log10(minX));
+    else if ((int)minX==0)
+        width=1;
+    else
+        width=(int)(log10(-minX))+1;
+    for (i=0; i<screenWidth-width; i++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("%1.0lf\n\n", maxX);
+
+    return (NO_ERROR);
+}
+
+
+/* PrintParamStats: Print parameter table (not model indicator params) to screen and .pstat file */
+int PrintParamStats (char *fileName, char **headerNames, int nHeaders, ParameterSample *parameterSamples, int nRuns, int nSamples)
+{
+    int     i, j, len, longestHeader, *sampleCounts=NULL;
+    static char *temp=NULL;
+    char    tempf[100];
+    Stat    theStats;
+    FILE    *fp;
+    
+    /* calculate longest header */
+    longestHeader = 9;  /* length of 'parameter' */
+    for (i=0; i<nHeaders; i++)
+        {
+        SafeStrcpy (&temp, headerNames[i]);
+        len = (int) strlen(temp);
+        for (j=0; modelIndicatorParams[j][0]!='\0'; j++)
+            if (IsSame (temp,modelIndicatorParams[j]) != DIFFERENT)
+                break;
+        if (modelIndicatorParams[j][0]!='\0')
+            continue;
+        if (!strcmp (temp, "Gen") || !strcmp (temp, "LnL") || !strcmp (temp, "LnPr"))
+            continue;
+        if (len > longestHeader)
+            longestHeader = len;
+        }
+    
+    /* open output file */
+    strncpy (tempf, fileName, 90);
+    strcat (tempf, ".pstat");
+    fp = OpenNewMBPrintFile (tempf);
+    if (!fp)
+        return ERROR;
+
+    /* print unique identifier to the output file */
+    if (strlen(stamp) > 1)
+        MrBayesPrintf (fp, "[ID: %s]\n", stamp);
+
+    /* allocate and set nSamples */
+    sampleCounts = (int *) SafeCalloc (nRuns, sizeof(int));
+    if (!sampleCounts)
+        {
+        fclose(fp);
+        return ERROR;
+        }
+    for (i=0; i<nRuns; i++)
+        sampleCounts[i] = nSamples;
+
+    /* print the header rows */
+    MrBayesPrint ("\n");
+    if (sumpParams.HPD == YES)
+        MrBayesPrint ("%s   %*c                             95%% HPD Interval\n", spacer, longestHeader, ' ');
+    else
+        MrBayesPrint ("%s   %*c                            95%% Cred. Interval\n", spacer, longestHeader, ' ');
+    MrBayesPrint ("%s   %*c                           --------------------\n", spacer, longestHeader, ' ');
+
+    if (nRuns > 1)
+        MrBayesPrint ("%s   Parameter%*c     Mean      Variance     Lower       Upper       Median    min ESS*  avg ESS    PSRF+ ", spacer, longestHeader-9, ' ');
+    else
+        MrBayesPrint ("%s   Parameter%*c     Mean      Variance     Lower       Upper       Median     ESS*", spacer, longestHeader-9, ' ');
+    MrBayesPrint ("\n");
+
+    MrBayesPrint ("%s   ", spacer);
+    for (j=0; j<longestHeader+1; j++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("---------------------------------------------------------------------");
+    if (nRuns > 1)
+        MrBayesPrint ("-------------------");
+    MrBayesPrint ("\n");
+    if (nRuns > 1)
+        MrBayesPrintf (fp, "Parameter\tMean\tVariance\tLower\tUpper\tMedian\tminESS\tavgESS\tPSRF\n");
+    else
+        MrBayesPrintf (fp, "Parameter\tMean\tVariance\tLower\tUpper\tMedian\tESS\n");
+
+    /* print table values */
+    for (i=0; i<nHeaders; i++)
+        {
+        SafeStrcpy(&temp, headerNames[i]);
+        len = (int) strlen(temp);
+        for (j=0; modelIndicatorParams[j][0]!='\0'; j++)
+            if (IsSame (temp,modelIndicatorParams[j]) != DIFFERENT)
+                break;
+        if (modelIndicatorParams[j][0]!='\0')
+            continue;
+        if (!strcmp (temp, "Gen") || !strcmp (temp, "LnL") || !strcmp (temp, "LnPr"))
+            continue;
+
+        GetSummary (parameterSamples[i].values, nRuns, sampleCounts, &theStats, sumpParams.HPD);
+        
+        MrBayesPrint ("%s   %-*s ", spacer, longestHeader, temp);
+        MrBayesPrint ("%10.6lf  %10.6lf  %10.6lf  %10.6lf  %10.6lf", theStats.mean, theStats.var, theStats.lower, theStats.upper, theStats.median);
+        MrBayesPrintf (fp, "%s", temp);
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.mean));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.var));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.lower));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.upper));
+        MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.median));
+
+        if (theStats.minESS == theStats.minESS)
+            {
+            MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.minESS));
+            MrBayesPrint ("  %8.2lf", theStats.minESS);
+            }
+        else
+            {
+            MrBayesPrint ("       NA ");
+            MrBayesPrintf (fp, "NA");
+            }
+        if (nRuns > 1)
+            {
+            if (theStats.minESS == theStats.minESS)
+                {
+                MrBayesPrint ("  %8.2lf", theStats.avrESS);
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.avrESS));
+                }
+            else
+                {
+                MrBayesPrint ("       NA ");
+                MrBayesPrintf (fp, "NA");
+                }
+            if (theStats.PSRF < 0.0)
+                {
+                MrBayesPrint ("     NA   ");
+                MrBayesPrintf (fp, "NA");
+                }
+            else
+                {
+                MrBayesPrint ("  %7.3lf", theStats.PSRF);
+                MrBayesPrintf (fp, "\t%s", MbPrintNum(theStats.PSRF));
+                }
+            }
+        MrBayesPrint ("\n");
+        MrBayesPrintf (fp, "\n");
+        }
+    MrBayesPrint ("%s   ", spacer);
+    for (j=0; j<longestHeader+1; j++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("---------------------------------------------------------------------");
+    if (nRuns > 1)
+        MrBayesPrint ("-------------------");
+    MrBayesPrint ("\n");
+    if (nRuns > 1)
+        {
+        MrBayesPrint ("%s   * Convergence diagnostic (ESS = Estimated Sample Size); min and avg values\n", spacer);
+        MrBayesPrint ("%s     correspond to minimal and average ESS among runs. \n", spacer); 
+        MrBayesPrint ("%s     ESS value below 100 may indicate that the parameter is undersampled. \n", spacer);
+        MrBayesPrint ("%s   + Convergence diagnostic (PSRF = Potential Scale Reduction Factor; Gelman\n", spacer);
+        MrBayesPrint ("%s     and Rubin, 1992) should approach 1.0 as runs converge.\n", spacer);
+        }
+    else
+        {
+        MrBayesPrint ("%s   * Convergence diagnostic (ESS = Estimated Sample Size); ESS value \n", spacer);
+        MrBayesPrint ("%s     below 100 may indicate that the parameter is undersampled. \n", spacer);
+        }
+    MrBayesPrint ("\n\n");
+
+    fclose (fp);
+    free (sampleCounts);
+    SafeFree ((void **)&temp);
+
+    return (NO_ERROR);
+}
+
+
+/* PrintPlot: Print x-y plot of log likelihood vs. generation */
+int PrintPlot (MrBFlt *xVals, MrBFlt *yVals, int numVals)
+{
+    int     i, j, k, numY[60], screenWidth, screenHeight;
+    MrBFlt  x, y, minX, maxX, minY, maxY, meanY[60], diff;
+                    
+    /* print x-y plot of log likelihood vs. generation */
+    screenWidth = 60; /* don't change this without changing numY and meanY, declared above */
+    screenHeight = 15;
+
+    /* find minX and maxX */
+    minX = xVals[0];
+    maxX = xVals[0];
+    for (i=0; i<numVals; i++)
+        {
+        x = xVals[i];
+        if (x < minX)
+            minX = x;
+        if (x > maxX)
+            maxX = x;
+        }
+
+    /* collect Y data */
+    for (i=0; i<screenWidth; i++)
+        {
+        numY[i] = 0;
+        meanY[i] = 0.0;
+        }
+    for (i=0; i<numVals; i++)
+        {
+        x = xVals[i];
+        y = yVals[i];
+        k = (int)(((x - minX) / (maxX - minX)) * screenWidth);
+        if (k >= screenWidth)
+            k = screenWidth - 1;
+        if (k < 0)
+            k = 0;
+        meanY[k] += y;
+        numY[k]++;
+        }
+
+    /* find minY and maxY */
+    minY = maxY = meanY[0] / numY[0];
+    for (i=0; i<screenWidth; i++)
+        {
+        if (meanY[i] == 0) /* with some compilers if (NaN < 1) is equal true !!! so we realy need this check*/
+            continue;
+        meanY[i] /= numY[i];
+        if (meanY[i] < minY)
+            minY = meanY[i];
+        if (meanY[i] > maxY)
+            maxY = meanY[i];
+        }
+
+    /* find difference */
+    diff = maxY - minY;
+
+    /* print plot */
+    MrBayesPrint ("\n   +");
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("+ %1.3lf\n", maxY);
+    for (j=screenHeight-1; j>=0; j--)
+        {
+        MrBayesPrint ("   |");
+        for (i=0; i<screenWidth; i++)
+            {
+            if (numY[i] > 0)
+                {
+                if ((meanY[i] > ((diff/screenHeight)*j)+minY && meanY[i] <= ((diff/screenHeight)*(j+1))+minY) ||
+                    (j == 0 && meanY[i] <= minY))
+                    MrBayesPrint ("*");
+                else
+                    MrBayesPrint (" ");
+                }
+            else
+                {
+                MrBayesPrint (" ");
+                }
+            }
+        MrBayesPrint ("|\n");
+        }
+    MrBayesPrint ("   +");
+    for (i=0; i<screenWidth; i++)
+        {
+        if (i % (screenWidth/10) == 0 && i != 0)
+            MrBayesPrint ("+");
+        else
+            MrBayesPrint ("-");
+        }
+    MrBayesPrint ("+ %1.3lf\n", minY);
+    MrBayesPrint ("   ^");
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("^\n");
+    MrBayesPrint ("   %1.0lf", minX);
+    if (minX == 0)
+        j = 1;
+    else
+        j = (int)(log10(minX)) + 1;
+    for (i=0; i<screenWidth-j; i++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("%1.0lf\n\n", maxX);
+
+    return (NO_ERROR);
+}
+
+
+void PrintPlotHeader (void)
+{
+    MrBayesPrint ("\n");
+    if (sumpParams.numRuns > 1)
+        {
+        MrBayesPrint ("%s   Below are rough plots of the generation (x-axis) versus the log   \n", spacer);
+        MrBayesPrint ("%s   probability of observing the data (y-axis). You can use these     \n", spacer);
+        MrBayesPrint ("%s   graphs to determine what the burn in for your analysis should be. \n", spacer);
+        MrBayesPrint ("%s   When the log probability starts to plateau you may be at station- \n", spacer);
+        MrBayesPrint ("%s   arity. Sample trees and parameters after the log probability      \n", spacer);
+        MrBayesPrint ("%s   plateaus. Of course, this is not a guarantee that you are at sta- \n", spacer);
+        MrBayesPrint ("%s   tionarity. Also examine the convergence diagnostics provided by   \n", spacer);
+        MrBayesPrint ("%s   the 'sump' and 'sumt' commands for all the parameters in your     \n", spacer);
+        MrBayesPrint ("%s   model. Remember that the burn in is the number of samples to dis- \n", spacer);
+        MrBayesPrint ("%s   card. There are a total of ngen / samplefreq samples taken during \n", spacer);
+        MrBayesPrint ("%s   a MCMC analysis.                                                  \n", spacer);
+        }
+    else
+        {
+        MrBayesPrint ("%s   Below is a rough plot of the generation (x-axis) versus the log   \n", spacer);
+        MrBayesPrint ("%s   probability of observing the data (y-axis). You can use this      \n", spacer);
+        MrBayesPrint ("%s   graph to determine what the burn in for your analysis should be.  \n", spacer);
+        MrBayesPrint ("%s   When the log probability starts to plateau you may be at station- \n", spacer);
+        MrBayesPrint ("%s   arity. Sample trees and parameters after the log probability      \n", spacer);
+        MrBayesPrint ("%s   plateaus. Of course, this is not a guarantee that you are at sta- \n", spacer);
+        MrBayesPrint ("%s   analysis should be. When the log probability starts to plateau    \n", spacer);
+        MrBayesPrint ("%s   tionarity. When possible, run multiple analyses starting from dif-\n", spacer);
+        MrBayesPrint ("%s   ferent random trees; if the inferences you make for independent   \n", spacer);
+        MrBayesPrint ("%s   analyses are the same, this is reasonable evidence that the chains\n", spacer);
+        MrBayesPrint ("%s   have converged. You can use MrBayes to run several independent    \n", spacer);
+        MrBayesPrint ("%s   analyses simultaneously. During such a run, MrBayes will monitor  \n", spacer);
+        MrBayesPrint ("%s   the convergence of topologies. After the run has been completed,  \n", spacer);
+        MrBayesPrint ("%s   the 'sumt' and 'sump' functions will provide additional conver-   \n", spacer);
+        MrBayesPrint ("%s   gence diagnostics for all the parameters in your model. Remember  \n", spacer);
+        MrBayesPrint ("%s   that the burn in is the number of samples to discard. There are   \n", spacer);
+        MrBayesPrint ("%s   a total of ngen / samplefreq samples taken during a MCMC analysis.\n", spacer);
+        }
+}
+
+
+/* ReadParamSamples: Read parameter samples from .p file */
+int ReadParamSamples (char *fileName, SumpFileInfo *fileInfo, ParameterSample *parameterSamples, int runNo)
+{
+    char    sumpToken[CMD_STRING_LENGTH], *s=NULL, *p;
+    int     inSumpComment, lineNum, numLinesRead, numLinesToRead, column, lastTokenWasDash,
+            tokenType;
+    MrBFlt  tempD;
+    FILE    *fp;
+
+    /* open file */
+    if ((fp = OpenTextFileR (fileName)) == NULL)
+        return ERROR;
+
+    /* allocate space for reading lines */
+    s = (char *) SafeCalloc (fileInfo->longestLineLength + 10, sizeof(char));
+
+    /* fast forward to beginning of last unburned parameter line. */
+    for (lineNum=0; lineNum<fileInfo->firstParamLine; lineNum++)
+      if (fgets (s, fileInfo->longestLineLength + 5, fp) == 0)
+          goto errorExit;
+
+    /* parse file, line-by-line. We are only parsing lines that have digits that should be read. */
+    inSumpComment = NO;
+    numLinesToRead = fileInfo->numRows;
+    numLinesRead = 0;
+    while (fgets (s, fileInfo->longestLineLength + 1, fp) != NULL)
+        {
+        lastTokenWasDash = NO;
+        column = 0;
+        p = s;
+        do {
+            if (GetToken (sumpToken, &tokenType, &p))
+                goto errorExit;
+            if (IsSame("[", sumpToken) == SAME)
+                inSumpComment = YES;
+            if (IsSame("]", sumpToken) == SAME)
+                inSumpComment = NO;
+            if (inSumpComment == NO)
+                {
+                if (tokenType == NUMBER)
+                    {
+                    /* read the number */
+                    if (column >= fileInfo->numColumns)
+                        {
+                        MrBayesPrint ("%s   Too many values read on line %d of file %s\n", spacer, lineNum, fileName);
+                        goto errorExit;
+                        }
+                    sscanf (sumpToken, "%lf", &tempD);
+                    if (lastTokenWasDash == YES)
+                        tempD *= -1.0;
+                    parameterSamples[column].values[runNo][numLinesRead] = tempD;
+                    column++;
+                    lastTokenWasDash = NO;
+                    }
+                else if (tokenType == DASH)
+                    {
+                    lastTokenWasDash = YES;
+                    }
+                else if (tokenType != UNKNOWN_TOKEN_TYPE)
+                    {
+                    /* we have a problem */
+                    MrBayesPrint ("%s   Line %d of file %s has non-digit characters\n", spacer, lineNum, fileName);
+                    goto errorExit;
+                    }
+                }
+            } while (*sumpToken);
+
+        lineNum++;
+        if (column == fileInfo->numColumns)
+            numLinesRead++;
+        else if (column != 0)
+            {
+            MrBayesPrint ("%s   Too few values on line %d of file %s\n", spacer, lineNum, fileName);
+            goto errorExit;
+            }
+        }
+
+        
+    /* Check how many parameter line was read in. */
+    if (numLinesRead != numLinesToRead)
+        {
+        MrBayesPrint ("%s   Unable to read all lines that should contain parameter samples\n", spacer);
+        goto errorExit;
+        }
+
+    fclose (fp);
+    free (s);
+
+    return (NO_ERROR);
+
+errorExit:
+
+    fclose (fp);
+    free (s);
+
+    return ERROR;
+}
+
+
+/* the following are moved from sumt.c to combine with sump.c */
+PartCtr *AddSumtPartition (PartCtr *r, PolyTree *t, PolyNode *p, int runId)
+{
+    int     i, n, comp, nLongsNeeded = sumtParams.BitsLongsNeeded;
+    
+    if (r == NULL)
+        {
+        /* new partition */
+        /* create a new node */
+        r = AllocPartCtr ();
+        if (r == NULL)
+            return NULL;
+        numUniqueSplitsFound++;
+        for (i=0; i<nLongsNeeded; i++)
+            r->partition[i] = p->partition[i];
+        for (i=0; i<sumtParams.numRuns; i++)
+            r->count[i] = 0;
+        r->left = r->right = NULL;
+        /* record values */
+        if (sumtParams.brlensDef == YES)
+            r->length[runId][0]= p->length;
+        if (sumtParams.isClock == YES)
+            r->height[runId][0]= p->depth;
+        if (sumtParams.isCalibrated == YES)
+            r->age[runId][0]= p->age;
+        for (i=0; i<sumtParams.nESets; i++)
+            r->nEvents[i][runId][0] = t->nEvents[i][p->index];
+        for (i=0; i<sumtParams.nBSets; i++)
+            {
+            r->bLen [i][runId][0] = t->effectiveBrLen[i][p->index];
+            r->bRate[i][runId][0] = t->effectiveBrLen[i][p->index] / p->length;
+            }
+        if (t->popSizeSet == YES)
+            r->popSize[runId][0] = t->popSize[p->index];
+        r->count[runId] ++;
+        r->totCount++;
+        }
+    else
+        {
+        for (i=0; i<nLongsNeeded; i++)
+            {
+            if (r->partition[i] != p->partition[i])
+                break;
+            }
+        
+        if (i == nLongsNeeded)
+            comp = 0;
+        else if (r->partition[i] < p->partition[i])
+            comp = -1;
+        else
+            comp = 1;
+        
+        if (comp == 0)          /* repeated partition */
+            {
+            n = r->count[runId];
+            /* check if we need to allocate more space */
+            if (n % ALLOC_LEN == 0)
+                {
+                /* allocate more space */
+                if (sumtParams.brlensDef == YES)
+                    r->length[runId] = (MrBFlt *) SafeRealloc ((void *)r->length[runId], ((size_t)n+ALLOC_LEN)*sizeof(MrBFlt));
+                if (sumtParams.isClock == YES)
+                    r->height[runId] = (MrBFlt *) SafeRealloc ((void *)r->height[runId], ((size_t)n+ALLOC_LEN)*sizeof(MrBFlt));
+                if (sumtParams.isCalibrated == YES)
+                    r->age[runId] = (MrBFlt *) SafeRealloc ((void *)r->age[runId], ((size_t)n+ALLOC_LEN)*sizeof(MrBFlt));
+                if (sumtParams.nESets > 0)
+                    {
+                    for (i=0; i<sumtParams.nESets; i++)
+                        r->nEvents[i][runId] = (int *) SafeRealloc ((void *)r->nEvents[i][runId], ((size_t)n+ALLOC_LEN)*sizeof(int));
+                    }
+                if (sumtParams.nBSets > 0)
+                    {
+                    for (i=0; i<sumtParams.nBSets; i++)
+                        {
+                        r->bRate[i][runId]   = (MrBFlt *) SafeRealloc ((void *)r->bRate[i][runId], ((size_t)n+ALLOC_LEN)*sizeof(MrBFlt));
+                        r->bLen [i][runId]   = (MrBFlt *) SafeRealloc ((void *)r->bLen [i][runId], ((size_t)n+ALLOC_LEN)*sizeof(MrBFlt));
+                        }
+                    }
+                if (sumtParams.popSizeSet == YES)
+                    r->popSize[runId] = (MrBFlt *) SafeRealloc ((void *)r->popSize[runId], ((size_t)n+ALLOC_LEN)*sizeof(MrBFlt));
+                }
+            /* record values */
+            r->count[runId]++;
+            r->totCount++;
+            if (sumtParams.brlensDef == YES)
+                r->length[runId][n]= p->length;
+            if (sumtParams.isClock == YES)
+                r->height[runId][n]= p->depth;
+            if (sumtParams.isCalibrated == YES)
+                r->age[runId][n]= p->age;
+            if (sumtParams.nESets > 0)
+                {
+                for (i=0; i<sumtParams.nESets; i++)
+                    r->nEvents[i][runId][n] = t->nEvents[i][p->index];
+                }
+            if (sumtParams.nBSets > 0)
+                {
+                for (i=0; i<sumtParams.nBSets; i++)
+                    {
+                    r->bLen [i][runId][n]   = t->effectiveBrLen[i][p->index];
+                    r->bRate[i][runId][n]   = t->effectiveBrLen[i][p->index] / p->length;
+                    }
+                }
+            if (sumtParams.popSizeSet == YES)
+                r->popSize[runId][n] = t->popSize[p->index];
+            }
+        else if (comp < 0)      /* greater than -> into left subtree */
+            {
+            if ((r->left = AddSumtPartition (r->left, t, p, runId)) == NULL)
+                {
+                FreePartCtr (r);
+                return NULL;
+                }
+            }
+        else
+            {
+            /* smaller than -> into right subtree */
+            if ((r->right = AddSumtPartition (r->right, t, p, runId)) == NULL)
+                {
+                FreePartCtr (r);
+                return NULL;
+                }
+            }
+        }
+
+    return r;
+}
+
+
+TreeCtr *AddSumtTree (TreeCtr *r, int *order)
+{
+    int     i, comp;
+
+    if (r == NULL)
+        {
+        /* new tree */
+        /* create a new node */
+        r = AllocTreeCtr();
+        if (!r)
+            return NULL;
+        numUniqueTreesFound++;
+        for (i=0; i<sumtParams.orderLen; i++)
+            r->order[i] = order[i];
+        r->count = 1;
+        }
+    else
+        {
+        for (i=0; i<sumtParams.orderLen; i++)
+            if (r->order[i] != order[i])
+                break;
+        
+        if (i==sumtParams.orderLen)
+            comp = 0;
+        else if (order[i] < r->order[i])
+            comp = 1;
+        else
+            comp = -1;
+        
+        if (comp == 0)          /* repeated partition */
+            r->count++;
+        else if (comp < 0)      /* greater than -> into left subtree */
+            {
+            if ((r->left = AddSumtTree (r->left, order)) == NULL)
+                {
+                FreeTreeCtr (r);
+                return NULL;
+                }
+            }
+        else
+            {
+            /* smaller than -> into right subtree */
+            if ((r->right = AddSumtTree (r->right, order)) == NULL)
+                {
+                FreeTreeCtr (r);
+                return NULL;
+                }
+            }
+        }
+
+    return r;
+}
+
+
+/* AllocPartCtr: Allocate space for one partition counter node using info in sumtParams */
+PartCtr *AllocPartCtr ()
+{
+    int             i, j;
+    PartCtr         *r;
+    
+    /* allocate basic stuff */
+    r = (PartCtr *) SafeCalloc (1, sizeof(PartCtr));
+    r->left = r->right = NULL;
+    r->partition = (BitsLong *) SafeCalloc ((size_t)(sumtParams.BitsLongsNeeded), sizeof(BitsLong));
+    r->count = (int *) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof (int));
+    if (sumtParams.brlensDef)
+        {
+        r->length = (MrBFlt **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof (MrBFlt *));
+        for (i=0; i<sumtParams.numRuns; i++)
+            r->length[i] = (MrBFlt *) SafeCalloc ((size_t)ALLOC_LEN, sizeof(MrBFlt));
+        }
+    if (sumtParams.isClock)
+        {
+        r->height = (MrBFlt **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof (MrBFlt *));
+        for (i=0; i<sumtParams.numRuns; i++)
+            r->height[i] = (MrBFlt *) SafeCalloc ((size_t)ALLOC_LEN, sizeof(MrBFlt));
+        r->age = (MrBFlt **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof (MrBFlt *));
+        for (i=0; i<sumtParams.numRuns; i++)
+            r->age[i] = (MrBFlt *) SafeCalloc ((size_t)ALLOC_LEN, sizeof(MrBFlt));
+        }
+
+    /* allocate relaxed clock parameters: eRate, nEvents, bRate */
+    if (sumtParams.nESets > 0)
+        r->nEvents = (int    ***) SafeCalloc ((size_t)(sumtParams.nESets), sizeof(int **));
+    for (i=0; i<sumtParams.nESets; i++)
+        {
+        r->nEvents[i] = (int    **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof(int *));
+        for (j=0; j<sumtParams.numRuns; j++)
+            r->nEvents[i][j] = (int    *) SafeCalloc ((size_t) ALLOC_LEN, sizeof(int));
+        }
+    if (sumtParams.nBSets > 0)
+        {
+        r->bLen  = (MrBFlt ***) SafeCalloc ((size_t)(sumtParams.nBSets), sizeof(MrBFlt **));
+        r->bRate = (MrBFlt ***) SafeCalloc ((size_t)(sumtParams.nBSets), sizeof(MrBFlt **));
+        }
+    for (i=0; i<sumtParams.nBSets; i++)
+        {
+        r->bLen[i]    = (MrBFlt **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof(MrBFlt *));
+        r->bRate[i]   = (MrBFlt **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof(MrBFlt *));
+        for (j=0; j<sumtParams.numRuns; j++)
+            {
+            r->bLen[i][j]    = (MrBFlt *) SafeCalloc ((size_t)ALLOC_LEN, sizeof(MrBFlt));
+            r->bRate[i][j]   = (MrBFlt *) SafeCalloc ((size_t)ALLOC_LEN, sizeof(MrBFlt));
+            }
+        }
+    if (sumtParams.popSizeSet == YES)
+        {
+        r->popSize = (MrBFlt **) SafeCalloc ((size_t)(sumtParams.numRuns), sizeof (MrBFlt *));
+        for (i=0; i<sumtParams.numRuns; i++)
+            r->popSize[i] = (MrBFlt *) SafeCalloc ((size_t)ALLOC_LEN, sizeof(MrBFlt));
+        }
+
+    return r;
+}
+
+
+/* AllocTreeCtr: Allocate space for a tree counter node using info in sumtParams struct*/
+TreeCtr *AllocTreeCtr ()
+{
+    TreeCtr     *r;
+
+    r = (TreeCtr *) SafeCalloc (1, sizeof(TreeCtr));
+    
+    r->left = r->right = NULL;
+    
+    r->order = (int *) SafeCalloc ((size_t)(sumtParams.orderLen), sizeof(int));
+
+    return r;
+}
+
+
+void CalculateTreeToTreeDistance (Tree *tree1, Tree *tree2, MrBFlt *d1, MrBFlt *d2, MrBFlt *d3)
+{
+    int         i, j, k;
+    MrBFlt      treeLen1=0.0, treeLen2=0.0;
+    TreeNode    *p, *q=NULL;
+    
+    (*d1) = (*d2) = (*d3) = 0.0;
+
+    /* set distance-based measures to max value */
+    if (sumtParams.brlensDef == YES)
+        {
+        treeLen1 = TreeLen(tree1);
+        treeLen2 = TreeLen(tree2);
+        (*d2) = treeLen1 + treeLen2;
+        (*d3) = 2.0;
+        }
+
+    /* now we can get distances in a single pass */
+    for (i=0; i<tree1->nNodes; i++)
+        {
+        p = tree1->allDownPass[i];
+        for (j=0; j<tree2->nNodes; j++)
+            {
+            q = tree2->allDownPass[j];
+            for (k=0; k<sumtParams.BitsLongsNeeded; k++)
+                if (p->partition[k] != q->partition[k])
+                    break;
+            if (k == sumtParams.BitsLongsNeeded)
+                break;
+            }
+        if (j < tree2->nNodes)
+            {
+            /* match */
+            if (sumtParams.brlensDef == YES)
+                {
+                (*d2) -= (p->length + q->length - fabs(p->length - q->length));
+                (*d3) -= (p->length/treeLen1 + q->length/treeLen2 - fabs(p->length/treeLen1 - q->length/treeLen2));
+                }
+            }
+        else /* if (k < sumtParams.BitsLongsNeeded) */
+            {
+            /* no match */
+            (*d1) += 2.0;
+            }
+        }
+
+#   if 0        
+    printf ("DISTANCES: %lf %lf %lf (%lf %lf)\n", *d1, *d2, *d3, tl1, tl2);
+    for (i=0; i<nnds; i++)
+        {
+        printf ("%4d -- %4d (%lf) %4d (%lf)\n", i, list1[i], lengths1[i], list2[i], lengths2[i]);
+        }
+#   endif
+}
+
+
+/* ConTree: Construct consensus tree */
+int ConTree (PartCtr **treeParts, int numTreeParts)
+{
+    int         i, j, targetNode, nBits, isCompat, numTerminalsEncountered;
+    BitsLong    x, *partition = NULL, bitsLongOne;
+    MrBFlt      freq, freqInterapted=0;
+    PolyTree    *t, *t2=NULL;
+    PolyNode    *p, *q, *r, *ql, *pl;
+    PartCtr     *part;
+    Stat        theStats;
+    int         isFirstLoop=1, isInterapted=0;
+    
+    /* we use a BitsLong variable set to one to escape dependence on interpretation of constant (signed?) int/long '1L' */
+    bitsLongOne = 1;
+    
+    /* check that we have at least three species */
+    if (sumtParams.numTaxa < 3)
+        {
+        MrBayesPrint ("%s   Too few taxa included to show consensus trees\n", spacer);
+        return ERROR;
+        }
+    
+treeConstruction:
+    /* now, make a consensus tree */
+    /* first allocate and initialize consensus tree */
+    t = AllocatePolyTree(sumtParams.numTaxa);
+    if (!t)
+        {
+        MrBayesPrint ("%s   Could not allocate consensus tree\n", spacer);
+        return(ERROR);
+        }
+    t->isRooted = sumtParams.isRooted;
+    t->isClock = sumtParams.isClock;
+    t->isRelaxed = sumtParams.isRelaxed;
+
+    /* initialize consensus tree nodes */
+    for (i=0; i<sumtParams.numTaxa; i++)
+        {
+        t->nodes[i].left = NULL;
+        t->nodes[i].sib = NULL;
+        t->nodes[i].index = i;
+        t->nodes[i].partitionIndex = -1;     /* partition ID */
+        t->nodes[i].age = 0.0;              /* temporally set to minimum value to allow any insertion in front of the terminal before actual
+                                               values of age and depth are available */
+        strcpy(t->nodes[i].label, sumtParams.taxaNames[i]);
+        t->nodes[i].depth = 0.0;
+        }
+    for (; i<t->memNodes; i++)
+        {
+        t->nodes[i].left = NULL;
+        t->nodes[i].sib = NULL;
+        t->nodes[i].index = i;
+        t->nodes[i].partitionIndex = -1;     /* partition ID */
+        strcpy (t->nodes[i].label, "");
+        }
+
+    /* create bush 
+       ->x counts number of subtended terminals 
+       make sure t->root->left is in outgroup */
+    p = t->root = &t->nodes[sumtParams.numTaxa];
+    p->anc = p->sib = NULL;
+    p->x = sumtParams.numTaxa;
+    p->age = MRBFLT_MAX; /* temporarily set to maximum value to allow any insertion in front of the root before actual values of age and depth are available */
+    p->depth = MRBFLT_MAX;
+    j = localOutGroup;
+    q = &t->nodes[j];
+    p->left = q;
+    q->anc = p;
+    q->x = 1;
+    for (i=0; i<sumtParams.numTaxa; i++)
+        {
+        if (i != j)
+            {
+            q->sib = &t->nodes[i];
+            q = q->sib;
+            q->anc = p;
+            q->x = 1;
+            }
+        }
+    q->sib = NULL;
+
+    /* Resolve bush according to partitions.
+       Partitions may include incompatible ones.
+       Partitions must be sorted from most frequent to least frequent 
+       for quit test to work when a 50% majority rule tree is requested
+       and in general for consensus tree to be correct. */
+    t->nNodes = sumtParams.numTaxa + 1;
+    t->nIntNodes = 1;
+    if (sumtParams.isRooted == YES)
+        targetNode = 2 * sumtParams.numTaxa - 2;
+    else
+        targetNode = 2 * sumtParams.numTaxa - 3;
+
+    numTerminalsEncountered = 0;
+    for (i=0; i<numUniqueSplitsFound; i++)
+        {
+        /* get partition */
+        part = treeParts[i];
+
+        /* calculate frequency and test if time to quit */
+        if (t->nNodes > targetNode && numTerminalsEncountered == sumtParams.numTaxa)
+            break;
+        freq = (MrBFlt)(part->totCount) / (MrBFlt)(sumtParams.numTreesSampled);
+        if (freq < 0.50 && !strcmp(sumtParams.sumtConType, "Halfcompat"))
+            break;
+        
+        /* get partition */
+        partition = part->partition;
+
+        /* count bits in this partition */
+        for (j=nBits=0; j<sumtParams.BitsLongsNeeded; j++)
+            {
+            x = partition[j];
+            for (x = partition[j]; x != 0; x &= (x - 1))
+                nBits++;
+            }
+
+        /* find out if this is an informative partition */
+        if (nBits == sumtParams.numTaxa || nBits == 0)
+            {
+            /* this is the root (for setting age of root node when tree is dated) */
+            q = t->root;
+            q->partitionIndex = i;
+            if (sumtParams.isClock == YES)
+                {
+                GetSummary(part->height, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+                q->depth = theStats.median;
+                for (p = q->left; p!=NULL; p = p->sib)
+                    {
+                    if (q->depth <= p->depth)
+                        break;
+                    }
+                assert (p==NULL); /* Root always has 100% freq and it should be older than any other node that has 100% freq. */
+                }
+            if (sumtParams.isCalibrated == YES)
+                {
+                GetSummary(part->age, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+                q->age = theStats.median;
+                for (p = q->left; p!=NULL; p = p->sib)
+                    {
+                    if (q->age <= p->age)
+                        break;
+                    }
+                assert (p==NULL); /* Root always has 100% freq and it should be older than any other node that has 100% freq. */
+                }
+            }
+        else if (nBits > 1 && !(nBits == sumtParams.numTaxa - 1 && sumtParams.isRooted == NO))
+            {
+            /* this is an informative partition */
+            /* find anc of partition */
+            j = FirstTaxonInPartition (partition, sumtParams.BitsLongsNeeded);
+            for (p = &t->nodes[j]; p!=NULL; p = p->anc)
+                if (p->x > nBits)
+                    break;
+                    
+            /* do not include if incompatible with ancestor or any of descendants
+               do not check terminals or root because it is
+               redundant and partitions have not necessarily been set for those */
+            isCompat = YES;
+            if (p->anc != NULL && IsPartNested(partition, p->partition, sumtParams.BitsLongsNeeded)==NO)
+                isCompat = NO;
+            else 
+                {
+                for (q=p->left; q!=NULL; q=q->sib)
+                    {
+                    if (q->x > 1 && IsPartCompatible(q->partition, partition, sumtParams.BitsLongsNeeded)==NO)
+                        break;
+                    }
+                if (q!=NULL)
+                    isCompat = NO;
+                }
+
+            if (isCompat == NO)
+                continue;
+
+            /* set new node */
+            q = &t->nodes[t->nNodes];
+            q->partitionIndex = i;
+            q->x = nBits;
+            q->partition = partition;
+            GetSummary(part->length, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+            q->support = freq;
+            q->length = theStats.median;
+            r=NULL;
+            if (sumtParams.isClock == YES)
+                {
+                GetSummary(part->height, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+                q->depth = theStats.median;
+                if (freq < 1.00)
+                    {
+                    for (r = p->left; r!=NULL; r = r->sib)
+                        {
+                        if (IsPartNested(r->partition, partition, sumtParams.BitsLongsNeeded) &&  r->depth >= q->depth)
+                            break; /* child is older then the node we try to add. Not good.*/
+                        }
+                    if (p->depth <= q->depth)
+                        {      /* New node older than the parent. Not good.*/
+                        r = p; /* Just to make r!=NULL*/
+                        }
+                    }
+                }
+            if (sumtParams.isCalibrated == YES)
+                {
+                GetSummary(part->age, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+                q->age = theStats.median;
+                if (freq < 1.00)
+                    {
+                    for (r = p->left; r!=NULL; r = r->sib)
+                        {
+                        if (freq < 1.00 && IsPartNested(r->partition, partition, sumtParams.BitsLongsNeeded) && r->age >= q->age)
+                            break; /* child is older then the node we try to add. Not good.*/
+                        }
+                    if (p->age <= q->age)
+                        {      /* New node older than the parent. Not good.*/
+                        r = p; /* Just to make r!=NULL*/
+                        }
+                    }
+                }
+
+            if (r!=NULL && isFirstLoop)
+                {
+                 /* cancel the addition of the new node*/
+                isInterapted =1;
+                freqInterapted=freq;
+                break; /* Finish creating the polytree */
+                }
+            t->nNodes++;
+            t->nIntNodes++;
+
+            /* go through descendants of anc */
+            ql = pl = NULL;
+            for (r=p->left; r!=NULL; r=r ->sib)
+                {
+                /* test if r is in the new partition or not */
+                if ((r->x > 1 && IsPartNested(r->partition, partition, sumtParams.BitsLongsNeeded)) || (r->x == 1 && (partition[r->index / nBitsInALong] & (bitsLongOne << (r->index % nBitsInALong))) != 0))
+                    {
+                    /* r is in the partition */
+                    if (ql == NULL)
+                        q->left = r;
+                    else
+                        ql->sib = r;
+                    ql = r;
+                    r->anc = q;
+                    }
+                else
+                    {
+                    /* r is not in the partition */
+                    if (pl == NULL)
+                        p->left = r;
+                    else
+                        pl->sib = r;
+                    pl = r;
+                    }
+                }
+            /* terminate new sib-node chain */
+            ql->sib = NULL;
+            /* new node is last in old sib-node chain */
+            pl->sib = q;
+            q->sib = NULL;
+            q->anc = p;
+            }
+        else
+            /* singleton partition */
+            {
+            if (nBits == sumtParams.numTaxa - 1)
+                j = localOutGroup;
+            else
+                j = FirstTaxonInPartition(partition, sumtParams.BitsLongsNeeded); /* nbits == 1 */
+            q = &t->nodes[j];
+            q->partitionIndex = i;
+            q->partition = partition;
+            numTerminalsEncountered++;
+            GetSummary(part->length, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+            q->length = theStats.median;
+            if (sumtParams.isClock == YES)
+                {
+                GetSummary(part->height, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+                q->depth = theStats.median;
+                if (q->anc->depth < q->depth)
+                    {
+                    /* We never should get here because terminals always have 100% freq and they are younger than any other node that has 100% freq. */
+                    /* We should be careful with the trees with 0-brl generated under the fossilized birth-death prior! (<= is changed to <) */
+                    assert (0);
+                    }
+                }
+            if (sumtParams.isCalibrated == YES)
+                {
+                GetSummary(part->age, sumtParams.numRuns, part->count, &theStats, sumtParams.HPD);
+                q->age = theStats.median;
+                if (q->anc->age < q->age)
+                    {
+                    /* We never should get here because terminals always have 100% freq and they are younger than any other node that has 100% freq. */
+                    /* We should be careful with the trees with 0-brl generated under the fossilized birth-death prior! (<= is changed to <) */
+                    assert (0);
+                    }
+                }
+            }
+        }
+
+    if (isFirstLoop)
+        {
+        t2 = t;
+        if (isInterapted)
+            {
+            isFirstLoop = 0;
+            goto treeConstruction;
+            }
+        }
+
+    /* get downpass arrays */
+    GetPolyDownPass(t);
+
+    /* order tips */
+    if (sumtParams.orderTaxa == YES)
+        OrderTips (t);
+
+    if (t!=t2)
+        {
+        /* get downpass arrays */
+        GetPolyDownPass(t2);
+
+        /* order tips */
+        if (sumtParams.orderTaxa == YES)
+            OrderTips (t2);
+        }
+        
+    /* draw tree to stdout and fp */
+    MrBayesPrint ("\n%s   Clade credibility values:\n\n", spacer);
+    ShowConTree (stdout, t, 80, YES);
+    if (logToFile == YES)
+        ShowConTree (logFileFp, t, 80, YES);
+    if (sumtParams.brlensDef == YES)
+        {
+        MrBayesPrint ("\n");
+        if (sumtParams.isClock == YES)
+            MrBayesPrint ("%s   Phylogram (based on median node depths):\n", spacer);
+        else
+            MrBayesPrint ("%s   Phylogram (based on average branch lengths):\n", spacer);
+        if (isInterapted)
+            {
+            MrBayesPrint ("%s   Warning. Phylogram containing all nodes with credibility values exceeding\n",spacer);
+            MrBayesPrint ("%s   the level set by Contype could not be constructed.\n",spacer);
+            MrBayesPrint ("%s   Only nodes with credibility values exceeding %.2f%% (percentage of trees\n", spacer, freqInterapted*100);
+            MrBayesPrint ("%s   where the node is present) were included in the phylogram.\n", spacer);
+            }
+        MrBayesPrint ("\n");
+        ShowConPhylogram (stdout, t2, 80);
+        if (logToFile == YES)
+            ShowConPhylogram (logFileFp, t2, 80);
+        }
+
+    /* print taxa block */
+    MrBayesPrintf (fpCon, "begin taxa;\n");
+    MrBayesPrintf (fpCon, "\tdimensions ntax=%d;\n", sumtParams.numTaxa);
+    MrBayesPrintf (fpCon, "\ttaxlabels\n", sumtParams.numTaxa);
+    for (i=0; i<sumtParams.numTaxa; i++)
+        {
+        for (j=0; j<t2->nNodes; j++)
+            if (t2->nodes[j].index == i)
+                break;
+        MrBayesPrintf (fpCon, "\t\t%s\n", t2->nodes[j].label);
+        }
+    MrBayesPrintf (fpCon, "\t\t;\nend;\n");
+    
+    MrBayesPrintf (fpCon, "begin trees;\n");
+    MrBayesPrintf (fpCon, "\ttranslate\n");
+    for (i=0; i<sumtParams.numTaxa; i++)
+        {
+        for (j=0; j<t2->nNodes; j++)
+            if (t2->nodes[j].index == i)
+                break;
+        if (i == sumtParams.numTaxa-1)
+            MrBayesPrintf (fpCon, "\t\t%d\t%s\n", t2->nodes[i].index+1, t2->nodes[i].label);
+        else
+            MrBayesPrintf (fpCon, "\t\t%d\t%s,\n", t2->nodes[i].index+1, t2->nodes[i].label);
+        }
+    MrBayesPrintf (fpCon, "\t\t;\n");
+    if (sumtParams.consensusFormat == SIMPLE)
+        PrintConTree(fpCon, t2);
+    else if (sumtParams.consensusFormat == FIGTREE)
+        PrintFigTreeConTree(fpCon, t2, treeParts);
+    MrBayesPrintf (fpCon, "end;\n");
+
+    if (t!=t2)
+        {
+        FreePolyTree (t2);
+        }
+    /* free memory */
+    FreePolyTree (t);
+
+    return (NO_ERROR);
+    MrBayesPrint ("%d", numTreeParts); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+MrBFlt CppEvolRate (PolyTree *t, PolyNode *p, int eSet)
+{
+    int         i, nEvents;
+    MrBFlt      ancRate, branchRate, *rate, *pos;
+    PolyNode    *q;
+
+    nEvents = t->nEvents[eSet][p->index];
+    pos = t->position[eSet][p->index];
+    rate = t->rateMult[eSet][p->index];
+
+    /* note that event positions are from top of branch (more recent, descendant tip) */
+    ancRate = 1.0;
+//  if (t->eType[eSet] == CPPm)
+//      {
+    for (q=p; q->anc != NULL; q=q->anc)
+        {
+        for (i=0; i<t->nEvents[eSet][p->index]; i++)
+            ancRate *= t->rateMult[eSet][p->index][i];
+        }
+    if (nEvents > 0)
+        {
+        branchRate = rate[0] * pos[0];
+        for (i=1; i<nEvents; i++)
+            {
+            branchRate += (pos[i] - pos[i-1]);
+            branchRate *= rate[i];
+            }
+        branchRate += 1.0 - pos[nEvents-1];
+        branchRate *= ancRate;
+        }
+    else
+        branchRate = ancRate;
+//      }
+/*
+    else if (t->eType[eSet] == CPPi)
+        {
+        for (q=p; q->anc != NULL; q=q->anc)
+            {
+            if (t->nEvents[eSet][p->index]>0)
+                {
+                ancRate = t->rateMult[eSet][p->index][0];
+                break;
+                }
+            }
+        if (nEvents > 0)
+            {
+            branchRate = ancRate * (1.0 - pos[nEvents-1]);
+            for (i=nEvents-2; i>=0; i--)
+                {
+                branchRate += (rate[i+1] * (pos[i+1] - pos[i]));
+                }
+            branchRate += (rate[0] * pos[0]);
+            }
+        else
+            branchRate = ancRate;
+        }
+*/
+
+    return branchRate;
+}
+
+
+int DoCompareTree (void)
+{
+    int             i, j, k, n, longestLineLength, brlensDef[2], numTreesInLastBlock[2],
+                    lastTreeBlockBegin[2], lastTreeBlockEnd[2], xaxis, yaxis, starHolder[80],
+                    minNumTrees, screenWidth, screenHeigth, numY[60], nSamples;
+    RandLong        temporarySeed;
+    BitsLong        *mask;
+    PartCtr         *x;
+    MrBFlt          xProb, yProb, xInc, yInc, xUpper, xLower, yUpper, yLower, *dT1=NULL, *dT2=NULL, *dT3=NULL, d1, d2, d3, 
+                    meanY[60], xVal, yVal, minX, minY, maxX, maxY, sums[3];
+    char            *s=NULL, prCh, treeName[2][100];
+    FILE            *fp;
+    time_t          curTime;
+    PartCtr         **treeParts=NULL;
+    Tree            *tree1=NULL, *tree2=NULL;
+    SumtFileInfo    sumtFileInfo;
+    
+#   if defined (MPI_ENABLED)
+    if (proc_id == 0)
+        {
+#   endif
+
+    /* Make sure we read trees using DoSumtTree() code instead of with the user tree code */
+    inComparetreeCommand = YES;
+
+    /* set file pointer to NULL */
+    fp = NULL;
+
+    strcpy(treeName[0],"tree"); //in case if parameter is not specified in a .t file
+    strcpy(treeName[1],"tree");
+
+    /* Check that a data set has been read in. We check taxon names against
+       those read in. */
+    if (isTaxsetDef == NO)
+        {
+        MrBayesPrint ("%s   A matrix or set of taxon labels must be specified before comparetree can be used\n", spacer);
+        goto errorExit;
+        }
+
+    /* open output files for summary information (two files); check if we want to overwrite previous results */
+    if (OpenComptFiles () == ERROR)
+        goto errorExit;
+
+    MrBayesPrint ("%s   Examining files ...\n", spacer);
+
+    /* Examine first file */
+    if (ExamineSumtFile(comptreeParams.comptFileName1, &sumtFileInfo, treeName[0], &(brlensDef[0])) == ERROR)
+        return ERROR;
+
+    /* Capture info */
+    longestLineLength      = sumtFileInfo.longestLineLength;
+    numTreesInLastBlock[0] = sumtFileInfo.numTreesInLastBlock;
+    lastTreeBlockBegin[0]  = sumtFileInfo.lastTreeBlockBegin;
+    lastTreeBlockEnd[0]    = sumtFileInfo.lastTreeBlockEnd;
+
+    /* Examine second file */
+    if (ExamineSumtFile(comptreeParams.comptFileName2, &sumtFileInfo, treeName[1], &brlensDef[1]) == ERROR)
+        return ERROR;
+
+    /* Capture info */
+    if (longestLineLength < sumtFileInfo.longestLineLength)
+        longestLineLength = sumtFileInfo.longestLineLength;
+    numTreesInLastBlock[1] = sumtFileInfo.numTreesInLastBlock;
+    lastTreeBlockBegin[1]  = sumtFileInfo.lastTreeBlockBegin;
+    lastTreeBlockEnd[1]    = sumtFileInfo.lastTreeBlockEnd;
+
+    /* Check whether we should work with brlens */
+    if (brlensDef[0] == YES && brlensDef[1] == YES)
+        sumtParams.brlensDef = YES;
+    else
+        sumtParams.brlensDef = NO;
+    
+    /* Allocate space for command string */
+    longestLineLength += 10;
+    s = (char *)SafeMalloc((size_t)longestLineLength * sizeof(char));
+    if (!s)
+        {
+        MrBayesPrint ("%s   Problem allocating string for reading tree file\n", spacer);
+        goto errorExit;
+        }
+
+    /* Allocate space for packed trees */
+    if (chainParams.relativeBurnin == YES)
+        {
+        numPackedTrees[0] = numTreesInLastBlock[0] - (int)(chainParams.burninFraction * numTreesInLastBlock[0]);
+        numPackedTrees[1] = numTreesInLastBlock[1] - (int)(chainParams.burninFraction * numTreesInLastBlock[1]);
+        }
+    else
+        {
+        numPackedTrees[0] = numTreesInLastBlock[0] - chainParams.chainBurnIn;
+        numPackedTrees[1] = numTreesInLastBlock[1] - chainParams.chainBurnIn;
+        }
+    if (memAllocs[ALLOC_PACKEDTREES] == YES)
+        {
+        MrBayesPrint ("%s   packedTreeList is already allocated\n", spacer);
+        goto errorExit;
+        }
+    packedTreeList[0] = (PackedTree *) SafeCalloc(numPackedTrees[0]+numPackedTrees[1], sizeof(PackedTree));
+    packedTreeList[1] = packedTreeList[0] + numPackedTrees[0];
+    if (!packedTreeList[0])
+        {
+        MrBayesPrint ("%s   Problem allocating packed tree list\n", spacer);
+        goto errorExit;
+        }
+    memAllocs[ALLOC_PACKEDTREES] = YES;
+
+    /* Tell user we are ready to go */
+    MrBayesPrint ("%s   Summarizing trees in files \"%s\" and \"%s\"\n", spacer,
+        comptreeParams.comptFileName1,
+        comptreeParams.comptFileName2);
+    
+    if (chainParams.relativeBurnin == YES)
+        MrBayesPrint ("%s   Using relative burnin ('relburnin=yes'), discarding the first %.0f %% ('burninfrac=%1.2f') of sampled trees\n",
+            spacer, chainParams.burninFraction*100.0, chainParams.burninFraction);
+    else
+        MrBayesPrint ("%s   Using absolute burnin ('relburnin=no'), discarding the first %d ('burnin=%d') sampled trees\n",
+            spacer, chainParams.chainBurnIn, chainParams.chainBurnIn);
+
+    MrBayesPrint ("%s   Writing statistics to file %s.<dists|pairs>\n", spacer, comptreeParams.comptOutfile);
+
+    /* Set up cheap status bar. */
+    MrBayesPrint ("\n%s   Tree reading status:\n\n", spacer);
+    MrBayesPrint ("%s   0      10      20      30      40      50      60      70      80      90     100\n", spacer);
+    MrBayesPrint ("%s   v-------v-------v-------v-------v-------v-------v-------v-------v-------v-------v\n", spacer);
+    MrBayesPrint ("%s   *", spacer);
+    numAsterices = 0;
+        
+    /* Read file 1 for real */
+    if ((fp = OpenTextFileR(comptreeParams.comptFileName1)) == NULL)
+        goto errorExit;
+        
+    /* ...and fast forward to beginning of last tree block (skipping begin trees). */
+    for (i=0; i<lastTreeBlockBegin[0] + 1; i++)
+        {
+        if (fgets (s, longestLineLength, fp) == NULL)
+            {
+            printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+            }
+        }
+        
+    /* Calculate burnin */
+    if (chainParams.relativeBurnin == YES)
+        comptreeParams.burnin = (int)(chainParams.burninFraction * numTreesInLastBlock[0]);
+    else
+        comptreeParams.burnin = chainParams.chainBurnIn;
+
+    /* Initialize sumtParams struct */
+    numUniqueSplitsFound = numUniqueTreesFound = 0;
+    sumtParams.runId = 0;
+    strcpy(sumtParams.curFileName, comptreeParams.comptFileName1);
+    sumtParams.tree = AllocatePolyTree (numTaxa);
+    AllocatePolyTreePartitions (sumtParams.tree);
+    sumtParams.numTreesEncountered = sumtParams.numTreesSampled = 0;
+    sumtParams.numFileTrees = (int *) SafeCalloc (2*2+2*numTaxa, sizeof(int));
+    sumtParams.numFileTreesSampled = sumtParams.numFileTrees + sumtParams.numRuns;
+    sumtParams.order = sumtParams.numFileTrees + 2*sumtParams.numRuns;
+    sumtParams.absentTaxa = sumtParams.numFileTrees + 2*sumtParams.numRuns + numTaxa;
+    sumtParams.numTreesInLastBlock = numTreesInLastBlock[0];
+    if (!sumtParams.numFileTrees)
+        {
+        MrBayesPrint ("%s   Problems allocating sumtParams.numFileTrees in DoSumt()\n", spacer);
+        goto errorExit;
+        }
+    else
+        memAllocs[ALLOC_SUMTPARAMS] = YES;
+
+    /* ... and parse the file */
+    expecting = Expecting(COMMAND);
+    inTreesBlock = YES;
+    ResetTranslateTable();
+    for (i=0; i<lastTreeBlockEnd[0] - lastTreeBlockBegin[0] - 1; i++)
+        {
+        if (fgets (s, longestLineLength, fp) == NULL)
+            {
+            printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+            }
+        /*MrBayesPrint ("%s", s);*/
+        if (ParseCommand (s) == ERROR)
+            goto errorExit;
+        }
+    inTreesBlock = NO;
+    ResetTranslateTable();
+
+    /* Check that at least one tree was read in. */
+    if (sumtParams.numFileTreesSampled[0] <= 0)
+        {
+        MrBayesPrint ("%s   No trees read in\n", spacer);
+        goto errorExit;
+        }
+        
+    /* ... and close file */
+    SafeFclose (&fp);
+
+    /* Read file 2 for real */
+    if ((fp = OpenTextFileR(comptreeParams.comptFileName2)) == NULL)
+        goto errorExit;
+        
+    /* ...and fast forward to beginning of last tree block. */
+    for (i=0; i<lastTreeBlockBegin[1] + 1; i++)
+        {
+        if (fgets (s, longestLineLength, fp) == NULL)
+            {
+            printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+            }
+        }
+        
+    /* Renitialize sumtParams struct */
+    sumtParams.runId = 1;
+    strcpy (sumtParams.curFileName, comptreeParams.comptFileName2);
+
+    /* Calculate burnin */
+    if (chainParams.relativeBurnin == YES)
+        comptreeParams.burnin = (int)(chainParams.burninFraction * numTreesInLastBlock[1]);
+    else
+        comptreeParams.burnin = chainParams.chainBurnIn;
+
+    /* ... and parse the file */
+    expecting = Expecting(COMMAND);
+    inTreesBlock = YES;
+    ResetTranslateTable();
+    for (i=0; i<lastTreeBlockEnd[1] - lastTreeBlockBegin[1] - 1; i++)
+        {
+        if (fgets (s, longestLineLength, fp) == NULL)
+            {
+            printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+            }
+        /*MrBayesPrint ("%s", s);*/
+        if (ParseCommand (s) == ERROR)
+            goto errorExit;
+        }
+    inTreesBlock = NO;
+    ResetTranslateTable();
+
+    /* Check that at least one tree was read in. */
+    if (sumtParams.numFileTreesSampled[1] <= 0)
+        {
+        MrBayesPrint ("%s   No trees read in\n", spacer);
+        goto errorExit;
+        }
+        
+    /* ... and close file */
+    SafeFclose (&fp);
+
+    /* Now finish cheap status bar. */
+    if (numAsterices < 80)
+        for (i=0; i<80 - numAsterices; i++)
+            MrBayesPrint ("*");
+    MrBayesPrint ("\n\n");
+    
+    /* tell user how many trees were successfully read */
+    MrBayesPrint ("%s   Read %d trees from last tree block of file \"%s\" (sampling %d of them)\n", spacer,
+        sumtParams.numFileTrees[0],
+        comptreeParams.comptFileName1,
+        sumtParams.numFileTreesSampled[0]);
+    MrBayesPrint ("%s   Read %d trees from last tree block of file \"%s\" (sampling %d of them)\n", spacer,
+        sumtParams.numFileTrees[1],
+        comptreeParams.comptFileName2,
+        sumtParams.numFileTreesSampled[1]);
+    
+    /* Extract partition counter pointers */
+    treeParts = (PartCtr **) SafeCalloc ((size_t)(numUniqueSplitsFound), sizeof(PartCtr *));
+    i = 0;
+    PartCtrUppass(partCtrRoot, treeParts, &i);
+
+    /* Sort taxon partitions (clades, splits) ... */
+    SortPartCtr (treeParts, 0, numUniqueSplitsFound-1);
+        
+    /* print to screen */
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   General explanation:                                                          \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   In an unrooted tree, a taxon bipartition (split) is specified by removing a   \n", spacer);
+    MrBayesPrint ("%s   branch, thereby dividing the species into those to the left and those to the  \n", spacer);
+    MrBayesPrint ("%s   right of the branch. Here, taxa to one side of the removed branch are denoted \n", spacer);
+    MrBayesPrint ("%s   '.' and those to the other side are denoted '*'. Specifically, the '.' symbol \n", spacer);
+    MrBayesPrint ("%s   is used for the taxa on the same side as the outgroup.                        \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   In a rooted or clock tree, the '*' symbol is simply used to denote the taxa   \n", spacer);
+    MrBayesPrint ("%s   that are included in a particular group (clade), that is, all the descendants \n", spacer);
+    MrBayesPrint ("%s   of a particular branch in the tree.  Taxa that are not included are denoted   \n", spacer);
+    MrBayesPrint ("%s   using the '.' symbol.                                                         \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   The output includes the ID of the encountered clades or splits (sorted from   \n", spacer);
+    MrBayesPrint ("%s   highest to lowest probability), the bipartition or clade in '.*' format, \n", spacer);
+    MrBayesPrint ("%s   number of times the bipartition or clade was observed in the first tree file  \n", spacer);
+    MrBayesPrint ("%s   served in the first tree file, the number of times the bipartition was,       \n", spacer);
+    MrBayesPrint ("%s   observed in the second tree file, the proportion of the time the bipartition  \n", spacer);
+    MrBayesPrint ("%s   was found in the first tree file, and the proportion of the time the bi-      \n", spacer);
+    MrBayesPrint ("%s   partition was found in the second tree file.                                  \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   List of taxa in bipartitions:                                                 \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    j = 1;
+    for (k=0; k<numTaxa; k++)
+        {
+        if (sumtParams.absentTaxa[k] == NO && taxaInfo[k].isDeleted == NO)
+            {
+            MrBayesPrint ("%s   %4d -- %s\n", spacer, j++, taxaNames[k]);
+            }
+        }
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   List of taxon bipartitions found in tree files:                               \n\n", spacer);
+
+    i = (int)(log10(sumtParams.numTreesSampled)) - 1;
+    if (i<1)
+        i = 1;
+    j = sumtParams.numTaxa - 8;
+    if (j < 1)
+        j = 1;        
+    MrBayesPrint ("%s     ID -- Partition%*c  No1%*c  No2%*c  Freq1   Freq2\n",
+        spacer, j, ' ', i, ' ', i, ' ');
+
+    mask = SafeCalloc (sumtParams.BitsLongsNeeded, sizeof(BitsLong));
+    for (i=0; i<sumtParams.numTaxa; i++)
+        SetBit (i, mask);
+    for (i=0; i<numUniqueSplitsFound; i++)
+        {
+        x = treeParts[i];
+        if (IsBitSet(localOutGroup, x->partition) == YES && sumtParams.isRooted == NO)
+            FlipBits(x->partition, sumtParams.BitsLongsNeeded, mask);
+        if ((MrBFlt)x->totCount/(MrBFlt)sumtParams.numTreesSampled >= comptreeParams.minPartFreq)
+            {
+            MrBayesPrint ("%s   %4d -- ", spacer, i+1);
+            ShowParts (stdout, x->partition, sumtParams.numTaxa);
+
+            j = (int)(log10(sumtParams.numTreesSampled)) + 1;
+            if (j < 3)
+                j = 3;
+            MrBayesPrint ("   %*d   %*d   %1.3lf   %1.3lf\n", 
+            j, x->count[0], j, x->count[1],
+            (MrBFlt)x->count[0]/(MrBFlt)sumtParams.numFileTreesSampled[0], 
+            (MrBFlt)x->count[1]/(MrBFlt)sumtParams.numFileTreesSampled[1]);
+            
+            MrBayesPrintf (fpParts, "%d\t%d\t%d\t%1.3lf\t%1.3lf\n", 
+            i+1, x->count[0], x->count[1], 
+            (MrBFlt)x->count[0]/(MrBFlt)sumtParams.numFileTreesSampled[0], 
+            (MrBFlt)x->count[1]/(MrBFlt)sumtParams.numFileTreesSampled[1]);
+            }
+        }
+    free (mask);
+
+    /* make a nifty graph plotting frequencies of clades found in the two tree files */
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   Bivariate plot of clade probabilities:                                        \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    MrBayesPrint ("%s   This graph plots the probabilities of clades found in file 1 (the x-axis)     \n", spacer);
+    MrBayesPrint ("%s   against the probabilities of the same clades found in file 2 (the y-axis).    \n", spacer);
+    MrBayesPrint ("                                                                                   \n");
+    xInc = (MrBFlt) (1.0 / 80.0);
+    yInc = (MrBFlt) (1.0 / 40.0);
+    yUpper = 1.0;
+    yLower = yUpper - yInc;
+    for (yaxis=39; yaxis>=0; yaxis--)
+        {
+        xLower = 0.0;
+        xUpper = xLower + xInc;
+        for (xaxis=0; xaxis<80; xaxis++)
+            {
+            starHolder[xaxis] = 0;
+            for (i=0; i<numUniqueSplitsFound; i++)
+                {
+                x = treeParts[i];
+                xProb = (MrBFlt)x->count[0]/(MrBFlt)sumtParams.numFileTreesSampled[0];
+                yProb = (MrBFlt)x->count[1]/(MrBFlt)sumtParams.numFileTreesSampled[1];
+                if ((xProb > xLower || (xProb == 0.0 && xaxis == 0)) && (xProb <= xUpper || (xProb == 1.0 && xaxis == 79))
+                 && (yProb > yLower || (yProb == 0.0 && yaxis == 0)) && (yProb <= yUpper || (yProb == 1.0 && yaxis == 39)))
+                    starHolder[xaxis] = 1;
+                }
+            xLower += xInc;
+            xUpper = xLower + xInc;
+            }
+        
+        MrBayesPrint ("%s   ", spacer);
+        for (xaxis=0; xaxis<80; xaxis++)
+            {
+            prCh = ' ';
+            if ((xaxis == 0 && yaxis == 0) || (xaxis == 79 && yaxis == 39))
+                prCh = '+';
+            else if ((xaxis == 0 && yaxis == 39) || (xaxis == 79 && yaxis == 0))
+                prCh = '+';
+            else if ((yaxis == 0 || yaxis == 39) && xaxis > 0 && xaxis < 79)
+                prCh = '-';
+            else if ((xaxis == 0 || xaxis == 79) && yaxis > 0 && yaxis < 39)
+                prCh = '|';
+            if (starHolder[xaxis] == 1)
+                prCh = '*';
+            MrBayesPrint ("%c", prCh);
+            }
+            if (yaxis == 39)
+                MrBayesPrint (" 1.00\n");
+            else if (yaxis == 0)
+                MrBayesPrint (" 0.00\n");
+            else
+                MrBayesPrint ("\n");
+
+        yUpper -= yInc;
+        yLower = yUpper - yInc;
+        }
+
+    MrBayesPrint ("%s   ^                                                                              ^\n", spacer);
+    MrBayesPrint ("%s  0.00                                                                          1.00\n", spacer);
+        
+    /* get tree-to-tree distances: first allocate some space */
+    minNumTrees = sumtParams.numFileTreesSampled[0];
+    if (sumtParams.numFileTreesSampled[1] < minNumTrees)
+        minNumTrees = sumtParams.numFileTreesSampled[1];
+    dT1 = (MrBFlt *) SafeMalloc (3 * (size_t)minNumTrees * sizeof(MrBFlt));
+    tree1 = AllocateFixedTree (sumtParams.numTaxa, sumtParams.isRooted);
+    tree2 = AllocateFixedTree (sumtParams.numTaxa, sumtParams.isRooted);
+    if (!dT1 || !tree1 || !tree2)
+        {
+        MrBayesPrint ("%s   Problem allocating topological distances\n", spacer);
+        goto errorExit;
+        }
+    dT2 = dT1 + minNumTrees;
+    dT3 = dT2 + minNumTrees;
+    
+    for (i=0; i<minNumTrees; i++)
+        {
+        if (sumtParams.isRooted == NO)
+            {
+            RetrieveUTree (tree1, packedTreeList[0][i].order, packedTreeList[0][i].brlens);
+            RetrieveUTree (tree2, packedTreeList[1][i].order, packedTreeList[1][i].brlens);
+            }
+        else
+            {
+            RetrieveRTree (tree1, packedTreeList[0][i].order, packedTreeList[0][i].brlens);
+            RetrieveRTree (tree2, packedTreeList[1][i].order, packedTreeList[1][i].brlens);
+            }
+        /* Allocate and set partitions now that we have a tree */
+        if (i == 0)
+            {
+            AllocateTreePartitions(tree1);
+            AllocateTreePartitions(tree2);
+            }
+        else
+            {
+            ResetTreePartitions(tree1);
+            ResetTreePartitions(tree2);
+            }
+        CalculateTreeToTreeDistance (tree1, tree2, &d1, &d2, &d3);
+        dT1[i] = d1;
+        dT2[i] = d2;
+        dT3[i] = d3;
+        }
+        
+    for (i=0; i<minNumTrees; i++)
+        {
+        /*MrBayesPrint ("%s   %4d -- %lf %lf %lf\n", spacer, i+1, dT1[i], dT2[i], dT3[i]);*/    
+        if (sumtParams.brlensDef == YES)
+            MrBayesPrintf (fpDists, "%d\t%lf\t%lf\t%lf\n", i+1, dT1[i], dT2[i], dT3[i]);    
+        else
+            MrBayesPrintf (fpDists, "%d\t%lf\n", i+1, dT1[i]);  
+        }
+        
+    /* print x-y plot of log likelihood vs. generation */
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   Rough plots of generation (x-axis) versus the measures of tree-   \n", spacer);
+    MrBayesPrint ("%s   to-tree distances (y-axis).                                       \n", spacer);
+    MrBayesPrint ("\n");
+    MrBayesPrint ("%s   Distance(Robinson-Foulds):\n", spacer);
+    MrBayesPrint ("\n");
+    screenWidth = 60; /* don't change this without changing numY and meanY, declared above */
+    screenHeigth = 15;
+    minX = minY = 1000000000.0;
+    maxX = maxY = -1000000000.0;
+    for (i=0; i<minNumTrees; i++)
+        {
+        xVal = (MrBFlt) (i + comptreeParams.burnin);
+        yVal = dT1[i];
+        if (xVal < minX)
+            minX = xVal;
+        if (yVal < minY)
+            minY = yVal;
+        if (xVal > maxX)
+            maxX = xVal;
+        if (yVal > maxY)
+            maxY = yVal;
+        }
+    for (i=0; i<screenWidth; i++)
+        {
+        numY[i] = 0;
+        meanY[i] = 0.0;
+        }
+    for (i=0; i<minNumTrees; i++)
+        {
+        xVal = (MrBFlt) (i + comptreeParams.burnin);
+        yVal = dT1[i];
+        k = (int)(((xVal - minX) / (maxX - minX)) * screenWidth);
+        if (k >= screenWidth)
+            k = screenWidth - 1;
+        meanY[k] += yVal;
+        numY[k]++;
+        }
+    MrBayesPrint ("\n%s   +", spacer);
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint ("-");
+    MrBayesPrint ("+ %1.2lf\n", maxY);
+    for (j=screenHeigth-1; j>=0; j--)
+        {
+        MrBayesPrint ("%s   |", spacer);
+        for (i=0; i<screenWidth; i++)
+            {
+            if (numY[i] > 0)
+                {
+                if (meanY[i] / numY[i] > (((maxY - minY)/screenHeigth)*j)+minY && meanY[i] / numY[i] <= (((maxY - minY)/screenHeigth)*(j+1))+minY)
+                    MrBayesPrint ("*");
+                else
+                    MrBayesPrint (" ");
+                }
+            else
+                {
+                MrBayesPrint (" ");
+                }
+            }
+        MrBayesPrint ("|\n");
+        }
+    MrBayesPrint ("%s   +", spacer);
+    for (i=0; i<screenWidth; i++)
+        {
+        if (numY[i] > 0 && meanY[i] / numY[i] <= minY)
+            MrBayesPrint ("*");
+        else if (i % (screenWidth/10) == 0 && i != 0)
+            MrBayesPrint ("+");
+        else
+            MrBayesPrint ("-");
+        }
+    MrBayesPrint ("+ %1.2lf\n", minY);
+    MrBayesPrint ("%s   ^", spacer);
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("^\n");
+    MrBayesPrint ("%s   %1.0lf", spacer, minX);
+    for (i=0; i<screenWidth; i++)
+        MrBayesPrint (" ");
+    MrBayesPrint ("%1.0lf\n\n", maxX);
+
+    if (sumtParams.brlensDef == YES)
+        {
+        for (n=0; n<2; n++)
+            {
+            MrBayesPrint ("\n");
+            if (n == 0)
+                MrBayesPrint ("%s   Distance(Robinson-Foulds with branch lengths):\n", spacer);
+            else
+                MrBayesPrint ("%s   Distance(Robinson-Foulds with scaled branch lengths):\n", spacer);
+            MrBayesPrint ("\n");
+            screenWidth = 60; /* don't change this without changing numY and meanY, declared above */
+            screenHeigth = 15;
+            minX = minY = 1000000000.0;
+            maxX = maxY = -1000000000.0;
+            for (i=0; i<minNumTrees; i++)
+                {
+                xVal = (MrBFlt) (i + comptreeParams.burnin);
+                if (n == 0)
+                    yVal = dT2[i];
+                else
+                    yVal = dT3[i];
+                if (xVal < minX)
+                    minX = xVal;
+                if (yVal < minY)
+                    minY = yVal;
+                if (xVal > maxX)
+                    maxX = xVal;
+                if (yVal > maxY)
+                    maxY = yVal;
+                }
+            for (i=0; i<screenWidth; i++)
+                {
+                numY[i] = 0;
+                meanY[i] = 0.0;
+                }
+            for (i=0; i<minNumTrees; i++)
+                {
+                xVal = (MrBFlt) (i + comptreeParams.burnin);
+                if (n == 0)
+                    yVal = dT2[i];
+                else
+                    yVal = dT3[i];
+                k = (int)(((xVal - minX) / (maxX - minX)) * screenWidth);
+                if (k >= screenWidth)
+                    k = screenWidth - 1;
+                meanY[k] += yVal;
+                numY[k]++;
+                }
+            MrBayesPrint ("\n%s   +", spacer);
+            for (i=0; i<screenWidth; i++)
+                MrBayesPrint ("-");
+            MrBayesPrint ("+ %1.2lf\n", maxY);
+            for (j=screenHeigth-1; j>=0; j--)
+                {
+                MrBayesPrint ("%s   |", spacer);
+                for (i=0; i<screenWidth; i++)
+                    {
+                    if (numY[i] > 0)
+                        {
+                        if (meanY[i] / numY[i] > (((maxY - minY)/screenHeigth)*j)+minY && meanY[i] / numY[i] <= (((maxY - minY)/screenHeigth)*(j+1))+minY)
+                            MrBayesPrint ("*");
+                        else
+                            MrBayesPrint (" ");
+                        }
+                    else
+                        {
+                        MrBayesPrint (" ");
+                        }
+                    }
+                MrBayesPrint ("|\n");
+                }
+            MrBayesPrint ("%s   +", spacer);
+            for (i=0; i<screenWidth; i++)
+                {
+                if (numY[i] > 0 && meanY[i] / numY[i] <= minY)
+                    MrBayesPrint ("*");
+                else if (i % (screenWidth/10) == 0 && i != 0)
+                    MrBayesPrint ("+");
+                else
+                    MrBayesPrint ("-");
+                }
+            MrBayesPrint ("+ %1.2lf\n", minY);
+            MrBayesPrint ("%s   ^", spacer);
+            for (i=0; i<screenWidth; i++)
+                MrBayesPrint (" ");
+            MrBayesPrint ("^\n");
+            MrBayesPrint ("%s   %1.0lf", spacer, minX);
+            for (i=0; i<screenWidth; i++)
+                MrBayesPrint (" ");
+            MrBayesPrint ("%1.0lf\n\n", maxX);
+            }
+        }
+
+    /* calculate average tree-to-tree distances */
+    curTime = time(NULL);
+    temporarySeed  = (RandLong)curTime;
+    if (temporarySeed < 0)
+        temporarySeed = -temporarySeed;
+    sums[0] = sums[1] = sums[2] = 0.0;
+    nSamples = 1000;
+    for (n=0; n<nSamples; n++)
+        {
+        i = (int) RandomNumber(&temporarySeed) * minNumTrees;
+        j = (int) RandomNumber(&temporarySeed) * minNumTrees;
+        if (sumtParams.isRooted == NO)
+            {
+            RetrieveUTree (tree1, packedTreeList[0][i].order, packedTreeList[0][i].brlens);
+            RetrieveUTree (tree2, packedTreeList[1][j].order, packedTreeList[1][j].brlens);
+            }
+        else /* if (sumtParams.isRooted == YES) */
+            {
+            RetrieveRTree (tree1, packedTreeList[0][i].order, packedTreeList[0][i].brlens);
+            RetrieveRTree (tree2, packedTreeList[1][j].order, packedTreeList[1][j].brlens);
+            }
+        CalculateTreeToTreeDistance (tree1, tree2, &d1, &d2, &d3);
+        sums[0] += d1;
+        sums[1] += d2;
+        sums[2] += d3;
+        }
+    MrBayesPrint ("%s   Mean tree-to-tree distances, based on %d trees randomly sampled from both files:\n\n", spacer, nSamples);
+    MrBayesPrint ("%s                                 Mean(Robinson-Foulds) = %1.3lf\n", spacer, sums[0]/nSamples);
+    if (sumtParams.brlensDef == YES)
+        {
+        MrBayesPrint ("%s             Mean(Robinson-Foulds with branch lengths) = %1.3lf\n", spacer, sums[1]/nSamples);
+        MrBayesPrint ("%s      Mean(Robinson-Foulds with scaled branch lengths) = %1.3lf\n", spacer, sums[2]/nSamples);
+        }
+    MrBayesPrint ("\n");
+
+    /* free memory and file pointers */
+    free(s);    
+    free (dT1);
+    FreeTree (tree1);
+    FreeTree (tree2);
+    if (memAllocs[ALLOC_PACKEDTREES] == YES)
+        {
+        for (i=0; i<numPackedTrees[0]+numPackedTrees[1]; i++)
+            {
+            free(packedTreeList[0][i].order);
+            free(packedTreeList[0][i].brlens);
+            }
+        free(packedTreeList[0]);
+        memAllocs[ALLOC_PACKEDTREES] = NO;
+        }
+
+    /* free sumtParams */
+    FreeSumtParams();
+
+    /* close files */
+    SafeFclose (&fp);
+    SafeFclose (&fpParts);
+    SafeFclose (&fpDists);
+    
+    /* free pointer array to partitions, part and tree counters */
+    free (treeParts);
+    FreePartCtr (partCtrRoot);
+    FreeTreeCtr (treeCtrRoot);
+    partCtrRoot = NULL;
+    treeCtrRoot = NULL;
+
+    /* reset taxon set */
+    ResetTaxonSet();
+
+#   if defined (MPI_ENABLED)
+        }
+#   endif
+
+    expecting = Expecting(COMMAND);
+    inComparetreeCommand = NO;
+    return (NO_ERROR);
+    
+    /* error exit */            
+    errorExit:
+        if (s) free(s);
+
+        /* free sumtParams */
+        FreeSumtParams();
+
+        free (dT1);
+        FreeTree (tree1);
+        FreeTree (tree2);
+        if (memAllocs[ALLOC_PACKEDTREES] == YES)
+            {
+            for (i=0; i<numPackedTrees[0]+numPackedTrees[1]; i++)
+                {
+                free(packedTreeList[0][i].order);
+                free(packedTreeList[0][i].brlens);
+                }
+            free(packedTreeList[0]);
+            memAllocs[ALLOC_PACKEDTREES] = NO;
+            }
+
+        /* reset taxon set */
+        ResetTaxonSet();
+
+        /* free pointer array to partitions, part and tree counters */
+        free (treeParts);
+        FreePartCtr (partCtrRoot);
+        FreeTreeCtr (treeCtrRoot);
+        partCtrRoot = NULL;
+        treeCtrRoot = NULL;
+
+        SafeFclose (&fp);
+        SafeFclose (&fpParts);
+        SafeFclose (&fpDists);
+        strcpy (spacer, "");
+
+        expecting = Expecting(COMMAND);
+        inComparetreeCommand = NO;
+
+        return (ERROR);
+}
+
+
+int DoCompareTreeParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        tempStr[100];
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            expecting  = Expecting(PARAMETER);
+            expecting |= Expecting(SEMICOLON);
+            }
+        /* set Filename (comptreeParams.comptFileName1) *************************************************/
+        else if (!strcmp(parmName, "Filename1"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (comptreeParams.comptFileName1, tkn);
+                MrBayesPrint ("%s   Setting comparetree filename 1 to %s\n", spacer, comptreeParams.comptFileName1);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Filename (comptreeParams.comptFileName2) *************************************************/
+        else if (!strcmp(parmName, "Filename2"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (comptreeParams.comptFileName2, tkn);
+                MrBayesPrint ("%s   Setting comparetree filename 2 to %s\n", spacer, comptreeParams.comptFileName2);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Filename (comptreeParams.comptOutfile) ***************************************************/
+        else if (!strcmp(parmName, "Outputname"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                strcpy (comptreeParams.comptOutfile, tkn);
+                MrBayesPrint ("%s   Setting comparetree output file to %s\n", spacer, comptreeParams.comptOutfile);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Relburnin (chainParams.relativeBurnin) ********************************************************/
+        else if (!strcmp(parmName, "Relburnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.relativeBurnin = YES;
+                    else
+                        chainParams.relativeBurnin = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Relburnin\n", spacer);
+                    return (ERROR);
+                    }
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using relative burnin (a fraction of samples discarded).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Using absolute burnin (a fixed number of samples discarded).\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                //free (tempStr);
+                return (ERROR);
+                }
+            }
+        /* set Burnin (chainParams.chainBurnIn) *******************************************************/
+        else if (!strcmp(parmName, "Burnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.chainBurnIn = tempI;
+                MrBayesPrint ("%s   Setting burnin to %d\n", spacer, chainParams.chainBurnIn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Burninfrac (chainParams.burninFraction) ************************************************************/
+        else if (!strcmp(parmName, "Burninfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too low (< 0.01)\n", spacer);
+                    return (ERROR);
+                    }
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too high (> 0.50)\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.burninFraction = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }
+            }
+        /* set Minpartfreq (comptreeParams.minPartFreq) *******************************************************/
+        else if (!strcmp(parmName, "Minpartfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                comptreeParams.minPartFreq = tempD;
+                MrBayesPrint ("%s   Including partitions with probability greater than or equal to %lf in summary statistics\n", spacer, comptreeParams.minPartFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoCompRefTree (void)
+{
+    /* Compare a tree file with the reference tree files to generate the SDSFs.
+       Use parameters in CompareTree and MCMCP (lazy option) */
+    
+    char         outName[130], inName[130], inRefName[130], treeName[100], *lineBuf=NULL, *s;
+    FILE         *fpTre=NULL, *fpOut=NULL;
+    int          i, n, longestL=0, burnin, gen, nRefRun, nTre[100]={0};
+    SumtFileInfo tFileInfo;
+    Tree         *t;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id != 0)
+        return NO_ERROR;
+#   endif
+
+    /* Check that a data set has been read in. We check taxon names against those read in. */
+    if (isTaxsetDef == NO)
+        {
+        MrBayesPrint ("%s   A matrix or set of taxon labels must be specified before compareref can be used\n", spacer);
+        return (ERROR);
+        }
+
+    /* this is a hack to account for the additional comparing tree sample 
+       chainParams.numRuns is used in AddTreeToPartitionCounters to alloc mem correctly */
+    nRefRun = chainParams.numRuns;
+    chainParams.numRuns += 1;
+
+    /* initialize */
+    if ((t = AllocateTree (numLocalTaxa)) == NULL)
+        {
+        MrBayesPrint ("%s   Problem allocating diagn tree\n", spacer);
+        goto errorExit;
+        }
+    if (SetUpPartitionCounters () == ERROR)
+        goto errorExit;
+    if ((chainParams.stat = (STATS *) SafeCalloc (numTopologies, sizeof (STATS))) == NULL)
+        goto errorExit;
+    else
+        memAllocs[ALLOC_STATS] = YES;
+
+    /* deal with the reference tree files */
+    // for (k=0; k<numTopologies; k++)
+    for (n=0; n<nRefRun; n++)
+        {
+        if (nRefRun == 1)
+            sprintf (inRefName, "%s.t", comptreeParams.comptFileName2);
+        else
+            sprintf (inRefName, "%s.run%d.t", comptreeParams.comptFileName2, n+1);
+        
+        /* Examine each ref tree file, save info to tFileInfo */
+        if (ExamineSumtFile(inRefName, &tFileInfo, treeName, &sumtParams.brlensDef) == ERROR)
+            goto errorExit;
+        if (longestL < tFileInfo.longestLineLength)
+            {
+            longestL = tFileInfo.longestLineLength;
+            lineBuf = (char *) SafeRealloc (lineBuf, (size_t)longestL * sizeof(char));
+            if (!lineBuf)
+                {
+                MrBayesPrint ("%s   Problem allocating string for reading tree file\n", spacer);
+                goto errorExit;
+                }
+            }
+        
+        /* calculate burnin */
+        if (chainParams.relativeBurnin == YES)
+            burnin = (int)(chainParams.burninFraction * tFileInfo.numTreesInLastBlock);
+        else
+            burnin = chainParams.chainBurnIn;
+        if (burnin >= tFileInfo.numTreesInLastBlock)
+            {
+            MrBayesPrint ("%s   Burnin should be smaller than the total number of trees\n", spacer);
+            goto errorExit;
+            }
+       
+        /* open the ref tree file */
+        if ((fpTre = OpenTextFileR (inRefName)) == NULL)
+            goto errorExit;
+        /* ...and fast forward to beginning in last tree block */
+        for (i=0; i <= tFileInfo.lastTreeBlockBegin; i++)
+            {
+            if (fgets(lineBuf, longestL-2, fpTre) == NULL)
+                goto errorExit;
+            }
+        
+        /* process each ref tree */
+        for (i=1; i <= tFileInfo.numTreesInLastBlock; i++)
+            {
+            do {
+                if (fgets (lineBuf, longestL-2, fpTre) == NULL)
+                    goto errorExit;
+                s = strtok (lineBuf, " ");
+                }
+            while (strcmp (s, "tree") != 0);
+            
+            /* add reference trees to partition counters, discarding burnin */
+            if (i > burnin)
+                {
+                s = strtok (NULL, ";");
+                while (*s != '(')
+                    s++;
+                StripComments(s);
+
+                if (ResetTopology (t, s) == ERROR)
+                    goto errorExit;
+                if (AddTreeToPartitionCounters (t, 0, n) == ERROR)
+                    goto errorExit;
+                nTre[n]++;
+                }
+            }
+
+        /* close the tree file */
+        SafeFclose (&fpTre);
+        }
+    /* end reference tree files */
+    
+    /* open output file */
+    strcpy (outName, comptreeParams.comptOutfile);
+    strcat (outName, ".sdsf");
+    if ((fpOut = OpenNewMBPrintFile (outName)) == NULL)
+        goto errorExit;
+    /* print stamp and header */
+    if ((int)strlen(stamp) > 1)
+        MrBayesPrintf (fpOut, "[ID: %s]\n", stamp);
+    if (chainParams.diagnStat == AVGSTDDEV)
+        MrBayesPrintf (fpOut, "Gen\tASDSF\n");
+    else  // MAXSTDDEV
+        MrBayesPrintf (fpOut, "Gen\tMSDSF\n");
+
+    /* Examine the tree file to be compared, save info to tFileInfo */
+    strcpy(inName, comptreeParams.comptFileName1);
+    if (ExamineSumtFile(inName, &tFileInfo, treeName, &sumtParams.brlensDef) == ERROR)
+        goto errorExit;
+    if (longestL < tFileInfo.longestLineLength)
+        {
+        longestL = tFileInfo.longestLineLength;
+        lineBuf = (char *) SafeRealloc (lineBuf, (size_t)longestL * sizeof(char));
+        if (!lineBuf)
+            {
+            MrBayesPrint ("%s   Problem allocating string for reading tree file\n", spacer);
+            goto errorExit;
+            }
+        }
+
+    /* open the tree file to be compared */
+    if ((fpTre = OpenTextFileR (inName)) == NULL)
+        goto errorExit;
+    /* ...and fast forward to beginning in last tree block */
+    for (i=0; i <= tFileInfo.lastTreeBlockBegin; i++)
+        {
+        if (fgets(lineBuf, longestL-2, fpTre) == NULL)
+            goto errorExit;
+        }
+
+    /* process each tree to be compared and print SDSF to file */
+    for (i=1; i <= tFileInfo.numTreesInLastBlock; i++)
+        {
+        do {
+            if (fgets (lineBuf, longestL-2, fpTre) == NULL)
+                goto errorExit;
+            s = strtok (lineBuf, " ");
+            }
+        while (strcmp (s, "tree") != 0);
+        
+        s = strtok (NULL, ";");
+        gen = atoi(s+4);  // 4 is offset to get rid of "rep." in tree name
+        while (*s != '(')
+            s++;
+        StripComments(s);
+
+        /* add the tree to partition counters */
+        if (ResetTopology (t, s) == ERROR)
+            goto errorExit;
+        if (AddTreeToPartitionCounters (t, 0, nRefRun) == ERROR)
+            goto errorExit;
+        nTre[nRefRun]++;
+            
+        /* calculate and write stdev of split freq */
+        CalcTopoConvDiagn2 (nTre);
+        if (chainParams.stat[0].numPartitions == 0)
+            {
+            MrBayesPrintf (fpOut, "%d\tNA\n", gen);
+            }
+        else if (chainParams.diagnStat == AVGSTDDEV)
+            {
+            MrBayesPrintf (fpOut, "%d\t%lf\n", gen, chainParams.stat[0].avgStdDev);
+            }
+        else  // MAXSTDDEV
+            {
+            MrBayesPrintf (fpOut, "%d\t%lf\n", gen, chainParams.stat[0].max);
+            }
+        }
+    
+    /* change back to the actual numRuns, end of hack */
+    chainParams.numRuns -= 1;
+    
+    /* close tree file */
+    SafeFclose (&fpTre);
+    /* close output file */
+    SafeFclose (&fpOut);
+    /* free memory */
+    free(lineBuf);
+    FreeTree (t);
+    FreeChainMemory();
+    
+    return (NO_ERROR);
+    
+    /* error exit */
+errorExit:
+    MrBayesPrint ("%s   Error in DoCompRefTree\n", spacer);
+    
+    chainParams.numRuns -= 1;
+    SafeFclose (&fpTre);
+    SafeFclose (&fpOut);
+    
+    FreeTree (t);
+    FreeChainMemory();
+    free(lineBuf);
+    
+    return (ERROR);
+}
+
+
+#if defined (PRINT_RATEMUL_CPP)
+int DELETE_ME_count_taxa(PolyNode *p)
+{
+    int sum=0;
+
+    if (p->left==NULL) {
+        if (p->depth > 0.1)
+            return 1;
+        else
+            return 0;
+    }
+
+    p=p->left;
+    while (p != NULL) {
+        sum+=DELETE_ME_count_taxa(p);
+        p=p->sib;
+    }
+    return sum;
+}
+
+
+void DELETE_ME_dump_depth(PolyNode *p)
+{
+    /*print depth of two taxa clade*/
+    /*
+    if (p->left != NULL && p->left->left == NULL && p->left->sib != NULL && p->left->sib->left == NULL){
+        fprintf (rateMultfp,"%f\n",p->depth);
+        }
+    if (p->left != NULL && p->left->left == NULL && p->left->sib != NULL && p->left->sib->left == NULL){
+        if (p->left->depth > 0.1 && p->left->sib->depth > 0.1)
+            fprintf (rateMultfp,"%f\n",p->depth);
+        }
+    */
+    /* print depth of three taxa clade */
+    if (((p->left != NULL && p->left->left == NULL) && p->left->sib != NULL && p->left->sib->left != NULL &&  p->left->sib->left->left == NULL && p->left->sib->left->sib->left == NULL) ||
+       (p->left != NULL && p->left->left != NULL && p->left->left->left == NULL && p->left->left->sib->left == NULL && (p->left->sib->left == NULL))) {
+        if (DELETE_ME_count_taxa(p)==2)
+            fprintf (rateMultfp,"%f\n",p->depth);
+        }
+    p=p->left;
+    while (p != NULL) {
+        DELETE_ME_dump_depth(p);
+        p=p->sib;
+    }
+}
+#endif
+
+
+int DoSumt (void)
+{
+    int             i, j=0, k, n, len, longestName, treeNo, numTreePartsToPrint,
+                    maxWidthID, maxWidthNumberPartitions, maxNumTaxa, tableWidth=0, unreliable, oneUnreliable,
+                    longestHeader;
+    MrBFlt          f, var_s, sum_s, stddev_s=0.0, sumsq_s, sumStdDev=0.0, maxStdDev=0.0, sumPSRF=0.0,
+                    maxPSRF=0.0, avgStdDev=0.0, avgPSRF=0.0, min_s=0.0, max_s=0.0, numPSRFSamples=0, min;
+    PartCtr         *x;
+    char            *s=NULL, tempName[120], fileName[120], treeName[100], divString[100];
+    char            *tempStr=NULL; /*not static because error ext is handeled*/
+    int             tempStrLength;
+    FILE            *fp=NULL;
+    PartCtr         **treeParts=NULL,*tmp;
+    SumtFileInfo    sumtFileInfo;
+    Stat            theStats;
+    BitsLong        *mask;
+
+#define SCREEN_WIDTH 80
+    
+#   if defined (MPI_ENABLED)
+    if (proc_id == 0)
+        {
+#   endif
+
+    /* Ensure that we read trees with sumt code and not user tree code */
+    inSumtCommand = YES;
+
+    /* set file pointers to NULL */
+    fp = fpParts = fpTstat = fpVstat = fpCon = fpTrees = NULL;
+
+    strcpy(treeName,"tree"); //in case if parameter is not specified in a .t file
+
+    /* Check if there is anything to do */
+    if (sumtParams.table == NO && sumtParams.summary == NO && sumtParams.showConsensus == NO)
+        {
+        MrBayesPrint ("%s   Nothing to do, all output parameters (Table, Summary, Consensus) set to 'NO'\n", spacer);
+        goto errorExit;
+        }
+
+    SafeStrcpy(&tempStr, " ");
+
+    /* Initialize sumtParams struct */
+    sumtParams.numTaxa = 0;
+    sumtParams.taxaNames = NULL;
+    sumtParams.BitsLongsNeeded = 0;
+    sumtParams.tree = AllocatePolyTree (numTaxa);
+    sumtParams.nESets = 0;
+    sumtParams.nBSets = 0;
+    sumtParams.eSetName = NULL;
+    sumtParams.bSetName = NULL;
+    sumtParams.popSizeSet = NO;
+    sumtParams.popSizeSetName = NULL;
+    AllocatePolyTreePartitions (sumtParams.tree);
+    sumtParams.numFileTrees = (int *) SafeCalloc (2*sumtParams.numRuns+2*numTaxa, sizeof(int));
+    sumtParams.numFileTreesSampled = sumtParams.numFileTrees + sumtParams.numRuns;
+    sumtParams.order = sumtParams.numFileTrees + 2*sumtParams.numRuns;
+    sumtParams.absentTaxa = sumtParams.numFileTrees + 2*sumtParams.numRuns + numTaxa;
+    if (!sumtParams.numFileTrees)
+        {
+        MrBayesPrint ("%s   Problems allocating sumtParams.numFileTrees in DoSumt()\n", spacer);
+        goto errorExit;
+        }
+    else
+        memAllocs[ALLOC_SUMTPARAMS] = YES;
+
+    /* Make sure outgroup is set correctly */
+    
+    for (treeNo = 0; treeNo < sumtParams.numTrees; treeNo++)
+        {
+        /* initialize across-file tree and partition counters */
+        sumtParams.numTreesSampled = sumtParams.numTreesEncountered = 0;
+        numUniqueSplitsFound = numUniqueTreesFound = 0;
+
+        /* initialize oneUnreliable && unreliable */
+        oneUnreliable = unreliable = NO;
+
+        /* initialize summary statistics */
+        sumStdDev = 0.0;
+        sumPSRF = 0.0;
+        numPSRFSamples = 0;
+        maxStdDev = 0.0;
+        maxPSRF = 0.0;
+
+        /* tell user we are ready to go */
+        if (sumtParams.numTrees > 1)
+            sprintf (fileName,"%s.tree%d", sumtParams.sumtFileName, treeNo+1);
+        else
+            strcpy (fileName, sumtParams.sumtFileName);
+
+        if (sumtParams.numRuns == 1)
+            MrBayesPrint ("%s   Summarizing trees in file \"%s.t\"\n", spacer, fileName);
+        else if (sumtParams.numRuns == 2)
+            MrBayesPrint ("%s   Summarizing trees in files \"%s.run1.t\" and \"%s.run2.t\"\n", spacer, fileName, fileName);
+        else if (sumtParams.numRuns > 2)
+            MrBayesPrint ("%s   Summarizing trees in files \"%s.run1.t\", \"%s.run2.t\",...,\"%s.run%d.t\"\n", spacer, fileName, fileName,fileName,sumtParams.numRuns);
+
+        if (chainParams.relativeBurnin == YES)
+            MrBayesPrint ("%s   Using relative burnin ('relburnin=yes'), discarding the first %.0f %% of sampled trees\n",
+                spacer, chainParams.burninFraction*100.0, chainParams.burninFraction);
+        else
+            MrBayesPrint ("%s   Using absolute burnin ('relburnin=no'), discarding the first %d sampled trees\n",
+                spacer, chainParams.chainBurnIn, chainParams.chainBurnIn);
+        
+        MrBayesPrint ("%s   Writing statistics to files %s.<parts|tstat|vstat|trprobs|con>\n", spacer, sumtParams.sumtOutfile);
+
+        for (sumtParams.runId=0; sumtParams.runId < sumtParams.numRuns; sumtParams.runId++)
+            {
+            /* initialize tree counters */
+            sumtParams.numFileTrees[sumtParams.runId] = sumtParams.numFileTreesSampled[sumtParams.runId] = 0;
+
+            /* open binary file */
+            if (sumtParams.numRuns == 1)
+                sprintf (tempName, "%s.t", fileName);
+            else
+                sprintf (tempName, "%s.run%d.t", fileName, sumtParams.runId+1);
+            strcpy(sumtParams.curFileName, tempName);
+
+            /* tell user we are examining files if for the first run */
+            if (sumtParams.runId == 0)
+                {
+                if (sumtParams.numRuns > 1 && sumtParams.numTrees > 1)
+                    MrBayesPrint ("%s   Examining first file for tree %d ...\n", spacer, treeNo);
+                else if (sumtParams.numRuns > 1 && sumtParams.numTrees == 1)
+                    MrBayesPrint ("%s   Examining first file ...\n", spacer);
+                else if (sumtParams.numRuns == 1 && sumtParams.numTrees > 1)
+                    MrBayesPrint ("%s   Examining file for tree %d ...\n", spacer, treeNo);
+                else
+                    MrBayesPrint ("%s   Examining file ...\n", spacer);
+                }
+
+            /* examine file */
+            if (ExamineSumtFile(tempName, &sumtFileInfo, treeName, &sumtParams.brlensDef) == ERROR)
+                goto errorExit;
+
+            /* capture values */
+            if (sumtParams.runId == 0)
+
+            /* catch lack of sampled trees */
+            if (chainParams.relativeBurnin == NO && chainParams.chainBurnIn > sumtFileInfo.numTreesInLastBlock)
+                {
+                MrBayesPrint ("%s   No trees are sampled as the burnin exceeds the number of trees in last block\n", spacer);
+                MrBayesPrint ("%s   Try setting burnin to a number less than %d\n", spacer, sumtFileInfo.numTreesInLastBlock);
+                goto errorExit;
+                }
+                
+            /* tell the user that everything is fine */
+            if (sumtParams.runId == 0)
+                {
+                if (sumtFileInfo.numTreeBlocks == 1)
+                    MrBayesPrint ("%s   Found one tree block in file \"%s\" with %d trees in last block\n",
+                        spacer, tempName, sumtFileInfo.numTreesInLastBlock);
+                else
+                    {
+                    MrBayesPrint ("%s   Found %d tree blocks in file \"%s\" with %d trees in last block\n",
+                        spacer, sumtFileInfo.numTreeBlocks, tempName, sumtFileInfo.numTreesInLastBlock);
+                    MrBayesPrint ("%s   Only the %d trees in last tree block will be summarized\n", spacer, sumtFileInfo.numTreesInLastBlock);
+                    }
+                sumtParams.numTreesInLastBlock = sumtFileInfo.numTreesInLastBlock;
+                if (sumtParams.numRuns > 1)
+                    MrBayesPrint ("%s   Expecting the same number of trees in the last tree block of all files\n", spacer);
+                if (chainParams.relativeBurnin == NO)
+                    sumtParams.burnin = chainParams.chainBurnIn;
+                else
+                    sumtParams.burnin = (int) (sumtFileInfo.numTreesInLastBlock * chainParams.burninFraction);
+                }
+            else
+                {
+                if (sumtFileInfo.numTreesInLastBlock != sumtParams.numFileTrees[0])
+                    {
+                    MrBayesPrint ("%s   Found %d trees in first file but %d trees in file \"%s\"\n", spacer,
+                        sumtParams.numFileTrees[0],
+                        sumtFileInfo.numTreesInLastBlock,
+                        tempName);
+                    goto errorExit;
+                    }
+                }
+        
+            /* Now we read the file for real. First, allocate a string for reading the file... */
+            if (sumtParams.runId == 0 && treeNo == 0)
+                {
+                s = (char *) SafeMalloc ((size_t)(sumtFileInfo.longestLineLength) * sizeof(char));
+                if (!s)
+                    {
+                    MrBayesPrint ("%s   Problem allocating string for reading sumt file\n", spacer);
+                    goto errorExit;
+                    }
+                }
+            else
+                {
+                free (s);
+                s = (char *) SafeMalloc ((size_t)(sumtFileInfo.longestLineLength) * sizeof (char));
+                if (!s)
+                    {
+                    MrBayesPrint ("%s   Problem reallocating string for reading sumt file\n", spacer);
+                    goto errorExit;
+                    }
+                }
+        
+            /* ... open the file ... */
+            if ((fp = OpenTextFileR(tempName)) == NULL)
+                goto errorExit;
+    
+            /* ...and fast forward to beginning of last tree block. */
+            for (i=0; i<sumtFileInfo.lastTreeBlockBegin+1; i++)
+                {
+                if (fgets (s, sumtFileInfo.longestLineLength-2, fp) == NULL)
+                    {
+                    printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+                    }
+                }
+
+#   if defined (PRINT_RATEMUL_CPP)
+            sprintf (tempName, "%s.ratemult", chainParams.chainFileName);
+            if ((rateMultfp=OpenNewMBPrintFile (tempName)) == NULL)
+                {
+                printf ("Error oppening file: %s to write", tempName);
+                goto errorExit;
+                }
+            fprintf (rateMultfp,"rateMult_CPP\n");
+#   endif
+
+            /* Set up cheap status bar. */
+            if (sumtParams.runId == 0)
+                {
+                if (sumtParams.numTrees > 1)
+                    MrBayesPrint ("\n%s   Tree reading status for tree %d:\n\n", spacer, treeNo+1);
+                else
+                    MrBayesPrint ("\n%s   Tree reading status:\n\n", spacer);
+                MrBayesPrint ("%s   0      10      20      30      40      50      60      70      80      90     100\n", spacer);
+                MrBayesPrint ("%s   v-------v-------v-------v-------v-------v-------v-------v-------v-------v-------v\n", spacer);
+                MrBayesPrint ("%s   *", spacer);
+                numAsterices = 0;
+                }
+        
+            /* ...and parse file, tree-by-tree. We are only parsing lines between the "begin trees" and "end" statements.
+            We don't actually get those lines, however, but rather the lines between those statements. */
+            expecting = Expecting(COMMAND);
+            /* We skip the begin trees statement so we need to set up some variables here */
+            inTreesBlock = YES;
+            ResetTranslateTable();
+            for (i=0; i<sumtFileInfo.lastTreeBlockEnd - sumtFileInfo.lastTreeBlockBegin - 1; i++)
+                {
+                if (fgets (s, sumtFileInfo.longestLineLength-2, fp) == NULL)
+                    {
+                    printf ("Error in function: %s at line: %d in file: %s", __FUNCTION__, __LINE__, __FILE__);
+                    }
+                /*MrBayesPrint ("%s", s);*/
+                if (ParseCommand (s) == ERROR)
+                    goto errorExit;
+                }
+            inTreesBlock = NO;
+            ResetTranslateTable();
+    
+            /* Finish cheap status bar. */
+            if (sumtParams.runId == sumtParams.numRuns - 1)
+                {
+                if (numAsterices < 80)
+                    {
+                    for (i=0; i<80 - numAsterices; i++)
+                        MrBayesPrint ("*");
+                    }
+                MrBayesPrint ("\n\n");
+                }
+    
+            /* print out information on absent and pruned taxa */
+            if (sumtParams.runId == sumtParams.numRuns - 1 && treeNo == 0)
+                PrintSumtTaxaInfo ();
+
+            /* tell user how many trees were successfully read */
+            if (sumtParams.numRuns == 1)
+                MrBayesPrint ("%s   Read %d trees from last tree block (sampling %d of them)\n", spacer,
+                    sumtParams.numTreesEncountered, sumtParams.numTreesSampled);
+            else if (sumtParams.numRuns > 1)
+                {
+                if (sumtParams.runId != 0 && sumtParams.numFileTreesSampled[sumtParams.runId]!=sumtParams.numFileTreesSampled[0])
+                    {
+                    if (sumtParams.runId == sumtParams.numRuns - 1)
+                        MrBayesPrint ("\n\n");
+                    MrBayesPrint ("%s   Found %d post-burnin trees in the first file but %d post-burnin trees in file %d\n",
+                            spacer,
+                            sumtParams.numFileTreesSampled[0],
+                            sumtParams.numFileTreesSampled[sumtParams.runId],
+                            sumtParams.runId+1);
+                    goto errorExit;
+                    }
+                if (sumtParams.runId == sumtParams.numRuns - 1)
+                    {
+                    MrBayesPrint ("%s   Read a total of %d trees in %d files (sampling %d of them)\n", spacer,
+                        sumtParams.numTreesEncountered,
+                        sumtParams.numRuns, sumtParams.numTreesSampled);
+                    MrBayesPrint ("%s      (Each file contained %d trees of which %d were sampled)\n", spacer,
+                        sumtParams.numFileTrees[0],
+                        sumtParams.numFileTreesSampled[0]);
+                    }
+                }
+
+            /* Check that at least one tree was read in. */
+            if (sumtParams.numTreesSampled <= 0)
+                {
+                MrBayesPrint ("%s   No trees read in\n", spacer);
+                goto errorExit;
+                }
+
+            SafeFclose (&fp);
+            }   /* next run for this tree */
+                
+        /* Extract partition counter pointers */
+        treeParts = (PartCtr **) SafeCalloc ((size_t)numUniqueSplitsFound, sizeof(PartCtr *));
+        i = 0;
+        PartCtrUppass(partCtrRoot, treeParts, &i);
+
+        min = (sumtParams.minPartFreq * (sumtParams.numTreesSampled/sumtParams.numRuns));
+        numTreePartsToPrint=numUniqueSplitsFound;
+        for (i=0; i<numTreePartsToPrint;)
+            {
+            for (j=0; j<sumtParams.numRuns;j++)
+                {
+                if (treeParts[i]->count[j]>=min)
+                    break;
+                }
+            if (j==sumtParams.numRuns)
+                {
+                numTreePartsToPrint--;
+                tmp=treeParts[numTreePartsToPrint];
+                treeParts[numTreePartsToPrint]=treeParts[i];
+                treeParts[i]=tmp;
+                }
+            else
+                {
+                i++;
+                }
+            }
+
+        /* Sort taxon partitions (clades, splits) ... */
+        SortPartCtr (treeParts, 0, numTreePartsToPrint-1);
+
+        /* Sort root and tips among those splits always present */
+        SortTerminalPartCtr (treeParts, numUniqueSplitsFound);
+
+        /* open output files for summary information (three files) */
+        if (OpenSumtFiles (treeNo) == ERROR)
+            goto errorExit;
+
+        /* Print partitions to screen. */
+        if (treeNo == 0)
+            {
+            longestName = 0;
+            for (k=0; k<numTaxa; k++)
+                {
+                if (taxaInfo[k].isDeleted == NO && sumtParams.absentTaxa[k] == NO)
+                    continue;
+                len = (int) strlen (taxaNames[k]);
+                if (len > longestName)
+                    longestName = len;
+                }
+            if (sumtParams.table == YES)
+                {
+                MrBayesPrint ("                                                                                   \n");
+                MrBayesPrint ("%s   General explanation:                                                          \n", spacer);
+                MrBayesPrint ("                                                                                   \n");
+                MrBayesPrint ("%s   In an unrooted tree, a taxon bipartition (split) is specified by removing a   \n", spacer);
+                MrBayesPrint ("%s   branch, thereby dividing the species into those to the left and those to the  \n", spacer);
+                MrBayesPrint ("%s   right of the branch. Here, taxa to one side of the removed branch are denoted \n", spacer);
+                MrBayesPrint ("%s   '.' and those to the other side are denoted '*'. Specifically, the '.' symbol \n", spacer);
+                MrBayesPrint ("%s   is used for the taxa on the same side as the outgroup.                        \n", spacer);
+                MrBayesPrint ("                                                                                   \n");
+                MrBayesPrint ("%s   In a rooted or clock tree, the tree is rooted using the model and not by      \n", spacer);
+                MrBayesPrint ("%s   reference to an outgroup. Each bipartition therefore corresponds to a clade,  \n", spacer);
+                MrBayesPrint ("%s   that is, a group that includes all the descendants of a particular branch in  \n", spacer);
+                MrBayesPrint ("%s   the tree.  Taxa that are included in each clade are denoted using '*', and    \n", spacer);
+                MrBayesPrint ("%s   taxa that are not included are denoted using the '.' symbol.                  \n", spacer);
+                MrBayesPrint ("                                                                                   \n");
+                MrBayesPrint ("%s   The output first includes a key to all the bipartitions with frequency larger \n", spacer);
+                MrBayesPrint ("%s   or equual to (Minpartfreq) in at least one run. Minpartfreq is a parameter to \n", spacer);
+                MrBayesPrint ("%s   sumt command and currently it is set to %1.2lf.  This is followed by a table  \n", spacer, sumtParams.minPartFreq);
+                MrBayesPrint ("%s   with statistics for the informative bipartitions (those including at least    \n", spacer);
+                MrBayesPrint ("%s   two taxa), sorted from highest to lowest probability. For each bipartition,   \n", spacer);
+                MrBayesPrint ("%s   the table gives the number of times the partition or split was observed in all\n", spacer);
+                MrBayesPrint ("%s   runs (#obs) and the posterior probability of the bipartition (Probab.), which \n", spacer);
+                MrBayesPrint ("%s   is the same as the split frequency. If several runs are summarized, this is   \n", spacer);
+                MrBayesPrint ("%s   followed by the minimum split frequency (Min(s)), the maximum frequency       \n", spacer);
+                MrBayesPrint ("%s   (Max(s)), and the standard deviation of frequencies (Stddev(s)) across runs.  \n", spacer);
+                MrBayesPrint ("%s   The latter value should approach 0 for all bipartitions as MCMC runs converge.\n", spacer);
+                MrBayesPrint ("                                                                                   \n");
+                MrBayesPrint ("%s   This is followed by a table summarizing branch lengths, node heights (if a    \n", spacer);
+                MrBayesPrint ("%s   clock model was used) and relaxed clock parameters (if a relaxed clock model  \n", spacer);
+                MrBayesPrint ("%s   was used). The mean, variance, and 95 %% credible interval are given for each \n", spacer);
+                MrBayesPrint ("%s   of these parameters. If several runs are summarized, the potential scale      \n", spacer);
+                MrBayesPrint ("%s   reduction factor (PSRF) is also given; it should approach 1 as runs converge. \n", spacer);
+                MrBayesPrint ("%s   Node heights will take calibration points into account, if such points were   \n", spacer);
+                MrBayesPrint ("%s   used in the analysis.                                                         \n", spacer);
+                MrBayesPrint ("%s                                                                                 \n", spacer);
+                MrBayesPrint ("%s   Note that Stddev may be unreliable if the partition is not present in all     \n", spacer);
+                MrBayesPrint ("%s   runs (the last column indicates the number of runs that sampled the partition \n", spacer);
+                MrBayesPrint ("%s   if more than one run is summarized). The PSRF is not calculated at all if     \n", spacer); 
+                MrBayesPrint ("%s   the partition is not present in all runs.The PSRF is also sensitive to small  \n", spacer);
+                MrBayesPrint ("%s   sample sizes and it should only be considered a rough guide to convergence    \n", spacer);
+                MrBayesPrint ("%s   since some of the assumptions allowing one to interpret it as a true potential\n", spacer);
+                MrBayesPrint ("%s   scale reduction factor are violated in MrBayes.                               \n", spacer);
+                MrBayesPrint ("%s                                                                                 \n", spacer);
+                MrBayesPrint ("%s   List of taxa in bipartitions:                                                 \n", spacer);
+                MrBayesPrint ("                                                                                   \n");
+                j = 1;
+                for (k=0; k<numTaxa; k++)
+                    {
+                    if (taxaInfo[k].isDeleted == NO && sumtParams.absentTaxa[k] == NO)
+                        {
+                        MrBayesPrint ("%s   %4d -- %s\n", spacer, j++, taxaNames[k]);
+                        }
+                    }
+                }
+            }
+    
+        if (sumtParams.numTrees > 1 && (sumtParams.table == YES || sumtParams.summary == YES))
+            {
+            MrBayesPrint ("\n\n");
+            MrBayesPrint ("%s   Results for tree number %d\n", spacer, treeNo+1);
+            MrBayesPrint ("%s   ==========================\n\n", spacer);
+            }
+
+        /* First print key to taxon bipartitions */
+        if (sumtParams.table == YES)
+            {
+            MrBayesPrint ("\n");
+            if (sumtParams.numTrees == 1)
+                MrBayesPrint ("%s   Key to taxon bipartitions (saved to file \"%s.parts\"):\n\n", spacer, sumtParams.sumtOutfile);
+            else
+                MrBayesPrint ("%s   Key to taxon bipartitions (saved to file \"%s.tree%d.parts\"):\n\n", spacer,  sumtParams.sumtOutfile, treeNo+1);
+            }
+
+        /* calculate a couple of numbers that are handy to have */
+        /*numTreePartsToPrint = 0;
+        for (i=0; i<numUniqueSplitsFound; i++)
+            {
+            if ((MrBFlt)treeParts[i]->totCount/(MrBFlt)sumtParams.numTreesSampled >= sumtParams.minPartFreq)
+                numTreePartsToPrint++;
+            }
+            */
+        maxWidthID = (int) (log10 (numTreePartsToPrint)) + 1;
+        if (maxWidthID < 2)
+            maxWidthID = 2;
+        maxNumTaxa = SCREEN_WIDTH - 9;
+
+        for (j=0; j<sumtParams.numTaxa; j+=maxNumTaxa)
+            {
+            /* print header to screen and to parts file simultaneously */
+
+            /* first print header to screen */
+            MrBayesPrint ("%s   ", spacer);
+            if (j == 0)
+                MrBayesPrint ("%*s -- Partition\n", maxWidthID, "ID");
+            else
+                MrBayesPrint ("%*s -- Partition (continued)\n", maxWidthID, "ID");
+            tableWidth = maxWidthID + 4 + sumtParams.numTaxa;
+            if (tableWidth > SCREEN_WIDTH)
+                tableWidth = SCREEN_WIDTH;
+            MrBayesPrint ("%s   ", spacer);
+            for (i=0; i<tableWidth; i++)
+                MrBayesPrint ("-");
+            MrBayesPrint ("\n");
+
+            /* now print header to file */
+            MrBayesPrintf (fpParts, "ID\tPartition\n");
+
+            /* now, show partitions that were found on screen; print to .parts file simultaneously */
+            mask = SafeCalloc (sumtParams.BitsLongsNeeded, sizeof(BitsLong));
+            for (i=0; i<sumtParams.numTaxa; i++)
+                SetBit (i, mask);
+            for (i=0; i<numTreePartsToPrint; i++)
+                {
+                x = treeParts[i];
+                if (IsBitSet(localOutGroup, x->partition) == YES && sumtParams.isRooted == NO)
+                    FlipBits(x->partition, sumtParams.BitsLongsNeeded, mask);
+
+                if ((NumBits(x->partition, sumtParams.BitsLongsNeeded) == numLocalTaxa || NumBits(x->partition, sumtParams.BitsLongsNeeded) == 0) && sumtParams.isClock == NO)
+                    continue;
+
+                MrBayesPrint ("%s   %*d -- ", spacer, maxWidthID, i);
+                if (sumtParams.numTaxa <= maxNumTaxa)
+                    ShowParts (stdout, x->partition, sumtParams.numTaxa);
+                else
+                    {
+                    if (sumtParams.numTaxa - j > maxNumTaxa)
+                        ShowSomeParts (stdout, x->partition, j, maxNumTaxa);
+                    else
+                        ShowSomeParts (stdout, x->partition, j, sumtParams.numTaxa - j);
+                    }
+                fflush(stdout);
+                MrBayesPrint ("\n");
+
+                MrBayesPrintf (fpParts, "%d\t", i);
+                ShowParts (fpParts, x->partition, sumtParams.numTaxa);
+                MrBayesPrintf (fpParts, "\n");
+                }
+            free (mask);
+
+            /* finish screen table */
+            if (sumtParams.table == YES)
+                {
+                MrBayesPrint ("%s   ", spacer);
+                for (i=0; i<tableWidth; i++)
+                    {
+                    MrBayesPrint ("-");
+                    }
+                MrBayesPrint ("\n");
+                if (oneUnreliable == YES)
+                    {
+                    MrBayesPrint ("%s   * The partition was not found in all runs so the values are unreliable\n\n", spacer);
+                    }
+                else
+                    {
+                    MrBayesPrint ("\n");
+                    }
+                }
+            }
+
+        /* Second, print statitistics for taxon bipartitions */
+        if (sumtParams.table == YES)
+            {
+            if (sumtParams.isRooted == NO)
+                MrBayesPrint ("%s   Summary statistics for informative taxon bipartitions\n", spacer);
+            else
+                MrBayesPrint ("%s   Summary statistics for informative taxon bipartitions (clades)\n", spacer);
+            MrBayesPrint ("%s      (saved to file \"%s.tstat\"):\n\n", spacer, sumtParams.sumtOutfile);
+            }
+
+        /* calculate a couple of numbers that are handy to have */
+        /*numTreePartsToPrint = 0;
+        for (i=0; i<numUniqueSplitsFound; i++)
+            {
+            if ((MrBFlt)treeParts[i]->totCount/(MrBFlt)sumtParams.numTreesSampled >= sumtParams.minPartFreq)
+                numTreePartsToPrint++;
+            }
+            */
+        maxWidthID = (int) (log10 (numTreePartsToPrint)) + 1;
+        if (maxWidthID < 2)
+            maxWidthID = 2;
+        maxWidthNumberPartitions = (int) (log10 (treeParts[0]->totCount)) + 1;
+        if (maxWidthNumberPartitions < 4)
+            maxWidthNumberPartitions = 4;
+
+        /* print header to screen and to parts file simultaneously */
+        if (sumtParams.table == YES)
+            {
+            /* first print header to screen */
+            MrBayesPrint ("%s   ", spacer);
+            MrBayesPrint ("%*s   ", maxWidthID, "ID");
+            tableWidth = maxWidthID + 3;
+            MrBayesPrint ("#obs");
+            tableWidth += 4;
+            for (i=4; i<maxWidthNumberPartitions; i++)
+                {
+                MrBayesPrint (" ");
+                tableWidth++;
+                }
+            MrBayesPrint ("    Probab.");
+            tableWidth += 11;
+            if (sumtParams.numRuns > 1)
+                {
+                MrBayesPrint ("     Sd(s)+ ");
+                MrBayesPrint ("     Min(s)      Max(s) ");
+                tableWidth += 36;
+                MrBayesPrint ("  Nruns ");
+                tableWidth += 8;
+                }
+            MrBayesPrint ("\n%s   ", spacer);
+            for (i=0; i<tableWidth; i++)
+                {
+                MrBayesPrint ("-");
+                }
+            MrBayesPrint ("\n");
+
+            /* now print header to file */
+            if (sumtParams.numRuns > 1)
+                MrBayesPrintf (fpTstat, "ID\t#obs\tProbability(=s)\tStddev(s)\tMin(s)\tMax(s)\tNruns\n");
+            else
+                MrBayesPrintf (fpTstat, "ID\t#obs\tProbability(=s)\n");
+            }
+
+        /* now, show informative partitions that were found on screen; print to .tstat file simultaneously */
+        for (i=0; i<numTreePartsToPrint; i++)
+            {
+            x = treeParts[i];
+
+            /* skip uninformative partitions */
+            if (NumBits(x->partition, sumtParams.BitsLongsNeeded) <= 1 || NumBits(x->partition, sumtParams.BitsLongsNeeded) == sumtParams.numTaxa)
+                continue;
+            if (NumBits(x->partition, sumtParams.BitsLongsNeeded) == sumtParams.numTaxa - 1 && sumtParams.isRooted == NO)
+                continue;
+
+            if (sumtParams.table == YES)
+                {
+                MrBayesPrint ("%s   %*d", spacer, maxWidthID, i);
+                fflush(stdout);
+                MrBayesPrintf (fpTstat, "%d\t", i);
+                }
+            if (sumtParams.numRuns > 1)
+                {
+                sum_s = 0.0;
+                sumsq_s = 0.0;
+                min_s = 1.0;
+                max_s = 0.0;
+                for (n=j=0; n<sumtParams.numRuns; n++)
+                    {
+                    if (x->count[n] > 0)
+                        j++;
+                    f = (MrBFlt) x->count[n] / (MrBFlt) sumtParams.numFileTreesSampled[n];
+                    sum_s += f;
+                    sumsq_s += f * f;
+                    if (f < min_s)
+                        min_s = f;
+                    if (f  > max_s)
+                        max_s = f;
+                    }
+                var_s = sumsq_s - sum_s * sum_s / (MrBFlt) sumtParams.numRuns;
+                var_s /= (sumtParams.numRuns - 1);
+                if (var_s > 0.0)
+                    stddev_s = sqrt (var_s);
+                else
+                    stddev_s = 0.0;
+                if (j == sumtParams.numRuns)
+                    unreliable = NO;
+                else
+                    {
+                    unreliable = YES;
+                    oneUnreliable = YES;
+                    }
+                }
+            if (sumtParams.table == YES)
+                {
+                f = (MrBFlt) x->totCount / (MrBFlt) sumtParams.numTreesSampled;
+                MrBayesPrint ("  %*d    %1.6lf", maxWidthNumberPartitions, x->totCount, f);
+                MrBayesPrintf (fpTstat, "\t%d\t%s", x->totCount, MbPrintNum(f));
+                if (sumtParams.numRuns > 1)
+                    {
+                    MrBayesPrint ("    %1.6lf    %1.6lf    %1.6lf", stddev_s, min_s, max_s);
+                    MrBayesPrint ("  %3d", j);
+                    MrBayesPrintf (fpTstat, "\t%s", MbPrintNum(stddev_s));
+                    MrBayesPrintf (fpTstat, "\t%s", MbPrintNum(min_s));
+                    MrBayesPrintf (fpTstat, "\t%s", MbPrintNum(max_s));
+                    MrBayesPrintf (fpTstat, "\t%d", j);
+                    }
+                MrBayesPrintf (fpTstat, "\n");
+                if (unreliable == YES)
+                    MrBayesPrint (" *\n");
+                else
+                    MrBayesPrint ("\n");
+                sumStdDev += stddev_s;
+                if (stddev_s > maxStdDev)
+                    maxStdDev = stddev_s;
+                }
+            }
+
+        /* finish screen table */
+        if (sumtParams.table == YES)
+            {
+            MrBayesPrint ("%s   ", spacer);
+            for (i=0; i<tableWidth; i++)
+                {
+                MrBayesPrint ("-");
+                }
+            MrBayesPrint ("\n");
+            if (sumtParams.numRuns > 1)
+                {
+                MrBayesPrint ("%s   + Convergence diagnostic (standard deviation of split frequencies)\n", spacer);
+                MrBayesPrint ("%s     should approach 0.0 as runs converge.\n\n", spacer);
+                }
+            if (oneUnreliable == YES)
+                MrBayesPrint ("%s   * The partition was not found in all runs so the values are unreliable\n", spacer);
+            }
+
+        /* Third, print statitistics for branch and node parameters */
+        if (sumtParams.table == YES)
+            {
+            MrBayesPrint ("\n");
+            MrBayesPrint ("%s   Summary statistics for branch and node parameters\n", spacer);
+            MrBayesPrint ("%s      (saved to file \"%s.vstat\"):\n", spacer, sumtParams.sumtOutfile);
+            }
+        
+        if (sumtParams.table == YES)
+            {
+            /* calculate longest header */
+            longestHeader = 9;  /* length of 'parameter' */
+            i = (int)(log10(numTreePartsToPrint)) + 3;   /* length of partition specifier including [] */
+            len = i + (int)(strlen(treeName)) + 2;   /* length of length{m}[n] or height{m}[n] */
+            if (len > longestHeader)
+                longestHeader = len;
+            for (j=0; j<sumtParams.nBSets; j++)
+                {
+                len = (int) strlen(sumtParams.tree->bSetName[j]) + 7 + i;
+                if (len > longestHeader)
+                    longestHeader = len;
+                }
+            for (j=0; j<sumtParams.nESets; j++)
+                {
+                len = (int) strlen(sumtParams.tree->eSetName[j]) + 8 + i;
+                if (len > longestHeader)
+                    longestHeader = len;
+                }
+            if (sumtParams.popSizeSet == YES)
+                {
+                len = (int) strlen(sumtParams.tree->popSizeSetName) + i;
+                if (len > longestHeader)
+                    longestHeader = len;
+                }
+    
+            /* print the header rows */
+            MrBayesPrint ("\n");
+            if (sumtParams.HPD == NO)
+                MrBayesPrint ("%s   %*c                             95%% Cred. Interval\n", spacer, longestHeader, ' ');
+            else
+                MrBayesPrint ("%s   %*c                              95%% HPD Interval\n", spacer, longestHeader, ' ');
+            MrBayesPrint ("%s   %*c                            --------------------\n", spacer, longestHeader, ' ');
+
+            MrBayesPrint ("%s   Parameter%*c     Mean       Variance     Lower       Upper       Median", spacer, longestHeader-9, ' ');
+            tableWidth = 68 + longestHeader - 9;
+            if (sumtParams.HPD == YES)
+                MrBayesPrintf (fpVstat, "Parameter\tMean\tVariance\tCredInt_Lower\tCredInt_Upper\tMedian", spacer, longestHeader-9, ' ');
+            else
+                MrBayesPrintf (fpVstat, "Parameter\tMean\tVariance\tHPD_Lower\tHPD_Upper\tMedian", spacer, longestHeader-9, ' ');
+            if (sumtParams.numRuns > 1)
+                {
+                    MrBayesPrint ("     PSRF+  Nruns");
+                tableWidth += 17;
+                MrBayesPrintf (fpVstat, "\tPSRF\tNruns");
+                }
+            MrBayesPrint ("\n");
+            MrBayesPrintf (fpVstat, "\n");
+
+            MrBayesPrint ("%s   ", spacer);
+            for (j=0; j<tableWidth; j++)
+                {
+                MrBayesPrint ("-");
+                }
+            MrBayesPrint ("\n");
+
+            /* print lengths */
+            strcpy (divString, treeName+4);
+            for (i=1; i<numTreePartsToPrint; i++)
+                {
+                x = treeParts[i];
+                tempStrLength=(int)strlen(tempStr);
+                SafeSprintf (&tempStr,&tempStrLength, "length%s[%d]", divString, i);
+                len = (int) strlen(tempStr);
+
+                GetSummary (x->length, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+
+                }
+
+            /* print heights */
+           if (sumtParams.isClock == YES)
+                {
+                strcpy (divString, treeName+4);
+                for (i=0; i<numTreePartsToPrint; i++)
+                    {
+                    x = treeParts[i];
+                    tempStrLength=(int)strlen(tempStr);
+                    SafeSprintf (&tempStr,&tempStrLength, "height%s[%d]", divString, i);
+                    len = (int) strlen(tempStr);
+
+                    GetSummary (x->height, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                    MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                    MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                    PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+                    }
+                }
+
+            /* print ages */
+            if (sumtParams.isCalibrated == YES)
+                {
+                strcpy (divString, treeName+4);
+                for (i=0; i<numTreePartsToPrint; i++)
+                    {
+                    x = treeParts[i];
+                    tempStrLength=(int)strlen(tempStr);
+                    SafeSprintf (&tempStr,&tempStrLength, "age%s[%d]", divString, i);
+                    len = (int) strlen(tempStr);
+
+                    GetSummary (x->age, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                    MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                    MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                    PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+                    }
+                }
+
+            /* print effective branch lengths */
+            if (sumtParams.isRelaxed == YES)
+                {
+                for (i=0; i<sumtParams.nBSets; i++)
+                    {
+                    for (j=1; j<numTreePartsToPrint; j++)
+                        {
+                        x = treeParts[j];
+                        tempStrLength=(int)strlen(tempStr);
+                        SafeSprintf (&tempStr,&tempStrLength, "%s_length[%d]", sumtParams.bSetName[i], j);
+                        len = (int) strlen(tempStr);
+
+                        GetSummary (x->bLen[i], sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                        MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                        MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                        PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+                        }
+                    for (j=1; j<numTreePartsToPrint; j++)
+                        {
+                        x = treeParts[j];
+                        tempStrLength=(int)strlen(tempStr);
+                        SafeSprintf (&tempStr,&tempStrLength, "%s_rate[%d]", sumtParams.bSetName[i], j);
+                        len = (int) strlen(tempStr);
+
+                        GetSummary (x->bRate[i], sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                        MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                        MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                        PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+                        }
+                    }
+                for (i=0; i<sumtParams.nESets; i++)
+                    {
+                    for (j=1; j<numTreePartsToPrint; j++)
+                        {
+                        x = treeParts[j];
+                        tempStrLength=(int)strlen(tempStr);
+                        SafeSprintf (&tempStr,&tempStrLength, "%s_nEvents[%d]", sumtParams.eSetName[i], j);
+                        len = (int) strlen(tempStr);
+
+                        GetIntSummary (x->nEvents[i], sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                        MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                        MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                        PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+                        }
+                    }
+                }
+
+            /* print population size sets */
+            if (sumtParams.popSizeSet == YES)
+                {
+                for (j=1; j<numTreePartsToPrint; j++)
+                    {
+                    x = treeParts[j];
+                    tempStrLength=(int)strlen(tempStr);
+                    SafeSprintf (&tempStr,&tempStrLength, "%s[%d]", sumtParams.popSizeSetName, j);
+                    len = (int) strlen(tempStr);
+
+                    GetSummary (x->popSize, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+
+                    MrBayesPrint ("%s   %-*s  ", spacer, longestHeader, tempStr);
+                    MrBayesPrintf (fpVstat, "%s", tempStr);
+
+                    PrintSumtTableLine(sumtParams.numRuns, x->count, &theStats, &numPSRFSamples, &maxPSRF, &sumPSRF);
+                    }
+                }
+
+            /* finish table */
+            MrBayesPrint ("%s   ", spacer);
+            for (j=0; j<tableWidth; j++)
+                MrBayesPrint ("-");
+            MrBayesPrint ("\n");
+
+            if (sumtParams.numRuns > 1)
+                {
+                MrBayesPrint ("%s   + Convergence diagnostic (PSRF = Potential Scale Reduction Factor; Gelman\n", spacer);
+                MrBayesPrint ("%s     and Rubin, 1992) should approach 1.0 as runs converge. NA is reported when\n", spacer);
+                MrBayesPrint ("%s     deviation of parameter values within all runs is 0 or when a parameter\n", spacer);
+                MrBayesPrint ("%s     value (a branch length, for instance) is not sampled in all runs.\n", spacer);
+                }
+
+            if (oneUnreliable == YES)
+                {
+                MrBayesPrint ("%s   * The partition was not found in all runs so the values are unreliable.\n", spacer);
+                }
+            MrBayesPrint ("\n\n");
+            }
+            
+        /* Exclude trivial splits when calculating average standard deviation of split frequencies. */
+        avgStdDev = sumStdDev / (numTreePartsToPrint-sumtParams.numTaxa-1);
+        avgPSRF   = sumPSRF / numPSRFSamples;
+        
+        if (sumtParams.numRuns > 1 && sumtParams.summary == YES)
+            {
+            MrBayesPrint ("%s   Summary statistics for partitions with frequency >= %1.2lf in at least one run:\n", spacer, sumtParams.minPartFreq);
+            MrBayesPrint ("%s       Average standard deviation of split frequencies = %1.6lf\n", spacer, avgStdDev);
+            MrBayesPrint ("%s       Maximum standard deviation of split frequencies = %1.6lf\n", spacer, maxStdDev);
+            }
+        if (sumtParams.brlensDef == YES && sumtParams.numRuns > 1 && sumtParams.summary == YES)
+            {
+            MrBayesPrint ("%s       Average PSRF for parameter values (excluding NA and >10.0) = %1.3lf\n", spacer, avgPSRF);
+            if (maxPSRF == 10)
+                MrBayesPrint ("%s       Maximum PSRF for parameter values = NA\n", spacer);
+            else
+                MrBayesPrint ("%s       Maximum PSRF for parameter values = %1.3lf\n", spacer, maxPSRF);
+            }
+        MrBayesPrint ("\n");
+
+        SortPartCtr (treeParts, 0, numUniqueSplitsFound-1); /* We sort again but this time we sort all partitions instead of just first numTreePartsToPrintNow */
+        /* make the majority rule consensus tree */
+        if (sumtParams.showConsensus == YES && ConTree (treeParts, numUniqueSplitsFound) == ERROR) 
+            goto errorExit;
+            
+        /* get probabilities of individual trees */
+        if (TreeProb () == ERROR)
+            goto errorExit;
+        
+        /* print brlens */
+        if (sumtParams.printBrlensToFile == YES && PrintBrlensToFile (treeParts, numUniqueSplitsFound, treeNo) == ERROR)
+            goto errorExit;
+
+        /* close files */
+        SafeFclose (&fpParts);
+        SafeFclose (&fpTstat);
+        SafeFclose (&fpVstat);
+        SafeFclose (&fpCon);
+        SafeFclose (&fpTrees);
+
+#   if defined (PRINT_RATEMUL_CPP)
+        SafeFclose (&rateMultfp);
+#   endif
+
+        /* free pointer array to partitions */
+        free (treeParts);
+        treeParts = NULL;
+        FreePartCtr (partCtrRoot);
+        partCtrRoot = NULL;
+        FreeTreeCtr (treeCtrRoot);
+        treeCtrRoot = NULL;
+        } /* next tree */
+
+    /* free memory and file pointers */
+    if (s) free(s);
+    FreeSumtParams();
+
+    /* reset numLocalTaxa and localOutGroup */
+    ResetTaxonSet();
+
+#   if defined (MPI_ENABLED)
+        }
+#   endif
+
+    expecting = Expecting(COMMAND);
+    inSumtCommand = NO;
+    SafeFree ((void **)&tempStr);
+
+    return (NO_ERROR);
+    
+    /* error exit */
+    errorExit:
+        /* free sumtParams */
+        if (s) free(s);
+        FreeSumtParams();
+        
+        /* close files in case they are open*/
+        SafeFclose (&fp);
+        SafeFclose (&fpParts);
+        SafeFclose (&fpTstat);
+        SafeFclose (&fpVstat);
+        SafeFclose (&fpCon);
+        SafeFclose (&fpTrees);
+
+#   if defined (PRINT_RATEMUL_CPP)
+        SafeFclose (&rateMultfp);
+#   endif
+
+        /* free pointer array to partitions, part and tree counters */
+        free (treeParts);
+        FreePartCtr (partCtrRoot);
+        FreeTreeCtr (treeCtrRoot);
+        partCtrRoot = NULL;
+        treeCtrRoot = NULL;
+
+        /* reset taxon set */
+        ResetTaxonSet();
+
+        expecting = Expecting(COMMAND);
+        inSumtCommand = NO;
+        SafeFree ((void **)&tempStr);
+
+        return (ERROR);
+}
+
+
+int DoSumtParm (char *parmName, char *tkn)
+{
+    int         tempI;
+    MrBFlt      tempD;
+    char        tempStr[100];
+    
+    if (defMatrix == NO)
+        {
+        MrBayesPrint ("%s   A matrix must be specified before sumt can be used\n", spacer);
+        return (ERROR);
+        }
+
+    if (expecting == Expecting(PARAMETER))
+        {
+        expecting = Expecting(EQUALSIGN);
+        }
+    else
+        {
+        if (!strcmp(parmName, "Xxxxxxxxxx"))
+            {
+            expecting  = Expecting(PARAMETER);
+            expecting |= Expecting(SEMICOLON);
+            }
+        /* set Filename (sumtParams.sumtFileName) ***************************************************/
+        else if (!strcmp(parmName, "Filename"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (strlen(tkn)>99)
+                    {
+                    MrBayesPrint ("%s   Maximum allowed length of file name is 99 characters. The given name:\n", spacer);
+                    MrBayesPrint ("%s      '%s'\n", spacer,tkn);
+                    MrBayesPrint ("%s   has %d characters.\n", spacer,strlen(tkn));
+                    return (ERROR);
+                    }
+                strcpy (sumtParams.sumtFileName, tkn);
+                strcpy(sumtParams.sumtOutfile, tkn);
+                MrBayesPrint ("%s   Setting sumt filename and outputname to %s\n", spacer, sumtParams.sumtFileName);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Relburnin (chainParams.relativeBurnin) ********************************************************/
+        else if (!strcmp(parmName, "Relburnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        chainParams.relativeBurnin = YES;
+                    else
+                        chainParams.relativeBurnin = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Relburnin\n", spacer);
+                    return (ERROR);
+                    }
+                if (chainParams.relativeBurnin == YES)
+                    MrBayesPrint ("%s   Using relative burnin (a fraction of samples discarded).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Using absolute burnin (a fixed number of samples discarded).\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burnin (chainParams.chainBurnIn) ***********************************************************/
+        else if (!strcmp(parmName, "Burnin"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                chainParams.chainBurnIn = tempI;
+                MrBayesPrint ("%s   Setting urn-in to %d\n", spacer, chainParams.chainBurnIn);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                {
+                return (ERROR);
+                }
+            }
+        /* set Burninfrac (chainParams.burninFraction) ************************************************************/
+        else if (!strcmp(parmName, "Burninfrac"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                if (tempD < 0.01)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too low (< 0.01)\n", spacer);
+                    return (ERROR);
+                    }
+                if (tempD > 0.50)
+                    {
+                    MrBayesPrint ("%s   Burnin fraction too high (> 0.50)\n", spacer);
+                    return (ERROR);
+                    }
+                chainParams.burninFraction = tempD;
+                MrBayesPrint ("%s   Setting burnin fraction to %.2f\n", spacer, chainParams.burninFraction);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else 
+                {
+                return (ERROR);
+                }
+            }
+        /* set Nruns (sumtParams.numRuns) *******************************************************/
+        else if (!strcmp(parmName, "Nruns"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Nruns must be at least 1\n", spacer);
+                    return (ERROR);
+                    }
+                else
+                    {
+                    sumtParams.numRuns = tempI;
+                    MrBayesPrint ("%s   Setting sumt nruns to %d\n", spacer, sumtParams.numRuns);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ntrees (sumtParams.numTrees) *******************************************************/
+        else if (!strcmp(parmName, "Ntrees"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%d", &tempI);
+                if (tempI < 1)
+                    {
+                    MrBayesPrint ("%s   Ntrees must be at least 1\n", spacer);
+                    return (ERROR);
+                    }
+                else
+                    {
+                    sumtParams.numTrees = tempI;
+                    MrBayesPrint ("%s   Setting sumt ntrees to %d\n", spacer, sumtParams.numTrees);
+                    expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                    }
+                }
+            else
+                return (ERROR);
+            }
+        /* set Contype (sumtParams.sumtConType) *****************************************************/
+        else if (!strcmp(parmName, "Contype"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    strcpy (sumtParams.sumtConType, tempStr);
+                    MrBayesPrint ("%s   Setting sumt contype to %s\n", spacer, sumtParams.sumtConType);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Conformat (sumtParams.consensusFormat) *****************************************************/
+        else if (!strcmp(parmName, "Conformat"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr,"Figtree"))
+                        {
+                        MrBayesPrint ("%s   Setting sumt conformat to Figtree\n", spacer);
+                        sumtParams.consensusFormat = FIGTREE;
+                        }
+                    else
+                        {
+                        MrBayesPrint ("%s   Setting sumt conformat to Simple\n", spacer);
+                        sumtParams.consensusFormat = SIMPLE;
+                        }
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for calctreeprobs\n", spacer);
+                    return (ERROR);
+                    }
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Calctreeprobs (sumtParams.calcTreeprobs) *********************************************/
+        else if (!strcmp(parmName, "Calctreeprobs"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.calcTreeprobs = YES;
+                    else
+                        sumtParams.calcTreeprobs = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for calctreeprobs\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.calcTreeprobs == YES)
+                    MrBayesPrint ("%s   Setting calctreeprobs to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting calctreeprobs to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Showtreeprobs (sumtParams.showSumtTrees) *********************************************/
+        else if (!strcmp(parmName, "Showtreeprobs"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.showSumtTrees = YES;
+                    else
+                        sumtParams.showSumtTrees = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for showtreeprobs\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.showSumtTrees == YES)
+                    MrBayesPrint ("%s   Setting showtreeprobs to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting showtreeprobs to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Hpd (sumpParams.HPD) ********************************************************/
+        else if (!strcmp(parmName, "Hpd"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.HPD = YES;
+                    else
+                        sumtParams.HPD = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Hpd\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.HPD == YES)
+                    MrBayesPrint ("%s   Reporting 95 %% region of Highest Posterior Density (HPD).\n", spacer);
+                else
+                    MrBayesPrint ("%s   Reporting median interval containing 95 %% of values.\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Printbrlens (sumtParams.printBrlensToFile) *********************************************/
+        else if (!strcmp(parmName, "Printbrlens"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.printBrlensToFile = YES;
+                    else
+                        sumtParams.printBrlensToFile = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for printbrlens\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.printBrlensToFile == YES)
+                    MrBayesPrint ("%s   Setting printbrlens to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting printbrlens to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Brlensgeq (sumtParams.brlensFreqDisplay) *******************************************************/
+        else if (!strcmp(parmName, "Brlensgeq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                sumtParams.brlensFreqDisplay = tempD;
+                MrBayesPrint ("%s   Printing branch lengths to file for partitions with probability >= %lf\n", spacer, sumtParams.brlensFreqDisplay);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Ordertaxa (sumtParams.orderTaxa) *********************************************/
+        else if (!strcmp(parmName, "Ordertaxa"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.orderTaxa = YES;
+                    else
+                        sumtParams.orderTaxa = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for ordertaxa\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.orderTaxa == YES)
+                    MrBayesPrint ("%s   Setting ordertaxa to yes\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting ordertaxa to no\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Outputname (sumtParams.sumtOutfile) *******************************************************/
+        else if (!strcmp(parmName, "Outputname"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                {
+                expecting = Expecting(ALPHA);
+                readWord = YES;
+                }
+            else if (expecting == Expecting(ALPHA))
+                {
+                sscanf (tkn, "%s", tempStr);
+                strcpy (sumtParams.sumtOutfile, tempStr);
+                MrBayesPrint ("%s   Setting sumt output file name to \"%s\"\n", spacer, sumtParams.sumtOutfile);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Table (sumtParams.table) ********************************************************/
+        else if (!strcmp(parmName, "Table"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.table = YES;
+                    else
+                        sumtParams.table = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Table (valid arguments are 'yes' and 'no')\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.table == YES)
+                    MrBayesPrint ("%s   Setting sumt to compute table of partition frequencies\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting sumt not to compute table of partition frequencies\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Summary (sumtParams.summary) ********************************************************/
+        else if (!strcmp(parmName, "Summary"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.summary = YES;
+                    else
+                        sumtParams.summary = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for 'Summary' (valid arguments are 'yes' and 'no')\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.summary == YES)
+                    MrBayesPrint ("%s   Setting sumt to summary statistics\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting sumt not to compute summary statistics\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Consensus (sumtParams.showConsensus) ********************************************************/
+        else if (!strcmp(parmName, "Consensus"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(ALPHA);
+            else if (expecting == Expecting(ALPHA))
+                {
+                if (IsArgValid(tkn, tempStr) == NO_ERROR)
+                    {
+                    if (!strcmp(tempStr, "Yes"))
+                        sumtParams.showConsensus = YES;
+                    else
+                        sumtParams.showConsensus = NO;
+                    }
+                else
+                    {
+                    MrBayesPrint ("%s   Invalid argument for Consensus (valid arguments are 'yes' and 'no')\n", spacer);
+                    return (ERROR);
+                    }
+                if (sumtParams.showConsensus == YES)
+                    MrBayesPrint ("%s   Setting sumt to show consensus trees\n", spacer);
+                else
+                    MrBayesPrint ("%s   Setting sumt not to show consensus trees\n", spacer);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        /* set Minpartfreq (sumtParams.minPartFreq) *******************************************************/
+        else if (!strcmp(parmName, "Minpartfreq"))
+            {
+            if (expecting == Expecting(EQUALSIGN))
+                expecting = Expecting(NUMBER);
+            else if (expecting == Expecting(NUMBER))
+                {
+                sscanf (tkn, "%lf", &tempD);
+                sumtParams.minPartFreq = tempD;
+                MrBayesPrint ("%s   Including partitions with probability greater than or equal to %lf in summary statistics\n", spacer, sumtParams.minPartFreq);
+                expecting = Expecting(PARAMETER) | Expecting(SEMICOLON);
+                }
+            else
+                return (ERROR);
+            }
+        else
+            return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int DoSumtTree (void)
+{
+    int             i, j, z, printEvery, nAstPerPrint, burnin;
+    MrBFlt          x, y;
+    PolyTree        *t;
+    PolyNode        *p;
+
+#   if defined (PRINT_RATEMUL_CPP)
+    /* get depths if relevant */
+    if (sumtParams.tree->isClock)
+        GetPolyDepths (sumtParams.tree);
+    if (rateMultfp !=NULL && sumtParams.tree->root !=NULL)
+        DELETE_ME_dump_depth(sumtParams.tree->root);
+#   endif
+
+    /* increment number of trees read in */
+    sumtParams.numFileTrees[sumtParams.runId]++;
+    sumtParams.numTreesEncountered++;
+
+    /*  update status bar */
+    if (sumtParams.numTreesInLastBlock * sumtParams.numRuns < 80)
+        {
+        printEvery = 1;
+        nAstPerPrint = 80 / (sumtParams.numTreesInLastBlock * sumtParams.numRuns);
+        if (sumtParams.numTreesEncountered % printEvery == 0)
+            {
+            for (i=0; i<nAstPerPrint; i++)
+                {
+                MrBayesPrint ("*");
+                numAsterices++;
+                }
+            }
+        }
+    else
+        {
+        x = (MrBFlt)(sumtParams.numTreesInLastBlock * sumtParams.numRuns) / (MrBFlt) (80);
+        y = (MrBFlt)(sumtParams.numFileTrees[sumtParams.runId] + sumtParams.numTreesInLastBlock * sumtParams.runId) / x;
+        z = (int)y;
+        if (numAsterices < z)
+            {
+            MrBayesPrint ("*");
+            numAsterices++;
+            }
+        }
+    
+    /* get burnin */
+    if (inComparetreeCommand == YES)
+        burnin = comptreeParams.burnin;
+    else
+        burnin = sumtParams.burnin;
+
+    if (sumtParams.numFileTrees[sumtParams.runId] > burnin)
+        {
+        /* increment the number of trees sampled */
+        sumtParams.numFileTreesSampled[sumtParams.runId]++;
+        sumtParams.numTreesSampled++;
+
+        /* get the tree we just read in */
+        t = sumtParams.tree;
+        
+        /* move calculation root for nonrooted trees if necessary */
+        MovePolyCalculationRoot (t, localOutGroup);
+        
+        /* check taxon set and outgroup */
+        if (sumtParams.runId == 0 && sumtParams.numFileTreesSampled[0] == 1)
+            {
+            if (isTranslateDef == YES && isTranslateDiff == YES)
+                {
+                /* we are using a translate block with different taxa set */
+                if (t->nNodes - t->nIntNodes != numTranslates)
+                    {
+                    MrBayesPrint ("%s   ERROR: Expected %d taxa; found %d taxa\n", spacer, numTranslates, sumtParams.numTaxa);
+                    return (ERROR);
+                    }
+                for (i=0; i<numTaxa; i++)
+                    sumtParams.absentTaxa[i] = NO;
+                for (i=numTranslates; i<numTaxa; i++)
+                    sumtParams.absentTaxa[i] = YES;
+                for (i=0; i<numTranslates; i++)
+                    if (strcmp(transFrom[i], taxaNames[outGroupNum]) == 0)
+                        break;
+                if (i == numTranslates)
+                    localOutGroup = 0;      /* no previous outgroup assignment is valid */
+                else
+                    localOutGroup = i;
+                }
+            else
+                {
+                /* we are using the current taxa set */
+                for (i=0; i<numTaxa; i++)
+                    sumtParams.absentTaxa[i] = YES;
+                for (i=0; i<t->nNodes; i++)
+                    {
+                    p = t->allDownPass[i];
+                    if (p->left == NULL)
+                        sumtParams.absentTaxa[p->index] = NO;
+                    }
+                localOutGroup = 0;
+                for (i=j=0; i<numTaxa; i++)
+                    {
+                    if (sumtParams.absentTaxa[i] == NO && taxaInfo[i].isDeleted == NO)
+                        {
+                        if (i == outGroupNum)
+                            localOutGroup = j;
+                        j++;
+                        }
+                    }
+                }
+
+            /* now we can safely prune the tree based on taxaInfo[].isDeleted */
+            /* note that PrunePolyTree relies on labels to recognize tips */
+            PrunePolyTree(t);
+
+            /* reset tip and int node indices in case some taxa deleted */
+            ResetTipIndices (t);
+            ResetIntNodeIndices(t);
+
+            /* set basic parameters */
+            sumtParams.numTaxa = t->nNodes - t->nIntNodes;
+            numLocalTaxa = sumtParams.numTaxa;
+            sumtParams.BitsLongsNeeded = ((numLocalTaxa-1) / nBitsInALong) + 1;
+            if (t->isRooted == YES)
+                sumtParams.orderLen = numLocalTaxa - 2;
+            else
+                sumtParams.orderLen = numLocalTaxa - 3;
+            }
+        else
+            {
+            /* the following block was conditioned with if (isTranslateDef == NO || isTranslateDiff == NO) 
+            The reason was not clearly stated  but it prevents exclusion of taxa to work in case when the condition does not hold.
+            My guess is that before PrunePolyTree() relied on indeses of tips be set as in original matrix.
+            Now it is not needed after PrunePolyTree and ResetTipIndices ware modified to use labels istead of indexes to recognize tips.*/
+                {
+                for (i=0; i<t->nNodes; i++)
+                    {
+                    p = t->allDownPass[i];
+                    if (p->left == NULL && taxaInfo[p->index].isDeleted == NO && sumtParams.absentTaxa[p->index] == YES)
+                        {
+                        MrBayesPrint ("%s   Taxon %d should not be in sampled tree\n", spacer, p->index + 1);
+                        return (ERROR);
+                        }
+                    }
+
+                /* now we can safely prune the tree based on taxaInfo[].isDeleted */
+                PrunePolyTree (t);
+
+                /* reset tip and int node indices in case some taxa deleted */
+                ResetTipIndices (t);
+                ResetIntNodeIndices(t);
+                }
+
+            /* check that all taxa are included */
+            if (t->nNodes - t->nIntNodes != sumtParams.numTaxa)
+                {
+                MrBayesPrint ("%s   Expecting %d taxa but tree '%s' in file '%s' has %d taxa\n",
+                    spacer, sumtParams.numTaxa, t->name, sumtParams.curFileName, t->nNodes-t->nIntNodes);
+                return ERROR;
+                }
+            }
+
+        if (sumtParams.runId == 0 && sumtParams.numFileTreesSampled[0] == 1)
+            {
+            /* harvest labels (can only be done safely after pruning) */
+            for (i=0; i<sumtParams.numTaxa; i++)
+                {
+                for (j=0; j<t->nNodes; j++)
+                    {
+                    p = t->allDownPass[j];
+                    if (p->index == i) {
+                         if (strlen(p->label)>99)
+                            {
+                            MrBayesPrint ("%s   Taxon name %s is too long. Maximun 99 characters is allowed.\n", spacer, p->label);
+                            return (ERROR);
+                            }
+                        AddString(&sumtParams.taxaNames, i, p->label);
+                        }
+                    }
+                }
+            }
+
+        /* check that tree agrees with template */
+        if (sumtParams.numTreesSampled == 1)
+            {
+            sumtParams.brlensDef = t->brlensDef;
+            sumtParams.isRooted = t->isRooted;
+            sumtParams.isClock = t->isClock;
+            sumtParams.isCalibrated = t->isCalibrated;
+            sumtParams.isRelaxed = t->isRelaxed;
+            sumtParams.nBSets = 0;
+            sumtParams.nESets = 0;
+            for (i=0; i<t->nBSets; i++)
+                AddString(&sumtParams.bSetName,sumtParams.nBSets++,t->bSetName[i]);
+            for (i=0; i<t->nESets; i++)
+                AddString(&sumtParams.eSetName,sumtParams.nESets++,t->eSetName[i]);
+            if (t->popSizeSet == YES)
+                {
+                sumtParams.popSizeSet = YES;
+                sumtParams.popSizeSetName = (char *) SafeCalloc (strlen(t->popSizeSetName)+1, sizeof(char));
+                strcpy(sumtParams.popSizeSetName, t->popSizeSetName);
+                }
+            else
+                sumtParams.popSizeSet = NO;
+            }
+        else /* if (sumtParams.numTreesSampled > 1) */
+            {
+            if (sumtParams.brlensDef != t->brlensDef)
+                {
+                MrBayesPrint ("%s   Trees with and without branch lengths mixed\n", spacer);
+                return ERROR;
+                }
+            if (sumtParams.isRooted != t->isRooted)
+                {
+                if (sumtParams.isRooted == YES)
+                    MrBayesPrint ("%s   Expected rooted tree but tree '%s' in file '%s' is not rooted\n",
+                        spacer, t->name, sumtParams.curFileName);
+                else if (sumtParams.isRooted == NO)
+                    MrBayesPrint ("%s   Expected unrooted tree but tree '%s' in file '%s' is rooted\n",
+                        spacer, t->name, sumtParams.curFileName);
+                return ERROR;
+                }
+            if (sumtParams.isClock != t->isClock)
+                {
+                if (sumtParams.isClock == YES)
+                    MrBayesPrint ("%s   Expected clock tree but tree '%s' in file '%s' is not clock\n",
+                        spacer, t->name, sumtParams.curFileName);
+                else if (sumtParams.isClock == NO)
+                    MrBayesPrint ("%s   Expected nonclock tree but tree '%s' in file '%s' is clock\n",
+                        spacer, t->name, sumtParams.curFileName);
+                return ERROR;
+                }
+            if (sumtParams.isCalibrated != t->isCalibrated)
+                {
+                if (sumtParams.isCalibrated == YES)
+                    MrBayesPrint ("%s   Expected calibrated tree but tree '%s' in file '%s' is not calibrated\n",
+                        spacer, t->name, sumtParams.curFileName);
+                else if (sumtParams.isCalibrated == NO)
+                    MrBayesPrint ("%s   Expected noncalibrated tree but tree '%s' in file '%s' is calibrated\n",
+                        spacer, t->name, sumtParams.curFileName);
+                return ERROR;
+                }
+            if (inComparetreeCommand == NO && sumtParams.isRelaxed != t->isRelaxed)
+                {
+                if (sumtParams.isRelaxed == YES)
+                    MrBayesPrint ("%s   Expected relaxed clock tree but tree '%s' in file '%s' is not relaxed\n",
+                        spacer, t->name, sumtParams.curFileName);
+                else if (sumtParams.isRelaxed == NO)
+                    MrBayesPrint ("%s   Expected unrooted tree but tree '%s' in file '%s' is rooted\n",
+                        spacer, t->name, sumtParams.curFileName);
+                return ERROR;
+                }
+            if (inComparetreeCommand == NO && (sumtParams.nESets != t->nESets || sumtParams.nBSets != t->nBSets))
+                {
+                MrBayesPrint ("%s   Tree '%s' in file '%s' does not have the expected relaxed clock parameters\n",
+                        spacer, t->name, sumtParams.curFileName);
+                return ERROR;
+                }
+            }
+
+        /* set partitions for tree */
+        ResetPolyTreePartitions(t);
+
+        /* get depths if relevant */
+        if (t->isClock)
+            GetPolyDepths (t);
+
+        /* get ages if relevant */
+        if (t->isCalibrated)
+            GetPolyAges (t);
+        
+        /* add partitions to counters */
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            partCtrRoot = AddSumtPartition (partCtrRoot, t, p, sumtParams.runId);
+            }
+            
+        /* add the tree to relevant tree list */
+        if (inSumtCommand == YES)
+            {
+            if (t->isRooted == YES)
+                StoreRPolyTopology (t, sumtParams.order);
+            else /* if (sumtParams.isRooted == NO) */
+                StoreUPolyTopology (t, sumtParams.order);
+            treeCtrRoot = AddSumtTree (treeCtrRoot, sumtParams.order);
+            }
+        else
+            {
+            i = sumtParams.numFileTreesSampled[sumtParams.runId] - 1;
+            if (StoreSumtTree (packedTreeList[sumtParams.runId], i, t) == ERROR)
+                return (ERROR);
+            }
+
+        /* Display the tree nodes. */
+#       if 0
+        ShowPolyNodes(t);
+#       endif
+        }
+    
+    return (NO_ERROR);  
+}
+
+
+int ExamineSumtFile (char *fileName, SumtFileInfo *sumtFileInfo, char *treeName, int *brlensDef)
+{
+    int     i, foundBegin, lineTerm, inTreeBlock, blockErrors, inSumtComment, lineNum, numTreesInBlock,
+            tokenType;
+    char    sumtToken[100], *s, *sumtTokenP;
+    FILE    *fp;
+
+    /* open binary file */
+    if ((fp = OpenBinaryFileR(fileName)) == NULL)
+        return ERROR;
+        
+    /* find out what type of line termination is used for file 1 */
+    lineTerm = LineTermType (fp);
+    if (lineTerm != LINETERM_MAC && lineTerm != LINETERM_DOS && lineTerm != LINETERM_UNIX)
+        {
+        MrBayesPrint ("%s   Unknown line termination for file  \"%s\"\n", spacer, fileName);
+        return ERROR;
+        }
+
+    /* find length of longest line in either file */
+    sumtFileInfo->longestLineLength = LongestLine (fp);
+    sumtFileInfo->longestLineLength += 10;
+    
+    /* allocate a string long enough to hold a line */
+    s = (char *)SafeMalloc((size_t)(sumtFileInfo->longestLineLength) * sizeof(char));
+    if (!s)
+        {
+        MrBayesPrint ("%s   Problem allocating string for examining file \"%s\"\n", spacer, fileName);
+        return (ERROR);
+        }
+        
+    /* close binary file */
+    SafeFclose (&fp);
+    
+    foundBegin = inTreeBlock = blockErrors = inSumtComment = NO;
+    lineNum = numTreesInBlock = 0;
+    sumtFileInfo->numTreeBlocks = 0;
+    sumtFileInfo->lastTreeBlockBegin = 0;
+    sumtFileInfo->lastTreeBlockEnd = 0;
+    sumtFileInfo->numTreesInLastBlock = 0;
+
+    /* open text file */
+    if ((fp = OpenTextFileR(fileName))==NULL)
+        {
+        MrBayesPrint ("%s   Could not read file \"%s\" in text mode \n", spacer, fileName);
+        return (ERROR);
+        }
+
+    /* read file */
+    while (fgets (s, sumtFileInfo->longestLineLength-2, fp) != NULL)
+        {
+        sumtTokenP = &s[0];
+        do
+            {
+            if (GetToken (sumtToken, &tokenType, &sumtTokenP))
+                goto errorExit;
+            if (IsSame("[", sumtToken) == SAME)
+                inSumtComment = YES;
+            if (IsSame("]", sumtToken) == SAME)
+                inSumtComment = NO;
+            
+            if (inSumtComment == YES)
+                {
+                if (IsSame ("Param", sumtToken) == SAME)
+                    {
+                    /* extract the tree name */
+                    if (GetToken (sumtToken, &tokenType, &sumtTokenP))   /* get the colon */
+                        goto errorExit;
+                    if (GetToken (sumtToken, &tokenType, &sumtTokenP))   /* get the tree name */
+                        goto errorExit;
+                    strcpy (treeName, sumtToken);
+                    if (GetToken (sumtToken, &tokenType, &sumtTokenP))
+                        goto errorExit;
+                    while (IsSame("]", sumtToken) != SAME)
+                        {
+                        strcat (treeName, sumtToken);
+                        if (GetToken (sumtToken, &tokenType, &sumtTokenP))
+                            goto errorExit;
+                        }
+                    inSumtComment = NO;
+                    }
+                }
+            else /* if (inSumtComment == NO) */
+                {
+                if (foundBegin == YES)
+                    {
+                    if (IsSame("Trees", sumtToken) == SAME)
+                        {
+                        numTreesInBlock = 0;
+                        inTreeBlock = YES;
+                        foundBegin = NO;
+                        sumtFileInfo->lastTreeBlockBegin = lineNum;
+                        }
+                    }
+                else
+                    {
+                    if (IsSame("Begin", sumtToken) == SAME)
+                        {
+                        if (foundBegin == YES)
+                            {
+                            MrBayesPrint ("%s   Found inappropriate \"Begin\" statement in file\n", spacer);
+                            blockErrors = YES;
+                            }
+                        foundBegin = YES;
+                        }
+                    else if (IsSame("End", sumtToken) == SAME)
+                        {
+                        if (inTreeBlock == YES)
+                            {
+                            sumtFileInfo->numTreeBlocks++;
+                            inTreeBlock = NO;
+                            sumtFileInfo->lastTreeBlockEnd = lineNum;
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Found inappropriate \"End\" statement in file\n", spacer);
+                            blockErrors = YES;
+                            }
+                        sumtFileInfo->numTreesInLastBlock = numTreesInBlock;
+                        }
+                    else if (IsSame("Tree", sumtToken) == SAME)
+                        {
+                        if (inTreeBlock == YES)
+                            {
+                            numTreesInBlock++;
+                            if (numTreesInBlock == 1)
+                                {
+                                *brlensDef = NO;
+                                for (i=0; s[i]!='\0'; i++)
+                                    {
+                                    if (s[i] == ':')
+                                        {
+                                        *brlensDef = YES;
+                                        break;
+                                        }
+                                    }
+                                }
+                            }
+                        else
+                            {
+                            MrBayesPrint ("%s   Found a \"Tree\" statement that is not in a tree block\n", spacer);
+                            blockErrors = YES;
+                            }
+                        }
+                    }
+                }
+                
+            } while (*sumtToken);
+        lineNum++;
+        }
+
+    /* Now, check some aspects of the tree file, such as the number of tree blocks and whether they are properly terminated. */
+    if (inTreeBlock == YES)
+        {
+        MrBayesPrint ("%s   Unterminated tree block in file %s. You probably need to\n", spacer, fileName);
+        MrBayesPrint ("%s   add a new line to the end of the file with \"End;\" on it.\n", spacer);
+        goto errorExit;
+        }
+    if (inSumtComment == YES)
+        {
+        MrBayesPrint ("%s   Unterminated comment in file %s\n", spacer, fileName);
+        goto errorExit;
+        }
+    if (blockErrors == YES)
+        {
+        MrBayesPrint ("%s   Found formatting errors in file %s\n", spacer, fileName);
+        goto errorExit;
+        }
+    if (sumtFileInfo->lastTreeBlockEnd < sumtFileInfo->lastTreeBlockBegin)
+        {
+        MrBayesPrint ("%s   Problem reading tree file %s\n", spacer, fileName);
+        goto errorExit;
+        }
+    if (sumtFileInfo->numTreesInLastBlock <= 0)
+        {
+        MrBayesPrint ("%s   No trees were found in last tree block of file %s\n", spacer, fileName);
+        goto errorExit;
+        }
+    free (s);
+    return (NO_ERROR);
+
+errorExit:
+    free (s);
+    return (ERROR);
+}
+
+
+/* FreePartCtr: Recursively free partition counter nodes */
+void FreePartCtr (PartCtr *r)
+{
+    int     i, j;
+
+    if (r==NULL)
+        return;
+    
+    FreePartCtr (r->left);
+    FreePartCtr (r->right);
+
+    /* free relaxed clock parameters: eRate, nEvents, bRate */
+    if (sumtParams.nESets > 0)
+        {
+        for (i=0; i<sumtParams.nESets; i++)
+            {
+            for (j=0; j<sumtParams.numRuns; j++)
+                free (r->nEvents[i][j]);
+            free (r->nEvents[i]);
+            }
+        free (r->nEvents);
+        }
+    if (sumtParams.nBSets > 0)
+        {
+        for (i=0; i<sumtParams.nBSets; i++)
+            {
+            for (j=0; j<sumtParams.numRuns; j++)
+                {
+                free (r->bLen [i][j]);
+                free (r->bRate[i][j]);
+                }
+            free (r->bLen [i]);
+            free (r->bRate[i]);
+            }
+        free (r->bLen);
+        free (r->bRate);
+        }
+
+    /* free basic parameters */
+    for (i=0; i<sumtParams.numRuns; i++)
+        free (r->length[i]);
+
+    free (r->length);
+    free (r->count);
+    free (r->partition);
+    free (r);
+    numUniqueSplitsFound--;
+    r = NULL;
+}
+
+
+/* FreeSumtParams: Free parameters allocated in sumtParams struct */
+void FreeSumtParams(void)
+{
+    int     i;
+
+    if (memAllocs[ALLOC_SUMTPARAMS] == YES)
+        {
+        for (i=0; i<sumtParams.numTaxa; i++)
+            free(sumtParams.taxaNames[i]);
+        free (sumtParams.taxaNames);
+        sumtParams.taxaNames = NULL;
+        if (sumtParams.numFileTrees) free (sumtParams.numFileTrees);
+        sumtParams.numFileTrees = NULL;
+        FreePolyTree (sumtParams.tree);
+        sumtParams.tree = NULL;
+        if (sumtParams.nBSets > 0)
+            {
+            for (i=0; i<sumtParams.nBSets; i++)
+                free(sumtParams.bSetName[i]);
+            free (sumtParams.bSetName);
+            sumtParams.bSetName = NULL;
+            sumtParams.nBSets = 0;
+            }
+        if (sumtParams.nESets > 0)
+            {
+            for (i=0; i<sumtParams.nESets; i++)
+                free(sumtParams.eSetName[i]);
+            free (sumtParams.eSetName);
+            sumtParams.eSetName = NULL;
+            sumtParams.nESets = 0;
+            }
+        if (sumtParams.popSizeSet == YES)
+            {
+            free (sumtParams.popSizeSetName);
+            sumtParams.popSizeSetName = NULL;
+            sumtParams.popSizeSet = NO;
+            }
+        memAllocs[ALLOC_SUMTPARAMS] = NO;
+        }
+}
+
+
+/* FreeTreeCtr: Recursively free tree counter nodes */
+void FreeTreeCtr (TreeCtr *r)
+{
+    if (r==NULL)
+        return;
+    
+    FreeTreeCtr (r->left);
+    FreeTreeCtr (r->right);
+
+    free (r->order);
+    free (r);
+    numUniqueTreesFound--;
+    r = NULL;
+}
+
+
+/* Label: Calculate length of label and fill in char *label if not NULL */
+int Label (PolyNode *p, int addIndex, char *label, int maxLength)
+{
+    int     i, j0, j1, k, n, length, nameLength, index;
+
+    if (p == NULL)
+        return 0;
+
+    /* first calculate length */
+    if (inSumtCommand == YES && isTranslateDiff == NO)
+        {
+        for (index=i=0; index<numTaxa; index++)
+            {
+            if (sumtParams.absentTaxa[index] == YES || taxaInfo[index].isDeleted == YES)
+                continue;
+            if (p->index == i)
+                break;
+            else
+                i++;
+            }
+        }
+    else
+        index = p->index;
+
+    if (addIndex != NO)
+        length = (int)(strlen(p->label)) + 4 + (int)(log10(index+1));
+    else
+        length = (int)(strlen(p->label));
+    length = (length > maxLength ? maxLength : length);
+
+    /* fill in label if label != NULL */
+    if (label != NULL)
+        {
+        if (addIndex != NO)
+            nameLength = length - 4 - (int)(log10(index+1));
+        else
+            nameLength = length;
+
+        for (i=0; i<nameLength-1; i++)
+            label[i] = p->label[i];
+        if ((int)strlen(p->label) > nameLength)
+            label[i] = '~';
+        else
+            label[i] = p->label[i];
+
+        if (addIndex != NO)
+            {
+            label[++i] = ' ';
+            label[++i] = '(';
+            n = index + 1;
+            k = (int)(log10(n)) + 1;
+            while (n != 0)
+                {
+                j0 = (int)(log10(n));
+                j1 = (int)(pow(10,j0));
+                label[++i] = '0' + n/j1;
+                n = n % j1;
+                k--;
+                }
+            while (k!=0)
+                {
+                label[++i] = '0';
+                k--;
+                }
+            label[++i] = ')';
+            }
+        label[++i] = '\0';
+        }
+
+    return length;
+}
+
+
+int OpenComptFiles (void)
+{
+    int         len, previousFiles, oldNoWarn, oldAutoOverwrite;
+    char        pFilename[120], dFilename[120];
+    FILE        *fpTemp;
+
+    oldNoWarn = noWarn;
+    oldAutoOverwrite = autoOverwrite;
+
+    /* set file names */
+    strcpy (pFilename, comptreeParams.comptOutfile);
+    strcpy (dFilename, comptreeParams.comptOutfile);
+    strcat (pFilename, ".pairs");
+    strcat (dFilename, ".dists");
+
+    /* one overwrite check for both files */
+    previousFiles = NO;
+    if (noWarn == NO)
+        {
+        if ((fpTemp = OpenTextFileR(pFilename)) != NULL)
+            {
+            previousFiles = YES;
+            fclose(fpTemp);
+            }
+        if ((fpTemp = OpenTextFileR(dFilename)) != NULL)
+            {
+            previousFiles = YES;
+            fclose(fpTemp);
+            }
+        if (previousFiles == YES)
+            {
+            MrBayesPrint("%s   There are previous compare results saved using the same filenames.\n", spacer);
+            if (WantTo("Do you want to overwrite these results") == YES)
+                {
+                MrBayesPrint("\n");
+                noWarn = YES;
+                autoOverwrite = YES;
+                }
+            else
+                {
+                MrBayesPrint("\n");
+                MrBayesPrint("%s   Please specify a different output file name before running the comparetree command.\n", spacer);
+                MrBayesPrint("%s      You can do that using 'comparetree outputfile=<name>'. You can also move or\n", spacer);
+                MrBayesPrint("%s      rename the old result files.\n", spacer);
+                return ERROR;
+                }
+            }
+        }
+
+    if ((fpParts = OpenNewMBPrintFile (pFilename)) == NULL)
+        {
+        noWarn = oldNoWarn;
+        autoOverwrite = oldAutoOverwrite;
+        return ERROR;
+        }
+    if ((fpDists = OpenNewMBPrintFile (dFilename)) == NULL)
+        {
+        noWarn = oldNoWarn;
+        autoOverwrite = oldAutoOverwrite;
+        return ERROR;
+        }
+        
+    /* Reset file flags */
+    noWarn = oldNoWarn;
+    autoOverwrite = oldAutoOverwrite;
+
+    /* print unique identifiers to each file */
+    len = (int) strlen (stamp);
+    if (len > 1)
+        {
+        MrBayesPrintf (fpParts, "[ID: %s]\n", stamp);
+        MrBayesPrintf (fpDists, "[ID: %s]\n", stamp);
+        }
+
+    return (NO_ERROR);
+}
+
+
+int OpenSumtFiles (int treeNo)
+{
+    int         i, len,  oldNoWarn, oldAutoOverwrite, previousFiles;
+    char        pFilename[120], sFilename[120], vFilename[120], cFilename[120], tFilename[120];
+    FILE        *fpTemp;
+
+    oldNoWarn = noWarn;
+    oldAutoOverwrite = autoOverwrite;
+
+    /* one overwrite check for all files */
+    if (noWarn == NO && treeNo == 0)
+        {
+        previousFiles = NO;
+        for (i=0; i<sumtParams.numTrees; i++)
+            {
+            if (sumtParams.numTrees > 1)
+                {
+                sprintf (pFilename, "%s.tree%d.parts", sumtParams.sumtOutfile, i+1);
+                sprintf (sFilename, "%s.tree%d.tstat", sumtParams.sumtOutfile, i+1);
+                sprintf (vFilename, "%s.tree%d.vstat", sumtParams.sumtOutfile, i+1);
+                sprintf (cFilename, "%s.tree%d.con.tre", sumtParams.sumtOutfile, i+1);
+                sprintf (tFilename, "%s.tree%d.trprobs", sumtParams.sumtOutfile, i+1);
+                }
+            else
+                {
+                sprintf (pFilename, "%s.parts", sumtParams.sumtOutfile);
+                sprintf (sFilename, "%s.tstat", sumtParams.sumtOutfile);
+                sprintf (vFilename, "%s.vstat", sumtParams.sumtOutfile);
+                sprintf (cFilename, "%s.con.tre", sumtParams.sumtOutfile);
+                sprintf (tFilename, "%s.trprobs", sumtParams.sumtOutfile);
+                }
+            if ((fpTemp = TestOpenTextFileR(pFilename)) != NULL)
+                {
+                previousFiles = YES;
+                fclose(fpTemp);
+                }
+            if ((fpTemp = TestOpenTextFileR(sFilename)) != NULL)
+                {
+                previousFiles = YES;
+                fclose(fpTemp);
+                }
+            if ((fpTemp = TestOpenTextFileR(vFilename)) != NULL)
+                {
+                previousFiles = YES;
+                fclose(fpTemp);
+                }
+            if ((fpTemp = TestOpenTextFileR(cFilename)) != NULL)
+                {
+                previousFiles = YES;
+                fclose(fpTemp);
+                }
+            if ((fpTemp = TestOpenTextFileR(tFilename)) != NULL)
+                {
+                previousFiles = YES;
+                fclose(fpTemp);
+                }
+            if (previousFiles == YES)
+                {
+                MrBayesPrint("\n");
+                MrBayesPrint("%s   There are previous tree sample summaries saved using the same filenames.\n", spacer);
+                if (WantTo("Do you want to overwrite these results") == YES)
+                    {
+                    MrBayesPrint("\n");
+                    noWarn = YES;
+                    autoOverwrite = YES;
+                    }
+                else
+                    {
+                    MrBayesPrint("\n");
+                    MrBayesPrint("%s   Please specify a different output file name before running the sumt command.\n", spacer);
+                    MrBayesPrint("%s      You can do that using 'sumt outputfile=<name>'. You can also move or\n", spacer);
+                    MrBayesPrint("%s      rename the old result files.\n", spacer);
+                    return ERROR;
+                    }
+                }
+            }
+        }
+
+    /* set file names */
+    if (sumtParams.numTrees > 1)
+        {
+        sprintf (pFilename, "%s.tree%d.parts", sumtParams.sumtOutfile, treeNo+1);
+        sprintf (sFilename, "%s.tree%d.tstat", sumtParams.sumtOutfile, treeNo+1);
+        sprintf (vFilename, "%s.tree%d.vstat", sumtParams.sumtOutfile, treeNo+1);
+        sprintf (cFilename, "%s.tree%d.con.tre", sumtParams.sumtOutfile, treeNo+1);
+        sprintf (tFilename, "%s.tree%d.trprobs", sumtParams.sumtOutfile, treeNo+1);
+        }
+    else
+        {
+        sprintf (pFilename, "%s.parts", sumtParams.sumtOutfile);
+        sprintf (sFilename, "%s.tstat", sumtParams.sumtOutfile);
+        sprintf (vFilename, "%s.vstat", sumtParams.sumtOutfile);
+        sprintf (cFilename, "%s.con.tre", sumtParams.sumtOutfile);
+        sprintf (tFilename, "%s.trprobs", sumtParams.sumtOutfile);
+        }
+
+    /* open files checking for over-write as appropriate */
+    if ((fpParts = OpenNewMBPrintFile(pFilename)) == NULL)
+        return ERROR;
+    if ((fpTstat = OpenNewMBPrintFile(sFilename)) == NULL)
+        {
+        SafeFclose (&fpParts);
+        return ERROR;
+        }
+    if ((fpVstat = OpenNewMBPrintFile(vFilename)) == NULL)
+        {
+        SafeFclose (&fpParts);
+        SafeFclose (&fpTstat);
+        return ERROR;
+        }
+    if ((fpCon = OpenNewMBPrintFile(cFilename)) == NULL)
+        {
+        SafeFclose (&fpParts);
+        SafeFclose (&fpTstat);
+        SafeFclose (&fpVstat);
+        return ERROR;
+        }
+    if (sumtParams.calcTreeprobs == YES)
+        {
+        if ((fpTrees = OpenNewMBPrintFile(tFilename)) == NULL)
+            {
+            SafeFclose (&fpParts);
+            SafeFclose (&fpTstat);
+            SafeFclose (&fpVstat);
+            SafeFclose (&fpCon);
+            return ERROR;
+            }
+        }
+
+    /* print #NEXUS if appropriate */
+    MrBayesPrintf (fpCon,   "#NEXUS\n");
+    if (sumtParams.calcTreeprobs == YES)
+        MrBayesPrintf (fpTrees, "#NEXUS\n");
+
+    /* print unique identifiers to each file */
+    len = (int) strlen (stamp);
+    if (len > 1)
+        {
+        MrBayesPrintf (fpParts, "[ID: %s]\n", stamp);
+        MrBayesPrintf (fpTstat, "[ID: %s]\n", stamp);
+        MrBayesPrintf (fpVstat, "[ID: %s]\n", stamp);
+        MrBayesPrintf (fpCon,   "[ID: %s]\n", stamp);
+        if (sumtParams.calcTreeprobs == YES)
+            MrBayesPrintf (fpTrees, "[ID: %s]\n", stamp);
+        }
+
+    /* Reset noWarn and autoOverwrite */
+    if (treeNo == sumtParams.numTrees - 1)
+        {
+        noWarn = oldNoWarn;
+        autoOverwrite = oldAutoOverwrite;
+        }
+
+    return (NO_ERROR);      
+}
+
+
+void PartCtrUppass (PartCtr *r, PartCtr **uppass, int *index)
+{
+    if (r != NULL)
+        {
+        uppass[(*index)++] = r;
+
+        PartCtrUppass (r->left, uppass, index);
+        PartCtrUppass (r->right, uppass, index);
+        }
+}
+
+
+/* PrintBrlensToFile: Print brlens to file */
+int PrintBrlensToFile (PartCtr **treeParts, int numTreeParts, int treeNo)
+{
+    int     i, j, runNo, numBrlens;
+    char    filename[100];
+    PartCtr *x;
+    FILE    *fp;
+
+    /* set file name */
+    if (sumtParams.numTrees > 1)
+        sprintf (filename, "%s.tree%d.brlens", sumtParams.sumtOutfile, treeNo+1);
+    else
+        sprintf (filename, "%s.brlens", sumtParams.sumtOutfile);
+
+    /* Open file checking for over-write as appropriate */
+    if ((fp = OpenNewMBPrintFile(filename)) == NULL)
+        return ERROR;
+
+    /* count number of brlens to print */
+    for (i=0; i<numTreeParts; i++)
+        {
+        if (treeParts[i]->totCount < sumtParams.brlensFreqDisplay)
+            break;
+        }
+    numBrlens = i;
+
+    /* print header */
+    for (i=0; i<numBrlens; i++)
+        {
+        MrBayesPrintf (fp, "v[%d]", i+1);
+        if (i==numBrlens-1)
+            MrBayesPrintf (fp, "\n");
+        else
+            MrBayesPrintf (fp, "\t");
+        }
+
+    /* print values */
+    for (i=0; i<numBrlens; i++)
+        {
+        x = treeParts[numBrlens];
+        for (runNo=0; runNo<sumtParams.numRuns; runNo++)
+            {
+            MrBayesPrintf (fp, "%s", MbPrintNum (x->length[runNo][0]));
+            for (j=1; j<x->count[i]; j++)
+                {
+                MrBayesPrintf (fp, "\t%s", MbPrintNum (x->length[runNo][j]));
+                }
+            }
+        MrBayesPrintf (fp, "\n");
+        }
+
+    return NO_ERROR;
+}
+
+
+/* PrintConTree: Print consensus tree in standard format readable by TreeView, Paup etc */
+void PrintConTree (FILE *fp, PolyTree *t)
+{
+    MrBayesPrintf (fp, "   [Note: This tree contains information on the topology, \n");
+    MrBayesPrintf (fp, "          branch lengths (if present), and the probability\n");
+    MrBayesPrintf (fp, "          of the partition indicated by the branch.]\n");
+    if (!strcmp(sumtParams.sumtConType, "Halfcompat"))
+        MrBayesPrintf (fp, "   tree con_50_majrule = ");
+    else
+        MrBayesPrintf (fp, "   tree con_all_compat = ");
+    WriteConTree (t->root, fp, YES);
+    MrBayesPrintf (fp, ";\n");
+    if (sumtParams.brlensDef == YES)
+        {
+        MrBayesPrintf (fp, "\n");
+        MrBayesPrintf (fp, "   [Note: This tree contains information only on the topology\n");
+        MrBayesPrintf (fp, "          and branch lengths (median of the posterior probability density).]\n");
+        if (!strcmp(sumtParams.sumtConType, "Halfcompat"))
+            MrBayesPrintf (fp, "   tree con_50_majrule = ");
+        else
+            MrBayesPrintf (fp, "   tree con_all_compat = ");
+        WriteConTree (t->root, fp, NO);
+        MrBayesPrintf (fp, ";\n");
+        }
+}
+
+
+/* PrintFigTreeConTree: Print consensus tree in rich format for FigTree */
+void PrintFigTreeConTree (FILE *fp, PolyTree *t, PartCtr **treeParts)
+{
+    if (!strcmp(sumtParams.sumtConType, "Halfcompat"))
+        MrBayesPrintf (fp, "   tree con_50_majrule = ");
+    else
+        MrBayesPrintf (fp, "   tree con_all_compat = ");
+    if (t->isRooted == YES)
+        MrBayesPrintf (fp, "[&R] ");
+    else
+        MrBayesPrintf (fp, "[&U] ");
+
+    WriteFigTreeConTree (t->root, fp, treeParts);
+    MrBayesPrintf (fp, ";\n");
+}
+
+
+void PrintFigTreeNodeInfo (FILE *fp, PartCtr *x, MrBFlt length)
+{
+    int     i, postProbPercent, postProbSdPercent;
+    MrBFlt  *support, mean, var, min, max;
+    Stat    theStats;
+
+    support = SafeCalloc (sumtParams.numRuns, sizeof(MrBFlt));
+    for (i=0; i<sumtParams.numRuns; i++)
+        {
+        support[i] = (MrBFlt) x->count[i] / (MrBFlt) sumtParams.numFileTreesSampled[i];
+        }
+    if (sumtParams.numRuns > 1)
+        {
+        MeanVariance (support, sumtParams.numRuns, &mean, &var);
+        Range (support, sumtParams.numRuns, &min, &max);
+        postProbPercent = (int) (100.0*mean + 0.5);
+        postProbSdPercent = (int) (100.0 * sqrt(var) + 0.5);
+        fprintf (fp, "[&prob=%.8le,prob_stddev=%.8le,prob_range={%.8le,%.8le},prob(percent)=\"%d\",prob+-sd=\"%d+-%d\"",
+            mean, sqrt(var), min, max, postProbPercent, postProbPercent, postProbSdPercent);
+        }
+    else
+        {
+        postProbPercent = (int) (100.0*support[0] + 0.5);
+        fprintf (fp, "[&prob=%.8le,prob(percent)=\"%d\"", support[0], postProbPercent);
+        }
+    if (sumtParams.isClock == YES)
+        {
+        GetSummary (x->height, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+        if (sumtParams.HPD == YES)
+            fprintf (fp, ",height_mean=%.8le,height_median=%.8le,height_95%%HPD={%.8le,%.8le}", theStats.mean, theStats.median, theStats.lower, theStats.upper);
+        else
+            fprintf (fp, ",height_mean=%.8le,height_median=%.8le,height_95%%CredInt={%.8le,%.8le}", theStats.mean, theStats.median, theStats.lower, theStats.upper);
+        }
+    if (sumtParams.isCalibrated == YES)
+        {
+        GetSummary (x->age, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+        if (sumtParams.HPD == YES)
+            fprintf (fp, ",age_mean=%.8le,age_median=%.8le,age_95%%HPD={%.8le,%.8le}", theStats.mean, theStats.median, theStats.lower, theStats.upper);
+        else
+            fprintf (fp, ",age_mean=%.8le,age_median=%.8le,age_95%%CredInt={%.8le,%.8le}", theStats.mean, theStats.median, theStats.lower, theStats.upper);
+        }
+    fprintf (fp, "]");
+    if (length >= 0.0)
+        fprintf (fp, ":%s", MbPrintNum(length));
+    if (sumtParams.brlensDef == YES)
+        {
+        GetSummary (x->length, sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+        if (sumtParams.HPD == YES)
+            fprintf (fp, "[&length_mean=%.8le,length_median=%.8le,length_95%%HPD={%.8le,%.8le}", theStats.mean, theStats.median, theStats.lower, theStats.upper);
+        else
+            fprintf (fp, "[&length_mean=%.8le,length_median=%.8le,length_95%%CredInt={%.8le,%.8le}", theStats.mean, theStats.median, theStats.lower, theStats.upper);
+        }
+    if (sumtParams.isClock == YES && sumtParams.isRelaxed == YES)
+        {
+        for (i=0; i<sumtParams.nBSets; i++)
+            {
+            GetSummary (x->bLen[i], sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+            if (sumtParams.HPD == YES)
+                fprintf (fp, ",effectivebrlen%s_mean=%lf,effectivebrlen%s_median=%lf,effectivebrlen%s_95%%HPD={%lf,%lf}",
+                    sumtParams.tree->bSetName[i], theStats.mean,
+                    sumtParams.tree->bSetName[i], theStats.median,
+                    sumtParams.tree->bSetName[i], theStats.lower,
+                    theStats.upper);
+            else
+                fprintf (fp, ",effectivebrlen%s_mean=%lf,effectivebrlen%s_median=%lf,effectivebrlen%s_95%%CredInt={%lf,%lf}",
+                    sumtParams.tree->bSetName[i], theStats.mean,
+                    sumtParams.tree->bSetName[i], theStats.median,
+                    sumtParams.tree->bSetName[i], theStats.lower,
+                    theStats.upper);
+            GetSummary (x->bRate[i], sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+            if (sumtParams.HPD == YES)
+                fprintf (fp, ",rate%s_mean=%lf,rate%s_median=%lf,rate%s_95%%HPD={%lf,%lf}",
+                    sumtParams.tree->bSetName[i], theStats.mean,
+                    sumtParams.tree->bSetName[i], theStats.median,
+                    sumtParams.tree->bSetName[i], theStats.lower,
+                    theStats.upper);
+            else
+                fprintf (fp, ",rate%s_mean=%lf,rate%s_median=%lf,rate%s_95%%CredInt={%lf,%lf}",
+                    sumtParams.tree->bSetName[i], theStats.mean,
+                    sumtParams.tree->bSetName[i], theStats.median,
+                    sumtParams.tree->bSetName[i], theStats.lower,
+                    theStats.upper);
+            }
+        for (i=0; i<sumtParams.nESets; i++)
+            {
+            GetIntSummary (x->nEvents[i], sumtParams.numRuns, x->count, &theStats, sumtParams.HPD);
+            if (sumtParams.HPD == YES)
+                fprintf (fp, ",nEvents%s_mean=%lf,nEvents%s_median=%lf,nEvents%s_95%%HPD={%lf,%lf}",
+                    sumtParams.tree->eSetName[i], theStats.mean,
+                    sumtParams.tree->eSetName[i], theStats.median,
+                    sumtParams.tree->eSetName[i], theStats.lower,
+                    theStats.upper);
+            else
+                fprintf (fp, ",nEvents%s_mean=%lf,nEvents%s_median=%lf,nEvents%s_95%%CredInt={%lf,%lf}",
+                    sumtParams.tree->eSetName[i], theStats.mean,
+                    sumtParams.tree->eSetName[i], theStats.median,
+                    sumtParams.tree->eSetName[i], theStats.lower,
+                    theStats.upper);
+            }
+        }
+    if (sumtParams.brlensDef == YES)
+        fprintf (fp, "]");
+
+    free (support);
+}
+
+
+void PrintSumtTableLine(int numRuns, int *rowCount, Stat *theStats, MrBFlt *numPSRFSamples, MrBFlt *maxPSRF, MrBFlt *sumPSRF)
+{
+    int j,k;
+
+    MrBayesPrint ("%10.6lf  %10.6lf  %10.6lf  %10.6lf  %10.6lf", theStats->mean, theStats->var, theStats->lower, theStats->upper, theStats->median);
+
+    MrBayesPrintf (fpVstat, "\t%s", MbPrintNum(theStats->mean));
+    MrBayesPrintf (fpVstat, "\t%s", MbPrintNum(theStats->var));
+    MrBayesPrintf (fpVstat, "\t%s", MbPrintNum(theStats->lower));
+    MrBayesPrintf (fpVstat, "\t%s", MbPrintNum(theStats->upper));
+    MrBayesPrintf (fpVstat, "\t%s", MbPrintNum(theStats->median));
+
+    if (numRuns > 1)
+        {
+        for (j=k=0; j<numRuns; j++)
+            if (rowCount[j] > 0)
+                k++;
+            if (theStats->PSRF < 0.0)
+                {
+                MrBayesPrint ("     NA    %3d", k);
+                MrBayesPrintf (fpVstat, "\tNA\t%d", k);
+                }
+            else
+                {
+                if (theStats->PSRF > 10.0)
+                    {
+                    MrBayesPrint ("    >10.0  %3d", k);
+                    MrBayesPrintf (fpVstat, "\tNA\t%d", k);
+                    (*maxPSRF) = 10.0;
+                    }
+                else
+                    {
+                    MrBayesPrint ("  %7.3lf  %3d", theStats->PSRF, k);
+                    MrBayesPrintf (fpVstat, "\t%s\t%d", MbPrintNum(theStats->PSRF), k);
+                    (*sumPSRF) += theStats->PSRF;
+                    (*numPSRFSamples)++;
+                    if (theStats->PSRF > *maxPSRF)
+                         (*maxPSRF) = theStats->PSRF;
+                    }
+                }
+
+                if (k != numRuns)
+                    MrBayesPrint (" *");
+        }
+
+        MrBayesPrintf (fpVstat, "\n");
+        MrBayesPrint ("\n");
+}
+
+
+/* PrintSumtTaxaInfo: Print information on pruned and absent taxa */
+void PrintSumtTaxaInfo (void)
+{
+    int     i, j, lineWidth, numExcludedTaxa, len;
+    char    tempStr[100];
+
+    /* print out information on absent taxa */
+    numExcludedTaxa = 0;
+    for (i=0; i<numTaxa; i++)
+        if (sumtParams.absentTaxa[i] == YES)
+            numExcludedTaxa++;
+
+    if (numExcludedTaxa > 0)
+        {
+        if (numExcludedTaxa == 1)
+            MrBayesPrint ("%s   The following taxon was absent from trees:\n", spacer);
+        else
+            MrBayesPrint ("%s   The following %d taxa were absent from trees:\n", spacer, numExcludedTaxa);
+        MrBayesPrint ("%s      ", spacer);
+        j = lineWidth = 0;
+        for (i=0; i<numTaxa; i++)
+            {
+            if (sumtParams.absentTaxa[i] == YES)
+                {
+                j++;
+                strcpy (tempStr, taxaNames[i]);
+                len = (int) strlen(tempStr);
+                lineWidth += len+2;
+                if (lineWidth > 60)
+                    {
+                    MrBayesPrint ("\n%s      ", spacer);
+                    lineWidth = 0;
+                    }
+                if (numExcludedTaxa == 1)
+                    MrBayesPrint ("%s\n", tempStr);
+                else if (numExcludedTaxa == 2 && j == 1)
+                    MrBayesPrint ("%s ", tempStr);
+                else if (j == numExcludedTaxa)
+                    MrBayesPrint ("and %s\n", tempStr);
+                else
+                    MrBayesPrint ("%s, ", tempStr);
+                }
+            }
+        MrBayesPrint ("\n");
+        }
+
+    /* print out information on pruned taxa */
+    numExcludedTaxa = 0;
+    for (i=0; i<numTaxa; i++)
+        if (taxaInfo[i].isDeleted == YES && sumtParams.absentTaxa[i] == NO)
+            numExcludedTaxa++;
+    
+    if (numExcludedTaxa > 0)
+        {
+        if (numExcludedTaxa == 1)
+            MrBayesPrint ("%s   The following taxon was pruned from trees:\n", spacer);
+        else
+            MrBayesPrint ("%s   The following %d taxa were pruned from trees:\n", spacer, numExcludedTaxa);
+        MrBayesPrint ("%s      ", spacer);
+        j = lineWidth = 0;
+        for (i=0; i<numTaxa; i++)
+            {
+            if (taxaInfo[i].isDeleted == YES && sumtParams.absentTaxa[i] == NO)
+                {
+                j++;
+                strcpy (tempStr, taxaNames[i]);
+                len = (int) strlen(tempStr);
+                lineWidth += len+2;
+                if (lineWidth > 60)
+                    {
+                    MrBayesPrint ("\n%s      ", spacer);
+                    lineWidth = 0;
+                    }
+                if (numExcludedTaxa == 1)
+                    MrBayesPrint ("%s\n", tempStr);
+                else if (numExcludedTaxa == 2 && j == 1)
+                    MrBayesPrint ("%s ", tempStr);
+                else if (j == numExcludedTaxa)
+                    MrBayesPrint ("and %s\n", tempStr);
+                else
+                    MrBayesPrint ("%s, ", tempStr);
+                }
+            }
+        MrBayesPrint ("\n");
+        }
+}
+
+
+/* Range: Determine range for a vector of MrBFlt values */
+void Range (MrBFlt *vals, int nVals, MrBFlt *min, MrBFlt *max)
+{    
+    SortMrBFlt (vals, 0, nVals-1);
+    
+    *min  = vals[0];
+    *max  = vals[nVals-1];
+}
+
+
+/* ResetTaxonSet: Reset included taxa and local outgroup number */
+void ResetTaxonSet (void)
+{
+    int     i, j;
+
+    /* reset numLocalTaxa and localOutGroup */
+    localOutGroup = 0;
+    numLocalTaxa = 0;
+    for (i=j=0; i<numTaxa; i++)
+        {
+        if (taxaInfo[i].isDeleted == NO)
+            {
+            if (i == outGroupNum)
+                localOutGroup = numLocalTaxa;
+            numLocalTaxa++;
+            }
+        }
+}
+
+
+void ResetTranslateTable (void)
+{
+    int i;
+
+    for (i=0; i<numTranslates; i++)
+        {
+        free (transFrom[i]);
+        free (transTo[i]);
+        }
+    free (transFrom);
+    free (transTo);
+    transFrom = NULL;
+    transTo = NULL;
+    numTranslates = 0;
+    isTranslateDef = NO;
+    isTranslateDiff = NO;
+}
+
+
+int ShowConPhylogram (FILE *fp, PolyTree *t, int screenWidth)
+{
+    int             i, j, k, nLines, from, to, treeWidth=0, barLength, printExponential,
+                    precision, width, newPos, curPos, nTimes, numSpaces, maxLabelLength;
+    char            *printLine, *markLine, temp[30], *label;
+    MrBFlt          scale, f, scaleBar;
+    PolyNode        *p, *q;
+
+    /* set max label length */
+    maxLabelLength = 20;
+
+    /* allocate space for label, printLine and markLine */
+    printLine = (char *) SafeCalloc ((2*screenWidth+2),sizeof(char)); 
+    label = (char *) SafeCalloc (maxLabelLength+1, sizeof(char));
+    if (!printLine || !label)
+        return ERROR;
+    markLine = printLine + screenWidth + 1;
+
+    /* calculate scale */
+    scale = 0.0;
+    t->root->f = 0.0;
+    for (i=t->nNodes-2; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        /* find distance to root in relevant units */
+        if (sumtParams.isClock == YES && sumtParams.isCalibrated == NO)
+            p->f = t->root->depth - p->depth;
+        else if (sumtParams.isClock == YES && sumtParams.isCalibrated == YES)
+            p->f = t->root->age - p->age;
+        else
+            p->f = p->anc->f + p->length;
+        if (p->left == NULL)
+            {
+            f = p->f / (screenWidth - Label(p,YES,NULL,maxLabelLength) - 2);
+            if (f > scale)
+                {
+                scale = f;
+                treeWidth = screenWidth - Label(p,YES,NULL,maxLabelLength) - 2;
+                }
+            }
+        }
+    
+    /* calculate x coordinates */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->x = (int) (0.5 + (p->f / scale));
+        }
+
+    /* calculate y coordinates and lines to print */
+    for (i=nLines=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left != NULL)
+            {
+            /* internal node */
+            for (q=p->left->sib; q->sib!=NULL; q=q->sib)
+                ;
+            p->y = (int) (0.5 + ((p->left->y + q->y) / 2.0));
+            }
+        else 
+            {
+            /* terminal node */
+            p->y = nLines;
+            nLines += 2;
+            }
+        }
+
+    /* print tree line by line */
+
+    for (i=0; i<nLines; i++)
+        {
+        MrBayesPrint ("%s   ", spacer);
+        /* empty printLine */
+        for (j=0; j<screenWidth; j++)
+            {
+            printLine[j] = ' ';
+            }   
+        printLine[j]='\0';
+
+        for (j=0; j<t->nNodes; j++)
+            {
+            p = t->allDownPass[j];
+            if (p->y != i)
+                continue;
+
+            /* this branch should be printed */
+            /* add branch */
+            if (p->anc == NULL)
+                {
+                /* this is the root of the whole tree */
+                printLine[p->x] = '+';
+                }
+            else
+                {
+                /* this is an ordinary branch */
+                to = p->x;
+                from = p->anc->x;
+                for (k=from+1; k<=to; k++)
+                    printLine[k] = '-';
+                if (p == p->anc->left)
+                    {
+                    if (markLine[from] == 0)
+                        printLine[from] = '/';
+                    else
+                        printLine[from] = '|';
+                    markLine[from] ++;
+                    }
+                else if (p->sib == NULL)
+                    {
+                    if (markLine[from] == 1)
+                        printLine[from] = '\\';
+                    else
+                        printLine[from] = '|';
+                    markLine[from] --;
+                    }
+                if (p->left!=NULL)
+                    {
+                    if (from != to)
+                        printLine[to] = '+';
+                    else
+                        printLine[to] = '|';
+                    }
+                else
+                    {
+                    /* add label if the branch is terminal */
+                    Label(p,YES,label,maxLabelLength);
+                    sprintf (printLine+to+2,"%s", label);
+                    }
+                }
+            }
+
+        /* check for cross branches */
+        for (j=0; j<screenWidth; j++)
+            {
+            if (markLine[j] >= 1 && printLine[j] == ' ')
+                printLine[j] = '|';
+            }
+        MrBayesPrintf (fp, "%s\n",printLine);
+        }
+
+    /* print scale */
+    k = (int) (floor (log10 (scale * 80)));
+    scaleBar = pow (10, k);
+    barLength = (int) (scaleBar / scale);
+    if (barLength > 80)
+        {
+        barLength /= 10;
+        scaleBar /= 10.0;
+        }
+    else if (barLength > 40)
+        {
+        barLength /= 5;
+        scaleBar /= 5.0;
+        }
+    else if (barLength > 16)
+        {
+        barLength /= 2;
+        scaleBar /= 2.0;
+        }
+
+    if (t->isClock == YES)
+        {
+        MrBayesPrint ("%s   ", spacer);
+        for (i=0; i<treeWidth; i++)
+            printLine[i] = '-';
+        nTimes = (int) (treeWidth / (scaleBar / scale));
+        for (i=0; i<=nTimes; i++)
+            printLine[treeWidth - (int)(i*scaleBar/scale)] = '|';
+        MrBayesPrint ("%s\n", printLine);
+        
+        MrBayesPrint ("%s   ", spacer);
+        f = treeWidth * scale;
+        if (f >= 1000.0 || f < 0.10)
+            {
+            printExponential = YES;
+            precision = 0;
+            }
+        else
+            {
+            printExponential = NO;
+            precision = 2 - (int) (log10 (f));
+            }
+        
+        curPos = 0;
+        f = nTimes * scaleBar;
+        while (curPos < treeWidth)
+            {
+            /* print the number */
+            if (printExponential == YES)
+                sprintf (temp, "%.2e", f);
+            else
+                sprintf (temp, "%.*lf", precision, f);
+            
+            /* room to print ? if so, print */
+            width = (int) strlen (temp);
+            newPos = treeWidth - (int) (nTimes * (scaleBar / scale));
+            numSpaces = newPos - width / 2 - curPos;
+            if (numSpaces >= 0 || (numSpaces >= -2 && curPos == 0))
+                {
+                while (numSpaces > 0)
+                    {
+                    printLine[curPos++] = ' ';
+                    numSpaces--;
+                    }
+                for (i=0; temp[i]!='\0'; i++)
+                    printLine[curPos++] = temp[i];
+                }
+
+            /* get new number */
+            f -= scaleBar;
+            nTimes--;
+            }
+
+        MrBayesPrint ("%s\n", printLine);
+            
+        if (sumtParams.isCalibrated == YES)
+            MrBayesPrint ("\n%s   [User-defined time units]\n\n", spacer);
+        else
+            MrBayesPrint ("\n%s   [Expected changes per site]\n\n", spacer);
+        }
+    else
+        {
+        MrBayesPrintf (fp, "%s   |", spacer);
+        for (i=0; i<barLength-1; i++)
+            MrBayesPrintf (fp, "-");
+        MrBayesPrintf (fp, "| %1.3lf expected changes per site\n\n", scaleBar);
+        }
+
+    free (printLine);
+
+    return NO_ERROR;
+}
+
+
+int ShowConTree (FILE *fp, PolyTree *t, int screenWidth, int showSupport)
+{
+    int             i, j, k, treeWidth, minBranchLength, maxWidth, isTreeDivided,
+                    printWidth, nLines, nodesToBePrinted, from, to, maxLabelLength,
+                    maxLength;
+    char            *printLine, *markLine, temp[20], *label;
+    PolyNode        *p=NULL, *q;
+
+    maxLength = 20;         /* max length of label */
+    minBranchLength = 5;    /* min length of branch in tree */
+    isTreeDivided = NO;
+    
+    /* allocate space for printLine, markLine and label */
+    printLine = (char *) SafeCalloc (maxLength+1+(2*screenWidth+2),sizeof(char));
+    if (!printLine)
+        return ERROR;
+    markLine = printLine + screenWidth + 1;
+    label = markLine + screenWidth + 1;
+
+    /* get fresh internal node indices */
+    k = t->nNodes - t->nIntNodes;
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        p->index = k++;
+        }
+    
+    /* calculate max length of labels including taxon index number */
+    maxLabelLength = 0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            {
+            j = Label(p,YES,NULL,maxLength);
+            if (j > maxLabelLength)
+                maxLabelLength = j;
+            }
+        }
+
+    /* make sure label can hold an interior node index number */
+    j = (int) (3.0 + log10((MrBFlt)t->nNodes)); 
+    maxLabelLength = (maxLabelLength > j ? maxLabelLength : j);
+
+    /* calculate remaining screen width for tree
+       and maxWidth in terms of branches */
+    treeWidth = screenWidth - maxLabelLength - 1;
+    maxWidth = treeWidth / minBranchLength;
+    
+    /* unmark whole tree */
+    for (i=0; i<t->nNodes; i++)
+        t->allDownPass[i]->mark = 0;
+    nodesToBePrinted = t->nNodes;
+
+    while (nodesToBePrinted > 0)
+        {
+        /* count depth of nodes in unprinted tree */
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->mark == 0)   /* the node has not been printed yet */
+                {
+                p->x = 0;
+                /* if it is an interior node in the tree that will be printed
+                   compute the depth of the node */
+                if (p->left != NULL && p->left->mark == 0)
+                    {
+                    for (q = p->left; q!=NULL; q=q->sib)
+                        {
+                        if (q->x > p->x)
+                            p->x = q->x;
+                        }
+                    p->x++;
+                    /* break when root of print subtree has been found */
+                    if (p->x >= maxWidth)
+                        break;
+                    }
+                }
+            }
+
+        /* if internal node then find largest nonprinted subtree among descendant nodes */
+        if (p->anc != NULL)
+            {
+            for (q=p->left; q!=NULL; q=q->sib)
+                {
+                if (q->x == p->x - 1 && q->mark == 0)
+                    p = q;
+                }
+            MrBayesPrintf (fp, "%s   Subtree rooted at node %d:\n\n", spacer, p->index);
+            isTreeDivided = YES;
+            }
+        else if (isTreeDivided == YES)
+            MrBayesPrintf (fp, "%s   Root part of tree:\n\n", spacer);
+
+        /* mark subtree for printing and
+           translate x coordinates from depth to position */
+        if (p->anc == NULL)
+            printWidth = p->x;
+        else
+            printWidth = p->x + 1;
+        p->mark = 1;
+        p->x = (int) (treeWidth - 0.5 - ((treeWidth - 1) * (p->x / (MrBFlt) printWidth)));
+        for (i=t->nNodes-2; i>=0; i--)
+            {
+            p = t->allDownPass[i];
+            if (p->mark == 0 && p->anc->mark == 1)
+                {   
+                p->mark = 1;
+                p->x = (int) (treeWidth - 0.5 - ((treeWidth - 1) * (p->x / (MrBFlt) printWidth)));
+                }
+            }
+
+        /* calculate y coordinates of nodes to be printed and lines to print */
+        for (i=nLines=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->mark == 1)
+                {
+                if (p->left != NULL && p->left->mark == 1)
+                    {
+                    /* internal node */
+                    for (q=p->left->sib; q->sib!=NULL; q=q->sib)
+                        ;
+                    p->y = (int) (0.5 + ((p->left->y + q->y) / 2.0));
+                    }
+                else 
+                    {
+                    /* terminal node */
+                    p->y = nLines;
+                    nLines += 2;
+                    }
+                }
+            }
+
+        /* print subtree line by line */
+        for (i=0; i<nLines; i++)
+            {
+            MrBayesPrintf (fp, "%s   ", spacer);
+            /* empty printLine */
+            for (j=0; j<screenWidth; j++)
+                {
+                printLine[j] = ' ';
+                }   
+            printLine[j]='\0';
+
+            for (j=0; j<t->nNodes; j++)
+                {
+                p = t->allDownPass[j];
+                if (p->mark != 1 || p->y != i)
+                    continue;
+
+                /* this branch should be printed
+                   add label if the branch is terminal in tree to be printed */
+                if (p->left == NULL)
+                    {
+                    Label (p,YES,label,maxLength);
+                    sprintf (printLine+treeWidth+1,"%s", label);
+                    }
+                else if (p->left->mark == 2)
+                    sprintf (printLine+treeWidth+1,"(%d)", p->index);
+                
+                /* add branch */
+                if (p->anc == NULL)
+                    {
+                    /* this is the root of the whole tree */
+                    printLine[p->x] = '+';
+                    nodesToBePrinted--;
+                    }
+                else if (p->anc->mark == 0)
+                    {
+                    /* this is a root of a subtree
+                       this branch will have to be printed again so do
+                       not decrease nodesToBePrinted */
+                    to = p->x;
+                    from = 0;
+                    for (k=from; k<to; k++)
+                        printLine[k] = '-';
+                    printLine[to] = '+';
+                    if (showSupport == YES)
+                        sprintf (temp, "%d", (int) (p->support*100.0 + 0.5));
+                    else
+                        *temp='\0';
+                    from = (int)(from + 1.5 + ((to - from - 1 - strlen(temp)) / 2.0));
+                    for (k=0; temp[k]!='\0'; k++)
+                        printLine[from++] = temp[k];
+                    }
+                else
+                    {
+                    /* this is an ordinary branch */
+                    to = p->x;
+                    from = p->anc->x;
+                    for (k=from+1; k<=to; k++)
+                        printLine[k] = '-';
+                    if (p == p->anc->left)
+                        {
+                        printLine[from] = '/';
+                        markLine[from] = 1;
+                        }
+                    else if (p->sib == NULL)
+                        {
+                        printLine[from] = '\\';
+                        markLine[from] = 0;
+                        }
+                    if (p->left!=NULL && p->left->mark!=2)
+                        {
+                        printLine[to] = '+';
+                        if (showSupport == YES)
+                            sprintf (temp, "%d", (int) (p->support*100.0 + 0.5));
+                        else
+                            *temp='\0';
+                        from = (int)(from + 1.5 + ((to - from - 1 - strlen(temp)) / 2.0));
+                        for (k=0; temp[k]!='\0'; k++)
+                            printLine[from++] = temp[k];
+                        }
+                    nodesToBePrinted--;
+                    }
+                }
+
+            /* check for cross branches */
+            for (j=0; j<treeWidth; j++)
+                {
+                if (markLine[j] == 1 && printLine[j] == ' ')
+                    printLine[j] = '|';
+                }
+        
+            MrBayesPrintf (fp, "%s\n",printLine);
+            }
+
+        /* mark printed branches */
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->mark == 1)
+                {
+                if (p->anc == NULL)
+                    p->mark = 2;
+                else if (p->anc->mark == 0)
+                    p->mark = 0;    /* this branch will have to be printed again */
+                else
+                    p->mark = 2;
+                }
+            }
+
+        }   /* next subtree */
+    
+    free (printLine);
+
+    return NO_ERROR;
+}
+
+
+void ShowParts (FILE *fp, BitsLong *p, int nTaxaToShow)
+{
+    int         i;
+    BitsLong    x, y, bitsLongOne;
+
+    bitsLongOne = 1;
+    
+    for (i=0; i<nTaxaToShow; i++)
+        {
+        y = p[i / nBitsInALong];
+        x = bitsLongOne << (i % nBitsInALong);
+        if ((x & y) == 0)
+            MrBayesPrintf (fp, ".");
+        else
+            MrBayesPrintf (fp, "*");
+        }
+}
+
+
+void ShowSomeParts (FILE *fp, BitsLong *p, int offset, int nTaxaToShow)
+{
+    int         i;
+    BitsLong    x, y, bitsLongOne;
+
+    bitsLongOne = 1;
+    
+    for (i=offset; i<offset+nTaxaToShow; i++)
+        {
+        y = p[i / nBitsInALong];
+        x = bitsLongOne << (i % nBitsInALong);
+        if ((x & y) == 0)
+            MrBayesPrintf (fp, ".");
+        else
+            MrBayesPrintf (fp, "*");
+        }
+}
+
+
+void SortPartCtr (PartCtr **item, int left, int right)
+{
+    register int    i, j;
+    PartCtr         *tempPartCtr;
+    int             x;
+
+    assert (left >= 0);
+    assert (right >= 0);
+
+    i = left;
+    j = right;
+    x = item[(left+right)/2]->totCount;
+    do 
+        {
+        while (item[i]->totCount > x && i < right)
+            i++;
+        while (x > item[j]->totCount && j > left)
+            j--;
+        if (i <= j)
+            {
+            tempPartCtr = item[i];
+            item[i] = item[j];
+            item[j] = tempPartCtr;
+                
+            i++;
+            j--;
+            }
+        } while (i <= j);
+    if (left < j)
+        SortPartCtr (item, left, j);
+    if (i < right)
+        SortPartCtr (item, i, right);
+}
+
+
+void SortTerminalPartCtr (PartCtr **item, int len)
+{
+    register int    i, j, maxCount;
+    PartCtr         *temp;
+
+    maxCount = item[0]->totCount;
+    
+    /* put root first */
+    for (i=0; item[i]->totCount == maxCount; i++)
+        if (NumBits(item[i]->partition, sumtParams.BitsLongsNeeded) == sumtParams.numTaxa)
+            break;
+
+    if (i!=0)
+        {
+        temp = item[0];
+        item[0] = item[i];
+        item[i] = temp;
+        }
+
+    /* then find terminals in index order */
+    for (i=1; i<=sumtParams.numTaxa; i++)
+        {
+        for (j=i; item[j]->totCount == maxCount && j<len; j++)
+            if (NumBits(item[j]->partition, sumtParams.BitsLongsNeeded) == 1 && 
+                FirstTaxonInPartition(item[j]->partition, sumtParams.BitsLongsNeeded) == i-1)
+                break;
+
+        if (j!=i)
+            {
+            temp = item[i];
+            item[i] = item[j];
+            item[j] = temp;
+            }
+        }
+}
+
+
+void SortTreeCtr (TreeCtr **item, int left, int right)
+{
+    register int    i, j;
+    TreeCtr         *tempTreeCtr;
+    int             x;
+
+    i = left;
+    j = right;
+    x = item[(left+right)/2]->count;
+    do 
+        {
+        while (item[i]->count > x && i < right)
+            i++;
+        while (x > item[j]->count && j > left)
+            j--;
+        if (i <= j)
+            {
+            tempTreeCtr = item[i];
+            item[i] = item[j];
+            item[j] = tempTreeCtr;
+                
+            i++;
+            j--;
+            }
+        } while (i <= j);
+    if (left < j)
+        SortTreeCtr (item, left, j);
+    if (i < right)
+        SortTreeCtr (item, i, right);
+}
+
+
+/* StoreSumtTree: Store tree in treeList in packed format */
+int StoreSumtTree (PackedTree *treeList, int index, PolyTree *t)
+{
+    int orderLen, numBrlens;
+
+    assert (treeList[index].brlens == NULL);
+    assert (treeList[index].order == NULL);
+
+    /* get tree dimensions */
+    numBrlens = t->nNodes - 1;
+    orderLen = t->nIntNodes - 1;
+
+    /* allocate space */
+    treeList[index].brlens = (MrBFlt *) SafeCalloc (numBrlens, sizeof(MrBFlt));
+    treeList[index].order  = (int *) SafeCalloc (orderLen, sizeof(MrBFlt));
+    if (!treeList[index].order || !treeList[index].brlens)
+        {
+        MrBayesPrint ("%s   Could not store packed representation of tree '%s'\n", spacer, t->name);
+        return (ERROR);
+        }
+
+    /* store tree */
+    if (t->isRooted == YES)
+        StoreRPolyTree (t, treeList[index].order, treeList[index].brlens);
+    else
+        StoreUPolyTree (t, treeList[index].order, treeList[index].brlens);
+
+    return (NO_ERROR);
+}
+
+
+/* TreeCtrUppass: extract TreeCtr nodes in uppass sequence */
+void TreeCtrUppass (TreeCtr *r, TreeCtr **uppass, int *index)
+{
+    if (r != NULL)
+        {
+        uppass[(*index)++] = r;
+
+        TreeCtrUppass (r->left, uppass, index);
+        TreeCtrUppass (r->right, uppass, index);
+        }
+}
+
+
+int TreeProb (void)
+{
+    int         i, num, nInSets[5];
+    MrBFlt      treeProb, cumTreeProb;
+    TreeCtr     **trees;
+    Tree        *theTree;
+    
+    /* check if we need to do this */
+    if (sumtParams.calcTreeprobs == NO)
+        return (NO_ERROR);
+
+    MrBayesPrint ("%s   Calculating tree probabilities...\n\n", spacer);
+
+    /* allocate space for tree counters and trees */
+    trees = (TreeCtr **) SafeCalloc ((size_t)numUniqueTreesFound, sizeof(TreeCtr *));
+    theTree = AllocateTree (sumtParams.numTaxa);
+    if (!trees || !theTree)
+        {
+        MrBayesPrint ("%s   Problem allocating trees or theTree in TreeProb\n", spacer);
+        return (ERROR);
+        }
+    
+    /* extract trees */
+    i = 0;
+    TreeCtrUppass (treeCtrRoot, trees, &i);
+
+    /* sort trees */
+    SortTreeCtr (trees, 0, numUniqueTreesFound-1);
+    
+    /* set basic params in receiving tree */
+    theTree->isRooted = sumtParams.isRooted;
+    if (theTree->isRooted)
+        {
+        theTree->nNodes = 2 * sumtParams.numTaxa;
+        theTree->nIntNodes = sumtParams.numTaxa - 1;
+        }
+    else
+        {
+        theTree->nNodes = 2 * sumtParams.numTaxa - 2;
+        theTree->nIntNodes = sumtParams.numTaxa - 2;
+        }
+
+    /* show tree data */
+    cumTreeProb = 0.0;
+    nInSets[0] = nInSets[1] = nInSets[2] = nInSets[3] = nInSets[4] = 0;
+    for (num=0; num<numUniqueTreesFound; num++)   /* loop over all of the trees that were found */
+        {
+        /* get probability of tree */
+        treeProb = (MrBFlt)trees[num]->count / (MrBFlt)sumtParams.numTreesSampled;
+        cumTreeProb += treeProb;
+        if (cumTreeProb >= 0.0 && cumTreeProb < 0.5)
+            nInSets[0]++;
+        else if (cumTreeProb >= 0.5 && cumTreeProb < 0.9)
+            nInSets[1]++;
+        else if (cumTreeProb >= 0.9 && cumTreeProb < 0.95)
+            nInSets[2]++;
+        else if (cumTreeProb >= 0.95 && cumTreeProb < 0.99)
+            nInSets[3]++;
+        else
+            nInSets[4]++;
+        
+        /* draw tree to stdout */
+        if (theTree->isRooted == YES)
+            RetrieveRTopology (theTree, trees[num]->order);
+        else
+            RetrieveUTopology (theTree, trees[num]->order);
+        if (sumtParams.showSumtTrees == YES)
+            {
+            MrBayesPrint ("\n%s   Tree %d (p = %1.3lf, P = %1.3lf):\n\n", spacer, num+1, treeProb, cumTreeProb);
+            ShowTree (theTree);
+            }
+
+        /* draw tree to file */
+        if (num == 0)
+            {
+            MrBayesPrintf (fpTrees, "[This file contains the trees that were found during the MCMC\n");
+            MrBayesPrintf (fpTrees, "search, sorted by posterior probability. \"p\" indicates the\n");
+            MrBayesPrintf (fpTrees, "posterior probability of the tree whereas \"P\" indicates the\n");
+            MrBayesPrintf (fpTrees, "cumulative posterior probability.]\n\n");
+            MrBayesPrintf (fpTrees, "begin trees;\n");
+            MrBayesPrintf (fpTrees, "   translate\n");
+            for (i=0; i<sumtParams.numTaxa; i++)
+                {
+                if (i == sumtParams.numTaxa - 1)
+                    MrBayesPrintf (fpTrees, "   %2d %s;\n", i+1, sumtParams.taxaNames[i]);
+                else
+                    MrBayesPrintf (fpTrees, "   %2d %s,\n", i+1, sumtParams.taxaNames[i]);
+                }
+            }
+        MrBayesPrintf (fpTrees, "   tree tree_%d [p = %1.3lf, P = %1.3lf] = [&W %1.6lf] ", num+1, treeProb, cumTreeProb, treeProb);
+        WriteTopologyToFile (fpTrees, theTree->root->left, theTree->isRooted);
+        MrBayesPrintf (fpTrees, ";\n");
+        if (num == numUniqueTreesFound - 1)
+            MrBayesPrintf (fpTrees, "end;\n");  
+        }
+        
+    /* print out general information on credible sets of trees */
+    i = nInSets[0] + nInSets[1] + nInSets[2] + nInSets[3] + nInSets[4];
+    MrBayesPrint ("%s   Credible sets of trees (%d tree%s sampled):\n", spacer, i, i > 1 ? "s" : "");
+    i = nInSets[0] + 1;
+    if (i > 1)
+        MrBayesPrint ("%s      50 %% credible set contains %d trees\n", spacer, i);
+    i += nInSets[1];
+    if (i > 1)
+        MrBayesPrint ("%s      90 %% credible set contains %d trees\n", spacer, i);
+    i += nInSets[2];
+    if (i > 1)
+        MrBayesPrint ("%s      95 %% credible set contains %d trees\n", spacer, i);
+    i += nInSets[3];
+    MrBayesPrint ("%s      99 %% credible set contains %d tree%s\n\n", spacer, i, i > 1 ? "s" : "");
+    
+    /* free memory */
+    free (trees);
+        
+    return (NO_ERROR);  
+}
+
+
+void WriteConTree (PolyNode *p, FILE *fp, int showSupport)
+{
+    PolyNode        *q;
+
+    if (p->anc != NULL)
+        if (p->anc->left == p)
+            fprintf (fp, "(");
+
+    for (q = p->left; q != NULL; q = q->sib)
+        {
+        if (q->anc->left != q) /* Note that q->anc always exists (it is p) */
+            fprintf (fp, ",");
+        WriteConTree (q, fp, showSupport);
+        }
+    if (p->left == NULL)
+        {
+        if (sumtParams.brlensDef == YES)
+            {
+            if (sumtParams.isClock == NO)
+                fprintf (fp, "%d:%s", p->index+1, MbPrintNum(p->length));
+            else
+                fprintf (fp, "%d:%s", p->index+1, MbPrintNum(p->anc->depth - p->depth));
+            }
+        else
+            fprintf (fp, "%d", p->index+1);
+        }
+        
+    if (p->sib == NULL && p->anc != NULL)
+        {
+        if (p->anc->anc != NULL)
+            {
+            if (sumtParams.brlensDef == YES && showSupport == NO)
+                {
+                if (sumtParams.isClock == NO)
+                    fprintf (fp, "):%s", MbPrintNum(p->anc->length));
+                else
+                    fprintf (fp, "):%s", MbPrintNum(p->anc->anc->depth - p->anc->depth));
+                }
+            else if (sumtParams.brlensDef == NO && showSupport == YES)
+                fprintf (fp, ")%1.3lf", p->anc->support); 
+            else if (sumtParams.brlensDef == YES && showSupport == YES)
+                {
+                if (sumtParams.isClock == NO)
+                    fprintf (fp, ")%1.3lf:%s", p->anc->support, MbPrintNum(p->anc->length));
+                else
+                    fprintf (fp, ")%1.3lf:%s", p->anc->support, MbPrintNum(p->anc->anc->depth - p->anc->depth));
+                }
+            else
+                fprintf (fp, ")");
+            }
+        else
+            fprintf (fp, ")");
+        }
+}
+
+
+/* WriteFigTreeConTree: Include rich information for each node in a consensus tree */
+void WriteFigTreeConTree (PolyNode *p, FILE *fp, PartCtr **treeParts)
+{
+    PolyNode        *q;
+
+    if (p->left == NULL)
+        {
+        fprintf (fp, "%d", p->index+1);
+        if (sumtParams.isClock == NO)
+            PrintFigTreeNodeInfo(fp, treeParts[p->partitionIndex], p->length);
+        else if (sumtParams.isCalibrated == YES)
+            PrintFigTreeNodeInfo(fp, treeParts[p->partitionIndex], p->anc->age - p->age);
+        else
+            PrintFigTreeNodeInfo(fp, treeParts[p->partitionIndex], p->anc->depth - p->depth);
+        }
+    else
+        {
+        fprintf  (fp, "(");
+        for (q = p->left; q != NULL; q = q->sib)
+            {
+            WriteFigTreeConTree (q, fp, treeParts);
+            if (q->sib != NULL)
+                fprintf (fp, ",");
+            }
+        fprintf (fp, ")");
+        if (p->partitionIndex >= 0 && p->partitionIndex < numUniqueSplitsFound)
+            {
+            if (p->anc == NULL)
+                {
+                if (sumtParams.isClock == YES)
+                    PrintFigTreeNodeInfo(fp,treeParts[p->partitionIndex], -1.0);
+                }
+            else if (sumtParams.isClock == NO)
+                PrintFigTreeNodeInfo(fp, treeParts[p->partitionIndex], p->length);
+            else if (sumtParams.isCalibrated == YES)
+                PrintFigTreeNodeInfo(fp, treeParts[p->partitionIndex], p->anc->age - p->age);
+            else
+                PrintFigTreeNodeInfo(fp, treeParts[p->partitionIndex], p->anc->depth - p->depth);
+            }
+        }
+}
+
diff --git a/src/sumpt.h b/src/sumpt.h
new file mode 100644 (file)
index 0000000..82ce273
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef __SUMPT_H__
+#define __SUMPT_H__
+
+/* struct to hold info about a .p file */
+typedef struct
+    {
+    int     longestLineLength;
+    int     headerLine;
+    int     firstParamLine;
+    int     numRows;
+    int     numColumns;
+    } SumpFileInfo;
+
+/* struct to hold info about a model probability */
+typedef struct
+    {
+    int     index;
+    double  prob;
+    } ModelProb;
+
+/* struct to hold a parameter sample, possibly from multiple files */
+typedef struct
+    {
+    MrBFlt **values;
+    } ParameterSample;
+
+/* function declarations */
+int     AllocateParameterSamples (ParameterSample **parameterSamples, int numRuns, int numRows, int numColumns);
+int     DoSump (void);
+int     DoSumpParm (char *parmName, char *tkn);
+int     DoSumSs (void);
+int     DoSumSsParm (char *parmName, char *tkn);
+int     ExamineSumpFile (char *fileName, SumpFileInfo *fileInfo, char ***headerNames, int *nHeaders);
+int     FindHeader (char *token, char **headerNames, int nHeaders, int *index);
+void    FreeParameterSamples (ParameterSample *parameterSamples);
+int     GetHeaders (char ***headerNames, char *headerLine, int *nHeaders);
+int     PrintPlot (MrBFlt *xVals, MrBFlt *yVals, int nSamples);
+int     ReadParamSamples (char *fileName, SumpFileInfo *fileInfo, ParameterSample *parameterSamples, int runNo);
+
+int     DoCompareTree (void);
+int     DoCompareTreeParm (char *parmName, char *tkn);
+int     DoCompRefTree (void);
+int     DoSumt (void);
+int     DoSumtParm (char *parmName, char *tkn);
+int     DoSumtTree (void);
+int     DoSumtTreeParm (char *parmName, char *tkn);
+void    ResetTranslateTable (void);
+int     ShowConTree (FILE *fp, PolyTree *t, int screenWidth, int showSupport);
+void    ShowParts (FILE *fp, BitsLong *p, int nTaxaToShow);
+
+#endif  /* __SUMPT_H__ */
diff --git a/src/utils.c b/src/utils.c
new file mode 100644 (file)
index 0000000..59c6389
--- /dev/null
@@ -0,0 +1,13999 @@
+/*
+ *  MrBayes 3
+ *
+ *  (c) 2002-2013
+ *
+ *  John P. Huelsenbeck
+ *  Dept. Integrative Biology
+ *  University of California, Berkeley
+ *  Berkeley, CA 94720-3140
+ *  johnh@berkeley.edu
+ *
+ *  Fredrik Ronquist
+ *  Swedish Museum of Natural History
+ *  Box 50007
+ *  SE-10405 Stockholm, SWEDEN
+ *  fredrik.ronquist@nrm.se
+ *
+ *  With important contributions by
+ *
+ *  Paul van der Mark (paulvdm@sc.fsu.edu)
+ *  Maxim Teslenko (maxim.teslenko@nrm.se)
+ *
+ *  and by many users (run 'acknowledgments' to see more info)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details (www.gnu.org).
+ *
+ */
+
+#include "bayes.h"
+#include "best.h"
+#include "command.h"
+#include "mcmc.h"
+#include "model.h"
+#include "utils.h"
+
+const char* const svnRevisionUtilsC = "$Rev: 1062 $";   /* Revision keyword which is expended/updated by svn on each commit/update */
+
+#define MAX_GAMMA_CATS                      20
+#define PI                                  3.14159265358979324
+#define PIOVER2                             1.57079632679489662
+#define POINTGAMMA(prob,alpha,beta)         PointChi2(prob,2.0*(alpha))/(2.0*(beta))
+#define PAI2                                6.283185307
+#define TINY                                1.0e-20
+#define EVALUATE_COMPLEX_NUMBERS            2
+#if !defined(MAX)
+#define MAX(a,b)                            (((a) > (b)) ? (a) : (b))
+#endif
+#if !defined(MIN)
+#define MIN(a,b)                            (((a) < (b)) ? (a) : (b))
+#endif
+#define SQUARE(a)                           ((a)*(a))
+
+/* local global variable */
+char    noLabel[] = "";
+
+/* local prototypes */
+void    DatedNodeDepths (TreeNode *p, MrBFlt *nodeDepths, int *index);
+void    DatedNodes (TreeNode *p, TreeNode **datedTips, int *index);
+int     NConstrainedTips (TreeNode *p);
+int     NDatedTips (TreeNode *p);
+void    PrintNode (char **s, int *len, TreeNode *p, int isRooted);
+void    ResetPolyNode (PolyNode *p);
+void    ResetTreeNode (TreeNode *p);
+void    SetNodeDepths (Tree *t);
+
+void    AddTwoMatrices (int dim, MrBFlt **a, MrBFlt **b, MrBFlt **result);
+void    BackSubstitutionRow (int dim, MrBFlt **u, MrBFlt *b);
+void    Balanc (int dim, MrBFlt **a, int *low, int *high, MrBFlt *scale);
+void    BalBak (int dim, int low, int high, MrBFlt *scale, int m, MrBFlt **z);
+MrBFlt  BetaCf (MrBFlt a, MrBFlt b, MrBFlt x);
+MrBFlt  BetaQuantile (MrBFlt alpha, MrBFlt beta, MrBFlt x);
+MrBFlt  CdfBinormal (MrBFlt h1, MrBFlt h2, MrBFlt r);
+MrBFlt  CdfNormal (MrBFlt x);
+complex Complex (MrBFlt a, MrBFlt b);
+MrBFlt  ComplexAbsoluteValue (complex a);
+complex ComplexAddition (complex a, complex b);
+complex ComplexConjugate (complex a);
+complex ComplexDivision (complex a, complex b);
+void    ComplexDivision2 (MrBFlt ar, MrBFlt ai, MrBFlt br, MrBFlt bi, MrBFlt *cr, MrBFlt *ci);
+complex ComplexExponentiation (complex a);
+int     ComplexInvertMatrix (int dim, complex **a, MrBFlt *dwork, int *indx, complex **aInverse, complex *col);
+complex ComplexLog (complex a);
+void    ComplexLUBackSubstitution (int dim, complex **a, int *indx, complex *b);
+int     ComplexLUDecompose (int dim, complex **a, MrBFlt *vv, int *indx, MrBFlt *pd);
+complex ComplexMultiplication (complex a, complex b);
+complex ComplexSquareRoot (complex a);
+complex ComplexSubtraction (complex a, complex b);
+int     ComputeEigenSystem (int dim, MrBFlt **a, MrBFlt *v, MrBFlt *vi, MrBFlt **u, int *iwork, MrBFlt *dwork);
+void    ComputeLandU (int dim, MrBFlt **aMat, MrBFlt **lMat, MrBFlt **uMat);
+void    ComputeMatrixExponential (int dim, MrBFlt **a, int qValue, MrBFlt **f);
+void    DivideByTwos (int dim, MrBFlt **a, int power);
+MrBFlt  D_sign (MrBFlt a, MrBFlt b);
+int     EigensForRealMatrix (int dim, MrBFlt **a, MrBFlt *wr, MrBFlt *wi, MrBFlt **z, int *iv1, MrBFlt *fv1);
+void    ElmHes (int dim, int low, int high, MrBFlt **a, int *interchanged);
+void    ElTran (int dim, int low, int high, MrBFlt **a, int *interchanged, MrBFlt **z);
+void    Exchange (int j, int k, int l, int m, int n, MrBFlt **a, MrBFlt *scale);
+MrBFlt  Factorial (int x);
+void    ForwardSubstitutionRow (int dim, MrBFlt **L, MrBFlt *b);
+MrBFlt  GammaRandomVariable (MrBFlt a, MrBFlt b, RandLong *seed);
+void    GaussianElimination (int dim, MrBFlt **a, MrBFlt **bMat, MrBFlt **xMat);
+int     Hqr2 (int dim, int low, int high, MrBFlt **h, MrBFlt *wr, MrBFlt *wi, MrBFlt **z);
+MrBFlt  IncompleteBetaFunction (MrBFlt alpha, MrBFlt beta, MrBFlt x);
+MrBFlt  IncompleteGamma (MrBFlt x, MrBFlt alpha, MrBFlt LnGamma_alpha);
+int     InvertMatrix (int dim, MrBFlt **a, MrBFlt *col, int *indx, MrBFlt **aInv);
+MrBFlt  LBinormal (MrBFlt h1, MrBFlt h2, MrBFlt r);
+int     LogBase2Plus1 (MrBFlt x);
+void    LUBackSubstitution (int dim, MrBFlt **a, int *indx, MrBFlt *b);
+int     LUDecompose (int dim, MrBFlt **a, MrBFlt *vv, int *indx, MrBFlt *pd);
+void    MultiplyMatrixByScalar (int dim, MrBFlt **a, MrBFlt scalar, MrBFlt **result);
+MrBFlt  PointChi2 (MrBFlt prob, MrBFlt v);
+void    PrintComplexVector (int dim, complex *vec);
+void    PrintSquareComplexMatrix (int dim, complex **m);
+void    PrintSquareDoubleMatrix (int dim, MrBFlt **matrix);
+void    PrintSquareIntegerMatrix (int dim, int **matrix);
+complex ProductOfRealAndComplex (MrBFlt a, complex b);
+MrBFlt  RndGamma (MrBFlt s, RandLong *seed);
+MrBFlt  RndGamma1 (MrBFlt s, RandLong *seed);
+MrBFlt  RndGamma2 (MrBFlt s, RandLong *seed);
+int     SetQvalue (MrBFlt tol);
+void    SetToIdentity (int dim, MrBFlt **matrix);
+MrBFlt  Tha (MrBFlt h1, MrBFlt h2, MrBFlt a1, MrBFlt a2);
+void    TiProbsUsingEigens (int dim, MrBFlt *cijk, MrBFlt *eigenVals, MrBFlt v, MrBFlt r, MrBFlt **tMat, MrBFlt **fMat, MrBFlt **sMat);
+void    TiProbsUsingPadeApprox (int dim, MrBFlt **qMat, MrBFlt v, MrBFlt r, MrBFlt **tMat, MrBFlt **fMat, MrBFlt **sMat);
+
+MrBFlt  QuantileLogNormal (MrBFlt prob, MrBFlt mu, MrBFlt sigma);
+int     DiscreteLogNormal (MrBFlt *rK, MrBFlt sigma, int K, int median);
+MrBFlt  LogNormalPoint (MrBFlt x, MrBFlt mu, MrBFlt sigma);
+
+/* AddBitfield: Add bitfield to list of bitfields. The function uses global variable nLongsNeeded. */
+int AddBitfield (BitsLong ***list, int listLen, int *set, int setLen)
+{
+    int     i, nLongsNeeded;
+
+    nLongsNeeded = (setLen - 1) / nBitsInALong + 1;
+
+    (*list) = (BitsLong **) SafeRealloc ((void *)(*list), ((size_t)listLen+1)*sizeof(BitsLong *));
+    if (!(*list))
+        return ERROR;
+    
+    (*list)[listLen] = (BitsLong *) SafeMalloc ((size_t)nLongsNeeded*sizeof(BitsLong));
+    if (!(*list)[listLen])
+        return ERROR;
+
+    ClearBits ((*list)[listLen], nLongsNeeded);
+    for (i=0; i<setLen; i++)
+        if (set[i] == YES)
+            SetBit(i, (*list)[listLen]);
+
+    return NO_ERROR;
+}
+
+
+#if defined (SSE_ENABLED)
+void * AlignedMalloc (size_t size, size_t alignment)
+{
+    void *mem;
+
+    #if defined GCC_SSE     /* gcc compiler */
+    if (posix_memalign (&mem, alignment, size))
+        return 0;
+    #elif defined ICC_SSE   /* icc compiler */
+    mem = _mm_malloc (size, alignment);
+    #elif defined MS_VCPP_SSE  /* ms visual */
+    mem = _aligned_malloc (size, alignment);
+    #else
+    mem = malloc (size);
+    #endif
+
+    return mem;
+}
+
+
+void AlignedSafeFree (void **ptr)
+{
+
+    #if defined ICC_SSE     /* icc compiler */
+    _mm_free (*ptr);
+    #elif defined MS_VCPP_SSE  /* ms visual */
+    _aligned_free (*ptr);
+    #else
+    free (*ptr);
+    #endif
+    
+    (*ptr) = NULL;
+}
+#endif
+
+
+int AreBitfieldsEqual (BitsLong *p, BitsLong *q, int length)
+{
+    int i;
+    
+    for (i=0; i<length; i++)
+        {
+        if (p[i] != q[i])
+            return NO;
+        }
+    
+    return YES;
+}
+
+
+/*----------------------------------------------------------------
+|
+|   Bit: return 1 if bit n is set in BitsLong *p
+|       else return 0
+|
+-----------------------------------------------------------------*/
+int Bit (int n, BitsLong *p)
+{
+    BitsLong        x, bitsLongOne;
+
+    bitsLongOne = 1;
+
+    p += n / nBitsInALong;
+    x = bitsLongOne << (n % nBitsInALong);
+
+    if ((x & (*p)) == 0)
+        return 0;
+    else
+        return 1;
+
+}
+
+
+/* ClearBit: Clear one bit in a bitfield */
+void ClearBit (int i, BitsLong *bits)
+{
+    BitsLong        x, bitsLongOne=1;
+
+    bits += i / nBitsInALong;
+
+    x = bitsLongOne << (i % nBitsInALong);
+    x ^= bitsLongWithAllBitsSet;
+
+    (*bits) &= x;
+}
+
+
+/* ClearBits: Clear all bits in a bitfield */
+void ClearBits (BitsLong *bits, int nLongs)
+{
+    int     i;
+    
+    for (i=0; i<nLongs; i++)
+        bits[i] = 0;
+}
+
+
+/* Copy bitfields */
+void CopyBits (BitsLong *dest, BitsLong *source, int length)
+{
+    int     i;
+
+    for (i=0; i<length; i++)
+        dest[i] = source[i];
+}
+
+
+/* CopyResults: copy results from one file to another up to lastGen*/
+int CopyResults (FILE *toFile, char *fromFileName, int lastGen)
+{
+    int     longestLine;
+    char    *strBuf, *strCpy, *word;
+    FILE    *fromFile;
+
+    if ((fromFile = OpenBinaryFileR(fromFileName)) == NULL)
+        return ERROR;
+
+    longestLine = LongestLine(fromFile)+10;
+    SafeFclose(&fromFile);
+    strBuf = (char *) SafeCalloc (2*(longestLine+2),sizeof(char));
+    strCpy = strBuf + longestLine + 2;
+
+    if ((fromFile = OpenTextFileR(fromFileName)) == NULL)
+        return ERROR;
+    
+    while (fgets(strBuf,longestLine,fromFile)!=NULL)
+        {
+        strncpy (strCpy,strBuf,longestLine);
+        word = strtok(strCpy," ");
+        /* atoi returns 0 when word is not integer number */
+        if (atoi(word)>lastGen)
+            break;
+        fprintf (toFile,"%s",strBuf);
+        fflush (toFile);
+        }
+    
+    SafeFclose(&fromFile);
+    free(strBuf);
+    return (NO_ERROR);
+}
+
+
+/* CopyProcessSsFile: copy results from one file to another up to lastStep. Also marginalLnLSS is collected for processed steps*/
+int CopyProcessSsFile (FILE *toFile, char *fromFileName, int lastStep, MrBFlt *marginalLnLSS, MrBFlt * splitfreqSS)
+{
+    int     longestLine, run, curStep, i;
+    double  tmp;
+    char    *strBuf, *strCpy, *word, *tmpcp;
+    FILE    *fromFile;
+
+    if ((fromFile = OpenBinaryFileR(fromFileName)) == NULL)
+        return ERROR;
+
+    longestLine = LongestLine(fromFile)+10;
+    SafeFclose(&fromFile);
+    strBuf = (char *) SafeCalloc (2*(longestLine+2),sizeof(char));
+    strCpy = strBuf + longestLine + 2;
+
+    if ((fromFile = OpenTextFileR(fromFileName)) == NULL)
+        return ERROR;
+    
+    while (fgets(strBuf,longestLine,fromFile)!=NULL)
+        {
+        strncpy (strCpy,strBuf,longestLine);
+        word = strtok(strCpy," \t\n");
+        /* atoi returns 0 when word is not integer number */
+        if (atoi(word)>lastStep)
+            break;
+        fprintf (toFile,"%s",strBuf);
+        fflush (toFile);
+        curStep = atoi(word);
+        if (curStep > 0)
+            {
+            strtok(NULL,"\t\n"); /*skip power*/
+            for (run=0; run<chainParams.numRuns; run++)
+                {
+                tmpcp = strtok(NULL,"\t\n");
+                if (tmpcp == NULL)
+                    {
+                    MrBayesPrint ("%s   Error: In .ss file not enough ellements on the string :%s        \n", spacer, strBuf);
+                    return ERROR;
+                    }
+                tmp = atof(tmpcp);
+                if (tmp == 0.0)
+                    {
+                    MrBayesPrint ("%s   Error: Value of some step contribution is 0.0 or not a number in .ss file. Sting:%s        \n", spacer, strBuf);
+                    return ERROR;
+                    }
+                marginalLnLSS[run]+=tmp;
+                }
+            for (i=0; i<numTopologies; i++)
+                {
+                tmpcp = strtok(NULL,"\t\n");
+                if (tmpcp == NULL)
+                    {
+                    MrBayesPrint ("%s   Error: In .ss file not enough ellements on the string :%s        \n", spacer, strBuf);
+                    return ERROR;
+                    }
+                tmp = atof(tmpcp);
+                splitfreqSS[i*chainParams.numStepsSS + curStep-1] = tmp;
+                }
+            }
+        }
+    
+    SafeFclose(&fromFile);
+    free(strBuf);
+    return (NO_ERROR);
+}
+
+
+/* CopyTreeResults: copy tree results upto lastGen from one file to another. numTrees is return containing number of trees that were copied. */
+int CopyTreeResults (FILE *toFile, char *fromFileName, int lastGen, int *numTrees)
+{
+    int     longestLine;
+    char    *strBuf, *strCpy, *word;
+    FILE    *fromFile;
+    
+    (*numTrees) = 0;
+
+    if ((fromFile = OpenBinaryFileR(fromFileName)) == NULL)
+        return ERROR;
+
+    longestLine = LongestLine(fromFile)+10;
+    SafeFclose(&fromFile);
+    strBuf = (char *) SafeCalloc (2*(longestLine+2),sizeof(char));
+    strCpy = strBuf + longestLine + 2;
+
+    if ((fromFile = OpenTextFileR(fromFileName)) == NULL)
+        return ERROR;
+    
+    while (fgets(strBuf,longestLine,fromFile)!=NULL)
+        {
+        strncpy (strCpy,strBuf,longestLine);
+        word = strtok(strCpy," ");
+        if (strcmp(word,"tree")==0)
+            {
+            word = strtok(NULL," ");
+            /* atoi returns 0 when word is not integer number,
+               4 is offset to get rid of "rep." in tree name */
+            if (atoi(word+4)>lastGen)
+                break;
+            (*numTrees)++;
+            fprintf (toFile,"%s",strBuf);
+            }
+        else if (*numTrees == 0)   /* do not print the end statement */
+            fprintf (toFile,"%s",strBuf);
+        fflush (toFile);
+        }
+        
+    SafeFclose(&fromFile);
+    free(strBuf);
+    return (NO_ERROR);
+}
+
+
+/* FirstTaxonInPartition: Find index of first taxon in partition */
+int FirstTaxonInPartition (BitsLong *partition, int length)
+{
+    int         i, j, nBits, taxon;
+    BitsLong    x, bitsLongOne=1;
+
+    nBits = sizeof(BitsLong) * 8;
+
+    taxon = 0;
+    for (i=0; i<length; i++)
+        {
+        x = bitsLongOne;
+        for (j=0; j<nBits; j++)
+            {
+            if (partition[i] & x)
+                return taxon;
+            taxon++;
+            x <<= 1;
+            }
+        }
+
+    return taxon;
+}
+
+
+/* FirstTree: Return file position of first tree after current position */
+long FirstTree (FILE *fp, char *lineBuf, int longestLine)
+{
+    long    firstTree;
+    char    *word;
+    
+    do {
+        firstTree = ftell(fp);
+        if ((fgets (lineBuf, longestLine, fp)) == NULL)
+            return 0;
+        word = strtok (lineBuf, " ");
+        } while (strcmp(word,"tree")!=0);
+
+    return (firstTree);
+}
+
+
+int Flip01 (int x)
+{
+    if (x == 0)
+        return (1);
+    else
+        return (0);
+}
+
+
+void FlipBits (BitsLong *partition, int length, BitsLong *mask)
+{
+    int         i;
+    
+    for (i=0; i<length; i++)
+        {
+        partition[i] ^= mask[i];
+        }
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   FlipOneBit: flip bit n in BitsLong *p
+|
+------------------------------------------------------------------*/
+void FlipOneBit (int n, BitsLong *p)
+{
+    BitsLong        x, bitsLongOne=1;
+
+    p += n/nBitsInALong;
+    x = bitsLongOne << (n % nBitsInALong);
+    (*p) ^= x;
+}
+
+
+/* Convert from 0-based growth function over six states to model index */
+int FromGrowthFxnToIndex(int *growthFxn)
+{
+    int     i, j, k, max, fxn[6];
+
+    /* set local growth fxn to lexicographical max */
+    for (i=0; i<6; i++)
+        fxn[i] = i;
+
+    /* decrease until we reach growthFxn */
+    for (k=202; k>=0; k--)
+        {
+        for (i=0; i<6; i++)
+            {
+            if (fxn[i] != growthFxn[i])
+                break;
+            }
+        if (i == 6)
+            break;
+
+        /* get next growth fxn */
+        for (i=5; i>=0; i--)
+            {
+            fxn[i]--;
+            if (fxn[i] >= 0)
+                break;
+            }
+
+        if (i < 0)
+            return -1;  /* error */
+        else if (i < 5)
+            {
+            max = 0;
+            for (j=0; j<=i; j++)
+                {
+                if (fxn[j] > max)
+                    max = fxn[j];
+                }
+            fxn[++i] = max + 1;
+            for (++i; i<6; i++)
+                fxn[i] = fxn[i-1] + 1;
+            }
+        }
+
+    return k;
+}
+
+
+/* Convert from model index to 0-based growth function over six states */
+void FromIndexToGrowthFxn(int index, int *growthFxn)
+{
+    int     i, j, max, k;
+
+    /* set growth fxn to lexicographical max */
+    for (i=0; i<6; i++)
+        growthFxn[i] = i;
+
+    /* decrease until we reach index */
+    for (k=202; k>index; k--)
+        {
+        for (i=5; i>=0; i--)
+            {
+            growthFxn[i]--;
+            if (growthFxn[i] >= 0)
+                break;
+            }
+
+        if (i < 0)
+            return; /* ERROR */
+        else if (i < 5)
+            {
+            max = 0;
+            for (j=0; j<=i; j++)
+                {
+                if (growthFxn[j] > max)
+                    max = growthFxn[j];
+                }
+            growthFxn[++i] = max + 1;
+            for (++i; i<6; i++)
+                growthFxn[i] = growthFxn[i-1] + 1;
+            }
+        }
+}
+
+
+/* GetIntSummary: Get summary statistics for a number of runs (int version) */
+void GetIntSummary (int **vals, int nRows, int *rowCount, Stat *theStats, int HPD)
+{
+    int     i, j, nVals;
+    MrBFlt  *theValues, *p;
+
+    nVals = 0;
+    for (i=0; i<nRows; i++)
+        nVals += rowCount[i];
+
+    theValues = (MrBFlt *) SafeCalloc (nVals, sizeof(MrBFlt));
+
+    /* extract values */
+    p = theValues;
+    for (i=0; i<nRows; i++)
+        {
+        for (j=0; j<rowCount[i]; j++)
+            {
+            (*p++) = (MrBFlt) (vals[i][j]);
+            }
+        }
+    
+    /* get statistics */
+    MeanVariance (theValues, nVals, &(theStats->mean), &(theStats->var));
+    if (HPD == YES)
+        LowerUpperMedian (theValues, nVals, &(theStats->lower), &(theStats->upper), &(theStats->median));
+    else
+        LowerUpperMedian (theValues, nVals, &(theStats->lower), &(theStats->upper), &(theStats->median));
+
+    free (theValues);
+}
+
+
+/* Get k from 0-based growth function */
+int GetKFromGrowthFxn(int *growthFxn)
+{
+    int i, k=0;
+
+    for (i=0; i<6; i++)
+        if (growthFxn[i] > k)
+            k = growthFxn[i];
+    
+    return k+1;
+}
+
+
+/* GetSummary: Get summary statistics for a number of runs */
+void GetSummary (MrBFlt **vals, int nRows, int *rowCount, Stat *theStats, int HPD)
+{
+    int     i, nVals;
+    MrBFlt  *theValues, *p, *ESS;
+
+    nVals = 0;
+    for (i=0; i<nRows; i++)
+        nVals += rowCount[i];
+
+    theValues = (MrBFlt *) SafeMalloc ((size_t)nVals * sizeof(MrBFlt));
+
+    /* extract values */
+    p = theValues;
+    for (i=0; i<nRows; i++)
+        {
+        memcpy ((void *)(p), (void *)(vals[i]), (size_t)rowCount[i] * sizeof(MrBFlt));
+        p += rowCount[i];
+        }
+    
+    /* get statistics */
+    MeanVariance (theValues, nVals, &(theStats->mean), &(theStats->var));
+    if (HPD == YES)
+        LowerUpperMedianHPD (theValues, nVals, &(theStats->lower), &(theStats->upper), &(theStats->median));
+    else
+        LowerUpperMedian (theValues, nVals, &(theStats->lower), &(theStats->upper), &(theStats->median));
+    if (nRows > 1)
+        theStats->PSRF = PotentialScaleReduction (vals, nRows, rowCount);
+
+    ESS = (MrBFlt *) SafeMalloc ((size_t)nRows * sizeof(MrBFlt));
+
+    EstimatedSampleSize (vals, nRows, rowCount, ESS);
+    theStats->avrESS = theStats->minESS = ESS[0];
+    for (i=1; i<nRows; i++)
+        {
+        theStats->avrESS += ESS[i];
+        if (theStats->minESS > ESS[i])
+            {
+            theStats->minESS = ESS[i];
+            }
+        }
+    theStats->avrESS /=nRows;
+
+    free (ESS);
+    free (theValues);
+}
+
+
+/* HarmonicArithmeticMean: Calculate harmonic and arithmetic mean from log values */
+int HarmonicArithmeticMeanOnLogs (MrBFlt *vals, int nVals, MrBFlt *mean, MrBFlt *harm_mean)
+{
+    int             i, reliable;
+    MrBFlt          a, x, y, scaler, n;
+
+    reliable = YES;
+    
+    scaler = vals[nVals-1];
+    a  = n = 0.0;
+    for (i=0; i<nVals; i++)
+        {
+        y = vals[i];
+        y -= scaler;
+        if (y > 400.0)
+            {
+            if (y > 5000.0)
+                {
+                reliable = NO;
+                continue;
+                }
+            a /= exp(y - 100.0);
+            scaler += y - 100.0;
+            y = 100.0;
+            }
+        
+        x = (MrBFlt) exp(y);
+         
+        if (n < 0.5)
+            a = x;
+        else
+            {
+            a += x;
+            }
+        n += 1.0;
+        }
+
+    /* arithmetic mean */
+    (*mean) = (MrBFlt) log(a/n) + scaler;
+    
+    scaler = (MrBFlt) (0.0 - vals[nVals-1]);
+    a  = n = 0.0;
+    for (i=0; i<nVals; i++)
+        {
+        y = (MrBFlt) (0.0 - vals[i]);
+        y -= scaler;
+        if (y > 400.0)
+            {
+            if (y > 5000.0)
+                {
+                reliable = NO;
+                continue;
+                }
+            a /= exp(y - 100.0);
+            scaler += y - 100.0;
+            y = 100.0;
+            }
+        
+        x = (MrBFlt) exp(y);
+        
+        if (n < 0.5)
+            a = x;
+        else
+            {
+            a += x;
+            }
+        n += (MrBFlt) 1.0;
+        }
+
+    /* harmonic mean */
+    (*harm_mean) = - (MrBFlt) log(a/n) - scaler;
+
+    if (reliable == YES)
+        return (NO_ERROR);
+    else
+        return (ERROR);
+}
+
+
+/* IsBitSet: Is bit i set in BitsLong *bits ? */
+int IsBitSet (int i, BitsLong *bits)
+{
+    BitsLong        x, bitsLongOne=1;
+
+    bits += i / nBitsInALong;
+
+    x = bitsLongOne << (i % nBitsInALong);
+
+    if ((*bits) & x)
+        return (YES);
+    else
+        return (NO);
+}
+
+
+/* IsConsistentWith: Is token consistent with expected word, case insensitive ? */
+int IsConsistentWith (const char *token, const char *expected)
+{
+    int     i, len;
+
+    if (strlen(token) > strlen(expected))
+        return NO;
+
+    len = (int) strlen (token);
+
+    for (i=0; i<len; i++)
+        {
+        if (tolower(token[i]) != tolower(expected[i]))
+            return NO;
+        }
+
+    return YES;
+}
+
+
+/* IsPartCompatible: Determine whether two partitions are nonoverlapping or nested (compatible) or
+        incompatible (partially overlapping) */
+int IsPartCompatible (BitsLong *smaller, BitsLong *larger, int length)
+{
+    int i;
+
+    /* test first if they overlap */
+    for (i=0; i<length; i++)
+        if ((smaller[i]&larger[i]) != 0)
+            break;
+
+    /* if they overlap, they must be nested */
+    if (i != length)    /* potentially incompatible */
+        {
+        for (i=0; i<length; i++)
+            if ((smaller[i]|larger[i]) != larger[i])
+                break;
+        }
+        
+    if (i == length)    /* passed either one of the tests */
+        return YES;
+    else
+        return NO;
+}
+
+
+/* IsPartNested: Test whether smaller partition is nested in larger partition */
+int IsPartNested (BitsLong *smaller, BitsLong *larger, int length)
+{
+    int i;
+
+    for (i=0; i<length; i++)
+        if ((smaller[i] | larger[i]) != larger[i])
+            break;
+        
+    if (i == length)
+        return YES;
+    else
+        return NO;
+}
+
+
+/* IsSectionEmpty: Test whether section of two bitfields is empty */
+int IsSectionEmpty (BitsLong *bitField1, BitsLong *bitField2, int length)
+{
+    int i;
+
+    for (i=0; i<length; i++)
+        if ((bitField1[i] & bitField2[i]) != 0)
+            return NO;
+        
+    return YES;
+}
+
+
+/* IsSectionEmpty: Test whether union of bitField1 and bitField2 equal to bitField3*/
+int IsUnionEqThird (BitsLong *bitField1, BitsLong *bitField2, BitsLong *bitField3, int length)
+{
+    int i;
+
+    for (i=0; i<length; i++)
+        if ((bitField1[i] | bitField2[i]) != bitField3[i])
+            return NO;
+        
+    return YES;
+}
+
+
+/* LastBlock: Return file position of last block in file */
+long LastBlock (FILE *fp, char *lineBuf, int longestLine)
+{
+    long    lastBlock;
+    char    *word;
+    
+    lastBlock = 0L;
+    rewind (fp);
+
+    while ((fgets (lineBuf, longestLine, fp)) != NULL)
+        {
+        word = strtok (lineBuf, " ");
+        if (strcmp (word, "begin") == 0)
+            lastBlock = ftell (fp);
+        }
+
+    return lastBlock;
+}
+
+
+int LineTermType (FILE *fp)
+{
+    int         ch, nextCh, term;
+
+    term = LINETERM_UNIX;   /* default if no line endings are found */
+    while ((ch = getc(fp)) != EOF)
+        {
+        if ((ch == '\n') || (ch == '\r'))
+            {
+            if (ch == '\n')
+                term = LINETERM_UNIX;
+            else /* ch = '\r' */
+                {
+                /* First test below handles one-line MAC file */
+                if (((nextCh = getc(fp)) == EOF) || (nextCh != '\n'))
+                    term = LINETERM_MAC;
+                else
+                    term = LINETERM_DOS;
+                }
+            break;
+            }
+        }
+    (void)fseek(fp, 0L, 0);     /* rewind */
+    
+    return (term);
+}
+
+
+/*The longest line in a file including line terminating characters present in binary mode.*/
+int LongestLine (FILE *fp)
+{
+    int         ch, lineLength, longest;
+    
+    longest = 0;
+    lineLength = 0;
+    ch = fgetc(fp);
+    while (ch != EOF)
+        {
+        if ((ch != '\n') && (ch != '\r'))
+            {
+            ch = fgetc(fp);
+            lineLength++;
+            continue;
+            }
+        if (ch == '\r')
+            {
+            if ((ch = fgetc(fp)) == '\n')
+                {
+                /* windows \r\n */
+                lineLength++;
+                ch = fgetc(fp);
+                }
+            else
+                {
+                /* old mac \r */
+                }
+            }
+        else  /*unix, linux,new mac or text mode read \n*/
+            {
+                ch = fgetc(fp);
+            }
+
+        if (lineLength > longest)
+                longest = lineLength;
+            lineLength = 0;
+        /*
+        if ((ch == '\n') || (ch == '\r'))
+            {
+            if (lineLength > longest)
+                longest = lineLength;
+            lineLength = 0;
+            }
+        else
+            lineLength++;
+            */
+        }
+    rewind (fp);        /* rewind */
+    
+    return (longest+1); /*+1 to accommodate last character*/
+}
+
+
+/* LowerUpperMedian: Determine median and 95 % credible interval */
+void LowerUpperMedian (MrBFlt *vals, int nVals, MrBFlt *lower, MrBFlt *upper, MrBFlt *median)
+
+{    
+    SortMrBFlt (vals, 0, nVals-1);
+    
+    *lower  = vals[(int)(0.025*nVals)];
+    *upper  = vals[(int)(0.975*nVals)];
+    *median = vals[nVals/2];
+
+}
+
+
+/* LowerUpperMedianHPD: Use a simple way to determine HPD */
+void LowerUpperMedianHPD (MrBFlt *vals, int nVals, MrBFlt *lower, MrBFlt *upper, MrBFlt *median)
+{
+    int     i, width, theStart;
+    MrBFlt  f, g, interval;
+
+    SortMrBFlt (vals, 0, nVals-1);
+    
+    width = (int)(nVals * 0.95 + 0.5);
+    theStart = 0;
+    interval = vals[width-1] - vals[0];
+    for (i=1; i<nVals-width; i++)
+    {
+        f = vals[i];
+        g = vals[i+width];
+        if (g - f < interval)
+        {
+            interval = g - f;
+            theStart = i;
+        }
+    }
+
+    *lower  = vals[theStart];
+    *upper  = vals[theStart+width-1];
+    *median = vals[nVals/2];
+}
+
+
+MrBFlt MaximumValue (MrBFlt x, MrBFlt y)
+{
+    if (x > y)
+        return (x);
+    else
+        return (y);
+}
+
+
+MrBFlt MinimumValue (MrBFlt x, MrBFlt y)
+{
+    if (x < y)
+        return (x);
+    else
+        return (y);
+}
+
+
+/* NOTE!!!! The result of this function should be used before consequtive call to it again.
+   It means NEVER use it like this:  printf ("%s %s", MbPrintNum (a),MbPrintNum (b)) */
+char *MbPrintNum (MrBFlt num)
+{
+    static char s[40];
+
+    if (scientific == YES)
+        sprintf (s,"%.*le", precision, num);
+    else
+        sprintf (s,"%.*lf", precision, num);
+
+    return s;
+}
+
+
+void MeanVariance (MrBFlt *vals, int nVals, MrBFlt *mean, MrBFlt *var)
+{
+    int             i;
+    MrBFlt          a, aOld, s, x;
+
+    a = s = 0.0;
+    for (i=0; i<nVals; i++)
+        {
+        x = vals[i];
+        aOld = a;
+        a += (x - a) / (MrBFlt) (i + 1);
+        s += (x - a) * (x - aOld);
+        }
+
+    /* mean */
+    (*mean) = a;
+    
+    /* variance */
+    if (nVals <= 1)
+        (*var) = 0.0;
+    else
+        (*var) = s / (nVals - 1);
+}
+
+
+/*  Compute mean and variance of log scaled values.
+@param vals    pointer to values in log scale
+@param nVals   number of "vals", minimum 1
+@param mean    adress of variable where computed mean is returned by the function
+@param var     adress of variable where computed variance is returned by the function. Could be set to NULL if this value need not to be returened. 
+@param varEst  adress of variable where computed estimate of the population variance is returned, could be set to NULL if this value need not to be returened. 
+               Could be set to NULL if this value need not to be returened.
+Note: We devide by nVals or by (nVals-1) when var and varEst is calculated from the sum of square differences. */
+void MeanVarianceLog (MrBFlt *vals, int nVals, MrBFlt *mean, MrBFlt *var, MrBFlt *varEst)
+{
+    int             i;
+    MrBFlt          a, aOld, s, x, y, scaler;
+
+    a = s = 0.0;
+    scaler = vals[nVals-1];
+    for (i=0; i<nVals; i++)
+        {
+        y = vals[i];
+        y -= scaler;
+        if (y > 200.0)
+            {
+            a /= exp(y - 100.0);
+            s /= exp(2*(y - 100));
+            scaler += y - 100.0;
+            y = 100.0;
+            }
+
+        x=(MrBFlt)exp(y);
+
+        aOld = a;
+        a += (x - a) / (MrBFlt) (i + 1);
+        s += (x - a) * (x - aOld);
+        }
+
+    /* mean */
+    (*mean) = log(a) + scaler;
+    
+    /* variance */
+    if (var!=NULL)
+        {
+        if (nVals <= 1)
+            (*var) = 0.0;
+        else
+            (*var) = log(s / nVals) + 2*scaler;
+        }
+
+    /* variance */
+    if (varEst!=NULL)
+        {
+        if (nVals <= 1)
+            (*varEst) = 0.0;
+        else
+            (*varEst) = log(s / (nVals+1)) + 2*scaler;
+        }
+}
+
+
+void MrBayesPrint (char *format, ...)
+{
+    va_list ptr;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id == 0)
+        {
+        if (echoMB == YES)
+            {
+            va_start (ptr, format);
+            vprintf (format, ptr);
+            va_end(ptr);
+            fflush (stdout);
+            }
+        if (logToFile == YES)
+            {
+            if (logFileFp == NULL)
+                printf ("%s   Could not print log output to file\n", spacer);
+            else
+                {
+                va_start (ptr, format);
+                vfprintf (logFileFp, format, ptr);
+                va_end(ptr);
+                fflush (logFileFp);
+                }
+            }
+        }
+#   else
+    if (chainParams.redirect == NO)
+        {
+        if (echoMB == YES)
+            {
+            va_start (ptr, format);
+            vprintf (format, ptr);
+            va_end(ptr);
+            fflush (stdout);
+            }
+        if (logToFile == YES)
+            {
+            if (logFileFp == NULL)
+                {
+                printf ("%s   Could not print log output to file\n", spacer);
+                logToFile = NO;
+                }
+            else
+                {
+                va_start (ptr, format);
+                vfprintf (logFileFp, format, ptr);
+                va_end(ptr);
+                fflush (logFileFp);
+                }
+            }
+        }
+#   endif
+}
+
+
+void MrBayesPrintf (FILE *f, char *format, ...)
+{
+    va_list                 ptr;
+
+#   if defined (MPI_ENABLED)
+    if (proc_id == 0)
+        {
+        va_start (ptr, format);
+        vfprintf (f, format, ptr);
+        va_end(ptr);
+        fflush(f);
+        }
+#   else
+    va_start (ptr, format);
+    vfprintf (f, format, ptr);
+    va_end(ptr);
+    fflush(f);
+#   endif
+}
+
+
+/** Next taxon in partition, for cycling over set bits in bit fields */
+int NextTaxonInPartition(int currentTaxon, BitsLong *partition, int length)
+{
+    int         i, j, taxon;
+    BitsLong    x, bitsLongOne=1;
+
+    taxon = currentTaxon + 1;
+    i = taxon / nBitsInALong;
+    x = (bitsLongOne << taxon % nBitsInALong);
+    for (j=taxon%nBitsInALong; j<nBitsInALong; j++)
+        {
+        if (partition[i] & x)
+            return taxon;
+        taxon++;
+        x <<= 1;
+        }
+
+    for (i++; i<length; i++)
+        {
+        x = 1;
+        for (j=0; j<nBitsInALong; j++)
+            {
+            if (partition[i] & x)
+                return taxon;
+            taxon++;
+            x <<= 1;
+            }
+        }
+
+    return taxon;
+}
+
+
+/* NBits: count bits in an int */
+int NBits (int x)
+{
+    int n=0;
+    
+    for (n=0; x != 0; n++)
+        x &= (x-1);
+    
+    return n;
+}
+
+
+/* NumBits: Count bits in a bitfield */
+int NumBits (BitsLong *x, int len)
+{
+    int         i, n=0;
+    BitsLong    y;
+
+    for (i=0; i<len; i++)
+        {
+        y = x[i];
+        while (y != 0)
+            {
+            y &= (y-1);
+            n++;
+            }
+        }
+    return n;
+}
+
+
+FILE *OpenBinaryFileR (char *name)
+{
+    FILE        *fp;
+    char        fileName[200];
+
+    strcpy(fileName, workingDir);
+    strncat(fileName, name, 199 - strlen(fileName));
+
+    if ((fp = fopen (fileName, "rb")) == NULL)  
+        {   
+        MrBayesPrint ("%s   Could not open file \"%s\"\n", spacer, name);
+        return (NULL);
+        }
+    else
+        return (fp);
+}
+
+
+FILE *OpenTextFileR (char *name)
+{
+    FILE        *fp;
+    char        fileName[200];
+
+    strcpy(fileName, workingDir);
+    strncat(fileName, name, 199 - strlen(fileName));
+
+    if ((fp = fopen (fileName, "r")) == NULL)  
+        {   
+        MrBayesPrint ("%s   Could not open file \"%s\"\n", spacer, fileName);
+        return (NULL);
+        }
+    else
+        return (fp);
+}
+
+
+FILE *OpenTextFileRQuait (char *name)
+{
+    FILE        *fp;
+    char        fileName[200];
+
+    strcpy(fileName, workingDir);
+    strncat(fileName, name, 199 - strlen(fileName));
+
+    if ((fp = fopen (fileName, "r")) == NULL)  
+        {   
+        return (NULL);
+        }
+    else
+        return (fp);
+}
+
+
+FILE *OpenTextFileA (char *name)
+{
+    FILE        *fp;
+    char        fileName[200];
+
+    strcpy(fileName, workingDir);
+    strncat(fileName, name, 199 - strlen(fileName));
+
+    if ((fp = fopen (fileName, "a+")) == NULL)  
+        {   
+        MrBayesPrint ("%s   Could not open file \"%s\"\n", spacer, name);
+        return (NULL);
+        }
+    else
+        return (fp);
+}
+
+
+FILE *OpenTextFileW (char *name)
+{
+    FILE        *fp;
+    char        fileName[200];
+
+    strcpy(fileName, workingDir);
+    strncat(fileName, name, 199 - strlen(fileName));
+
+    if ((fp = fopen (fileName, "w+")) == NULL)  
+        {   
+        MrBayesPrint ("%s   Could not open file \"%s\"\n", spacer, name);
+        return (NULL);
+        }
+    else
+        return (fp);
+}
+
+
+/*!
+\param vals[0..nRuns][count[]]   All records for all runs 
+\param nRuns                     Number of runs
+\param count[0..nRuns]           Number of records in each run
+\return PSRF
+*/
+MrBFlt PotentialScaleReduction (MrBFlt **vals, int nRuns, int *count)
+{
+    int             i, j, nVals;
+    MrBFlt          aW, aOldW, sW, sWj, aB, aOldB, sB, x, R2, weight;
+
+    aB = sB = sW = sWj = 0.0;
+    nVals = 0;
+    for (j=0; j<nRuns; j++)
+        {
+        if (count[j]==0)
+            {
+            return -1.0;
+            }
+        nVals += count[j];
+        aW = vals[j][0];
+        for (i=1; i<count[j]; i++)
+            {
+            x = vals[j][i];
+            aOldW = aW;
+            aW += (x - aW) / (MrBFlt) (i + 1);
+            sWj += (x - aW) * (x - aOldW);
+            }
+        sW += sWj / (MrBFlt)(count[j] - 1);
+        x = aW;
+        aOldB = aB;
+        aB += (x - aB) / (MrBFlt) (j + 1);
+        if (j!=0)
+            sB += (x - aB) * (x - aOldB);
+        }
+
+    sB = sB / (MrBFlt) (nRuns - 1);
+    sW = sW / (MrBFlt) (nRuns);
+
+    weight = (MrBFlt) nVals / (MrBFlt) nRuns;
+    if (sW > 0.0)
+        {
+        R2 = ((weight - 1.0) / weight) + ((MrBFlt)(nRuns + 1) / (MrBFlt) (nRuns)) * (sB / sW);
+        return sqrt(R2);
+        }
+    else
+        return -1.0;
+}
+
+
+/*!
+\param vals[0..nRuns][count[]]   All records for all runs 
+\param nRuns                     Number of runs
+\param count[0..nRuns]           Number of records in each run
+\param returnESS[0..nRuns]       Is an arry in which the routine returns ESS values for each run.
+*/
+void EstimatedSampleSize (MrBFlt **vals, int nRuns, int *count, MrBFlt *returnESS)
+{
+    int         i, j, lag, maxLag, samples;
+    MrBFlt      *values, mean, del1, del2, varStat=0.0;
+    MrBFlt      gammaStat[2000];
+        
+    for (i=0; i<nRuns; i++)
+        {
+        samples=count[i];
+        values=vals[i];
+        mean=0.0;
+        for (j=0; j<samples; j++)
+            {
+            mean+=values[j];
+            }
+        mean /=samples;
+
+        maxLag = ((samples - 1) > 2000)?2000:(samples - 1);
+
+        for (lag = 0; lag < maxLag; lag++)
+            {
+            gammaStat[lag]=0;
+            for (j = 0; j < samples - lag; j++) 
+                {
+                del1 = values[j] - mean;
+                del2 = values[j + lag] - mean;
+                gammaStat[lag] += (del1 * del2);
+                }
+
+            gammaStat[lag] /= ((MrBFlt) (samples - lag));
+
+            if (lag == 0) 
+                {
+                varStat = gammaStat[0];
+                } 
+            else if (lag % 2 == 0) 
+                {
+                if (gammaStat[lag - 1] + gammaStat[lag] > 0) 
+                    {
+                    varStat += 2.0 * (gammaStat[lag - 1] + gammaStat[lag]);
+                    }
+                else
+                    maxLag = lag;
+                }
+            }
+        returnESS[i] = (gammaStat[0] * samples) / varStat;
+        }
+}
+
+
+/* SafeCalloc: Print error if out of memory */
+void *SafeCalloc(size_t n, size_t s) {
+
+    void *ptr;
+    
+    if (s*n == 0)
+        {
+        //return NULL;
+        }
+
+    ptr= calloc(n, s);
+
+    if (ptr==NULL)
+        {
+        MrBayesPrint ("%s   Out of memory. Most probable course for the problem is that MrBayes reached\n", spacer);
+        MrBayesPrint ("%s   the limit of allowed memory for a process in your Operating System. Consult\n", spacer);
+        MrBayesPrint ("%s   documentation of your OS how to extend the limit, or use 64 bit version OS \n", spacer);
+        MrBayesPrint ("%s   and compile 64 bit version of MrBayes.                                     \n", spacer);
+        MrBayesPrint ("%s   Segmentation fault may follow.                                             \n", spacer);
+        return NULL;
+        }
+
+    return ptr;
+}
+
+
+int SafeFclose(FILE **fp) {
+    int retval=-1;
+#   if defined MPI_ENABLED
+    if (proc_id == 0) {
+#   endif
+    if (fp!=NULL && (*fp)!=NULL) 
+        retval=fclose(*fp);
+    *fp = NULL;
+#   if defined MPI_ENABLED
+    }
+#   endif
+    return retval;  
+}
+
+
+/* SafeFree: Set pointer to freed space to NULL */
+void SafeFree (void **ptr)
+{
+    free (*ptr);
+
+    (*ptr) = NULL;
+}
+
+
+/* SafeMalloc: Print error if out of memory; clear memory */
+void *SafeMalloc (size_t s)
+{
+    void *ptr;
+
+    if (s == 0)
+        {
+        return NULL;
+        }
+
+    ptr= malloc(s);
+
+    if (ptr==NULL)
+        {
+        MrBayesPrint ("%s   Out of memory. Most probable course for the problem is that MrBayes reached\n", spacer);
+        MrBayesPrint ("%s   the limit of allowed memory for a process in your Operating System. Consult\n", spacer);
+        MrBayesPrint ("%s   documentation of your OS how to extend the limit, or use 64 bit version OS \n", spacer);
+        MrBayesPrint ("%s   and compile 64 bit version of MrBayes.                                     \n", spacer);
+        MrBayesPrint ("%s   Segmentation fault may follow.                                             \n", spacer);
+        return NULL;
+        }
+
+    return memset(ptr,0,s);
+}
+
+
+/* SafeRealloc: Print error if out of memory */
+void *SafeRealloc (void *ptr, size_t s)
+{
+    if (s == 0)
+        {
+        free(ptr);
+        return NULL;
+        }
+
+    if (ptr == NULL)
+        {
+        ptr = malloc (s);
+        memset(ptr, 0, s);
+        }
+    else
+        ptr = realloc (ptr, s);
+
+    if (ptr==NULL)
+        {
+        MrBayesPrint ("%s   Out of memory. Most probable course for the problem is that MrBayes reached\n", spacer);
+        MrBayesPrint ("%s   the limit of allowed memory for a process in your Operating System. Consult\n", spacer);
+        MrBayesPrint ("%s   documentation of your OS how to extend the limit, or use 64 bit version OS \n", spacer);
+        MrBayesPrint ("%s   and compile 64 bit version of MrBayes.                                     \n", spacer);
+        MrBayesPrint ("%s   Segmentation fault may follow.                                             \n", spacer);
+        return NULL;
+        }
+
+    return ptr;
+}
+
+
+/* SafeStrcat: Allocate or reallocate target to fit result; assumes ptr is NULL if not allocated */
+char *SafeStrcat (char **target, const char *source)
+{
+    if (*target == NULL)
+        *target = (char *) SafeCalloc (strlen(source)+1, sizeof(char));
+    else
+        *target = (char *) SafeRealloc ((void *)*target, (strlen(source)+strlen(*target)+1)*sizeof(char));
+
+    if (*target)
+        strcat(*target, source);
+
+    return (*target);
+}
+
+
+/* SafeStrcpy: Allocate or reallocate target to fit result; assumes ptr is NULL if not allocated */
+char *SafeStrcpy (char **target, const char *source)
+{
+    *target = (char *) SafeRealloc ((void *)*target, (strlen(source)+1)*sizeof(char));
+
+    if (*target)
+        strcpy(*target,source);
+
+    return (*target);
+}
+
+
+/* SetBit: Set a particular bit in a series of longs */
+void SetBit (int i, BitsLong *bits)
+{
+    BitsLong        x, bitsLongOne=1;
+
+    bits += i / nBitsInALong;
+
+    x = bitsLongOne << (i % nBitsInALong);
+
+    (*bits) |= x;
+}
+
+
+void SortInts (int *item, int *assoc, int count, int descendingOrder)
+{
+    SortInts2 (item, assoc, 0, count-1, descendingOrder);
+}
+
+
+void SortInts2 (int *item, int *assoc, int left, int right, int descendingOrder)
+{
+    register int    i, j, x, y;
+
+    if (descendingOrder == YES)
+        {
+        i = left;
+        j = right;
+        x = item[(left+right)/2];
+        do 
+            {
+            while (item[i] > x && i < right)
+                i++;
+            while (x > item[j] && j > left)
+                j--;
+            if (i <= j)
+                {
+                y = item[i];
+                item[i] = item[j];
+                item[j] = y;
+                
+                if (assoc)
+                    {
+                    y = assoc[i];
+                    assoc[i] = assoc[j];
+                    assoc[j] = y;
+                    }               
+                i++;
+                j--;
+                }
+            } while (i <= j);
+        if (left < j)
+            SortInts2 (item, assoc, left, j, descendingOrder);
+        if (i < right)
+            SortInts2 (item, assoc, i, right, descendingOrder);
+        }
+    else
+        {
+        i = left;
+        j = right;
+        x = item[(left+right)/2];
+        do 
+            {
+            while (item[i] < x && i < right)
+                i++;
+            while (x < item[j] && j > left)
+                j--;
+            if (i <= j)
+                {
+                y = item[i];
+                item[i] = item[j];
+                item[j] = y;
+                
+                if (assoc)
+                    {
+                    y = assoc[i];
+                    assoc[i] = assoc[j];
+                    assoc[j] = y;
+                    }               
+                i++;
+                j--;
+                }
+            } while (i <= j);
+        if (left < j)
+            SortInts2 (item, assoc, left, j, descendingOrder);
+        if (i < right)
+            SortInts2 (item, assoc, i, right, descendingOrder);
+        }
+}
+
+
+/* SortMrBFlt: Sort in increasing order */
+void SortMrBFlt (MrBFlt *item, int left, int right)
+{
+    register int    i, j;
+    MrBFlt          x, temp;
+
+    i = left;
+    j = right;
+    x = item[(left+right)/2];
+    do 
+        {
+        while (item[i] < x && i < right)
+            i++;
+        while (x < item[j] && j > left)
+            j--;
+        if (i <= j)
+            {
+            temp = item[i];
+            item[i] = item[j];
+            item[j] = temp;
+                
+            i++;
+            j--;
+            }
+        } while (i <= j);
+    if (left < j)
+        SortMrBFlt (item, left, j);
+    if (i < right)
+        SortMrBFlt (item, i, right);
+}
+
+
+/* StrCmpCaseInsensitive: Case insensitive string comparison */
+int StrCmpCaseInsensitive (char *s, char *t)
+{
+    int i, minLen;
+
+    if (strlen(s) < strlen(t))
+        minLen = (int) strlen(s);
+    else
+        minLen = (int) strlen(t);
+
+    for (i=0; i<minLen; i++)
+        if (tolower(s[i])!= tolower(t[i]))
+            break;
+
+    if (s[i] == '\0' && t[i] == '\0')
+        return 0;
+    else if (tolower(s[i]) > tolower(t[i]))
+        return 1;
+    else
+        return -1;
+}
+
+
+/* StripComments: Strip possibly nested comments from the string s.
+    Example: s="text1[text2[text3]]"-> s="text1" */
+void StripComments (char *s)
+{
+    char    *t;
+    int     inComment;
+
+    inComment = 0;
+    for (t=s; *s != '\0'; s++)
+        {
+        if (inComment == 0)
+            {
+            if (*s == '[')
+                inComment++;
+            else
+                *t++ = *s;
+            }
+        else
+            {
+            if (*s == ']')
+                inComment--;
+            else if (*s == '[')
+                inComment++;
+            }
+        }
+    *t = '\0';
+}
+
+
+FILE *TestOpenTextFileR (char *name)
+{
+    char        fileName[100];
+
+    strcpy(fileName, workingDir);
+    strncat(fileName, name, 99 - strlen(fileName));
+
+    return fopen (fileName, "r");   
+}
+
+
+/*---------
+|
+|   UpdateGrowthFxn: We expect a set of unique indexes from 0 to 5
+|      indicating a partition of 6 rates into sets. We make sure
+|      the indices correspond to a restricted growth function here.
+|
+-----------------------*/
+void UpdateGrowthFxn(int *growthFxn)
+{
+    int     i, j, max, fxn[6];
+
+    for (i=0; i<6; i++)
+        fxn[i] = -1;
+
+    max = 0;
+    for (i=0; i<6; i++)
+        {
+        if (fxn[i] != -1)
+            continue;
+        for (j=i; j<6; j++)
+            {
+            if (growthFxn[j] == growthFxn[i])
+                fxn[j] = max;
+            }
+        max++;
+        }
+
+    for (i=0; i<6; i++)
+        growthFxn[i] = fxn[i];   
+}
+
+
+int UpperTriangIndex(int i, int j, int size)
+{
+    if (i < j)
+        return (2*size - i - 3) * i / 2 + j - 1;
+    else
+        return (2*size - j - 3) * j / 2 + i - 1;
+}
+
+
+int WantTo (const char *msg)
+{
+    char    s[100];
+    int     i;
+
+    MrBayesPrint ("%s   %s? (yes/no): ", spacer, msg);
+
+    for (i=0; i<10; i++)
+        {
+        if (fgets (s, 98, stdin) == NULL)
+            {
+            MrBayesPrint ("%s   Failed to retrieve answer; will take that as a no\n", spacer);
+            return NO;
+            }
+
+        /* Strip away the newline */
+        s[strlen(s)-1] = '\0';
+
+        /* Check answer */
+        if (IsConsistentWith (s, "yes") == YES)
+            return YES;
+        else if (IsConsistentWith (s, "no") == YES)
+            return NO;
+
+        MrBayesPrint ("%s   Enter yes or no: ", spacer);
+        }
+
+    MrBayesPrint ("%s   MrBayes does not understand; will take that as a no\n", spacer);
+
+    return NO;
+}
+
+
+/* the following are moved from tree.c */
+/* AddToTreeList: Add tree at end of tree list */
+int AddToTreeList (TreeList *treeList, Tree *tree)
+{
+    TreeListElement     *listElement = (TreeListElement *) SafeCalloc (1, sizeof(TreeListElement));
+    if (!listElement)
+        return (ERROR);
+
+    listElement->order = (int *) SafeCalloc (tree->nIntNodes-1, sizeof(int));
+    if (!listElement->order)
+        return (ERROR);
+    listElement->next = NULL;
+
+    if (treeList->last == NULL)
+        treeList->last = treeList->first = listElement;
+    else
+        {
+        treeList->last->next = listElement;
+        treeList->last = listElement;
+        }
+
+    if (tree->isRooted)
+        StoreRTopology (tree, listElement->order);
+    else
+        StoreUTopology (tree, listElement->order);
+
+    return (NO_ERROR);
+}
+
+
+/* AllocatePolyTree: Allocate memory space for a polytomous tree */
+PolyTree *AllocatePolyTree (int numTaxa)
+{
+    int         i;
+    PolyTree    *pt;
+
+    pt = (PolyTree *) SafeCalloc (1, sizeof (PolyTree));
+    if (!pt)
+        return (NULL);
+
+    pt->memNodes = 2*numTaxa;  
+    pt->nodes = (PolyNode *) SafeCalloc (2*numTaxa, sizeof(PolyNode));
+    pt->allDownPass = (PolyNode **) SafeCalloc (3*numTaxa, sizeof (PolyNode *));
+    pt->intDownPass = pt->allDownPass + 2*numTaxa;
+    if (pt->nodes == NULL || pt->allDownPass == NULL)
+        {
+        free (pt->nodes);
+        free (pt->allDownPass);
+        free (pt);
+        return (NULL);
+        }
+
+    /* initialize nodes and set index and memoryIndex */
+    for (i=0; i<2*numTaxa; i++)
+        {
+        ResetPolyNode(&pt->nodes[i]);
+        pt->nodes[i].memoryIndex = i;
+        pt->nodes[i].index = i;
+        }
+
+    /* initialize tree properties */
+    pt->nNodes = pt->nIntNodes = 0;
+    pt->root = NULL;
+    pt->brlensDef = NO;
+    pt->isRooted = NO;
+    pt->isClock = NO;
+    pt->isCalibrated = NO;
+    pt->isRelaxed = NO;
+    pt->clockRate = 0.0;
+    strcpy(pt->name,"");
+
+    /* initialize bitsets */
+    pt->bitsets = NULL;
+    
+    /* initialize relaxed clock parameters */
+    pt->nESets = 0;
+    pt->nEvents = NULL;
+    pt->position = NULL;
+    pt->rateMult = NULL;
+    pt->eSetName = NULL;
+
+    pt->nBSets = 0;
+    pt->effectiveBrLen = NULL;
+    pt->bSetName = NULL;
+
+    /* initialize population size set parameters */
+    pt->popSizeSet = NO;
+    pt->popSize = NULL;
+    pt->popSizeSetName = NULL;
+
+    return (pt);
+}
+
+
+/* AllocatePolyTreeRelClockParams: Allocate space for relaxed clock parameters */
+int AllocatePolyTreeRelClockParams (PolyTree *pt, int nBSets, int nESets)
+{
+    int     i;
+
+    /* free previous clock params if any */
+    FreePolyTreeRelClockParams (pt);
+
+    /* set number of sets */
+    pt->nBSets = nBSets;
+    pt->nESets = nESets;
+
+    /* we do not allocate space for the actual names here; these will be NULL pointers */
+
+    /* take care of branch params */
+    if (pt->nBSets > 0)
+        {
+        pt->bSetName = (char **) SafeCalloc (pt->nBSets, sizeof (char *));
+        pt->effectiveBrLen = (MrBFlt **) SafeCalloc (pt->nBSets, sizeof (MrBFlt *));
+        for (i=0; i<pt->nBSets; i++)
+            pt->effectiveBrLen[i] = (MrBFlt *) SafeCalloc (pt->memNodes, sizeof(MrBFlt));
+        }
+    
+    /* take care of breakpoint params */
+    if (pt->nESets > 0)
+        {
+        pt->eSetName = (char **) SafeCalloc (pt->nESets, sizeof(char *));
+        pt->nEvents = (int **) SafeCalloc (pt->nESets, sizeof(int *));
+        pt->position = (MrBFlt ***) SafeCalloc (pt->nESets, sizeof(MrBFlt **));
+        pt->rateMult = (MrBFlt ***) SafeCalloc (pt->nESets, sizeof(MrBFlt **));
+        for (i=0; i<pt->nESets; i++)
+            {
+            pt->nEvents[i] = (int *) SafeCalloc (pt->memNodes, sizeof(int));
+            pt->position[i] = (MrBFlt **) SafeCalloc (pt->memNodes, sizeof(MrBFlt *));
+            pt->rateMult[i] = (MrBFlt **) SafeCalloc (pt->memNodes, sizeof(MrBFlt *));
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* AllocatePolyTreePartitions: Allocate space for and set partitions for polytomous tree */
+int AllocatePolyTreePartitions (PolyTree *pt)
+{
+    int         i, nLongsNeeded, numTaxa;
+
+    /* get some handy numbers */
+    numTaxa = pt->memNodes/2;
+    nLongsNeeded = (numTaxa -1) / nBitsInALong + 1;
+
+    /* allocate space */
+    pt->bitsets = (BitsLong *) SafeRealloc ((void *)pt->bitsets, pt->memNodes*nLongsNeeded*sizeof(BitsLong));
+    if (pt->bitsets == NULL)
+        return (ERROR);
+    for (i=0; i<pt->memNodes*nLongsNeeded; i++)
+        pt->bitsets[i] = 0;
+    
+    /* set node partition pointers */
+    for (i=0; i<pt->memNodes; i++)
+        pt->nodes[i].partition = pt->bitsets + i*nLongsNeeded;
+
+    /* clear and set partitions; if the tree is empty, nothing is set */
+    ResetPolyTreePartitions(pt);
+    
+    return (NO_ERROR);
+}
+
+
+/* AllocateTree: Allocate memory space for a tree (unrooted or rooted) */
+Tree *AllocateTree (int numTaxa)
+{
+    int     i;
+    Tree    *t;
+    
+    t = (Tree *) SafeCalloc (1, sizeof (Tree));
+    if (t == NULL)
+        return NULL;
+
+    /* initialize basic tree properties */
+    t->memNodes = 2*numTaxa;
+    strcpy (t->name, "");
+    
+    t->isRooted = NO;
+    t->isClock = NO;
+
+    t->checkConstraints = NO;
+    t->nConstraints = 0;
+    t->nLocks = 0;
+    t->isCalibrated = NO;
+    t->nNodes = t->nIntNodes = 0;
+    t->nRelParts = 0;
+    t->relParts = NULL;
+
+    /* initialize pointers */
+    t->bitsets = NULL;
+    t->flags = NULL;
+    t->constraints = NULL;
+
+    /* allocate and initialize nodes and node arrays (enough for both rooted and unrooted trees) */
+    t->nNodes = 0;
+    t->nIntNodes = 0;
+    if ((t->nodes = (TreeNode *) SafeCalloc (2*numTaxa, sizeof (TreeNode))) == NULL)
+        {
+        free (t);
+        return NULL;
+        }
+    if ((t->allDownPass = (TreeNode **) SafeCalloc (3*numTaxa, sizeof (TreeNode *))) == NULL)
+        {
+        free (t->nodes);
+        free (t);
+        return NULL;
+        }
+    t->intDownPass = t->allDownPass + t->memNodes;
+    
+    /* initialize nodes and set index and memoryIndex */
+    for (i=0; i<t->memNodes; i++)
+        {
+        ResetTreeNode(&t->nodes[i]);
+        t->nodes[i].memoryIndex = i;
+        t->nodes[i].index = i;
+        }
+
+    return t;
+}
+
+
+/* AllocateFixedTree: Allocate memory space for a fixed unrooted or rooted tree */
+Tree *AllocateFixedTree (int numTaxa, int isRooted)
+{
+    int     i;
+    Tree    *t;
+    
+    t = (Tree *) SafeCalloc (1, sizeof (Tree));
+    if (t == NULL)
+        return NULL;
+
+    /* initialize basic tree properties */
+    if (isRooted == YES)
+        t->memNodes = 2*numTaxa;
+    else
+        t->memNodes = 2*numTaxa - 2;
+    strcpy (t->name, "");
+    
+    t->isRooted = isRooted;
+    t->isClock = NO;
+
+    t->checkConstraints = NO;
+    t->nConstraints = 0;
+    t->nLocks = 0;
+    t->isCalibrated = NO;
+    t->nNodes = t->nIntNodes = 0;
+    t->nRelParts = 0;
+    t->relParts = NULL;
+
+    /* initialize pointers */
+    t->bitsets = NULL;
+    t->flags = NULL;
+    t->constraints = NULL;
+
+    /* allocate and initialize nodes and node arrays (enough for both rooted and unrooted trees) */
+    if (t->isRooted)
+        {
+        t->nNodes = 2*numTaxa;
+        t->nIntNodes = numTaxa - 1;
+        }
+    else
+        {
+        t->nNodes = 2*numTaxa - 2;
+        t->nIntNodes = numTaxa - 2;
+        }
+    if ((t->nodes = (TreeNode *) SafeCalloc (t->nNodes, sizeof (TreeNode))) == NULL)
+        {
+        free (t);
+        return NULL;
+        }
+    if ((t->allDownPass = (TreeNode **) SafeCalloc (t->nNodes + t->nIntNodes, sizeof (TreeNode *))) == NULL)
+        {
+        free (t->nodes);
+        free (t);
+        return NULL;
+        }
+    t->intDownPass = t->allDownPass + t->nNodes;
+    
+    /* initialize nodes and set index and memoryIndex */
+    for (i=0; i<t->memNodes; i++)
+        {
+        ResetTreeNode(&t->nodes[i]);
+        t->nodes[i].memoryIndex = i;
+        t->nodes[i].index = i;
+        }
+
+    return t;
+}
+
+
+/* AllocateTreePartitions: Allocate space for and set partitions for tree */
+int AllocateTreePartitions (Tree *t)
+{
+    int         i, nLongsNeeded, numTaxa;
+    TreeNode    *p;
+    
+    /* get some handy numbers */
+    if (t->isRooted == YES)
+        numTaxa = t->nNodes - t->nIntNodes - 1;
+    else
+        numTaxa = t->nNodes - t->nIntNodes;
+    nLongsNeeded = (numTaxa - 1) / nBitsInALong + 1;
+
+    /* reallocate space */
+    t->bitsets = (BitsLong *) SafeRealloc ((void *)(t->bitsets), (size_t)(t->nNodes) * (size_t)nLongsNeeded * sizeof(BitsLong));
+    if (!t->bitsets)
+        return (ERROR);
+    
+    /* clear bit fields */
+    for (i=0; i<t->nNodes*nLongsNeeded; i++)
+        t->bitsets[i] = 0;
+        
+    /* set node pointers to bit fields */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->partition = t->bitsets + i*nLongsNeeded;
+        }
+
+    /* set partition specifiers for terminals */
+    ResetTreePartitions(t);
+    
+    return (NO_ERROR);
+}
+
+
+int AreTopologiesSame (Tree *t1, Tree *t2)
+{
+    int         i, j, k, nLongsNeeded, nTaxa;
+    BitsLong    *mask;
+    TreeNode    *p, *q;
+
+    if (t1->nNodes != t2->nNodes)
+        return (NO);
+    if (t1->nIntNodes != t2->nIntNodes)
+        return (NO);
+    
+    if (t1->isRooted == YES)
+        nTaxa = t1->nNodes - t1->nIntNodes - 1;
+    else
+        nTaxa = t1->nNodes - t1->nIntNodes;
+    
+    /* allocate space for mask */
+    nLongsNeeded = (nTaxa - 1) / nBitsInALong + 1;
+    mask = (BitsLong *) SafeCalloc (nLongsNeeded, sizeof(BitsLong));
+    
+    /* set mask */
+    for (i=0; i<nTaxa; i++)
+        SetBit(i, mask);
+    
+    /* allocate and set partition pointers */
+    AllocateTreePartitions (t1);
+    AllocateTreePartitions (t2);
+
+    /* check for congruence */
+    for (i=0; i<t1->nIntNodes; i++)
+        {
+        p = t1->intDownPass[i];
+        if (t1->isRooted == NO && IsBitSet(t2->root->index,p->partition))
+                    FlipBits(p->partition,nLongsNeeded, mask);
+        for (j=0; j<t2->nIntNodes; j++)
+            {
+            q = t2->intDownPass[j];
+            for (k=0; k<nLongsNeeded; k++)
+                {
+                if (p->partition[k] != q->partition[k])
+                    break;
+                }
+            if (k == nLongsNeeded)
+                break;
+            }
+        if (j == t2->nIntNodes)
+            {
+            FreeTreePartitions (t1);
+            FreeTreePartitions (t2);
+            free (mask);
+            return (NO);            
+            }
+        }
+
+    FreeTreePartitions (t1);
+    FreeTreePartitions (t2);
+    free (mask);
+    return (YES);
+}
+
+
+int AreTreesSame (Tree *t1, Tree *t2)
+{
+    int         i, j, k, nLongsNeeded, nTaxa;
+    BitsLong    *mask;
+    TreeNode    *p, *q;
+
+    extern void ShowNodes(TreeNode*, int, int);
+    
+    if (t1->nNodes != t2->nNodes)
+        return (NO);
+    if (t1->nIntNodes != t2->nIntNodes)
+        return (NO);
+    
+    if (t1->isRooted == YES)
+        nTaxa = t1->nNodes - t1->nIntNodes - 1;
+    else
+        nTaxa = t1->nNodes - t1->nIntNodes;
+    
+    /* allocate space for mask */
+    nLongsNeeded = (nTaxa - 1) / nBitsInALong + 1;
+    mask = (BitsLong *) SafeCalloc (nLongsNeeded, sizeof(BitsLong));
+    
+    /* set mask */
+    for (i=0; i<nTaxa; i++)
+        SetBit(i, mask);
+
+    /* allocate and set partition pointers */
+    AllocateTreePartitions (t1);
+    AllocateTreePartitions (t2);
+
+    /* check for congruence */
+    for (i=0; i<t1->nNodes; i++)
+        {
+        p = t1->allDownPass[i];
+        if (p->anc == NULL && t1->isRooted == YES)
+            continue;
+        if (t1->isRooted == NO && IsBitSet(t2->root->index,p->partition))
+            FlipBits(p->partition,nLongsNeeded, mask);
+        for (j=0; j<t2->nNodes; j++)
+            {
+            q = t2->allDownPass[j];
+            for (k=0; k<nLongsNeeded; k++)
+                {
+                if (p->partition[k] != q->partition[k])
+                    break;
+                }
+            if (k == nLongsNeeded && AreDoublesEqual (p->length, q->length, 0.000001) == YES)
+                break;
+            else if (k == nLongsNeeded)
+                {
+                FreeTreePartitions (t1);
+                FreeTreePartitions (t2);
+                free (mask);
+                return (NO);
+                }
+            }
+        if (j == t2->nNodes)
+            {
+            FreeTreePartitions (t1);
+            FreeTreePartitions (t2);
+            free (mask);
+            return (NO);            
+            }
+        }
+
+    FreeTreePartitions (t1);
+    FreeTreePartitions (t2);
+    free (mask);
+    return (YES);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   BuildConstraintTree: Build constraint tree. The tree t is
+|      needed only to hold information about constraints and
+|      included taxa.
+|
+----------------------------------------------------------------*/
+int BuildConstraintTree (Tree *t, PolyTree *pt, char **localTaxonNames)
+{
+    int             i, j, k, constraintId, nLongsNeeded, nextNode;
+    BitsLong        *constraintPartition, *mask;
+    PolyNode        *pp, *qq, *rr, *ss, *tt;
+    
+    pt->isRooted = t->isRooted;
+
+    nLongsNeeded = (numLocalTaxa - 1) / nBitsInALong + 1;
+    constraintPartition = (BitsLong *) SafeCalloc (2*nLongsNeeded, sizeof(BitsLong));
+    if (!constraintPartition)
+        {
+        MrBayesPrint ("%s   Problems allocating constraintPartition in BuildConstraintTree", spacer);
+        return (ERROR);
+        }
+    mask = constraintPartition + nLongsNeeded;
+
+    /* calculate mask (needed to take care of unused bits when flipping partitions) */
+    for (i=0; i<numLocalTaxa; i++)
+        SetBit (i, mask);
+
+    /* reset all nodes */
+    for (i=0; i<2*numLocalTaxa; i++)
+        {
+        pp = &pt->nodes[i];
+        pp->isDated = NO;
+        pp->calibration = NULL;
+        pp->age = -1.0;
+        pp->isLocked = NO;
+        pp->lockID = -1;
+        pp->index = i;
+        }
+
+    /* build a bush */
+    pt->root = &pt->nodes[numLocalTaxa];
+    for (i=0; i<numLocalTaxa; i++)
+        {
+        pp = &pt->nodes[i];
+        pp->index = i;
+        pp->left = NULL;
+        if (i == numLocalTaxa - 1)
+            pp->sib = NULL;
+        else
+            pp->sib = &pt->nodes[i+1];
+        pp->anc = pt->root;
+        }
+    pp = pt->root;
+    pp->left = &pt->nodes[0];
+    pp->anc = pp->sib = NULL;
+    pt->nNodes = numLocalTaxa + 1;
+    pt->nIntNodes = 1;
+
+    /* make sure the outgroup is the right-most node */
+    pt->nodes[localOutGroup].index = numLocalTaxa - 1;
+    pt->nodes[numLocalTaxa - 1].index = localOutGroup;
+
+    /* allocate and set partition specifiers in bush */
+    GetPolyDownPass(pt);
+    AllocatePolyTreePartitions(pt);
+
+    /* set terminal taxon labels */
+    for (i=0; i<pt->nNodes; i++)
+        {
+        pp = pt->allDownPass[i];
+        if (pp->index < numLocalTaxa)
+            strcpy (pp->label, localTaxonNames[pp->index]);
+        }
+
+    /* resolve the bush according to constraints */
+    /* for now, satisfy all constraints */
+    /* for now, bail out if constraints are not compatible */
+    /* Eventually, we might want to be build a parsimony (WAB) or compatibility (WIB) matrix and
+       draw a starting tree from the universe according to the score of the tree. A simple way of accomplishing
+       approximately this is to use sequential addition, with probabilities in each step determined
+       by the parsimony or compatibility score of the different possibilities. */ 
+    nextNode = numLocalTaxa + 1;
+    t->nLocks=0;
+    for (constraintId=0; constraintId<numDefinedConstraints; constraintId++)
+        {
+        if (t->constraints[constraintId] == NO || definedConstraintsType[constraintId] != HARD)
+            continue;
+
+        /* initialize bits in partition to add; get rid of deleted taxa in the process */
+        ClearBits(constraintPartition, nLongsNeeded);
+        for (i=j=0; i<numTaxa; i++)
+            {
+            if (taxaInfo[i].isDeleted == YES)
+                continue;
+            if (IsBitSet(i, definedConstraint[constraintId]) == YES)
+                SetBit(j, constraintPartition);
+            j++;
+            }
+        assert (j == numLocalTaxa);
+                
+        /* make sure outgroup is outside constrained partition if the tree is unrooted */
+        if (t->isRooted == NO && IsBitSet(localOutGroup, constraintPartition))
+            FlipBits(constraintPartition, nLongsNeeded, mask);
+
+        /* check that partition should be included */
+        k = NumBits(constraintPartition, nLongsNeeded);
+        if (k == 0)
+            {
+            MrBayesPrint ("%s   WARNING: Constraint '%s' refers only to deleted taxa\n", spacer, constraintNames[constraintId]);
+            MrBayesPrint ("%s            and will be disregarded\n", spacer);
+            t->constraints[constraintId] = NO;
+            continue;
+            }
+        if (k == 1)
+            {
+            MrBayesPrint ("%s   WARNING: Constraint '%s' refers to a single tip and\n", spacer, constraintNames[constraintId]);
+            MrBayesPrint ("%s            will be disregarded\n", spacer);
+            t->constraints[constraintId] = NO;
+            continue;
+            }
+
+        /* check if root in rooted tree (we allow this to enable inference of ancestral states) */
+        if (k == numLocalTaxa && t->isRooted == YES)
+            {
+            if (pt->root->isLocked == YES) {
+                MrBayesPrint ("%s   WARNING: Constraint '%s' is a duplicate of another constraint\n", spacer, constraintNames[constraintId]);
+                MrBayesPrint ("%s            and will be ignored\n", spacer);
+                t->constraints[constraintId] = NO;
+                continue;
+                }
+            pt->root->isLocked = YES;
+            pt->root->lockID = constraintId;
+            t->nLocks++;
+            continue;
+            }
+
+        /* check if interior root in unrooted tree (we allow this to enable inference of ancestral states) */
+        if ((k == numLocalTaxa - 1 || k == numLocalTaxa) && t->isRooted == NO)
+            {
+            if (pt->root->isLocked == YES) {
+                MrBayesPrint ("%s   WARNING: Constraint '%s' is a duplicate of another constraint\n", spacer, constraintNames[constraintId]);
+                MrBayesPrint ("%s            and will be ignored\n", spacer);
+                t->constraints[constraintId] = NO;
+                continue;
+                }
+            pt->root->isLocked = YES;
+            pt->root->lockID = constraintId;
+            t->nLocks++;
+            continue;
+            }
+
+        /* find first included terminal */
+        k = FirstTaxonInPartition (constraintPartition, nLongsNeeded);
+        for (i=0; pt->nodes[i].index != k; i++)
+            ;
+        pp = &pt->nodes[i];
+
+        /* go down until node is not included in constraint */
+        do {
+            qq = pp;
+            pp = pp->anc;       
+        } while (IsPartNested(pp->partition, constraintPartition, nLongsNeeded));
+
+        /* check that the node has not yet been included */
+        for (i=0; i<nLongsNeeded; i++)
+            {
+            if (qq->partition[i] != constraintPartition[i])
+                break;
+            }
+        if (i==nLongsNeeded)
+            {
+            MrBayesPrint ("%s   WARNING: Constraint '%s' is a duplicate of another constraint\n", spacer, constraintNames[constraintId]);
+            MrBayesPrint ("%s            and will be ignored\n", spacer);
+            t->constraints[constraintId] = NO;
+            continue;
+            }
+
+        /* create a new node */
+        tt = &pt->nodes[nextNode++];
+        tt->anc = pp;
+        tt->isLocked = YES;
+        tt->lockID = constraintId;
+        t->nLocks++;
+        for (i=0; i<nLongsNeeded; i++)
+            tt->partition[i] = constraintPartition[i];
+        pt->nIntNodes++;
+        pt->nNodes++;
+
+        /* sort descendant nodes in two connected groups: included and excluded */
+        /* if there is a descendant that overlaps (incompatible) then return error */
+        rr = ss = NULL;
+        qq = pp->left;
+        do {
+            if (IsPartNested(qq->partition, constraintPartition, nLongsNeeded))
+                {
+                if (ss != NULL)
+                    ss->sib = qq;
+                else
+                    tt->left = qq;
+                ss = qq;
+                qq->anc = tt;
+                }
+            else if (IsPartCompatible(qq->partition, constraintPartition, nLongsNeeded))
+                {
+                if (rr != NULL)
+                    rr->sib = qq;
+                else
+                    tt->sib = qq;
+                rr = qq;
+                }
+            else
+                {
+                free (constraintPartition);
+                return (ERROR);
+                }
+            qq = qq->sib;
+            } while (qq != NULL);
+        pp->left = tt;
+        rr->sib = ss->sib = NULL;
+        }
+    
+    /* relabel interior nodes */
+    GetPolyDownPass(pt);
+    for (i=0; i<pt->nIntNodes; i++)
+        pt->intDownPass[i]->index = i + numLocalTaxa;
+
+    /* exit */
+    free (constraintPartition);
+    FreePolyTreePartitions(pt);
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------
+|
+|   BuildRandomRTopology: Builds a random rooted
+|      topology. Will set indices in t->nodes
+|      such that they are from 0 to n-1 for the n tips
+|      and from n to 2n-2 for the n-1 interior 
+|      nodes. Last is root. Does not touch labels
+|      of tips.
+|
+----------------------------------------------*/
+int BuildRandomRTopology (Tree *t, RandLong *seed)
+{
+    int         i, j, nTips;
+    TreeNode    *p, *q, *r;
+
+    nTips = t->nNodes - t->nIntNodes - 1;
+    
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = &t->nodes[i];
+        p->index = i;
+        p->left = p->right = p->anc = NULL;
+        }
+
+    /* connect the first two tip nodes */
+    q = &t->nodes[0];
+    r = &t->nodes[1];
+    p = &t->nodes[nTips];
+    q->anc = r->anc = p;
+    p->left = q;
+    p->right = r;
+    q = &t->nodes[2*nTips-1];
+    p->anc = q;
+    q->left = p;
+
+    for (i=2; i<nTips; i++)
+        {
+        q = &t->nodes[i];
+        r = &t->nodes[i-2+nTips+1];
+        q->anc = r;
+        r->left = q;
+        j = (int) (RandomNumber(seed) * (2 * i - 1));
+        if (j < i)
+            p = &t->nodes[j];
+        else
+            p = &t->nodes[j-i + nTips];
+        r->right = p;
+        r->anc = p->anc;
+        if (p->anc != NULL)
+            {
+            if (p->anc->left == p)
+                p->anc->left = r;
+            else
+                p->anc->right = r;
+            }
+        p->anc = r;
+        }
+
+    /* set root and get downpass */
+    t->root = &t->nodes[2*nTips-1];
+    GetDownPass (t);
+
+    /* relabel interior nodes */
+    for (i=0; i<t->nIntNodes; i++)
+        t->intDownPass[i]->index = i+nTips;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------
+|
+|   BuildRandomUTopology: Builds a random unrooted
+|      topology. Assumes that indices are set
+|      in t->nodes from 0 to n-1 for the n tips
+|      and from n to 2n-3 for the n-2 interior 
+|      nodes. Move the calculation root after
+|      this routine to get the right root.
+|
+----------------------------------------------*/
+int BuildRandomUTopology (Tree *t, RandLong *seed)
+{
+    int         i, j, nTips;
+    TreeNode    *p, *q, *r;
+
+    nTips = t->nNodes - t->nIntNodes;
+    
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = &t->nodes[i];
+        p->index = i;
+        p->left = p->right = p->anc = NULL;
+        }
+    
+    /* connect the first three nodes, assuming 0 is calc root */
+    q = &t->nodes[1];
+    r = &t->nodes[2];
+    p = &t->nodes[nTips];
+    q->anc = r->anc = p;
+    p->left = q;
+    p->right = r;
+    q = &t->nodes[0];
+    p->anc = q;
+    q->left = p;
+
+    for (i=3; i<nTips; i++)
+        {
+        q = &t->nodes[i];
+        r = &t->nodes[i - 3 + nTips + 1];
+        q->anc = r;
+        r->left = q;
+        j = (int) (RandomNumber(seed) * (2 * i - 3));
+        if (j < i - 1)
+            p = &t->nodes[j+1];
+        else
+            p = &t->nodes[j+1-i + nTips];
+        r->right = p;
+        r->anc = p->anc;
+        if (p->anc->left == p)
+            p->anc->left = r;
+        else
+            p->anc->right = r;
+        p->anc = r;
+        }
+
+    t->root = &t->nodes[0];
+    
+    /* get downpass */
+    GetDownPass (t);
+
+    /* relabel interior nodes */
+    for (i=0; i<t->nIntNodes; i++)
+        t->intDownPass[i]->index = i+nTips;
+
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CheckConstraints: Check that tree complies with constraints
+|
+----------------------------------------------------------------*/
+int CheckConstraints (Tree *t)
+{
+    int             a, i, j, k, nLongsNeeded;
+    BitsLong        *constraintPartition, *mask;
+    TreeNode        *p=NULL;
+        
+    if (t->checkConstraints == NO)
+        return (NO_ERROR);
+
+    /* allocate space */
+    nLongsNeeded = (numLocalTaxa - 1) / nBitsInALong + 1;
+    constraintPartition = (BitsLong *) SafeCalloc (2*nLongsNeeded, sizeof(BitsLong));
+    if (!constraintPartition)
+        {
+        MrBayesPrint ("%s   Problems allocating constraintPartition in CheckConstraints", spacer);
+        return (ERROR);
+        }
+    mask = constraintPartition + nLongsNeeded;
+
+    /* set mask (needed to reset unused bits when flipping partitions) */
+    for (i=0; i<numLocalTaxa; i++) 
+      SetBit (i, mask); 
+    
+    if (AllocateTreePartitions(t) == ERROR)
+        {
+        MrBayesPrint ("%s   Problems allocating tree partitions in CheckConstraints", spacer);
+        return (ERROR);
+        }
+
+    for (a=0; a<numDefinedConstraints; a++)
+        {
+        if (t->constraints[a] == NO  || definedConstraintsType[a] != HARD)
+            continue;
+
+        /* set bits in partition to check */
+        ClearBits(constraintPartition, nLongsNeeded);
+        for (j=k=0; j<numTaxa; j++)
+            {
+            if (taxaInfo[j].isDeleted == YES)
+                continue;
+            if (IsBitSet(j, definedConstraint[a]) == YES)
+                SetBit(k, constraintPartition);
+            k++;
+            }
+
+        /* make sure outgroup is outside constrained partition if unrooted tree */
+        if (t->isRooted == NO && IsBitSet(localOutGroup, constraintPartition))
+            FlipBits(constraintPartition, nLongsNeeded, mask);
+
+        /* find the locked node */
+        for (i=j=0; i<t->nNodes; i++)
+            {
+            if (t->allDownPass[i]->isLocked == YES && t->allDownPass[i]->lockID == a)
+                {
+                p = t->allDownPass[i];
+                j++;
+                }
+            }
+    
+        if (j != 1)
+            {
+            MrBayesPrint ("%s   Tree has %d locks with id %d identifying constraint '%s'\n", spacer, j, a, constraintNames[a]);
+            free (constraintPartition);
+            FreeTreePartitions(t);
+            return (ERROR);
+            }
+
+        /* check that locked node is correct */
+        for (i=0; i<nLongsNeeded; i++)
+            {
+            if (p->partition[i] != constraintPartition[i]) 
+                {
+                MrBayesPrint ("%s   Lock %d is set for the wrong node [this is a bug]\n", spacer, a);
+                free (constraintPartition);
+                FreeTreePartitions(t);
+                return (ERROR);
+                }
+            }
+        }
+    
+    FreeTreePartitions (t);
+    free (constraintPartition);
+    return (NO_ERROR);
+}
+
+
+/*----------------------------------------------------------------
+|
+|   CheckSetConstraints: Check and set tree constraints
+|
+----------------------------------------------------------------*/
+int CheckSetConstraints (Tree *t)
+{
+    int             a, i, j, k, nLongsNeeded, foundIt, numLocks;
+    BitsLong        *constraintPartition, *mask;
+    TreeNode        *p;
+        
+    if (t->checkConstraints == NO)
+        return (NO_ERROR);
+
+    /* reset all existing locks, if any */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->isLocked = NO;
+        p->lockID = -1;
+        if (p->left != NULL)
+            {
+            p->calibration = NULL;
+            p->isDated = NO;
+            p->age = -1.0;
+            }
+        }
+
+    /* allocate space */
+    if (AllocateTreePartitions (t) == ERROR)
+        {
+        MrBayesPrint ("%s   Problems allocating tree bitsets", spacer);
+        return ERROR;
+        }
+
+    nLongsNeeded = ((numLocalTaxa - 1) / nBitsInALong) + 1;
+    constraintPartition = (BitsLong *) SafeCalloc (2*nLongsNeeded, sizeof(BitsLong));
+    if (!constraintPartition)
+        {
+        MrBayesPrint ("%s   Problems allocating constraintPartition", spacer);
+        FreeTreePartitions(t);
+        return ERROR;
+        }
+    mask = constraintPartition + nLongsNeeded;
+
+    /* set mask (needed to take care of unused bits when flipping partitions) */
+    for (i=0; i<numLocalTaxa; i++)
+        SetBit (i, mask);
+
+    numLocks = 0;
+    for (a=0; a<numDefinedConstraints; a++)
+        {
+        if (modelParams[t->relParts[0]].activeConstraints[a] == NO || definedConstraintsType[a] != HARD)
+            continue;
+
+        /* set bits in partition to add */
+        ClearBits(constraintPartition, nLongsNeeded);
+        for (i=j=0; i<numTaxa; i++)
+            {
+            if (taxaInfo[i].isDeleted == YES)
+                continue;
+            if (IsBitSet(i, definedConstraint[a]) == YES)
+                SetBit(j, constraintPartition);
+            j++;
+            }
+
+        /* make sure outgroup is outside constrained partition (marked 0) */
+        if (t->isRooted == NO && IsBitSet(localOutGroup, constraintPartition) == YES)
+            FlipBits(constraintPartition, nLongsNeeded, mask);
+
+        /* skip partition if uninformative */
+        k = NumBits(constraintPartition, nLongsNeeded);
+        if (k == 0 || k == 1)
+            continue;
+            
+        /* find the node that should be locked */
+        foundIt = NO;
+        for (i=0; i<t->nIntNodes; i++)
+            {
+            p = t->intDownPass[i];
+            for (j=0; j<nLongsNeeded; j++)
+                {
+                if (p->partition[j] != constraintPartition[j])
+                    break;
+                }
+
+            if (j == nLongsNeeded)
+                {
+                foundIt = YES;
+                p->isLocked = YES;
+                p->lockID = a;
+                if (nodeCalibration[a].prior != unconstrained)
+                    {
+                    p->isDated = YES;
+                    p->calibration = &nodeCalibration[a];
+                    }
+                numLocks++;
+                break;
+                }
+            }
+    
+        if (foundIt == NO)
+            {
+            MrBayesPrint ("%s   Tree breaks constraint '%s'\n", spacer, constraintNames[a]);
+            FreeTreePartitions (t);
+            free (constraintPartition);
+            return (ERROR);
+            }
+        }
+
+    if (numLocks != t->nLocks)
+        {
+        MrBayesPrint ("%s   Inconsistent lock settings. This is a bug, please report it.\n", spacer);
+        FreeTreePartitions (t);
+        free (constraintPartition);
+        return (ERROR);
+        }
+    
+    /* exit */
+    FreeTreePartitions(t);
+    free (constraintPartition);
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------------
+|
+|   ColorClusters: Recursive function to color the clusters in a tree by
+|      assigning numbers to them in their variable x
+|
+------------------------------------------------------------------------*/
+void ColorClusters (TreeNode *p, int *index)
+{
+    if (p!=NULL)
+        {
+        if (p->isLocked == YES || p->anc == NULL || p->anc->anc == NULL)
+            p->x = (++(*index));
+        else
+            p->x = p->anc->x;
+        ColorClusters(p->left, index);
+        ColorClusters(p->right, index);
+        }
+}
+
+
+/* CopyPolyNodes: Copies everything except pointers and memoryIndex */
+void CopyPolyNodes (PolyNode *p, PolyNode *q, int nLongsNeeded)
+{
+    p->index                  = q->index; 
+    p->mark                   = q->mark;
+    p->length                 = q->length;
+    p->x                      = q->x;
+    p->y                      = q->y;
+    p->isDated                = q->isDated;
+    p->calibration            = q->calibration;
+    p->age                    = q->age;
+    p->isLocked               = q->isLocked;
+    p->lockID                 = q->lockID;
+    strcpy (p->label, q->label);
+    if (nLongsNeeded!=0)
+        {
+        assert (p->partition);
+        assert (q->partition);
+        memcpy (p->partition,q->partition, nLongsNeeded*sizeof(BitsLong));
+        }
+    p->support                = q->support;
+    p->f                      = q->f;
+}
+
+
+void CopySubtreeToTree (Tree *subtree, Tree *t)
+{
+    int         i, /*j,*/ k;
+    TreeNode    *p, *q=NULL, *r;
+
+    for (i=/*j=*/0; i<subtree->nNodes - 1; i++)
+        {
+        p = subtree->allDownPass[i];
+
+        for (k=0; k<t->nNodes; k++)
+            {
+            q = t->allDownPass[k];
+            if (q->index == p->index)
+                break;
+            }
+        q->length = p->length;
+        q->marked = YES;
+        if (p->left != NULL && p->right != NULL)
+            {
+            for (k=0; k<t->nNodes; k++)
+                {
+                r = t->allDownPass[k];
+                if (r->index == p->left->index)
+                    {
+                    q->left = r;
+                    r->anc = q;
+                    }
+                else if (r->index == p->right->index)
+                    {
+                    q->right = r;
+                    r->anc = q;
+                    }
+                }
+            }
+        }
+
+    p = subtree->root;
+
+    for (k=0; k<t->nNodes; k++)
+        {
+        q = t->allDownPass[k];
+        if (q->index == p->index)
+            break;
+        }
+
+    if (q->left->marked == YES)
+        {
+        for (k=0; k<t->nIntNodes; k++)
+            {
+            r = t->intDownPass[k];
+            if (r->index == p->left->index)
+                {
+                q->left = r;
+                r->anc = q;
+                }
+            }
+        }
+    else if (q->right->marked == YES)
+        {
+        for (k=0; k<t->nIntNodes; k++)
+            {
+            r = t->intDownPass[k];
+            if (r->index == p->left->index)
+                {
+                q->right = r;
+                r->anc = q;
+                }
+            }
+        }
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   CopyToPolyTreeFromPolyTree: copies second tree to first tree
+|
+-----------------------------------------------------------------*/
+int CopyToPolyTreeFromPolyTree (PolyTree *to, PolyTree *from)
+{
+    int         i, j, k, nLongsNeeded;
+    PolyNode    *p, *q;
+
+    /* check we have enough memory */
+    assert (to->memNodes >= from->nNodes);
+    if (from->bitsets==NULL || to->bitsets==NULL)
+        {
+        nLongsNeeded=0;
+        }
+    else
+        {
+        assert (to->memNodes >= from->memNodes);/*Otherwise partition length woould not be long enough for nodes in "to" */
+        nLongsNeeded = (from->memNodes/2 - 1) / nBitsInALong + 1;
+        }
+
+    /* copy nodes */
+    for (i=0; i<from->nNodes; i++)
+        {
+        /* copy pointers */
+        p  = from->nodes + i;
+        q  = to->nodes + i;
+
+        if (p->anc != NULL)
+            q->anc = to->nodes + p->anc->memoryIndex;
+        else
+            {
+            q->anc = NULL;
+            to->root = q;
+            }
+
+        if (p->left != NULL)
+            q->left = to->nodes + p->left->memoryIndex;
+        else
+            q->left = NULL;
+
+        if (p->sib != NULL)
+            q->sib = to->nodes + p->sib->memoryIndex;
+        else
+            q->sib = NULL;
+
+        /* Copy everything else except memoryIndex */
+        CopyPolyNodes (q, p, nLongsNeeded);
+        }
+
+    /* fill node arrays */
+    /* copy tree properties */
+    to->nNodes = from->nNodes;
+    to->nIntNodes = from->nIntNodes;
+    to->isRooted = from->isRooted;
+    to->isClock = from->isClock;
+    to->isRelaxed = from->isRelaxed;
+    to->clockRate = from->clockRate;
+    strcpy (to->name, from->name);
+  
+    GetPolyDownPass (to);
+
+    /* copy partitions */
+    if (from->bitsets)
+        {
+        if (!to->bitsets)
+            AllocatePolyTreePartitions(to);
+        else
+            ResetPolyTreePartitions(to);
+        }
+
+    /* copy relaxed clock parameters */
+    FreePolyTreeRelClockParams (to);
+    
+    if (from->nBSets + from->nESets > 0)
+        AllocatePolyTreeRelClockParams (to, from->nBSets, from->nESets);
+
+    for (i=0; i<to->nBSets; i++)
+        {
+        to->bSetName[i] = (char *) SafeCalloc (strlen(from->bSetName[i])+2, sizeof(char));
+        strcpy (to->bSetName[i], from->bSetName[i]);
+        for (j=0; j<from->nNodes; j++)
+            to->effectiveBrLen[i][j] = from->effectiveBrLen[i][j];
+        }
+    
+    for (i=0; i<to->nESets; i++)
+        {
+        to->eSetName[i] = (char *) SafeCalloc (strlen(from->eSetName[i])+2, sizeof(char));
+        strcpy (to->eSetName[i], from->eSetName[i]);
+        for (j=0; j<from->nNodes; j++)
+            {
+            to->nEvents[i][j] = from->nEvents[i][j];
+            if (to->nEvents[i][j] > 0)
+                {
+                to->position[i][j] = (MrBFlt *) SafeCalloc (to->nEvents[i][j], sizeof (MrBFlt));
+                to->rateMult[i][j] = (MrBFlt *) SafeCalloc (to->nEvents[i][j], sizeof (MrBFlt));
+                for (k=0; k<to->nEvents[i][j]; k++)
+                    {
+                    to->position[i][j][k] = from->position[i][j][k];
+                    to->rateMult[i][j][k] = from->rateMult[i][j][k];
+                    }
+                }
+            }
+        }
+    
+    /* copy population size parameters */
+    FreePolyTreePopSizeParams(to);
+    to->popSizeSet = from->popSizeSet;
+    if (to->popSizeSet == YES)
+        {
+        to->popSize = (MrBFlt *) SafeCalloc (to->nNodes, sizeof(MrBFlt));
+        for (i=0; i<to->nNodes; i++)
+            to->popSize[i] = from->popSize[i];
+        to->popSizeSetName = (char *) SafeCalloc (strlen(from->popSizeSetName) + 1, sizeof(char));
+        strcpy (to->popSizeSetName, from->popSizeSetName);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   CopyToSpeciesTreeFromPolyTree: copies second tree (polytomous) to
+|       first tree, which is a species tree. The species tree needs to
+|       be allocated enough space first to hold the resulting tree.
+|
+-----------------------------------------------------------------*/
+int CopyToSpeciesTreeFromPolyTree (Tree *to, PolyTree *from)
+{
+    int         i;
+    PolyNode    *p;
+    TreeNode    *q, *q1;
+#   if defined (DEBUG_SPECIESTREE)
+    int         j;
+#   endif
+
+    /* make sure assumptions are correct */
+    assert (from->isRooted == YES);
+    assert (from->isClock == YES);
+    assert (from->nNodes - from->nIntNodes == numSpecies);
+    assert (to->memNodes == 2*numSpecies);
+    assert (to->nIntNodes == from->nIntNodes);
+    assert (to->nNodes == from->nNodes + 1);
+
+    /* make sure indices are set correctly for from nodes */
+#   if defined (DEBUG_SPECIESTREE)
+    for (i=0; i<from->nNodes; i++)
+        {
+        for (j=0; j<from->nNodes; j++)
+            {
+            p = from->allDownPass[j];
+            if (p->index == i)
+                break;
+            }
+        assert (j != from->nNodes);
+        assert (!(p->left == NULL && p->index >= numSpecies));
+        }
+#   endif
+
+    /* copy nodes */
+    for (i=0; i<from->nNodes; i++)
+        {
+        /* copy pointers */
+        p  = from->allDownPass[i];
+        q  = to->nodes + p->index;
+
+        if (p->anc != NULL)
+            q->anc = to->nodes + p->anc->index;
+        else
+            q->anc = NULL;
+
+        if (p->left != NULL)    
+            q->left = to->nodes + p->left->index;
+        else
+            q->left = NULL;
+
+        if (p->left != NULL)
+            q->right = to->nodes + p->left->sib->index;
+        else
+            q->right = NULL;
+
+        q->nodeDepth              = p->depth;
+        q->age                    = p->age;
+        q->length                 = p->length;
+        q->index                  = p->index;
+        if (q->index < numSpecies)
+            q->label = speciesNameSets[speciespartitionNum].names[q->index];
+        else
+            q->label = noLabel;
+        }
+
+    /* fix root */
+    p = from->root;
+    q = to->nodes + p->index;
+    q1 = to->nodes + from->nNodes;      /* get the 'extra' root node that polytomous trees do not use */
+    q->anc = q1;
+    q1->index = from->nNodes;
+    q1->left = q;
+    q1->right = q1->anc = NULL;
+    q1->isLocked = NO;
+    q1->lockID = -1;
+    q1->isDated = NO;
+    q1->calibration = NULL;
+    q1->age = -1.0;
+    to->root = q1;
+
+    /* get downpass */
+    GetDownPass (to);
+    
+    /* a user tree might not come with node depths set */
+    if (to->root->left->nodeDepth == 0.0)
+        SetNodeDepths(to);
+
+    /* set partitions */
+    if (to->bitsets)
+        ResetTreePartitions(to);
+
+    return (NO_ERROR);      
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   CopyToTreeFromPolyTree: copies second tree (polytomous) to first
+|       tree (used to initialize constrained starting trees, e.g.).
+|       An unrooted source tree will be rooted on outgroup
+|       An unrooted source tree that needs to be copied to
+|       a rooted target tree will be randomly rooted on a node below
+|       all defined constraints. The to tree needs to be allocated
+|       enough space first to hold the resulting tree.
+|
+-----------------------------------------------------------------*/
+int CopyToTreeFromPolyTree (Tree *to, PolyTree *from)
+{
+    int         i, j;
+    PolyNode    *p=NULL;
+    TreeNode    *q, *q1;
+
+    /* refuse to arbitrarily root an input tree */
+    assert (!(from->isRooted == NO && to->isRooted == YES));
+    if ((from->isRooted == NO) && (to->isRooted == YES))
+        {
+        MrBayesPrint ("%s   Failed to copy trees due to difference in rootedness of source and destination. \n", spacer);
+        return (ERROR);
+        }
+
+    /* make sure assumptions are in order */
+    assert (to->memNodes >= from->nNodes + (to->isRooted == NO ? 0 : 1));
+    assert (localOutGroup >= 0 && localOutGroup < numLocalTaxa);
+    assert (numLocalTaxa == from->nNodes - from->nIntNodes);
+    assert (!(from->isRooted == YES && from->nNodes != 2*from->nIntNodes + 1));
+    assert (!(from->isRooted == NO  && from->nNodes != 2*from->nIntNodes + 2));
+    
+    /* make sure indices are set correctly for from nodes */
+    for (i=0; i<from->nNodes; i++)
+        {
+        for (j=0; j<from->nNodes; j++)
+            {
+            p = from->allDownPass[j];
+            if (p->index == i)
+                break;
+            }
+        assert (j != from->nNodes);
+        assert (!(p->left == NULL && p->index >= numLocalTaxa));
+        }
+                
+    /* deal with root */
+    if (to->isRooted == NO && from->isRooted == YES)
+        Deroot(from);
+
+    /* make sure calculation root is set correctly */
+    if (to->isRooted == NO && MovePolyCalculationRoot (from, localOutGroup) == ERROR)
+        return ERROR;
+
+    /* copy nodes */
+    for (i=0; i<from->nNodes; i++)
+        {
+        /* copy pointers */
+        p  = from->allDownPass[i];
+        q  = to->nodes + p->index;
+
+        if (p->anc != NULL)
+            q->anc = to->nodes + p->anc->index;
+        else
+            q->anc = NULL;
+
+        if (p->left != NULL)    
+            q->left = to->nodes + p->left->index;
+        else
+            q->left = NULL;
+
+        if (p->left != NULL)
+            q->right = to->nodes + p->left->sib->index;
+        else
+            q->right = NULL;
+
+        q->isLocked               = p->isLocked;
+        q->lockID                 = p->lockID;
+        q->isDated                = p->isDated;
+        q->calibration            = p->calibration;
+        q->age                    = p->age;
+        q->nodeDepth              = p->depth;
+        q->length                 = p->length;
+        q->index                  = p->index;
+        if (q->index < numLocalTaxa)
+            q->label = localTaxonNames[q->index];
+        else
+            q->label = noLabel;
+        }
+
+    /* fix root */
+    if (to->isRooted == NO)
+        {
+        p = from->root;
+        q = to->nodes + p->index;
+        q->anc = to->root = to->nodes + p->left->sib->sib->index;
+        q->length = to->root->length;
+        to->root->length = 0.0;
+        to->root->left = q;
+        to->root->right = to->root->anc = NULL;
+        }
+    else
+        {
+        p = from->root;
+        q = to->nodes + p->index;
+        q1 = to->nodes + from->nNodes;      /* get the 'extra' root node that polytomous trees do not use */
+        q->anc = q1;
+        q1->index = from->nNodes;
+        q1->left = q;
+        q1->right = q1->anc = NULL;
+        q1->isLocked = NO;
+        q1->lockID = -1;
+        q1->isDated = NO;
+        q1->calibration = NULL;
+        q1->age = -1.0;
+        to->root = q1;
+        }
+
+    /* get downpass */
+    GetDownPass (to);
+    
+    /* set node depths */
+    if (to->isRooted == YES && to->root->left->nodeDepth == 0.0)
+        SetNodeDepths(to);
+
+    /* set partitions */
+    if (to->bitsets)
+        ResetTreePartitions(to);
+
+    /* relaxed clock parameters are not stored in binary trees but in separate parameters */
+
+    return (NO_ERROR);      
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   CopyToTreeFromTree: copies second tree to first tree
+|       (used to initialize brlen sets for same topology)
+|       Note: partition information of nodes are not copied if
+|       either "from" or "to" tree does not have bitsets allocated
+|
+-----------------------------------------------------------------*/
+int CopyToTreeFromTree (Tree *to, Tree *from)
+{
+    int         i, numTaxa, nLongsNeeded;
+    TreeNode    *p, *q;
+
+    numTaxa = from->nNodes - from->nIntNodes - (from->isRooted == YES ? 1 : 0);
+    nLongsNeeded = (numTaxa - 1) / nBitsInALong + 1;
+    if (from->bitsets==NULL || to->bitsets==NULL)
+        nLongsNeeded=0;
+
+    /* check that there is enough memory */
+    assert (to->memNodes >= from->nNodes);
+    
+    /* copy nodes (use index of p as memoryIndex for q) */
+    for (i=0; i<from->nNodes; i++)
+        {
+        /* copy pointers */
+        p  = from->nodes + i;
+        q  = to->nodes + p->index;
+
+        if (p->anc != NULL)
+            q->anc = to->nodes + p->anc->index;
+        else
+            {
+            q->anc = NULL;
+            to->root = q;
+            }
+
+        if (p->left != NULL)
+            q->left = to->nodes + p->left->index;
+        else
+            q->left = NULL;
+
+        if (p->right != NULL)
+            q->right = to->nodes + p->right->index;
+        else
+            q->right = NULL;
+
+        CopyTreeNodes (q, p, nLongsNeeded);
+        }
+
+    /* create new node arrays */
+    to->nNodes = from->nNodes;
+    to->nIntNodes = from->nIntNodes;
+    GetDownPass (to);
+
+    /* copy tree properties (these should be constant most of them) */
+    strcpy (to->name, from->name);
+    to->isRooted = from->isRooted;
+    to->isClock = from->isClock;
+    to->isCalibrated = from->isCalibrated;
+    to->checkConstraints = from->checkConstraints;
+    to->nConstraints = from->nConstraints;
+    to->constraints = from->constraints;
+    to->nLocks = from->nLocks;
+    to->nRelParts = from->nRelParts;
+    to->relParts = from->relParts;
+
+    /* copy partitions */
+    if (from->bitsets)
+        {
+        if (!to->bitsets)
+            AllocateTreePartitions(to);
+        else
+            ResetTreePartitions(to);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* Copy node q to node p */
+void CopyTreeNodes (TreeNode *p, TreeNode *q, int nLongsNeeded)
+{
+    /* copies everything except pointers and memoryIndex */
+    p->label                  = q->label;
+    p->index                  = q->index;
+    p->upDateCl               = q->upDateCl;
+    p->upDateTi               = q->upDateTi;
+    p->scalerNode             = q->scalerNode;
+    p->isLocked               = q->isLocked;
+    p->lockID                 = q->lockID;
+    p->isDated                = q->isDated;
+    p->marked                 = q->marked;
+    p->x                      = q->x;
+    p->y                      = q->y;
+    p->d                      = q->d;
+    p->length                 = q->length;
+    p->nodeDepth              = q->nodeDepth;
+    p->calibration            = q->calibration;
+    p->age                    = q->age;
+    if (nLongsNeeded != 0)
+        {
+        assert (p->partition);
+        assert (q->partition);
+        memcpy (p->partition, q->partition, nLongsNeeded*sizeof(BitsLong));
+        }
+}
+
+
+void CopyTreeToSubtree (Tree *t, Tree *subtree)
+{
+    int         i, j, k;
+    TreeNode    *p, *q, *r;
+
+    for (i=j=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->marked == NO)
+            continue;
+
+        q = &subtree->nodes[j++];
+        q->index = p->index;
+        q->length = p->length;
+        if (p->left == NULL || p->left->marked == NO)
+            q->left = q->right = NULL;
+        else
+            {
+            for (k=0; k<j-1; k++)
+                {
+                r = &subtree->nodes[k];
+                if (r->index == p->left->index)
+                    {
+                    q->left = r;
+                    r->anc = q;
+                    }
+                else if (r->index == p->right->index)
+                    {
+                    q->right = r;
+                    r->anc = q;
+                    }
+                }
+            }
+        
+        if (p->anc->marked == NO)
+            {
+            r = &subtree->nodes[j++];
+            subtree->root = r;
+            r->anc = r->right = NULL;
+            r->left = q;
+            q->anc = r;
+            r->length = 0.0;
+            r->index = p->anc->index;
+            }
+
+        }
+
+    GetDownPass (subtree);
+
+    subtree->isRooted = t->isRooted;
+    subtree->nRelParts = t->nRelParts;
+    subtree->relParts = t->relParts;
+}
+
+
+/* DatedNodeDepths: Recursive function to get node depths */
+void DatedNodeDepths (TreeNode *p, MrBFlt *nodeDepths, int *index)
+{
+    if (p != NULL)
+        {
+        if (p->left == NULL || p->isDated == YES)
+            nodeDepths[(*index)++] = p->nodeDepth;
+        else
+            {
+            DatedNodeDepths (p->left,  nodeDepths, index);
+            DatedNodeDepths (p->right, nodeDepths, index);
+            }
+        }
+}
+
+
+/* DatedNodes: Recursive function to get dated tips or interior nodes */
+void DatedNodes (TreeNode *p, TreeNode **datedNodes, int *index)
+{
+    if (p != NULL)
+        {
+        if (p->left != NULL && p->isDated == NO)
+            {
+            DatedNodes (p->left,  datedNodes, index);
+            DatedNodes (p->right, datedNodes, index);
+            }
+        datedNodes[(*index)++] = p;
+        }
+}
+
+
+/* Deroot: Deroot a rooted polytomous tree with branch lengths */
+int Deroot (PolyTree *pt)
+{
+    PolyNode    *p, *q, *r, tempNode;
+    int         i;
+
+    p = pt->root;
+
+    if (p->left->sib->sib != NULL)
+        return (ERROR);      /* tree is not rooted or it is polytomous */
+
+    if (p != &pt->nodes[pt->nNodes-1])
+        {
+        q = &pt->nodes[pt->nNodes-1];
+        /* now swap content of p and q including pointers */
+        tempNode = *q;
+        *q = *p;
+        *p = tempNode;
+        /* swap back memoryindex */
+        p->memoryIndex = q->memoryIndex;
+        q->memoryIndex = tempNode.memoryIndex;
+        /* all pointers to q should be pointers to p */
+        for (i=0; i<pt->nNodes; i++)
+            {
+            r = &pt->nodes[i];
+            if (r->left == q)
+                r->left = p;
+            if (r->anc == q)
+                r->anc = p;
+            if (r->sib == q)
+                r->sib = p;
+            }
+        /* all pointers to p should be pointers to q; all these are anc pointers from the descendants of the root */
+        pt->root = q;
+        for (r=q->left; r!=NULL; r=r->sib)
+            r->anc = q;
+        /* finally set p to the new root */
+        p = pt->root;
+        }
+
+    /* make sure the left of the old root is interior and can be used as new root */
+    if (p->left->left == NULL)
+        {
+        q = p->left;
+        r = q->sib;
+        p->left = r;
+        r->sib = q;
+        q->sib = NULL;
+        }
+    
+    pt->root = p->left;
+    pt->root->left->sib->sib = p->left->sib;
+    p->left->sib->length += pt->root->length;
+    pt->root->length = 0.0;
+    pt->root->sib = NULL;
+    pt->root->anc = NULL;
+
+    pt->nNodes--;
+    pt->nIntNodes--;
+
+    GetPolyDownPass(pt);
+
+    return (NO_ERROR);
+}
+
+
+/* EraseTreeList: Erase all trees in treeList */
+void EraseTreeList (TreeList *treeList)
+{
+    TreeListElement *listElement;
+    TreeListElement *previous;
+
+    listElement = treeList->first;
+    if (listElement != NULL)
+        do 
+            {
+            free (listElement->order);
+            previous = listElement;
+            listElement = listElement->next;
+            free (previous);
+            } 
+        while (listElement != NULL);
+
+    treeList->first = treeList->last = NULL;
+}
+
+
+void UpdateTreeWithClockrate (Tree *t, MrBFlt clockRate)
+{
+    int i;
+    TreeNode *p;
+
+    if (t->fromUserTree == NO)
+        {
+        /*Set nodeDepth*/
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            p->nodeDepth = p->age * clockRate;
+            }
+
+        /* calculate branch lengths */
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc != NULL)
+                {
+                if (p->anc->anc != NULL)
+                    {
+                    p->length = p->anc->nodeDepth - p->nodeDepth;
+                    }
+                else
+                    p->length = 0.0; //not a problem for root node. 
+                }
+            }
+        }
+    else
+        {
+        for (i=0; i<t->nNodes-1; i++)
+            {
+            p = t->allDownPass[i];
+            p->age = p->nodeDepth / clockRate;
+            }
+        }
+}
+
+
+/*----------------------------------------------------------------
+|
+|   findAllowedClockrate: Finds the range of clock rates allowed for the tree.
+|
+|   @param t        - tree to check (IN)  
+|   @minClockRate   - adress where minimum allowed clock rate is stored (OUT)
+|   @maxClockRate   - adress where maximum allowed clock rate is stored (OUT)
+|
+----------------------------------------------------------------*/
+void findAllowedClockrate (Tree *t, MrBFlt *minClockRate, MrBFlt *maxClockRate)
+{
+    int i;
+    TreeNode *p;
+    MrBFlt min, max, tmp;
+
+    min=0.0;
+    max=MRBFLT_MAX;
+
+    *minClockRate = 2.0;
+    *maxClockRate = 1.0;
+
+    if (t->fromUserTree == NO)
+        {
+        for (i=0; i<t->nNodes-1; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc->anc != NULL)
+                {
+                tmp = BRLENS_MIN/(p->anc->age - p->age);
+                assert (tmp > 0);
+                if (tmp > min)
+                    min = tmp;
+
+                tmp = BRLENS_MAX/(p->anc->age - p->age);
+                assert (tmp > 0);
+                if (tmp > max)
+                    max = tmp;
+                }
+            }
+        *minClockRate= min;
+        *maxClockRate= max;
+        }
+    else
+        {
+        IsCalibratedClockSatisfied (t,minClockRate,maxClockRate, 0.001);
+        }
+}
+
+
+/* FreePolyTree: Free memory space for a polytomous tree (unrooted or rooted) */
+void FreePolyTree (PolyTree *pt)
+{   
+    if (pt != NULL)
+        {
+        FreePolyTreePartitions(pt);
+        FreePolyTreeRelClockParams(pt);
+        FreePolyTreePopSizeParams(pt);
+        free (pt->allDownPass);
+        free (pt->nodes);
+        free (pt);
+        }
+}
+
+
+/* FreePolyTreePartitions: Free memory space for polytomous tree partitions */
+void FreePolyTreePartitions (PolyTree *pt)
+{
+    int i;
+    if (pt != NULL && pt->bitsets != NULL)
+        {
+        for (i=0; i<pt->memNodes; i++)
+            pt->nodes[i].partition = NULL;
+        free (pt->bitsets);
+        pt->bitsets = NULL;
+        }
+}
+
+
+/* FreePolyTreePopSizeParams: Free population size set parameters of polytree */
+void FreePolyTreePopSizeParams (PolyTree *pt)
+{
+    if (pt->popSizeSet == YES)
+        {
+        free (pt->popSize);
+        free (pt->popSizeSetName);
+        }
+    pt->popSizeSet = NO;
+    pt->popSize = NULL;
+    pt->popSizeSetName = NULL;
+}
+
+
+/* FreePolyTreeRelClockParams: Free relaxed clock parameters of polytree */
+void FreePolyTreeRelClockParams (PolyTree *pt)
+{
+    int i, j;
+
+    /* free breakpoint clock parameters */
+    for (i=0; i<pt->nESets; i++)
+        {
+        for (j=0; j<pt->memNodes; j++)
+            {
+            if (pt->nEvents[i][j] > 0)
+                {
+                free (pt->position[i][j]);
+                free (pt->rateMult[i][j]);
+                }
+            }
+        free (pt->eSetName[i]);
+        free (pt->nEvents[i]);
+        free (pt->position[i]);
+        free (pt->rateMult[i]);
+        }
+    free (pt->nEvents);
+    free (pt->position);
+    free (pt->rateMult);
+    free (pt->eSetName);
+    pt->nESets = 0;
+    pt->nEvents = NULL;
+    pt->position = NULL;
+    pt->rateMult = NULL;
+    pt->eSetName = NULL;
+
+    /* free branch clock parameters */
+    for (i=0; i<pt->nBSets; i++)
+        {
+        free (pt->bSetName[i]);
+        free (pt->effectiveBrLen[i]);
+        }
+    free (pt->effectiveBrLen);
+    free (pt->bSetName);
+    pt->nBSets = 0;
+    pt->effectiveBrLen = NULL;
+    pt->bSetName = NULL;
+}
+
+
+/* FreeTree: Free memory space for a tree (unrooted or rooted) */
+void FreeTree (Tree *t)
+{
+    if (t != NULL)
+        {
+        free (t->bitsets);
+        free (t->flags);
+        free (t->allDownPass);
+        free (t->nodes);
+        free (t);
+        }
+}
+
+
+/* FreeTreePartitions: Free memory space for tree partitions */
+void FreeTreePartitions (Tree *t)
+{
+    int     i;
+
+    if (t != NULL && t->bitsets != NULL)
+        {
+        free (t->bitsets);
+        t->bitsets = NULL;
+        for (i=0; i<t->memNodes; i++)
+            t->nodes[i].partition = NULL;
+        }
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   GetDatedNodeDepths: Get an array containing the node depths of the dated tips,
+|       internal or external, plus dated root
+|
+---------------------------------------------------------------------------------------------*/
+void GetDatedNodeDepths (TreeNode *p, MrBFlt *nodeDepths)
+{
+    int index = 0;
+    
+    assert (p != NULL);
+
+    nodeDepths[index++] = p->nodeDepth;     /* include root node depth */
+    if (p->left != NULL)
+        {
+        DatedNodeDepths (p->left, nodeDepths, &index);
+        DatedNodeDepths (p->right, nodeDepths, &index);
+        }
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   GetDatedNodes: Get an array containing the dated tips,
+|       internal or external, and all interior nodes in the same subtree
+|
+---------------------------------------------------------------------------------------------*/
+void GetDatedNodes (TreeNode *p, TreeNode **datedNodes)
+{
+    int     index = 0;
+    
+    assert (p != NULL);
+
+    if (p->left!= NULL)
+        {
+        DatedNodes (p->left,  datedNodes, &index);
+        DatedNodes (p->right, datedNodes, &index);
+        }
+}
+
+
+/* get down pass for tree t (wrapper function) */
+void GetDownPass (Tree *t)
+{
+    int i, j;
+
+    i = j = 0;
+    GetNodeDownPass (t, t->root, &i, &j);
+}
+
+
+/* get the actual down pass sequences */
+void GetNodeDownPass (Tree *t, TreeNode *p, int *i, int *j)
+{
+    if (p != NULL)
+        {
+        GetNodeDownPass (t, p->left,  i, j);
+        GetNodeDownPass (t, p->right, i, j);
+        if (p->left != NULL && p->right != NULL && p->anc != NULL)
+            {
+            t->intDownPass[(*i)++] = p;
+            t->allDownPass[(*j)++] = p;
+            }
+        else if (p->left == NULL && p->right == NULL && p->anc != NULL)
+            {
+            t->allDownPass[(*j)++] = p;
+            }
+        else if (p->left != NULL && p->right == NULL && p->anc == NULL)
+            {
+            t->allDownPass[(*j)++] = p;
+            }
+        }
+}
+
+
+/* GetPolyAges: Get PolyTree node ages */
+void GetPolyAges (PolyTree *t)
+{
+    int         i;
+    PolyNode    *p;
+
+    GetPolyDepths (t); /* just to make sure... */
+    
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->age = p->depth / t->clockRate;
+        }
+}
+
+
+/* GetPolyDepths: Get PolyTree node depths */
+void GetPolyDepths (PolyTree *t)
+{
+    int         i;
+    MrBFlt      maxDepth;
+    PolyNode    *p;
+
+    maxDepth = t->root->depth = 0.0;
+
+    for (i=t->nNodes-2; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        p->depth = p->anc->depth + p->length;
+        if (p->depth > maxDepth)
+            maxDepth = p->depth;
+        }
+
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->depth = maxDepth - p->depth;
+        }
+}
+
+
+/* get down pass for polytomous tree t (wrapper function) */
+void GetPolyDownPass (PolyTree *t)
+{
+    int i, j;
+
+    i = j = 0;
+    GetPolyNodeDownPass (t, t->root, &i, &j);
+    assert (t->nIntNodes==j);
+}
+
+
+/* get the actual down pass sequences for a polytomous tree */
+void GetPolyNodeDownPass (PolyTree *t, PolyNode *p, int *i, int *j)
+{
+    PolyNode    *q;
+    
+    if (p->left != NULL)
+        {
+        for (q=p->left; q!=NULL; q=q->sib)
+            GetPolyNodeDownPass(t, q, i, j);
+        }
+
+    t->allDownPass[(*i)++] = p;
+    if (p->left != NULL)
+        t->intDownPass[(*j)++] = p;
+}
+
+
+/* GetFromTreeList: Get first tree from a tree list and remove it from the list*/
+int GetFromTreeList (TreeList *treeList, Tree *tree)
+{
+    TreeListElement *listElement;
+
+    if (treeList->first == NULL)
+        {
+        MrBayesPrint ("%s   Tree list empty\n", spacer);
+        return (ERROR);
+        }
+    if (tree->isRooted == YES)
+        RetrieveRTopology (tree, treeList->first->order);
+    else
+        {
+        RetrieveUTopology (tree, treeList->first->order);
+        if (localOutGroup != 0)
+            MoveCalculationRoot (tree, localOutGroup);
+        }
+
+    listElement = treeList->first;
+    treeList->first = listElement->next;
+
+    free (listElement->order);
+    free (listElement);
+
+    return (NO_ERROR);
+}
+
+
+/*------------------------------------------------------------------
+|
+|   InitBrlens: This routine will set all branch lengths of a
+|      nonclock tree to the value given by 'v'.
+|
+------------------------------------------------------------------*/
+int InitBrlens (Tree *t, MrBFlt v)
+{
+    int         i;
+    TreeNode    *p;
+
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL && !(t->isRooted == YES && p->anc->anc == NULL))
+            p->length = v;
+        else
+            p->length = 0.0;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* 
+@param levUp        is the number of edges between the "node" and the most resent calibrated predecessor +1,
+                    for the calibrated nodes it should be 1
+@param calibrUp     is the age of the most resent calibrated predecessor
+@return             age of the node 
+*/
+MrBFlt SetNodeCalibratedAge(TreeNode *node, unsigned levUp, MrBFlt calibrUp)
+{
+    MrBFlt r,l;
+
+    if (node->age != -1.0)
+        {
+        if (node->right != NULL)
+            SetNodeCalibratedAge (node->right, 2, node->age);
+        if (node->left != NULL)
+            SetNodeCalibratedAge (node->left,  2, node->age);
+        return node->age;
+        }
+
+    r = SetNodeCalibratedAge (node->right, levUp+1, calibrUp);
+    l = SetNodeCalibratedAge (node->left,  levUp+1, calibrUp);
+
+    if (r > l)
+        {
+        assert (calibrUp - r > 0.0);
+        return node->age = r + (calibrUp - r)/levUp;
+        }
+    else
+        {
+        assert (calibrUp - l > 0.0);
+        return node->age = l + (calibrUp - l)/levUp;
+        }
+}
+
+
+/*-------------------------------------------------------------------
+|
+|   InitCalibratedBrlens: This routine will build a clock tree
+|       consistent with calibration constraints on terminal
+|       taxa and/or constrained interior nodes. At least one
+|       node should be calibrated.
+|       If not possible to build such a tree, ERROR
+|       is returned.
+|
+--------------------------------------------------------------------*/
+int InitCalibratedBrlens (Tree *t, MrBFlt clockRate, RandLong *seed)
+{
+    int             i;
+    TreeNode        *p;
+    Model           *mp;
+    MrBFlt          treeAgeMin, treeAgeMax;
+    Calibration     *calibrationPtr;
+
+#   ifdef DEBUG_CALIBRATION
+    printf ("Before initializing calibrated brlens\n");
+    ShowNodes(t->root, 0, YES);
+#   endif
+    
+    if (t->isRooted == NO)
+        {
+        MrBayesPrint ("%s   Tree is unrooted\n", spacer);
+        return (ERROR);
+        }
+
+    /* Check whether root has age constraints */
+    mp = &modelParams[t->relParts[0]];
+    treeAgeMin = 0.0;
+    treeAgeMax = POS_INFINITY;
+    if (t->root->left->isDated == YES)
+        {
+        treeAgeMin = t->root->left->calibration->min;
+        treeAgeMax = t->root->left->calibration->max;
+        }
+    else if (!strcmp(mp->clockPr, "Uniform") || !strcmp(mp->clockPr, "Fossilization"))
+        {
+        if (mp->treeAgePr.min > treeAgeMin)
+            treeAgeMin = mp->treeAgePr.min;
+        if (mp->treeAgePr.max < treeAgeMax)
+            treeAgeMax = mp->treeAgePr.max;
+        }
+
+    /* date all nodes from top to bottom with min. age as nodeDepth*/
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            {
+            if (p->left == NULL && p->right == NULL)
+                {
+                if (p->isDated == NO)
+                    {
+                    p->nodeDepth = 0.0;
+                    p->age = 0.0;
+                    }
+                else
+                    {
+                    if (p->calibration->prior == fixed)
+                        p->nodeDepth = p->age = p->calibration->priorParams[0];
+                    else
+                        p->nodeDepth = p->age = p->calibration->min;
+                    }
+                }
+            else
+                {
+                if (p->left->nodeDepth > p->right->nodeDepth)
+                    p->nodeDepth = p->left->nodeDepth;
+                else
+                    p->nodeDepth = p->right->nodeDepth;
+                if (p->isDated == YES || (p->anc->anc == NULL && (!strcmp(mp->clockPr,"Uniform") || !strcmp(mp->clockPr,"Fossilization"))))
+                    {
+                    if (p->isDated == NO)
+                        calibrationPtr = &mp->treeAgePr;
+                    else
+                        calibrationPtr = p->calibration;
+
+                    if (calibrationPtr->max <= p->nodeDepth)
+                        {
+                        if (p->isDated == NO)
+                            MrBayesPrint ("%s   Calibration inconsistency for root node\n", spacer);
+                        else
+                            MrBayesPrint ("%s   Calibration inconsistency for node '%s'\n", spacer, constraintNames[p->lockID]);
+                        MrBayesPrint ("%s   Cannot make a tree where the node is %s\n", spacer, calibrationPtr->name);
+                        return (ERROR);
+                        }
+                    else
+                        {
+                        if (calibrationPtr->min < p->nodeDepth)
+                            p->age = p->nodeDepth;
+                        else
+                            p->age = p->nodeDepth = calibrationPtr->min;
+                        }
+                    }
+                else
+                    p->age = -1.0;
+                }
+            }
+        }
+
+    /* try to make root node deeper than minimum age */
+    p = t->root->left;
+    if (p->nodeDepth==0.0)  p->nodeDepth = 1.0;
+    if (p->nodeDepth * 1.5 < treeAgeMax)
+        p->nodeDepth = p->age = 1.5 * p->nodeDepth;
+    else
+        p->nodeDepth = p->age = treeAgeMax;
+
+    SetNodeCalibratedAge (p, 1, p->age);
+
+    /* Setup node depths */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->nodeDepth = p->age * clockRate;
+        assert (!(p->left == NULL && p->calibration == NULL && p->nodeDepth != 0.0));
+        }
+
+    /* calculate branch lengths */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            {
+            if (p->anc->anc != NULL)
+                {
+                p->length = p->anc->nodeDepth - p->nodeDepth;
+                if (p->length < BRLENS_MIN)
+                    {
+                    //MrBayesPrint ("%s   Restrictions of node calibration and clockrate makes some branch lenghts too small.\n", spacer);
+                    //return (ERROR);
+                    }
+                if (p->length > BRLENS_MAX)
+                    {
+                    //MrBayesPrint ("%s   Restrictions of node calibration and clockrate makes some branch lenghts too long.\n", spacer);
+                    //return (ERROR);
+                    }
+                }
+            else
+                p->length = 0.0; //not a problem for root node. 
+            }
+        }
+
+#   ifdef DEBUG_CALIBRATION
+    printf ("after\n");
+    ShowNodes (t->root, 0, YES);
+    getchar();
+#   endif
+
+    return (NO_ERROR);
+    MrBayesPrint ("%lf", *seed); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/*-------------------------------------------------------
+|
+|   InitClockBrlens: This routine will initialize
+|      a clock tree by setting the root to depth 1.0
+|      and then assigning node depths according to
+|      the relative node depth measured in terms of the
+|      maximum number of branches to the tip from each
+|      node.
+|
+--------------------------------------------------------*/
+int InitClockBrlens (Tree *t)
+{
+    int             i, maxBrSegments=0;
+    TreeNode        *p;
+
+    if (t->isRooted == NO)
+        {
+        MrBayesPrint ("%s   Tree is unrooted\n", spacer);
+        return (ERROR);
+        }
+    
+    /* calculate maximum number of branch segments above root */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            {
+            if (p->left == NULL && p->right == NULL)
+                {
+                p->x = 0;
+                }
+            else
+                {
+                if (p->left->x > p->right->x)
+                    p->x = p->left->x + 1;
+                else
+                    p->x = p->right->x + 1;
+                }
+            if (p->anc->anc == NULL)
+                maxBrSegments = p->x;
+            }
+        }
+
+    /* assign node depths */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            p->nodeDepth = (MrBFlt) (p->x) / (MrBFlt) maxBrSegments;
+        else
+            p->nodeDepth = 0.0;
+        }
+        
+    /* calculate branch lengths */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->anc != NULL)
+            {
+            if (p->anc->anc != NULL)
+                p->length = p->anc->nodeDepth - p->nodeDepth;
+            else
+                p->length = 0.0;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+int GetRandomEmbeddedSubtree (Tree *t, int nTerminals, RandLong *seed, int *nEmbeddedTrees)
+{
+    int         i, j, k, n, ran, *pP, *pL, *pR, nLeaves, *nSubTrees;
+    TreeNode    *p=NULL, **leaf;
+
+    /* Calculate number of leaves in subtree (number of terminals minus the root) */
+    nLeaves = nTerminals - 1;
+    
+    /* Initialize all flags */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        p->x = 0;
+        p->y = 0;
+        }
+    
+    /* Allocate memory */
+    nSubTrees = (int *) SafeCalloc (nTerminals * t->nNodes, sizeof(int));
+    if (!nSubTrees)
+        return (ERROR);
+    leaf = (TreeNode **) SafeMalloc (nLeaves * sizeof (TreeNode *));
+    if (!leaf)
+        {
+        free (nSubTrees);
+        return (ERROR);
+        }
+
+    /* Calculate how many embedded trees rooted at each node */
+    (*nEmbeddedTrees) = 0;
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            {
+            p->x = 0;
+            nSubTrees[p->index*nTerminals + 1] = 1;
+            }
+        else
+            {
+            pL = nSubTrees + p->left->index*nTerminals;
+            pR = nSubTrees + p->right->index*nTerminals;
+            pP = nSubTrees + p->index*nTerminals;
+            pP[1] = 1;
+            for (j=2; j<=nLeaves; j++)
+                {
+                for (k=1; k<j; k++)
+                    {
+                    pP[j] += pL[k] * pR[j-k];
+                    }
+                }
+            p->x = pP[nLeaves];
+            (*nEmbeddedTrees) += p->x;
+            }
+        }
+
+    /* Randomly select one embedded tree of the right size */
+    ran = (int) (RandomNumber(seed) * (*nEmbeddedTrees));
+
+    /* Find the interior root corresponding to this tree */
+    for (i=j=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        j += p->x;
+        if (j>ran)
+            break;
+        }
+
+    /* Find one random embedded tree with this root */
+    p->y = nLeaves;
+    p->marked = YES;
+    leaf[0] = p;
+    n = 1;
+    while (n < nLeaves)
+        {
+        /* select a node with more than one descendant */
+        for (i=0; i<n; i++)
+            {
+            p = leaf[i];
+            if (p->y > 1)
+                break;
+            }
+
+        /* break it into descendants */
+        pL = nSubTrees + p->left->index*nTerminals;
+        pR = nSubTrees + p->right->index*nTerminals;
+        pP = nSubTrees + p->index*nTerminals;
+        ran = (int) (RandomNumber(seed) * pP[p->y]);
+        k = 0;
+        for (j=1; j<p->y; j++)
+            {
+            k += pL[j] * pR[p->y-j];
+            if (k > ran)
+                break;
+            }
+
+            p->left->y = j;
+        p->right->y = p->y - j;
+        p->left->marked = YES;
+        p->right->marked = YES;
+        leaf[i] = p->left;
+        leaf[n++] = p->right;
+        }
+
+    free (nSubTrees);
+    free (leaf);
+
+    return (NO_ERROR);
+}
+
+        
+/*-----------------------------------------------------------------------------
+|
+| IsCalibratedClockSatisfied: This routine SETS (not just checks as name suggested) calibrated clock tree nodes age, depth. based on branch lengthes
+|     and checks that user defined brlens satisfy the specified calibration(s) up to tolerance tol
+| TODO: clock rate is devived here and used to set ages but clockrate parameter is not updated here (make sure that it does not produce inconsistancy)
+|
+|------------------------------------------------------------------------------*/
+int IsCalibratedClockSatisfied (Tree *t,MrBFlt *minClockRate,MrBFlt *maxClockRate , MrBFlt tol)
+{
+    int             i, j, maxRateConstrained, minRateConstrained, isViolated;
+    MrBFlt          f, maxHeight, minRate=0, maxRate=0, ageToAdd, *x, *y, clockRate;
+    TreeNode        *p, *q, *r, *s;
+
+    /* By defauult assume the tree does not have allowed range of clockrate */
+    *minClockRate = 2.0;
+    *maxClockRate = 1.0;
+
+    if (t->isRooted == NO)
+        return (NO);
+        
+    x = (MrBFlt *) SafeCalloc (2*t->nNodes, sizeof (MrBFlt));
+    if (x == NULL)
+        {
+        MrBayesPrint ("%s   Out of memory in IsCalibratedClockSatisfied\n", spacer);
+        free (x);
+        return (NO);
+        }
+    y = x + t->nNodes;
+
+    /* reset node depth and age, and set minimum (x) and maximum (y) age of each node */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->age = -1.0;
+        p->nodeDepth = -1.0;
+        if (p->isDated == YES)
+            {
+            assert (p->calibration->prior != unconstrained);
+            x[p->index] = p->calibration->min;
+            y[p->index] = p->calibration->max;
+            }
+        else if (p->left == NULL && p->right == NULL)
+            x[p->index] = y[p->index] = 0.0;
+        else
+            {
+            x[p->index] = y[p->index] = -1.0;
+            }
+        }
+
+    /* calculate node heights in branch length units */
+    /* node depth will be set from the root for now  */
+    p = t->root->left;
+    p->nodeDepth = 0.0;
+    for (i=t->nNodes-3; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        p->nodeDepth = p->anc->nodeDepth + p->length;
+        }
+
+    /* find maximum height of tree */   
+    maxHeight = -1.0;
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL)
+            {
+            if (p->nodeDepth > maxHeight)
+                {
+                maxHeight = p->nodeDepth;
+                }
+            }
+        }
+    
+    /* calculate node depth from tip of tree */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        p->nodeDepth = maxHeight - p->nodeDepth;
+        }
+
+    /* check potentially constraining calibrations */
+    /* and find minimum and maximum possible rate */
+    maxRateConstrained = NO;
+    minRateConstrained = NO;
+    isViolated = NO;
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (x[p->index] < 0.0 && y[p->index] < 0.0)
+            continue;
+        for (j=i+1; j<t->nNodes-1; j++)
+            {
+            q = t->allDownPass[j];
+            if (x[q->index] < 0.0 && y[q->index] < 0.0)
+                continue;
+            if (p->nodeDepth == q->nodeDepth) // becouse clock rate could be as low as possible we can not take approximate equality. 
+                {
+                /* same depth so they must share a possible age */
+                if ((x[p->index] != -1.0 && y[q->index] !=-1.0 && AreDoublesEqual (x[p->index], y[q->index], tol) == NO && x[p->index] > y[q->index]) ||
+                    (y[p->index] != -1.0 && x[q->index] !=-1.0 && AreDoublesEqual (y[p->index], x[q->index], tol) == NO && y[p->index] < x[q->index]))
+                    {
+                    isViolated = YES;
+                    break;
+                    }
+                }
+            else
+                {
+                if (p->nodeDepth > q->nodeDepth)
+                    {
+                    r = p;
+                    s = q;
+                    }
+                else
+                    {
+                    r = q;
+                    s = p;
+                    }
+                if (x[r->index] >= 0.0 && y[s->index] >= 0.0)
+                    {
+                    f = (r->nodeDepth - s->nodeDepth) / (x[r->index] - y[s->index]);
+                    if (f <= 0.0 || x[r->index] == y[s->index])
+                        {
+                        if (AreDoublesEqual (r->nodeDepth, s->nodeDepth, tol*0.1) == YES)
+                            continue;
+                        if ((r->calibration != NULL && r->calibration->prior != fixed) || (s->calibration != NULL && s->calibration->prior != fixed))
+                            continue;
+                        isViolated = YES;
+                        break;
+                        }
+                    if (maxRateConstrained == NO)
+                        {
+                        maxRateConstrained = YES;
+                        maxRate = f;
+                        }
+                    else if (f < maxRate)
+                        maxRate = f;
+                    }
+                if (y[r->index] >= 0.0 && x[s->index] >= 0.0)
+                    {
+                    f = (r->nodeDepth - s->nodeDepth) / (y[r->index] - x[s->index]);
+                    if (f <= 0.0 || y[r->index] == x[s->index])
+                        {
+                        if (AreDoublesEqual (r->nodeDepth, s->nodeDepth, tol*0.1) == YES)
+                            continue;
+                        isViolated = YES;
+                        break;
+                        }
+                    if (minRateConstrained == NO)
+                        {
+                        minRateConstrained = YES;
+                        minRate = f;
+                        }
+                    else if (f > minRate)
+                        minRate = f;
+                    }
+                }
+            }
+        if (isViolated == YES)
+            break;
+        }
+
+    /* check if outright violation */
+    if (isViolated == YES)
+        {
+        MrBayesPrint ("%s   Branch lengths do not satisfy the calibration(s)\n", spacer);
+        free (x);
+        return (NO);
+        }
+    
+    /* Allow tollerance */
+    if (minRateConstrained == YES && maxRateConstrained == YES && AreDoublesEqual (minRate, maxRate, tol) == YES && minRate > maxRate) 
+        {
+        maxRate = minRate;
+        }
+
+    if (minRateConstrained == YES)
+        *minClockRate = minRate;
+    else
+        *minClockRate = 0.0;
+
+    if (maxRateConstrained == YES)
+        *maxClockRate = maxRate;
+    else
+        *maxClockRate = MRBFLT_MAX;
+
+    /* check that minimum and maximum rates are consistent */
+    if (minRateConstrained == YES && maxRateConstrained == YES && minRate > maxRate)
+        {
+        MrBayesPrint ("%s   Branch lengths do not satisfy the calibration(s)\n", spacer);
+        free (x);
+        return (NO);
+        }
+
+    /* date all nodes based on a suitable rate */
+    if (minRateConstrained == YES)
+        clockRate = minRate;
+    else if (maxRateConstrained == YES)
+        clockRate = 0.5 * maxRate;
+    else
+        clockRate = 1.0;
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        p->age = p->nodeDepth / clockRate;
+        }
+
+    /* check if there is an age to add (I guess this is here because when max rate is close to minrate and we have numerical precision inacuracy) */
+    ageToAdd = 0.0;
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (x[p->index] > 0.0 && x[p->index] > p->age)
+            {
+            f = x[p->index] - p->age;
+            if (f > ageToAdd)
+                ageToAdd = f;
+            }
+        }
+    
+    /* add extra length if any */
+    if (AreDoublesEqual (ageToAdd, 0.0, 0.00000001) == NO)
+        {
+        for (i=0; i<t->nNodes-1; i++)
+            {
+            p = t->allDownPass[i];
+            p->age += ageToAdd;
+            }
+        }
+
+    free (x);
+
+    /* reset node depths to ensure that non-dated tips have node depth 0.0 */
+    SetNodeDepths(t);
+
+    return (YES);
+}
+
+
+int IsClockSatisfied (Tree *t, MrBFlt tol)
+{
+    int             i, foundFirstLength, isClockLike;
+    MrBFlt          firstLength=0.0, length;
+    TreeNode        *p, *q;
+
+    if (t->isRooted == NO)
+        return (NO);
+        
+    foundFirstLength = NO;
+    isClockLike = YES;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL)
+            {
+            if (p->isDated == YES)
+                {
+                //continue;
+                length = p->nodeDepth;
+                }
+            else
+                length = 0.0;
+            q = p;
+            while (q->anc != NULL)
+                {
+                if (q->anc->anc != NULL)
+                    length += q->length;
+                q = q->anc;
+                }
+            if (foundFirstLength == NO)
+                {
+                firstLength = length;
+                foundFirstLength = YES;
+                }
+            else
+                {
+                if (AreDoublesEqual (firstLength, length, tol) == NO)
+                    {
+                    MrBayesPrint ("%s   Node (%s) is not at the same depth as some other tip taking colibration into account. \n", spacer, p->label);
+                    isClockLike = NO;
+                    }
+                }
+            }
+        }
+    if (firstLength < BRLENS_MIN)
+        isClockLike = NO;
+
+    return (isClockLike);
+}
+
+
+/* Check that tree obeys topology constraints and that node depths and ages are consistent */
+int IsTreeConsistent (Param *param, int chain, int state)
+{
+    Tree        *tree;
+    TreeNode    *p;
+    int         i, j;
+    MrBFlt      b, r, rAnc, clockRate;
+    Param       *subParm;
+
+    if (param->paramType != P_TOPOLOGY && param->paramType != P_BRLENS && param->paramType != P_SPECIESTREE)
+        return YES;
+
+    tree      = GetTree(param, chain, state);
+    if (modelSettings[param->relParts[0]].clockRate != NULL)
+        clockRate = *GetParamVals(modelSettings[param->relParts[0]].clockRate, chain, state);
+    else
+        clockRate = 1.0;
+
+    if (CheckConstraints(tree)==ERROR) {
+        printf ("Tree does not obey constraints\n");
+        return NO;
+    }
+
+    /* check that the last few indices are not taken in a rooted tree */
+    if (tree->isRooted == YES && tree->root->index != tree->nNodes - 1)
+        {
+        printf ("Problem with root index\n");
+        return NO;
+        }
+    if (tree->isRooted == YES && tree->root->left->index != tree->nNodes - 2)
+        {
+        printf ("Problem with interior root index\n");
+        return NO;
+        }
+
+    if (tree->isClock == NO)
+        {
+        for (i=0; i<tree->nNodes-1; i++)
+            {
+            p = tree->allDownPass[i];
+            if (p->length <= 0.0)
+                {
+                if (p->length == 0.0)
+                    printf ("Node %d has zero branch length %f\n", p->index, p->length);
+                else
+                    printf ("Node %d has negative branch length %f\n", p->index, p->length);
+                return NO;
+                }
+            }
+        return YES;
+        }
+
+    /* Clock trees */
+
+    /* Check that lengths and depths are consistent */
+    for (i=0; i<tree->nNodes-2; i++) {
+        p = tree->allDownPass[i];
+        if (p->length < 0.0) {
+            printf ("Node %d has negative branch length %f\n", p->index, p->length);
+            return NO;
+        }
+        if (fabs(p->anc->nodeDepth - p->nodeDepth - p->length) > 0.000001) {
+            printf ("Node %d has length %f but nodeDepth %f and ancNodeDepth %f\n",
+                p->index, p->length, p->nodeDepth, p->anc->nodeDepth);
+            return NO;
+        }
+        if (p->left == NULL && p->isDated == NO && p->nodeDepth != 0.0) {
+                printf ("Node %d is an autodated tip (0.0) but has node depth %lf\n",
+                    p->index, p->nodeDepth);
+                return NO;
+        }
+    }
+
+    /* Check that ages and calibrations are consistent */
+    if (tree->isCalibrated == YES)
+        {
+        for (i=0; i<tree->nNodes-1; i++)
+            {
+            p = tree->allDownPass[i];
+            if (p->isDated == YES) {
+                if (fabs((p->age - p->nodeDepth/clockRate)/p->age) > 0.000001)
+                    {
+                    printf ("Node %d has age %f but nodeDepth %f when clock rate is %f\n",
+                        p->index, p->age, p->nodeDepth, clockRate);
+                    return NO;
+                    }
+                if (p->calibration->prior == fixed && fabs((p->age - p->calibration->priorParams[0])/p->age) > 0.000001)
+                    {
+                    printf ("Node %d has age %f but should be fixed to age %f\n",
+                        p->index, p->age, p->calibration->priorParams[0]);
+                    return NO;
+                    }
+                else if (p->calibration->prior == uniform &&
+                        ((p->age - p->calibration->min)/p->age < -0.000001 || (p->age - p->calibration->max)/p->age > 0.000001))
+                    {
+                    printf ("Node %d has age %f but should be in the interval [%f,%f]\n",
+                        p->index, p->age, p->calibration->min, p->calibration->max);
+                    return NO;
+                    }
+                else if ((p->age - p->calibration->min)/p->age < -0.000001)
+                    {
+                    printf ("Node %d has age %f but should be at least of age %f\n",
+                        p->index, p->age, p->calibration->min);
+                    return NO;
+                    }
+                else if ((p->age - p->calibration->max)/p->age > 0.000001)
+                    {
+                    printf ("Node %d has age %f but should be no older than %f\n",
+                        p->index, p->age, p->calibration->max);
+                    return NO;
+                    }
+                }
+            }
+        }
+
+    for (i=0; i<param->nSubParams; i++)
+        {
+        subParm = param->subParams[i];
+        if (subParm->paramId == TK02BRANCHRATES || (subParm->paramId == MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state) == RCL_TK02))
+            {
+            rAnc = GetParamVals(subParm, chain, state)[tree->root->left->index];
+            if (fabs(rAnc - 1.0) > 1E-6)
+                {
+                printf ("%s   TK02 relaxed clock mismatch in root rate, which is %e\n", spacer, rAnc);
+                return NO;
+                }
+            for (j=0; j<tree->nNodes-2; j++)
+                {
+                p = tree->allDownPass[j];
+                b = GetParamSubVals(subParm, chain, state)[p->index];
+                r = GetParamVals(subParm, chain, state)[p->index];
+                rAnc = GetParamVals(subParm, chain, state)[p->anc->index];
+                if (fabs(p->length * (r + rAnc) / 2.0 - b) > 0.000001)
+                    {
+                    printf ("%s   TK02 relaxed clock mismatch in branch %d\n", spacer, p->index);
+                    return NO;
+                    }
+                }
+            }
+        else if (subParm->paramId == IGRBRANCHRATES || (subParm->paramId == MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state) == RCL_IGR))
+            {
+            for (j=0; j<tree->nNodes-2; j++)
+                {
+                p = tree->allDownPass[j];
+                b = GetParamSubVals(subParm, chain, state)[p->index];
+                r = GetParamVals(subParm, chain, state)[p->index];
+                if (fabs(p->length * r - b) > 0.000001)
+                    {
+                    printf ("%s   Igr relaxed clock mismatch in branch %d\n", spacer, p->index);
+                    return NO;
+                    }
+                }
+            }
+        }
+
+    if (param->paramType == P_SPECIESTREE)
+        return (IsSpeciesTreeConsistent(GetTree(param, chain, state), chain));
+
+    return YES;
+}
+
+
+/* LabelTree: Label tree; remove previous labels if any */
+int LabelTree (Tree *t, char **taxonNames)
+{
+    int         i, nTaxa;
+    TreeNode    *p = NULL;
+
+    nTaxa = t->nNodes - t->nIntNodes;
+    if (t->isRooted == YES)
+        nTaxa--;
+    
+    /* erase previous labels, if any */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        p->marked = NO;
+        t->nodes[i].label = noLabel;
+        }
+
+    /* add labels */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = &t->nodes[i];
+        if (p->left == NULL || (t->isRooted == NO && p->anc == NULL))
+            {
+            if (p->marked == YES || p->index < 0 || p->index >= nTaxa)
+                {
+                MrBayesPrint ("%s   Taxon node index repeated or out of range\n", spacer);
+                return (ERROR);
+                }
+            else
+                p->label = taxonNames[p->index];
+            p->marked = YES;
+            }
+        else if (p->index > 0 && p->index < nTaxa)
+            {
+            MrBayesPrint ("%s   Terminal taxon index set for interior node\n", spacer);
+            return (ERROR);
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   Mark: This routine will mark up a subtree rooted at p
+|
+---------------------------------------------------------------------------------------------*/
+void Mark (TreeNode *p)
+{
+    if (p != NULL)
+        {
+        p->marked = YES;
+        Mark (p->left);
+        Mark (p->right);
+        }
+}
+
+
+/*-------------------------------------------------------------------------------------------
+ |
+ |   MarkDistance: This routine will mark up an unconstrained subtree rooted at p within dist
+ |      The distance will be positive in the crown part and negative in the root part.
+ |
+ ---------------------------------------------------------------------------------------------*/
+void MarkDistance (TreeNode *p, int YESorNO, int dist, int *n)
+{
+    if (p == NULL || p->anc == NULL)
+        return;
+    
+    p->marked = YES;
+    if (YESorNO == YES) // in root part
+        p->x = p->anc->x -1;
+    else               // in crown part
+        p->x = p->anc->x +1;
+    (*n)++;
+        
+    if (p->isLocked == NO && abs(p->x) < dist)
+        {
+        MarkDistance (p->left, YESorNO, dist, n);
+        MarkDistance (p->right,YESorNO, dist, n);
+        }
+}
+
+
+/*-------------------------------------------------------------------------------------------
+ |
+ |   MarkUnconstrained: This routine will mark up an unconstrained subtree rooted at p
+ |
+ ---------------------------------------------------------------------------------------------*/
+void MarkUnconstrained (TreeNode *p)
+{
+    if (p != NULL)
+        {
+        p->marked = YES;
+        if (p->isLocked == NO)
+            {
+            MarkUnconstrained (p->left);
+            MarkUnconstrained (p->right);
+            }
+        }
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   MoveCalculationRoot: This routine will move the calculation root to the terminal with 
+|      index outgroup
+|
+---------------------------------------------------------------------------------------------*/
+int MoveCalculationRoot (Tree *t, int outgroup)
+{
+    int             i;
+    TreeNode        *p, *q, *r;
+    
+    if (t->isRooted == YES || outgroup < 0 || outgroup > t->nNodes - t->nIntNodes - (t->isRooted == YES ? 1 : 0))
+        {
+        MrBayesPrint ("%s   Problem moving calculation root\n", spacer);
+        return (ERROR);
+        }
+
+    if (t->root->index == outgroup)
+        return (NO_ERROR);    /* nothing to do */
+
+    /* mark the path to the new calculation root */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL)
+            {
+            if (p->index == outgroup)
+                p->marked = YES;
+            else
+                p->marked = NO;
+            }
+        else
+            {
+            if (p->left->marked == YES || p->right->marked == YES)
+                p->marked = YES;
+            else
+                p->marked = NO;
+            }
+        }
+
+    /* rotate the tree to use the specified calculation root */
+    p = t->root->left;
+    q = t->root;
+    q->anc = p;
+    q->left = q->right = NULL;
+    q->length = p->length;
+    while (p->left != NULL && p->right != NULL)
+        {
+        if (p->left->marked == YES)
+            {
+            r = p->left;
+            p->anc = r;
+            p->left = q;
+            p->length = r->length;
+            q = p;
+            p = r;
+            }
+        else /* if (p->right->marked == YES) */
+            {
+            r = p->right;
+            p->anc = r;
+            p->right = q;
+            p->length = r->length;
+            q = p;
+            p = r;
+            }
+        }
+    p->left = p->anc;
+    p->right = p->anc = NULL;
+    t->root = p;
+    p->length = 0.0;
+
+    GetDownPass (t);
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   MovePolyCalculationRoot: This routine will move the calculation root to the terminal with 
+|      index outgroup and place it as the right-most descendant of the root node
+|
+---------------------------------------------------------------------------------------------*/
+int MovePolyCalculationRoot (PolyTree *t, int outgroup)
+{
+    int             i;
+    PolyNode        *p = NULL, *q, *r;
+
+    /* check if tree is rooted, in which case calculation root is irrelevant */
+    if (t->root->left->sib->sib == NULL)
+        return (NO_ERROR);
+
+    if (outgroup < 0 || outgroup > t->nNodes - t->nIntNodes)
+        {
+        MrBayesPrint ("%s   Outgroup index is out of range\n", spacer);
+        return (ERROR);
+        }
+
+    if (t->root->left->sib->sib->sib != NULL)
+        {
+        MrBayesPrint ("%s   Root has more than three descendants\n", spacer);
+        return (ERROR);
+        }
+
+    /* check if rerooting actually necessary */
+    if (t->root->left->sib->sib->index == outgroup)
+        return (NO_ERROR);
+    
+    /* mark the path to the new calculation root */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->index == outgroup)
+            break;
+        }
+    if (p->left != NULL)
+        {
+        MrBayesPrint ("%s   Outgroup index set for internal node\n", spacer);
+        for (i=0; i<t->nNodes; i++)
+            printf ("%d -- %d\n", i, t->allDownPass[i]->index);
+        getchar();
+        return (ERROR);
+        }
+
+    /* mark path to current root */
+    for (i=0; i<t->nNodes; i++)
+        t->allDownPass[i]->mark = NO;
+    q = p;
+    while (q != NULL)
+        {
+        q->mark = YES;
+        q = q->anc;
+        }
+
+    /* rotate the tree to use the specified calculation root */
+    p = t->root;
+    for (;;)
+        {
+        /* find marked descendant */
+        for (q=p->left; q->mark == NO; q=q->sib)
+            ;
+        if (q->index == outgroup)
+            break;
+        /* add old root to descendants of that node */
+        for (r=q->left; r->sib!=NULL; r=r->sib)
+            ;
+        r->sib = p;
+        p->sib = NULL;   /* should not be needed */
+        p->anc = q;
+        p->length = q->length;
+        /* remove that node from descendants of old root node */
+        if (p->left == q)
+            p->left = q->sib;
+        else
+            {
+            for (r=p->left; r->sib!=q; r=r->sib)
+                ;
+            r->sib = r->sib->sib;
+            }
+        /* make new node root */
+        q->sib = NULL;
+        q->anc = NULL;
+        q->length = 0.0;
+        p = q;
+        }
+    
+    /* p is now the new root */
+    t->root = p;
+
+    /* finally make sure calculation root is last node among root's descendants */
+    for (q=p->left; q->sib!=NULL; q=q->sib)
+        ;
+    if (q->index != outgroup)
+        {
+        if (p->left->index == outgroup)
+            {
+            q->sib = p->left;
+            p->left = p->left->sib;
+            q->sib->sib = NULL;
+            }
+        else
+            {
+            for (r=p->left; r->sib->index!=outgroup; r=r->sib)
+                ;
+            q->sib = r->sib;
+            r->sib = r->sib->sib;
+            q->sib->sib = NULL;
+            }
+        }
+
+    GetPolyDownPass (t);
+
+    return (NO_ERROR);
+}
+
+
+/* 
+@return the number of levels for the tree rooted at the "node" 
+*/
+int NrSubTreeLevels(TreeNode *node)
+{
+    int r,l;
+
+    if (node == NULL)
+        {
+        return -1;
+        }
+
+    r = NrSubTreeLevels (node->right);
+    l = NrSubTreeLevels (node->left);
+
+    return ((r>l)?(r):(l))+1;
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   NumConstrainedTips: This routine will return the number of constrained tips, internal or external
+|
+---------------------------------------------------------------------------------------------*/
+int NumConstrainedTips (TreeNode *p)
+{
+    int     i = 0;
+
+    if (p == NULL)
+        return i;
+    if (p->left == NULL)
+        return 1;
+
+    i += NConstrainedTips (p->left);
+    i += NConstrainedTips (p->right);
+
+    return i;
+}
+
+
+/* NConstrainedTips: Recursive function to get the number of constrained tips */
+int NConstrainedTips (TreeNode *p)
+{
+    int     i=0;
+    
+    if (p!=NULL)
+        {
+        if (p->left == NULL || p->isLocked == YES)
+            return 1;
+        else
+            {
+            i += NConstrainedTips (p->left);
+            i += NConstrainedTips (p->right);
+            }
+        }
+    return i;
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   NumDatedTips: This routine will return the number of dated tips, internal or external
+|
+---------------------------------------------------------------------------------------------*/
+int NumDatedTips (TreeNode *p)
+{
+    int     i = 0;
+
+    assert (p != NULL && p->left != NULL);
+
+    i += NDatedTips (p->left);
+    i += NDatedTips (p->right);
+
+    return i;
+}
+
+
+/* NDatedTips: recursive function to get the number of dated tips */
+int NDatedTips (TreeNode *p)
+{
+    int     i=0;
+    
+    assert (p!=NULL);
+
+    if (p->left == NULL || p->isDated == YES)
+        return 1;
+    else
+        {
+        i += NDatedTips (p->left);
+        i += NDatedTips (p->right);
+        return i;
+        }
+}
+
+
+/* OrderTips: Order tips in a polytomous tree */
+void OrderTips (PolyTree *t)
+{
+    int         i, j;
+    PolyNode    *p, *q, *r, *pl, *ql, *rl;
+
+    /* label by minimum index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            {
+            if (t->isRooted == NO && p->index == localOutGroup)
+                p->x = -1;
+            else
+                p->x = p->index;
+            }
+        else
+            {
+            j = t->nNodes;
+            for (q=p->left; q!=NULL; q=q->sib)
+                {
+                if (q->x < j)
+                    j = q->x;
+                }
+            p->x = j;
+            }
+        }
+
+    /* and rearrange */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL || p->anc == NULL)
+            continue;
+        for (ql=NULL, q=p->left; q->sib!=NULL; ql=q, q=q->sib)
+            {
+            for (rl=q, r=q->sib; r!=NULL; rl=r, r=r->sib)
+                {
+                if (r->x < q->x)
+                    {
+                    if (ql == NULL)
+                        p->left = r;
+                    if (r == q->sib) /* swap adjacent q and r */
+                        {
+                        if (ql != NULL)
+                            ql->sib = r;
+                        pl = r->sib;
+                        r->sib = q;
+                        q->sib = pl;
+                        }
+                    else    /* swap separated q and r */
+                        {
+                        if (ql != NULL)
+                            ql->sib = r;
+                        pl = r->sib;
+                        r->sib = q->sib;
+                        rl->sib = q;
+                        q->sib = pl;
+                        }
+                    pl = q;
+                    q = r;
+                    r = pl;
+                    }
+                }
+            }
+        }
+    GetPolyDownPass(t);
+}
+
+
+/* PrintNodes: Print a list of tree nodes, pointers and length */
+void PrintNodes (Tree *t)
+{
+    int         i;
+    TreeNode    *p;
+
+    printf ("Node\tleft\tright\tanc\tlength\n");
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = &t->nodes[i];
+        printf ("%d\t%d\t%d\t%d\t%f\t%f\n",
+            p->index,
+            p->left == NULL ? -1 : p->left->index,
+            p->right == NULL ? -1 : p->right->index,
+            p->anc == NULL ? -1 : p->anc->index,
+            p->length,
+            p->nodeDepth);
+        }
+
+    if (t->root == NULL)
+        printf ("root: NULL\n");
+    else
+        printf ("root: %d\n", t->root->index);
+
+    printf ("allDownPass:");
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p!=NULL)
+            printf ("  %d", p->index);
+        else
+            printf ("  NULL");
+        }
+    printf ("\nintDownPass:  ");
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        if (p!=NULL)
+            printf ("  %d\t", p->index);
+        else
+            printf ("  NULL\t");
+        }
+    printf ("\n");
+}
+
+
+/* PrintPolyNodes: Print a list of polytomous tree nodes, pointers and length */
+void PrintPolyNodes (PolyTree *pt)
+{
+    int         i, j, k;
+    PolyNode    *p;
+
+    printf ("Node\tleft\tsib\tanc\tlength\tlabel\n");
+    for (i=0; i<pt->memNodes; i++)
+        {
+        p = &pt->nodes[i];
+        printf ("%d\t%d\t%d\t%d\t%f\t%s\n",
+            p->index,
+            p->left == NULL ? -1 : p->left->index,
+            p->sib == NULL ? -1 : p->sib->index,
+            p->anc == NULL ? -1 : p->anc->index,
+            p->length,
+            p->label);
+        }
+    printf ("root: %d\n", pt->root->index);
+    fflush(stdout);
+
+    if (pt->nBSets > 0)
+        {
+        for (i=0; i<pt->nBSets; i++)
+            {
+            printf ("Effective branch length set '%s'\n", pt->bSetName[i]);
+            for (j=0; j<pt->nNodes; j++)
+                {
+                printf ("%d:%f", j, pt->effectiveBrLen[pt->nBSets][j]);
+                if (j != pt->nNodes-1)
+                    printf (", ");
+                }
+            printf ("\n");
+            }
+        }
+    
+    if (pt->nESets > 0)
+        {
+        for (i=0; i<pt->nESets; i++)
+            {
+            printf ("Cpp event set '%s'\n", pt->eSetName[i]);
+            for (j=0; j<pt->nNodes; j++)
+                {
+                if (pt->nEvents[i*pt->nNodes+j] > 0)
+                    {
+                    printf ("\tNode %d -- %d:(", j, pt->nEvents[i][j]);
+                    for (k=0; k<pt->nEvents[i][j]; k++)
+                        {
+                        printf ("%f %f", pt->position[i][j][k], pt->rateMult[i][j][k]);
+                        if (k != pt->nEvents[i][j]-1)
+                            printf (", ");
+                        }
+                    printf (")\n");
+                    }
+                }
+            printf ("\n");
+            }
+        }
+
+    fflush(stdout);
+}
+
+
+/* PrintTranslateBlock: Print a translate block to file fp for tree t */
+void PrintTranslateBlock (FILE *fp, Tree *t)
+{
+    int     i, j, nTaxa;
+
+    if (t->isRooted == NO)
+        nTaxa = t->nNodes - t->nIntNodes;
+    else
+        nTaxa = t->nNodes - t->nIntNodes - 1;
+
+    fprintf (fp, "\ttranslate\n");
+
+    for (i=0; i<nTaxa; i++)
+        {
+        for (j=0; j<t->nNodes; j++)
+            if (t->allDownPass[j]->index == i)
+                break;
+        if (i == nTaxa-1)
+            fprintf (fp, "\t\t%d\t%s;\n", i+1, t->allDownPass[j]->label);
+        else
+            fprintf (fp, "\t\t%d\t%s,\n", i+1, t->allDownPass[j]->label);
+        }
+}
+
+
+/**
+Update relaxed clock parameter of the branch of a node with index "b" after node with index "a" is removed. 
+i.e. make branch of node with index "b" be a concatenation of its original branch and the branch of node with index "a"
+Relaxed clock parameter of node with index "a" become invalid in the process.
+Note: For Non-clock models the routine has no effect.
+
+|       |
+|       |
+a       |
+|   ->  |
+|       |
+|       b
+b                */
+void AppendRelaxedBranch (int a,int b,PolyTree *t)
+{
+    int i,len;
+
+    for (i=0; i<t->nBSets; i++)
+        {
+        t->effectiveBrLen[i][b] += t->effectiveBrLen[i][a];
+        }
+
+    for (i=0; i<t->nESets; i++)
+        {
+        len=t->nEvents[i][a]+t->nEvents[i][b];
+        t->position[i][a] = (MrBFlt *) SafeRealloc ((void *)t->position[i][a], len*sizeof(MrBFlt));
+        t->rateMult[i][a] = (MrBFlt *) SafeRealloc ((void *)t->rateMult[i][a], len*sizeof(MrBFlt));
+        memcpy (t->position[i][a]+t->nEvents[i][a], t->position[i][b], t->nEvents[i][b]*sizeof(MrBFlt));
+        memcpy (t->rateMult[i][a]+t->nEvents[i][a], t->rateMult[i][b], t->nEvents[i][b]*sizeof(MrBFlt));
+        free(t->position[i][b]);
+        free(t->rateMult[i][b]);
+        t->position[i][b] = t->position[i][a];
+        t->rateMult[i][b] = t->rateMult[i][a];
+        t->position[i][a] = NULL;
+        t->rateMult[i][a] = NULL;
+        t->nEvents[i][a] = 0;
+        t->nEvents[i][b] = len;
+        }
+
+}
+
+
+/**
+Swap relaxed clock paramiters of the branch of nodes with index "a" and "b".
+*/
+void SwapRelaxedBranchInfo (int a,int b,PolyTree *t)
+{
+    int i,j;
+    MrBFlt tmp, *tmpp;
+
+    for (i=0; i<t->nBSets; i++)
+        {
+        tmp = t->effectiveBrLen[i][a];
+        t->effectiveBrLen[i][a] = t->effectiveBrLen[i][b];
+        t->effectiveBrLen[i][b] = tmp;
+        }
+    if (t->popSizeSet == YES)
+        {
+        tmp = t->popSize[a];
+        t->popSize[a]=t->popSize[b];
+        t->popSize[b] = tmp;
+        }
+
+    for (i=0; i<t->nESets; i++)
+        {
+        tmpp = t->position[i][a];
+        t->position[i][a] = t->position[i][b];
+        t->position[i][b] = tmpp;
+        tmpp = t->rateMult[i][a];
+        t->rateMult[i][a] = t->rateMult[i][b];
+        t->rateMult[i][b] = tmpp;
+        j = t->nEvents[i][a];
+        t->nEvents[i][a] = t->nEvents[i][b];
+        t->nEvents[i][b] = j;
+        }
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   PrunePolyTree: This routine will prune a polytomous tree according to the currently
+|      included taxa.  NB! All tree nodes cannot be accessed by cycling over the
+|      pt->nodes array after the deletion, because some spaces will be occupied by deleted
+|      nodes and pt->nNodes is no longer the length of this array
+|      (if proper re-arangment of pt->nodes needed then remove "#if 0" and make changes to p->x, see below).
+|
+---------------------------------------------------------------------------------------------*/
+int PrunePolyTree (PolyTree *pt)
+{
+    int             i, j, numDeleted, numTermPruned, numIntPruned, index;
+    PolyNode        *p = NULL, *q=NULL, *r=NULL, *qa;
+
+    numDeleted = 0;
+    for (i=0; i<pt->nNodes; i++)
+        {
+        p = pt->allDownPass[i];
+        CheckString (taxaNames, numTaxa, p->label, &index);
+        if (p->left == NULL && taxaInfo[index].isDeleted == YES)
+            numDeleted++;
+        }
+        
+    if (numDeleted == 0)
+        {
+        /* nothing to do */
+        return (NO_ERROR);
+        }
+    if (pt->nNodes - pt->nIntNodes - numDeleted < 3)
+        {
+        MrBayesPrint ("%s   Pruned tree has less than three taxa in it\n", spacer);
+        return (ERROR);
+        }
+    if (pt->nNodes - pt->nIntNodes < numLocalTaxa)
+        {
+        MrBayesPrint ("%s   Tree to be pruned does not include all taxa\n", spacer);
+        return (ERROR);
+        }
+
+    /* prune away one node at a time */
+    numIntPruned = 0;
+    numTermPruned = 0;
+    for (i=0; i<pt->nNodes; i++)
+        {
+        p = pt->allDownPass[i];
+        if (p->left != NULL)
+            continue;
+        CheckString (taxaNames, numTaxa, p->label, &index);
+        if (taxaInfo[index].isDeleted == YES)
+            {
+            numTermPruned++;
+            for (q=p->anc->left; q!=NULL; q=q->sib)
+                {
+                if (q->sib == p)
+                    break;
+                }
+            if (q == NULL)
+                {
+                /* p is the left of its ancestor */
+                assert (p->anc->left == p);
+                p->anc->left = p->sib;
+                }
+            else
+                {
+                /* p is q->sib; this also works if p->sib is NULL */
+                q->sib = p->sib;
+                }
+            /* if only one child left, delete ancestral node */
+            j = 0;
+            for (q=p->anc->left; q!=NULL; q=q->sib)
+                j++;
+            if (j == 1)
+                {
+                /* p->anc->left is only child left; make p->anc be p->anc->left and accommodate its length */
+                numIntPruned++;
+                qa= p->anc;
+                q = qa->left;
+                if (q->left == NULL)
+                    {
+                    AppendRelaxedBranch (qa->index, q->index, pt);
+                    qa->index = q->index;
+                    qa->length += q->length;
+                    strcpy(qa->label, q->label);
+                    qa->left = NULL;
+                    /* To make sure that q is not treated as the representer of the tip it represented before. i.e. make  condition if (p->left != NULL) true */
+                    q->left = (struct pNode*)1; 
+                    }
+                else
+                    {
+                    if (qa->anc != NULL)
+                        {
+                        AppendRelaxedBranch (qa->index, q->index, pt);
+                        qa->length += q->length;
+                        }
+                    qa->index   = q->index;
+                    qa->left = q->left;
+                    for (r=q->left; r!= NULL; r=r->sib)
+                        r->anc = qa;
+                    }
+                }
+            /* if unrooted, then root node has to have more then 2 children, thus the following check */
+            if (j == 2 && pt->isRooted == NO && p->anc->anc == NULL)
+                {
+                numIntPruned++;
+                r=p->anc; /*r is the root with only 2 children*/
+                if (r->left->left != NULL)
+                    {/* Make r->left new root by attaching "right" child of r to children of r->left */
+                    for (q=r->left->left; q->sib!=NULL; q=q->sib)
+                        ;
+                    q->sib = r->left->sib;
+                    r->left->sib->anc = q->anc;
+                    r->left->sib->length += q->anc->length;
+                    r->left->sib = NULL;
+                    r->left->anc = NULL;
+                    pt->root = r->left;
+                    }
+                else
+                    {/* Make "right" child of r (r->left->sib) the new root by attaching r->left to children of r->"right" */
+                    for (q=r->left->sib->left; q->sib!=NULL; q=q->sib)
+                        ;
+                    q->sib = r->left;
+                    r->left->anc = q->anc;
+                    r->left->length += q->anc->length;
+                    r->left->sib = NULL;
+                    q->anc->anc = NULL;
+                    pt->root = q->anc;
+                    }
+                }
+            }
+        }
+
+#if 0 
+    /* place unused space at the end of pt->nodes array. If activated this code p->x has to be set to non 0 value for all p that are deleted. */
+    for (i=0; i<pt->nNodes; i++)
+        {
+        p = &pt->nodes[i];
+        if (p->x != 0)
+            {
+            for (j=i+1; j<pt->nNodes; j++)
+                {
+                q = &pt->nodes[j];
+                if (q->x == 0)
+                    break;
+                }
+            if (j != pt->nNodes)
+                {
+                /* swap nodes; quite difficult! */
+                CopyPolyNodes (p, q, nLongsNeeded);
+                p->left = q->left;
+                p->sib = q->sib;
+                p->anc = q->anc;
+                for (k=0; k<pt->nNodes; k++)
+                    {
+                    r = &pt->nodes[k];
+                    if (r->left == q)
+                        r->left = p;
+                    if (r->sib == q)
+                        r->sib = p;
+                    if (r->anc == q)
+                        r->anc = p;
+                    }
+                }
+            }
+        }
+#endif
+
+    /* correct number of nodes */
+    pt->nNodes -= (numTermPruned + numIntPruned);
+    pt->nIntNodes -= numIntPruned;
+    
+    /* get downpass; note that the deletion procedure does not change the root in rooted case */
+    i=j=0;
+    GetPolyNodeDownPass (pt, pt->root, &i, &j);
+    assert (i==pt->nNodes);
+    assert (j==pt->nIntNodes);
+
+    return (NO_ERROR);
+}
+
+
+/*--------------------------------------------------------------------
+|
+|       RandPerturb: Randomly perturb a tree by nPert NNIs
+|
+---------------------------------------------------------------------*/
+int RandPerturb (Tree *t, int nPert, RandLong *seed)
+{
+    int         i, whichNode;
+    TreeNode    *p, *q, *a, *b, *c;
+    
+    if (t->nConstraints >= t->nIntNodes)
+        {
+        MrBayesPrint ("%s   User tree cannot be perturbed because all nodes are locked\n", spacer);
+        return (ERROR);
+        }
+
+    for (i=0; i<nPert; i++)
+        {
+        do
+            {
+            whichNode = (int)(RandomNumber(seed) * (t->nIntNodes - 1));
+            p = t->intDownPass[whichNode];
+            } while (p->isLocked == YES);
+        
+        q = p->anc;
+        a  = p->left;
+        b  = p->right;
+        if (q->left == p)
+            c  = q->right;
+        else    
+            c  = q->left;
+        
+        if (RandomNumber(seed) < 0.5)
+            {
+            /* swap b and c */
+            p->right = c;
+            c->anc  = p;
+
+            if (q->left == c)
+                q->left = b;
+            else
+                q->right = b;
+            b->anc = q;
+            }
+        else
+            {
+            /* swap a and c */
+            p->left = c;
+            c->anc  = p;
+
+            if (q->left == c)
+                q->left = a;
+            else
+                q->right = a;
+            a->anc = q;
+            }
+
+        if (t->isCalibrated == YES)
+            InitCalibratedBrlens (t, 0.0001, seed);
+        else if (t->isClock == YES)
+            InitClockBrlens (t);
+        }
+    
+    GetDownPass (t);
+
+    if (t->checkConstraints == YES && CheckConstraints (t) == NO_ERROR)
+        {
+        MrBayesPrint ("%s   Broke constraints when perturbing tree\n", spacer);
+        return (ERROR);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*
+|       Reorder array of nodes "nodeArray" such that first nodes in it could be paired with "w" to create imediat common ancestor and this ancesor node would not vialate any constraint.  
+|       
+| @param w                      Reference node as described 
+| @param nodeArray              A set of node to order as described
+| @param activeConstraints      Array containing indeces of active constraints in the set of defined constraints
+| @param nLongsNeeded           Length of partition information (in BitsLong) in a node and constraint deffinition.
+| @param isRooted               Do constraints apply to rootet tree YES or NO
+|
+| @return                       Number of nodes in "nodeArray" that could be paired  with "w" to create imediat common ancestor and this ancesor node would not vialate any constraint
+*/
+int ConstraintAllowedSet(PolyNode *w, PolyNode **nodeArray, int nodeArraySize, int *activeConstraints, int activeConstraintsSize, int nLongsNeeded, int isRooted)
+{
+    int             i, j,  k, FirstEmpty;
+    BitsLong        **constraintPartition;
+    PolyNode        *tmp;
+
+    for (j=0; j<activeConstraintsSize; j++)
+        {
+        k=activeConstraints[j];
+
+        if (definedConstraintsType[k] == PARTIAL)
+            {
+            if ((IsPartNested(definedConstraintPruned[k], w->partition, nLongsNeeded) == YES) ||
+                (isRooted == NO && IsPartNested(definedConstraintTwoPruned[k], w->partition, nLongsNeeded) == YES))
+                continue;/* all nodes are compartable because condition of the constraint has to be sutsfied in the subtree rooted at w*/
+
+            FirstEmpty = IsSectionEmpty(definedConstraintPruned[k], w->partition, nLongsNeeded);
+            if (FirstEmpty == YES &&  IsSectionEmpty(definedConstraintTwoPruned[k], w->partition, nLongsNeeded) == YES)
+                continue; /* all nodes are compartable becouse w does not contain any constraint taxa*/
+
+            assert (FirstEmpty^IsSectionEmpty(definedConstraintTwoPruned[k], w->partition, nLongsNeeded));
+
+            if (FirstEmpty == YES)
+                {/*w->partition has intersection with definedConstraintTwoPruned[k], thus remove all nodes from nodeArray that intersect with definedConstraintPruned[k]*/
+                constraintPartition=definedConstraintPruned;
+                }
+            else
+                {/*w->partition has intersection with definedConstraintPruned[k], thus remove all nodes from nodeArray that intersect with definedConstraintTwoPruned[k]*/
+                constraintPartition=definedConstraintTwoPruned;
+                }
+
+            for (i=0;i<nodeArraySize;i++)
+                {
+                if (IsSectionEmpty(constraintPartition[k], nodeArray[i]->partition, nLongsNeeded) == NO &&
+                    ((FirstEmpty == NO && isRooted== YES) ||  IsPartNested(constraintPartition[k], nodeArray[i]->partition, nLongsNeeded) == NO))
+                  /*second part of if statment is to bail out "nodeArray[i]" when "w" contains nodes for example from definedConstraintPruned and "nodeArray[i]" have definedConstraintTwoPruned fully nested in it
+                  This bail out not applicable if t->isRooted== YES Since we should create a rooting node for the first set of taxa in the constraint.
+                  Note that such case possible because we may have hard constraint node that fully nest definedConstraintTwoPruned but also having taxa from definedConstraintPruned keeping constraint active.*/
+                    {
+                    tmp = nodeArray[i];
+                    nodeArray[i]=nodeArray[--nodeArraySize];
+                    nodeArray[nodeArraySize]=tmp;
+                    i--;
+                    }
+                }
+            }/*end if PARTIAL*/
+        else 
+            {
+            assert (definedConstraintsType[k] == NEGATIVE);
+            if (isRooted == YES || IsBitSet(localOutGroup, definedConstraintPruned[k])==NO)
+                constraintPartition=definedConstraintPruned;
+            else
+                constraintPartition=definedConstraintTwoPruned;
+            
+            if (IsSectionEmpty(constraintPartition[k], w->partition, nLongsNeeded)==YES)
+                continue;
+
+            for (i=0;i<nodeArraySize;i++)
+                {
+                if (IsUnionEqThird (w->partition, nodeArray[i]->partition, constraintPartition[k], nLongsNeeded) == YES)
+                    {
+                    tmp = nodeArray[i];
+                    nodeArray[i]=nodeArray[--nodeArraySize];
+                    nodeArray[nodeArraySize]=tmp;
+                    i--;
+                    }
+                }
+
+            }/*end if NEGATIVE*/
+        }
+
+   return nodeArraySize;
+}
+
+
+/*
+|               Check if "partition" violate any constraint.  
+|       
+| @param partiton               Partition to check 
+| @param activeConstraints      Array containing indeces of active constraints in the set of defined constraints  
+| @param nLongsNeeded           Length of partition information (in BitsLong) in a node and constraint deffinition
+| @param isRooted               Do constraints apply to rootet tree YES or NO
+|
+| @return                       Index of first violated constraint in activeConstraints array, -1 if no constraint is violated.
+*/
+int ViolatedConstraint(BitsLong *partition, int *activeConstraints, int activeConstraintsSize, int nLongsNeeded, int isRooted)
+{
+    int             j, k;
+    BitsLong        **constraintPartition;
+
+    for (j=0; j<activeConstraintsSize; j++)
+        {
+        k=activeConstraints[j];
+        assert (definedConstraintsType[k] != HARD);
+
+        if (definedConstraintsType[k] == PARTIAL)
+            {
+            if ((IsSectionEmpty(definedConstraintPruned[k], partition, nLongsNeeded) == NO) &&
+                (IsSectionEmpty(definedConstraintTwoPruned[k], partition, nLongsNeeded) == NO) &&
+                (IsPartNested(definedConstraintPruned[k], partition, nLongsNeeded) == NO) &&
+                !(isRooted == NO && IsPartNested(definedConstraintTwoPruned[k], partition, nLongsNeeded) == YES))
+                return j;
+            }/*end if PARTIAL*/
+        else 
+            {
+            assert (definedConstraintsType[k] == NEGATIVE);
+            if (isRooted == YES || IsBitSet(localOutGroup, definedConstraintPruned[k])==NO)
+                constraintPartition=definedConstraintPruned;
+            else
+                constraintPartition=definedConstraintTwoPruned;
+
+            if (IsUnionEqThird (partition, partition, constraintPartition[k], nLongsNeeded) == YES)
+                return j;
+            }/*end if NEGATIVE*/
+        }
+
+   return -1;
+}
+
+
+/*
+|         Remove from activeConstraints references to constraints that become satisfied if PolyNode "w" exist, i.e. they do not need to be checked furter thus become not active  
+|
+| @param activeConstraints      Array containing indeces of active constraints in the set of defined constraints
+| @param nLongsNeeded           Length of partition information (in BitsLong) in a node and constraint deffinition.
+| @param isRooted               Do constraints apply to rootet tree YES or NO
+|
+| @return                       Size of pruned "activeConstraints" array
+*/
+int PruneActiveConstraints (PolyNode *w, int *activeConstraints, int activeConstraintsSize, int nLongsNeeded, int isRooted)
+{
+    int             j,  k;
+    BitsLong        **constraintPartition;
+    //PolyNode        *tmp;
+
+    for (j=0; j<activeConstraintsSize; j++)
+        {
+        k=activeConstraints[j];
+
+        if (definedConstraintsType[k] == PARTIAL)
+            {
+            if ((IsPartNested(definedConstraintPruned[k], w->partition, nLongsNeeded) == YES && IsSectionEmpty(definedConstraintTwoPruned[k], w->partition, nLongsNeeded)) ||
+               (isRooted == NO && IsPartNested(definedConstraintTwoPruned[k], w->partition, nLongsNeeded) == YES && IsSectionEmpty(definedConstraintPruned[k], w->partition, nLongsNeeded)))
+                {
+                //tmp = activeConstraints[j];
+                activeConstraints[j]=activeConstraints[--activeConstraintsSize];
+                //activeConstraints[activeConstraintsSize]=tmp;
+                j--;
+                }
+            }/*end if PARTIAL*/
+        else 
+            {
+            assert (definedConstraintsType[k] == NEGATIVE);
+            if (isRooted == YES || IsBitSet(localOutGroup, definedConstraintPruned[k])==NO)
+                constraintPartition=definedConstraintPruned;
+            else
+                constraintPartition=definedConstraintTwoPruned;
+            
+            if (IsPartNested(constraintPartition[k], w->partition, nLongsNeeded)==NO && IsSectionEmpty(constraintPartition[k], w->partition, nLongsNeeded)==NO)
+                {
+                //tmp = activeConstraints[j];
+                activeConstraints[j]=activeConstraints[--activeConstraintsSize];
+                //activeConstraints[activeConstraintsSize]=tmp;
+                j--;
+                }
+            }/*end if NEGATIVE*/
+        }
+
+   return activeConstraintsSize;
+}
+
+
+/*--------------------------------------------------------------------
+|
+|           RandResolve: Randomly resolve a polytomous tree
+|
+| @param    tt is a tree which contains information about applicable constraints. If it is set to NULL then no constraints will be used. 
+|           If t!=NULL then partitions of nodes of polytree should be allocated for example by AllocatePolyTreePartitions (t);
+| @return   NO_ERROR on succes, ABORT if could not resolve a tree without vialating some consraint, ERROR if any other error occur 
+---------------------------------------------------------------------*/
+int RandResolve (Tree *tt, PolyTree *t, RandLong *seed, int destinationIsRooted)
+{
+    int         i, j, k, nextNode, stopNode, rand1, rand2, nTaxa, nLongsNeeded, tmp;
+    PolyNode    *p=NULL, *q, *r, *u, *w1, *w2;
+    int         nodeArrayAllowedSize, nodeArraySize, activeConstraintsSize;
+    PolyNode    **nodeArray;
+    int         *activeConstraints;
+
+    assert (tt==NULL || t->bitsets!=NULL); /* partition fields of t nodes need to be allocated if constraints are used*/
+    nTaxa = t->nNodes - t->nIntNodes;     /* different from numLocalTaxa potentially if a species tree */
+    assert (nTaxa <= t->memNodes/2); /* allocated tree has to be big enough*/
+    nLongsNeeded = (nTaxa - 1) / nBitsInALong + 1; /* allocated lenght of partitions is t->memNodes/2 bits but only first nTaxa bits are used */
+
+    nodeArray = t->allDownPass; /*temporary use t->allDownPass for different purpose. It get properly reset at the end. */
+    activeConstraints = tempActiveConstraints;
+    activeConstraintsSize = 0;
+
+    /* collect constraints to consider if applicable*/
+    if (tt!=NULL && tt->constraints!=NULL)
+        {
+        for (k=0; k<numDefinedConstraints; k++)
+            {
+            if (tt->constraints[k] == YES && definedConstraintsType[k] != HARD)
+                activeConstraints[activeConstraintsSize++]=k;
+            }
+        }
+
+    /* count immediate descendants */
+    GetPolyDownPass(t);
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        tmp=ViolatedConstraint(p->partition, activeConstraints, activeConstraintsSize, nLongsNeeded, t->isRooted);
+        if (tmp != -1)
+            {
+            assert (p->isLocked == YES);
+            MrBayesPrint ("%s   Could not build a constraint tree since hard constraint \"%s\" and constraint \"%s\" are incompatible\n", spacer, constraintNames[p->lockID], constraintNames[activeConstraints[tmp]]);
+            return (ERROR);
+            }
+        activeConstraintsSize = PruneActiveConstraints (p, activeConstraints, activeConstraintsSize, nLongsNeeded, t->isRooted);
+        j = 0;
+        for (q=p->left; q!=NULL; q=q->sib)
+            j++;
+        p->x = j;
+        }
+
+    /* add one node at a time */
+    if (destinationIsRooted == NO)
+        stopNode = 2*nTaxa - 2;
+    else
+        stopNode = 2*nTaxa - 1;
+    for (nextNode=t->nNodes; nextNode < stopNode; nextNode++)
+        {
+        /* find a polytomy to break */
+        for (i=0; i<t->nIntNodes; i++)
+            {
+            p = t->intDownPass[i];
+            if (destinationIsRooted == YES && p->x > 2)
+                break;
+            if (destinationIsRooted == NO && ((p->anc != NULL && p->x > 2) || (p->anc == NULL && p->x > 3)))
+                break;
+            }
+
+        /* if we can't find one, there's an error */
+        if (i == t->nIntNodes)
+            {
+            return  ERROR;
+            }
+
+        nodeArraySize=0;
+        /*Collect initial list of candidate nodes to join*/
+        for (q = p->left; q!= NULL; q = q->sib)
+            {
+            nodeArray[nodeArraySize++]=q;
+            }
+        assert (nodeArraySize==p->x);
+
+        /* identify two descendants randomly */
+        /* make sure we do not select outgroup if it is an unrooted tree */
+        if (p->anc == NULL && destinationIsRooted == NO)
+            nodeArraySize--;
+
+        do
+            {
+            /* Pick first node */
+            rand1 = (int) (RandomNumber(seed) * nodeArraySize);
+            w1 = nodeArray[rand1];
+            nodeArray[rand1] = nodeArray[--nodeArraySize];
+
+            if (nodeArraySize==0)
+                return ABORT; /* Potentaily here we could instead revert by removing last added node and try again. */
+
+            /* Move all nodes in nodeArray which can be paired with w to the begining of array */
+            nodeArrayAllowedSize=ConstraintAllowedSet(w1, nodeArray, nodeArraySize, activeConstraints, activeConstraintsSize, nLongsNeeded, t->isRooted);
+            /* TODO optimization for Maxim (if not Maxim remove it if you still see it): if nodeArrayAllowedSize==0 then set w1->y */
+            } while (nodeArrayAllowedSize == 0);
+
+        rand2 = (int) (RandomNumber(seed) *nodeArrayAllowedSize);
+        w2 = nodeArray[rand2];
+
+        /* create a new node */
+        u = &t->nodes[nextNode];
+        u->anc = p;
+        u->x = 2;
+        p->x--;
+
+        if (tt != NULL) {
+            for (j=0; j<nLongsNeeded; j++)
+                u->partition[j] = w1->partition[j] | w2->partition[j] ;
+            activeConstraintsSize = PruneActiveConstraints (u, activeConstraints, activeConstraintsSize, nLongsNeeded, t->isRooted);
+        }
+
+        u->left = w1;
+        t->nNodes++;
+        t->nIntNodes++;
+
+        /* connect tree together */
+        r = u;
+        for (q = p->left; q!= NULL; q = q->sib)
+            {
+            if (q != w1 && q != w2)
+                {
+                r->sib=q;
+                r = q;
+                }
+            }
+        r->sib = NULL;
+        w1->sib = w2;
+        w2->sib = NULL;
+        w1->anc = u;
+        w2->anc = u;
+        p->left = u;
+
+        /* update tree */
+        GetPolyDownPass (t);
+        }
+
+    /* relabel interior nodes (important that last indices are at the bottom!) */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        p->index = nTaxa + i;
+        }
+    return NO_ERROR;
+}
+
+
+/* ResetTreeNode: Reset tree node except for memory index */
+void ResetTreeNode (TreeNode *p)
+{
+    /* do not change memoryIndex; that is set once and for all when tree is allocated */
+    p->index                  = 0; 
+    p->scalerNode             = NO;         
+    p->upDateCl               = NO;
+    p->upDateTi               = NO;
+    p->marked                 = NO;
+    p->length                 = 0.0;
+    p->nodeDepth              = 0.0;
+    p->x                      = 0;
+    p->y                      = 0;
+    p->index                  = 0;
+    p->isDated                = NO;
+    p->calibration            = NULL;
+    p->age                    = -1.0;
+    p->isLocked               = NO;
+    p->lockID                 = -1;
+    p->label                  = noLabel;
+    p->d                      = 0.0;
+    p->partition              = NULL;
+}
+
+
+/* ResetPolyNode: Reset all values of one node in a polytree */
+void ResetPolyNode (PolyNode *p)
+{
+    /* we reset everything here except memoryIndex, which should be immutable */
+    p->length = 0.0;
+    p->depth = 0.0;
+    p->age = 0.0;
+    p->anc = p->left = p->sib = NULL;
+    p->calibration = NULL;
+    p->f = 0.0;
+    p->index = 0;
+    p->isDated = NO;
+    p->isLocked = NO;
+    strcpy (p->label,"");
+    p->lockID = 0;
+    p->partition = NULL;
+    p->partitionIndex = 0;
+    p->support = 0.0;
+    p->x = p->y = 0;
+}
+
+
+/* ResetPolyTree: Reset polytomous tree to pristine state but keep relevant memory. */
+void ResetPolyTree (PolyTree *pt)
+{
+    int     i, maxTaxa, nLongsNeeded;
+
+    /* clear nodes */
+    for (i=0; i<pt->memNodes; i++)
+        ResetPolyNode (&pt->nodes[i]);
+
+    /* empty node arrays and tree properties but keep space */
+    for (i=0; i<pt->nNodes; i++)
+        pt->allDownPass[i] = NULL;
+    for (i=0; i<pt->nIntNodes; i++)
+        pt->intDownPass[i] = NULL;
+    pt->nNodes = 0;
+    pt->nIntNodes = 0;
+    pt->root = NULL;
+    pt->brlensDef = NO;
+    pt->isRooted = NO;
+    pt->isClock = NO;
+    pt->isRelaxed = NO;
+    pt->clockRate = 0.0;
+
+    /* empty bitsets but keep space and pointers */
+    if (pt->bitsets)
+        {
+        maxTaxa = pt->memNodes / 2;
+        nLongsNeeded = (maxTaxa - 1) / nBitsInALong + 1;
+        for (i=0; i<pt->memNodes*nLongsNeeded; i++)
+            pt->bitsets[i] = 0;
+        for (i=0; i<pt->memNodes; i++)
+            pt->nodes[i].partition = pt->bitsets + i*nLongsNeeded;
+        }
+
+    /* empty relaxed clock parameters */
+    FreePolyTreeRelClockParams (pt);
+
+    /* empty population size set parameters */
+    FreePolyTreePopSizeParams (pt);
+}
+
+
+/* ResetPolyTreePartitions: Reset and set bit patterns describing partitions */
+void ResetPolyTreePartitions (PolyTree *pt)
+{
+    int         i, j, numTaxa, nLongsNeeded;
+    PolyNode    *pp;
+
+    /* get some handy numbers */
+    numTaxa = pt->memNodes/2;
+    nLongsNeeded = (numTaxa - 1) / nBitsInALong + 1;
+    
+    /* reset bits describing partitions */
+    for (i=0; i<pt->memNodes*nLongsNeeded; i++)
+        {
+        pt->bitsets[i] = 0;
+        }
+
+    /* set bits describing partitions */
+    for (i=0; i<pt->nNodes; i++)
+        {
+        assert (pt->allDownPass != NULL && pt->allDownPass[i] != NULL);
+        assert (pt->allDownPass[i]->partition != NULL);
+        
+        pp = pt->allDownPass[i];
+        if (pp->left == NULL)
+            {
+            SetBit (pp->index, pp->partition);
+            }
+        if (pp->anc != NULL)
+            {
+            for (j=0; j<nLongsNeeded; j++)
+                pp->anc->partition[j] |= pp->partition[j];
+            }
+        }
+}
+
+
+/*----------------------------------------------
+|
+|   ResetRootHeight: Reset node heights in a clock
+|      tree to fit a new root height. Assumes
+|      node depths and lengths set correctly.
+|
+-----------------------------------------------*/
+int ResetRootHeight (Tree *t, MrBFlt rootHeight)
+{
+    int         i;
+    TreeNode    *p;
+    MrBFlt      factor, x, y;
+
+    if (t->isClock == NO)
+        return ERROR;
+    
+    /* make sure node depths are set */
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->nodeDepth = 0.0;
+        else
+            {
+            x = p->left->nodeDepth + p->left->length;
+            y = p->right->nodeDepth + p->right->length;
+            if (x > y)
+                p->nodeDepth = x;
+            else
+                p->nodeDepth = y;
+            }
+        }
+    for (i=t->nNodes-3; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        p->nodeDepth = p->anc->nodeDepth - p->length;
+        }
+
+    /* now reset node depths and branch lengths */
+    factor = rootHeight / t->root->left->nodeDepth;
+    t->root->left->nodeDepth = rootHeight;
+    for (i=t->nNodes-2; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        p->nodeDepth *= factor;
+        p->length *= factor;
+        }
+
+    return NO_ERROR;
+}
+
+
+/*----------------------------------------------
+|
+|   ResetTipIndices: reset tip indices to be from 
+|      0 to number of included taxa, in same order
+|      as in the original taxon set.
+|
+-----------------------------------------------*/
+void ResetTipIndices(PolyTree *pt)
+{
+    int         i, j, k, m;
+    PolyNode    *p = NULL;
+
+    for (i=j=0; i<numTaxa; i++)
+        {
+        for (k=0; k<pt->nNodes; k++)
+            {
+            p = pt->allDownPass[k];
+            if (StrCmpCaseInsensitive(p->label,taxaNames[i]) == 0)
+                break;
+            }
+        if (k < pt->nNodes)
+            {
+            assert (p->left == NULL);
+            if (p->index!=j) {
+                SwapRelaxedBranchInfo (p->index, j, pt);
+                for (m=0; m<pt->nNodes; m++)
+                    {
+                    if (pt->allDownPass[m]->index==j)
+                        {
+                        pt->allDownPass[m]->index=p->index;
+                        break;
+                        }
+                    }
+                p->index = j;
+                }
+            j++;
+            }
+        }
+}
+
+
+/*----------------------------------------------
+|
+|   ResetTopology: rebuild the tree t to fit the 
+|      Newick string s. Everyting except topology
+|      is left in the same state in t.
+|
+-----------------------------------------------*/
+int ResetTopology (Tree *t, char *s)
+{
+    TreeNode    *p, *q;
+    int         i, j, k, inLength;
+    char        temp[30];
+    
+    /* set all pointers to NULL */
+    for (i=0; i<t->memNodes; i++)
+        {
+        p = &t->nodes[i];
+        p->anc = p->right = p->left = NULL;
+        p->index = -1;
+        }
+    p = &t->nodes[0];
+
+    /* start out assuming that the tree is rooted; we will detect below if it is not */
+    t->isRooted = YES;
+    inLength = NO;
+    for (i=0, j=1; *s!='\0'; s++)
+        {
+        if (*s == ',' || *s == ')' || *s == ':')
+            {
+            if (p->right == NULL && inLength == NO)
+                {
+                temp[i] = '\0';
+                k = atoi (temp);
+                p->index = k-1;
+                i = 0;
+                }
+            else
+                inLength = NO;
+            }
+        if (*s == '(')
+            {
+            q = p;
+            p = &t->nodes[j++];
+            q->left = p;
+            p->anc = q;
+            }
+        else if (*s == ',')
+            {
+            if (p->anc->right == NULL)
+                {
+                q = p->anc;
+                p = &t->nodes[j++];
+                p->anc = q;
+                q->right = p;
+                }
+            else /* if p->anc->right == p (near 'root' of unrooted trees) */
+                {
+                q = p->anc;
+                p = &t->nodes[j++];
+                q->anc = p;
+                p->left = q;
+                t->isRooted = NO;
+                }
+            }
+        else if (*s == ')')
+            {
+            p = p->anc;
+            }
+        else if (*s == ':')
+            {
+            inLength = YES;
+            }
+        else if (inLength == NO)
+            {
+            temp[i++] = *s;
+            }
+        }
+
+    /* attach root to rooted tree */
+    if (t->isRooted == YES)
+        {
+        p = &t->nodes[0];
+        q = &t->nodes[j++];
+        q->left = p;
+        p->anc = q;
+        }
+
+    /* relabel interior nodes, find number of nodes and root */
+    t->nNodes = j;
+    t->nIntNodes = t->nNodes/2 - 1;
+
+    if (t->isRooted == NO)
+        j = t->nNodes - t->nIntNodes;
+    else
+        j = t->nNodes - t->nIntNodes - 1;
+
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = &t->nodes[i];
+        if (p->index == -1)
+            p->index = j++;
+        if (p->anc == NULL)
+            t->root = p;
+        }
+
+    GetDownPass (t);
+
+    return NO_ERROR;
+}
+
+
+/*-----------------------------------------------------------------
+|
+|   ResetBrlensFromTree: copies brlens and depths from second tree (vTree) to
+|       first tree (used to initialize brlen sets for same topology)
+|
+-----------------------------------------------------------------*/
+int ResetBrlensFromTree (Tree *tree, Tree *vTree)
+{
+    int         i, j, k, nLongsNeeded, numTips;
+    MrBFlt      d1, d2;
+    TreeNode    *p, *q;
+
+    if (tree->isRooted != vTree->isRooted)
+        return (ERROR);
+    
+    if (AreTopologiesSame (tree, vTree) == NO)
+        return (ERROR);
+
+    /* allocate and set up partitions */
+    AllocateTreePartitions (vTree);
+    AllocateTreePartitions (tree);
+    numTips = tree->nNodes - tree->nIntNodes - (tree->isRooted == YES ? 1 : 0);
+    nLongsNeeded = (int) ((numTips - 1) / nBitsInALong) + 1;
+
+    /*copy lengths and nodeDepthes*/
+    for (i=0; i<vTree->nNodes; i++)
+        {
+        p  = vTree->allDownPass[i];
+        for (j=0; j<tree->nNodes; j++)
+            {
+            q  = tree->allDownPass[j];
+            for (k=0; k<nLongsNeeded; k++)
+                if (p->partition[k] != q->partition[k])
+                    break;
+            if (k==nLongsNeeded)
+                {
+                q->length = p->length;
+                if (tree->isRooted == YES)
+                    q->nodeDepth = p->nodeDepth;
+                }
+            }
+        }
+
+    if (tree->isRooted == YES)
+        {
+        /*Next compute height for the root. */
+        for (i=0; i<tree->nNodes-1; i++)
+            {
+            p  = tree->allDownPass[i];
+            if (p->left == NULL)
+                p->nodeDepth = 0.0;
+            else
+                {
+                d1 = p->left->nodeDepth + p->left->length;
+                d2 = p->right->nodeDepth + p->right->length;
+                if (d1 > d2)
+                    p->nodeDepth = d1;
+                else
+                    p->nodeDepth = d2;
+                }
+            }
+        for (i=tree->nNodes-3; i>=0; i--)
+            {
+            p = tree->allDownPass[i];
+            if (p->left==NULL && p->calibration==NULL) 
+                continue;    /* leave at 0.0 */
+            p->nodeDepth = p->anc->nodeDepth - p->length;
+            }
+        }
+
+    FreeTreePartitions(tree);
+    FreeTreePartitions(vTree);
+    
+    return (NO_ERROR);
+}
+
+
+/* ResetIntNodeIndices: Set int node indices in downpass order from numTaxa to 2*numTaxa-2 */
+void ResetIntNodeIndices (PolyTree *t)
+{
+    int i, m, index;
+
+    index = t->nNodes - t->nIntNodes;
+
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        if (t->intDownPass[i]->index != index)
+            {
+            SwapRelaxedBranchInfo (t->intDownPass[i]->index, index, t);
+            for (m=0; m<t->nIntNodes; m++)
+                {
+                if (t->intDownPass[m]->index==index)
+                    {
+                    t->intDownPass[m]->index=t->intDownPass[i]->index;
+                    break;
+                    }
+                }
+            t->intDownPass[i]->index = index;
+            }
+        index++;
+        }
+}
+
+
+/* ResetTopologyFromTree: use top to set topology in tree */
+int ResetTopologyFromTree (Tree *tree, Tree *top)
+{
+    int         i, j, k;
+    TreeNode    *p, *q, *r, *p1;
+
+    /* adopt rooting */
+    tree->isRooted = top->isRooted;
+    tree->nNodes = top->nNodes;
+    tree->nIntNodes = top->nIntNodes;
+    
+    /* set all pointers to NULL */
+    for (i=0; i<tree->nNodes; i++)
+        {
+        p = &tree->nodes[i];
+        p->anc = p->right = p->left = NULL;
+        }
+
+    /* now copy topology */
+    for (i=0; i<top->nIntNodes; i++)
+        {
+        p1 = top->intDownPass[i];
+        
+        k = p1->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        p = &tree->nodes[j];
+
+        k = p1->left->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        q = &tree->nodes[j];
+
+        k = p1->right->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        r = &tree->nodes[j];
+
+        p->left = q;
+        p->right= r;
+        q->anc = r->anc = p;
+        }
+
+    /* arrange the root */
+    k = top->root->index;
+    for (j=0; j<tree->nNodes; j++)
+        if (tree->nodes[j].index == k)
+            break;
+    p = &tree->nodes[j];
+
+    k = top->root->left->index;
+    for (j=0; j<tree->nNodes; j++)
+        if (tree->nodes[j].index == k)
+            break;
+    q = &tree->nodes[j];
+    p->left = q;
+    q->anc = p;
+    p->right = p->anc = NULL;
+    tree->root = p;
+
+    GetDownPass (tree);
+
+    return (NO_ERROR);
+}
+
+
+/* ResetTopologyFromPolyTree: use polytree top to set topology in tree */
+int ResetTopologyFromPolyTree (Tree *tree, PolyTree *top)
+{
+    int         i, j, k;
+    TreeNode    *p, *q, *r;
+    PolyNode    *p1;
+
+    if (tree->isRooted != top->isRooted)
+        return (ERROR);
+    
+    /* set all pointers to NULL */
+    for (i=0; i<tree->nNodes; i++)
+        {
+        p = &tree->nodes[i];
+        p->anc = p->right = p->left = NULL;
+        }
+
+    /* now copy topology */
+    for (i=0; i<top->nIntNodes; i++)
+        {
+        p1 = top->intDownPass[i];
+        
+        k = p1->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        p = &tree->nodes[j];
+
+        k = p1->left->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        q = &tree->nodes[j];
+
+        k = p1->left->sib->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        r = &tree->nodes[j];
+
+        p->left = q;
+        p->right= r;
+        q->anc = r->anc = p;
+        }
+
+    /* arrange the root */
+    if (top->isRooted == YES)
+        {
+        k = top->root->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        p = &tree->nodes[j];
+
+        k = top->nNodes;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        q = &tree->nodes[j];
+
+        q->left = p;
+        q->anc = NULL;
+        q->right = NULL;
+        tree->root = q;
+        }
+    else /* if (top->isRooted == NO) */
+    {
+        k = top->root->index;
+        for (j=0; j<tree->nNodes; j++)
+            if (tree->nodes[j].index == k)
+                break;
+        p = &tree->nodes[j];
+
+        k = localOutGroup;
+        for (p1=top->root->left; p1!=NULL; p1=p1->sib)
+            if (p1->index == k)
+                break;
+
+        assert (p1 != NULL);
+        if (p1 == NULL)
+            return (ERROR);
+
+        q = &tree->nodes[p1->index];
+        k = p1->anc->left->sib->sib->index;     /* index of missing child */
+        if (p->left == q)
+            p->left = &tree->nodes[k];
+        else if (p->right == q)
+            p->right = &tree->nodes[k];
+
+        q->anc = q->right = NULL;
+        p->anc = q;
+        q->left = p;
+    }
+
+    GetDownPass (tree);
+
+    return (NO_ERROR);
+}
+
+
+/* ResetTreePartitions: Reset bitsets describing tree partitions */
+void ResetTreePartitions (Tree *t)
+{
+    int         i, j, numTaxa, nLongsNeeded;
+    TreeNode    *p;
+
+    /* get some handy numbers */
+    numTaxa = t->nNodes - t->nIntNodes - (t->isRooted == YES ? 1 : 0);
+    nLongsNeeded = (numTaxa - 1) / nBitsInALong + 1;
+    
+    /* reset bits describing partitions */
+    for (i=0; i<t->nNodes; i++)
+        {
+        assert (t->allDownPass != NULL && t->allDownPass[i] != NULL);
+        assert (t->allDownPass[i]->partition != NULL);
+        
+        p = t->allDownPass[i];
+        for (j=0; j<nLongsNeeded; j++)
+            p->partition[j] = 0;
+        }
+
+    /* set bits describing partitions */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL || (p->anc == NULL && t->isRooted == NO))
+            SetBit (p->index, p->partition);
+        else if (p->anc != NULL)
+            {
+            for (j=0; j<nLongsNeeded; j++)
+                p->partition[j] = p->left->partition[j] | p->right->partition[j];
+            }
+        }
+}
+
+
+/*-------------------------------------------------------
+|
+|   RetrieveRTopology: This routine will rebuild a rooted
+|      tree from the order array created by StoreRTopology.
+|      All tree information except the structure will
+|      remain unaltered.
+|
+--------------------------------------------------------*/
+int RetrieveRTopology (Tree *t, int *order)
+{
+    int         i, numTaxa;
+    TreeNode    *p, *q, *r;
+    
+    numTaxa = t->nNodes - t->nIntNodes - 1;
+    
+    /* sort the tips in the t->allDownPass array */
+    p = t->nodes;
+    for (i=0; i<t->nNodes; i++, p++)
+        t->allDownPass[p->index] = p;
+
+    /* make sure the root has index 2*numTaxa-1 */
+    q = t->allDownPass[t->nNodes-1];
+    q->anc = q->right = NULL;
+    t->root = q;
+
+    /* connect the first two tips */
+    p = t->allDownPass[numTaxa];
+    p->anc = q;
+    q->left = p;
+    p->length = 0.0;
+    q = t->allDownPass[0];
+    r = t->allDownPass[1];
+    p->left = q;
+    p->right = r;
+    q->anc = r->anc = p;
+
+    /* add one tip at a time */
+    for (i=2; i<numTaxa; i++)
+        {
+        p = t->allDownPass[i];
+        q = t->allDownPass[numTaxa-1+i];
+        r = t->allDownPass[*(order++)];
+        p->anc = q;
+        q->left = p;
+        q->right = r;
+        q->anc = r->anc;
+        if (r->anc->left == r)
+            r->anc->left = q;
+        else
+            r->anc->right = q;
+        r->anc = q;
+        }
+
+    /* get downpass */
+    GetDownPass (t);
+
+    /* relabel interior nodes (root is correctly labeled already) */
+    for (i=0; i<t->nIntNodes; i++)
+        t->intDownPass[i]->index = i+numTaxa;
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   RetrieveRTree: This routine will rebuild a rooted
+|      tree from the arrays created by StoreRTree.
+|      All tree information except the structure and
+|      branch lengths will remain unaltered.
+|
+--------------------------------------------------------*/
+int RetrieveRTree (Tree *t, int *order, MrBFlt *brlens)
+{
+    int         i, numTaxa;
+    TreeNode    *p, *q, *r;
+
+    numTaxa = t->nNodes - t->nIntNodes - 1;
+    
+    /* sort the tips in the t->allDownPass array */
+    p = t->nodes;
+    for (i=0; i<t->nNodes; i++, p++)
+        t->allDownPass[p->index] = p;
+
+    /* make sure that root has index 2*numTaxa-1 */
+    q = t->allDownPass[t->nNodes-1];
+    q->anc = q->right = NULL;
+    q->length = 0.0;
+    t->root = q;
+
+    /* connect the first three tips */
+    p = t->allDownPass[numTaxa];
+    p->anc = q;
+    q->left = p;
+    p->length = 0.0;
+    q = t->allDownPass[0];
+    r = t->allDownPass[1];
+    p->left = q;
+    p->right = r;
+    q->anc = r->anc = p;
+    q->length = *(brlens++);
+    r->length = *(brlens++);
+
+    /* add one tip at a time */
+    for (i=2; i<numTaxa; i++)
+        {
+        p = t->allDownPass[i];
+        q = t->allDownPass[numTaxa-1+i];
+        r = t->allDownPass[*(order++)];
+        p->anc = q;
+        q->left = p;
+        q->right = r;
+        q->anc = r->anc;
+        if (r->anc->left == r)
+            r->anc->left = q;
+        else
+            r->anc->right = q;
+        r->anc = q;
+        if (q->anc->anc != NULL)
+            q->length = *(brlens++);
+        else
+            {
+            r->length = *(brlens++);
+            q->length = 0.0;
+            }
+        p->length = *(brlens++);
+        }
+
+    /* get downpass */
+    GetDownPass (t);
+
+    /* relabel interior nodes (root is correctly labeled already) */
+    for (i=0; i<t->nIntNodes; i++)
+        t->intDownPass[i]->index = i+numTaxa;
+
+    /* set the node depths */
+    SetNodeDepths (t);
+    
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   RetrieveRTreeWithIndices: This routine will rebuild a rooted
+|      tree from the arrays created by StoreRTreeWithIndices.
+|      All tree information except the structure, branch lengths
+|      and node indices will remain unaltered.
+|
+--------------------------------------------------------*/
+int RetrieveRTreeWithIndices (Tree *t, int *order, MrBFlt *brlens)
+{
+    int         i, numTaxa;
+    TreeNode    *p, *q, *r;
+
+    extern void ShowNodes (TreeNode *, int, int);
+
+    numTaxa = t->nNodes - t->nIntNodes - 1;
+    
+    /* sort the tips in the t->allDownPass array */
+    p = t->nodes;
+    for (i=0; i<t->nNodes; i++, p++)
+        t->allDownPass[p->index] = p;
+
+    /* make sure that root has index 2*numTaxa-1 */
+    q = t->allDownPass[t->nNodes-1];
+    q->anc = q->right = NULL;
+    q->length = 0.0;
+    t->root = q;
+
+    /* connect the first three 'tips' with interior node, index from order array */
+    p = t->allDownPass[numTaxa];
+    p->x = *(order++);
+    p->anc = q;
+    q->left = p;
+    p->length = 0.0;
+    q = t->allDownPass[0];
+    r = t->allDownPass[1];
+    p->left = q;
+    p->right = r;
+    q->anc = r->anc = p;
+    q->length = *(brlens++);
+    r->length = *(brlens++);
+
+    /* add one tip at a time */
+    for (i=2; i<numTaxa; i++)
+        {
+        p = t->allDownPass[i];
+        assert (*order >= numTaxa && *order < 2*numTaxa - 1);
+        q = t->allDownPass[numTaxa-1+i];
+        q->x = *(order++);
+        r = t->allDownPass[*(order++)];
+        p->anc = q;
+        q->left = p;
+        q->right = r;
+        q->anc = r->anc;
+        if (r->anc->left == r)
+            r->anc->left = q;
+        else
+            r->anc->right = q;
+        r->anc = q;
+        if (q->anc->anc != NULL)
+            q->length = *(brlens++);
+        else
+            {
+            r->length = *(brlens++);
+            q->length = 0.0;
+            }
+        p->length = *(brlens++);
+        }
+
+    /* get downpass */
+    GetDownPass (t);
+
+    /* relabel interior nodes using labels in scratch variable x */
+    for (i=0; i<t->nIntNodes; i++)
+        {
+        p = t->intDownPass[i];
+        p->index = p->x;
+        }
+
+    /* set the node depths */
+    SetNodeDepths (t);
+    
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   RetrieveUTopology: This routine will rebuild an unrooted
+|      tree from the order array created by StoreUTopology.
+|      All tree information except the structure
+|      will remain unaltered.
+|
+--------------------------------------------------------*/
+int RetrieveUTopology (Tree *t, int *order)
+{
+    int         i, numTips;
+    TreeNode    *p, *q, *r;
+    
+    /* preliminaries */
+    numTips = t->nNodes - t->nIntNodes;
+    for (i=0; i<t->nNodes; i++)
+        t->nodes[i].left = t->nodes[i].right = t->nodes[i].anc = NULL;
+
+    /* sort the tips in the t->allDownPass array */
+    p = t->nodes;
+    for (i=0; i<t->nNodes; i++, p++)
+        t->allDownPass[p->index] = p;
+
+    /* make sure root has index 0 */
+    q = t->allDownPass[0];
+    q->anc = q->right = NULL;
+    t->root = q;
+
+    /* connect the first three tips */
+    p = t->allDownPass[numTips];
+    p->anc = q;
+    q->left = p;
+    q = t->allDownPass[1];
+    r = t->allDownPass[2];
+    p->left = q;
+    p->right = r;
+    q->anc = r->anc = p;
+
+    /* add one tip at a time */
+    for (i=3; i<numTips; i++)
+        {
+        p = t->allDownPass[i];
+        q = t->allDownPass[numTips-2+i];
+        r = t->allDownPass[order[i-3]];
+        p->anc = q;
+        q->left = p;
+        q->right = r;
+        q->anc = r->anc;
+        if (r->anc->left == r)
+            r->anc->left = q;
+        else
+            r->anc->right = q;
+        r->anc = q;
+        }
+
+    /* get downpass */
+    GetDownPass (t);
+    
+    /* relabel interior nodes (root is correctly labeled already) */
+    for (i=0; i<t->nIntNodes; i++)
+        t->intDownPass[i]->index = i+numTips;
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   RetrieveUTree: This routine will rebuild an unrooted
+|      tree from the arrays created by StoreUTree.
+|      All tree information except the structure and
+|      branch lengths will remain unaltered.
+|
+--------------------------------------------------------*/
+int RetrieveUTree (Tree *t, int *order, MrBFlt *brlens)
+{
+    int         i, numTips;
+    TreeNode    *p, *q, *r;
+    
+    /* preliminaries */
+    numTips = t->nNodes - t->nIntNodes;
+    for (i=0; i<t->nNodes; i++)
+        t->nodes[i].left = t->nodes[i].right = t->nodes[i].anc = NULL;
+    
+    /* sort the tips in the t->allDownPass array */
+    p = t->nodes;
+    for (i=0; i<t->nNodes; i++, p++)
+        t->allDownPass[p->index] = p;
+
+    /* make sure that root has index 0 */
+    q = t->allDownPass[0];
+    q->anc = q->right = NULL;
+    t->root = q;
+
+    /* connect the first three tips */
+    p = t->allDownPass[numTips];
+    p->anc = q;
+    q->left = p;
+    p->length = *(brlens++);
+    q = t->allDownPass[1];
+    r = t->allDownPass[2];
+    p->left = q;
+    p->right = r;
+    q->anc = r->anc = p;
+    q->length = *(brlens++);
+    r->length = *(brlens++);
+
+    /* add one tip at a time */
+    for (i=3; i<numTips; i++)
+        {
+        p = t->allDownPass[i];
+        q = t->allDownPass[numTips-2+i];
+        r = t->allDownPass[order[i-3]];
+        p->anc = q;
+        q->left = p;
+        q->right = r;
+        q->anc = r->anc;
+        if (r->anc->left == r)
+            r->anc->left = q;
+        else
+            r->anc->right = q;
+        r->anc = q;
+        q->length = *(brlens++);
+        p->length = *(brlens++);
+        }
+
+    /* get downpass */
+    GetDownPass (t);
+
+    /* relabel interior nodes (root is correctly labeled already) */
+    for (i=0; i<t->nIntNodes; i++)
+        t->intDownPass[i]->index = i+numTips;
+
+    return (NO_ERROR);
+}
+
+
+void SetDatedNodeAges (Param *param, int chain, int state)
+{
+    int         i;
+    MrBFlt      clockRate;
+    ModelInfo   *m;
+    TreeNode    *p;
+    Tree        *t;
+
+    extern void ShowNodes(TreeNode *,int,int);
+
+    t = GetTree (param, chain, state);
+    m = &modelSettings[t->relParts[0]];
+
+    if (m->clockRate == NULL)
+        clockRate = 1.0;
+    else
+        clockRate = *GetParamVals(m->clockRate, chain, state);
+
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->isDated == YES)
+            p->age = p->nodeDepth / clockRate;
+        else
+            p->age = -1.0;
+        }
+}
+
+
+void SetNodeDepths (Tree *t)
+{
+    int     i;
+    MrBFlt      d1, d2;
+    TreeNode    *p;
+
+    extern void ShowNodes(TreeNode *,int,int);
+
+    for (i=0; i<t->nNodes-1; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->nodeDepth = 0.0;
+        else
+            {
+            d1 = p->left->nodeDepth  + p->left->length;
+            d2 = p->right->nodeDepth + p->right->length;
+            //assert (!(t->isCalibrated == NO && AreDoublesEqual(d1,d2,0.00001)==NO)); // may not work if we set startval topology of strict clock tree by non clock tree. 
+            if (d1 > d2)
+                p->nodeDepth = d1;
+            else
+                p->nodeDepth = d2;
+            }
+        }
+
+    for (i=t->nNodes-3; i>=0; i--)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->calibration == NULL)
+            p->nodeDepth = 0.0;
+        else
+            p->nodeDepth = p->anc->nodeDepth - p->length;
+        }
+}
+
+
+/* Set ages of a clock tree according to depth and clockrate. Check that resulting ages are consistant with calibration.
+|  return YES if tree is age consistent, No otherwise.
+*/
+int SetTreeNodeAges (Param *param, int chain, int state)
+{
+    Tree        *tree;
+    TreeNode    *p;
+    int         i;
+    MrBFlt      clockRate;
+
+    if (param->paramType != P_TOPOLOGY && param->paramType != P_BRLENS && param->paramType != P_SPECIESTREE)
+        return YES;
+
+    tree = GetTree(param, chain, state);
+    if (modelSettings[param->relParts[0]].clockRate != NULL)
+        clockRate = *GetParamVals(modelSettings[param->relParts[0]].clockRate, chain, state);
+    else
+        return YES;
+
+    /* Clock trees */
+
+    /* Check that lengths and depths are consistant. That would work for the case when we set up branch length from starting tree  */
+    for (i=0; i<tree->nNodes-1; i++) {
+        p = tree->allDownPass[i];
+        p->age =  p->nodeDepth / clockRate;
+    }
+
+    /* Check that ages and calibrations are consistent */
+    if (tree->isCalibrated == YES)
+        {
+        for (i=0; i<tree->nNodes-1; i++)
+            {
+            p = tree->allDownPass[i];
+            if (p->isDated == YES) {
+                if (p->calibration->prior == fixed && fabs((p->age - p->calibration->priorParams[0])/p->age) > 0.000001)
+                    {
+                    printf ("Node %d has age %f but should be fixed to age %f\n",
+                        p->index, p->age, p->calibration->priorParams[0]);
+                    return NO;
+                    }
+                else if (p->calibration->prior == uniform && (p->age < p->calibration->min || p->age > p->calibration->max))
+                    {
+                    printf ("Node %d has age %f but should be in the interval [%f,%f]\n",
+                        p->index, p->age, p->calibration->min, p->calibration->max);
+                    return NO;
+                    }
+                else if (p->age < p->calibration->min)
+                    {
+                    printf ("Node %d has age %f but should be minimally of age %f\n",
+                        p->index, p->age, p->calibration->min);
+                    return NO;
+                    }
+                else if (p->age > p->calibration->max)
+                    {
+                    printf ("Node %d has age %f but should be maximally of age %f\n",
+                        p->index, p->age, p->calibration->max);
+                    return NO;
+                    }
+                }
+            }
+        }
+
+    return YES;
+}
+
+
+int ShowPolyNodes (PolyTree *pt)
+{
+    int             i;
+    PolyNode        *p;
+
+    /* this is the tree, on a node-by-node basis */
+    printf ("   memnodes = %d  nNodes = %d  nIntNodes = %d  root = %d\n", pt->memNodes, pt->nNodes, pt->nIntNodes, pt->root->index);
+    printf ("   isRooted = %d\n", pt->isRooted);
+    printf ("   no. index (left sib anc) -- locked/free -- label (p->x)\n");
+    for (i=0; i<pt->memNodes; i++)
+        {
+        p = &pt->nodes[i];
+        if (!(p->left == NULL && p->sib == NULL && p->anc == NULL))
+            {
+            printf ("%4d -- %4d ", i, p->index);
+            if (p->left != NULL)
+                printf ("(%4d ", p->left->index);
+            else
+                printf ("(null ");
+
+            if (p->sib != NULL)
+                printf ("%4d ", p->sib->index);
+            else
+                printf ("null ");
+                
+            if (p->anc != NULL)
+                printf ("%4d)", p->anc->index);
+            else
+                printf ("null)");
+            
+            if (p->isLocked == YES)
+                printf ("-- locked -- ");
+            else
+                printf ("-- free --");
+
+            if (p->left == NULL && p->anc != NULL)
+                printf ("  \"%s\" (%d)\n", p->label, p->x);
+            else
+                printf (" \"\" (%d)\n", p->x);
+            }
+        }
+
+    return NO_ERROR;
+}
+
+
+/* ShowTree: Show tree on screen */
+int ShowTree (Tree *t)
+{
+    int             i, j, k, x, nLines, nLevels, levelDepth, from, to;
+    char            treeLine[SCREENWIDTH2], labelLine[100];
+    TreeNode        *p;
+    
+    /* get coordinates */
+    x = 0;
+    nLines = 0;
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL && p->right == NULL)
+            {
+            p->x = x;
+            x += 2;
+            p->y = 0;
+            nLines += 2;
+            }
+        else if (p->left != NULL && p->right != NULL && p->anc != NULL)
+            {
+            p->x = p->left->x + (p->right->x - p->left->x) / 2;
+            if (p->left->y > p->right->y)
+                p->y = p->left->y + 1;
+            else
+                p->y = p->right->y + 1;
+            }
+        else
+            {
+            p->x = x;
+            x += 2;
+            p->y = 0;
+            }
+        }
+
+    /* print tree out, line-by-line */
+    levelDepth = SCREENWIDTH / t->root->left->y;
+    nLevels = t->root->left->y;
+    for (j=0; j<=nLines-2; j++)
+        {
+        for (i=0; i<SCREENWIDTH2-2; i++)
+            treeLine[i] = ' ';
+        treeLine[SCREENWIDTH-1] = '\n';
+        if (j % 2 == 0)
+            {
+            for (i=0; i<t->nNodes; i++)
+                {
+                p = t->allDownPass[i];
+                if (p->left == NULL && p->x == j)
+                    {
+                    strcpy (labelLine, p->label);
+                    }
+                }
+            }
+        for (i=0; i<t->nNodes; i++)
+            {
+            p = t->allDownPass[i];
+            if (p->anc != NULL)
+                {
+                if (p->anc->anc != NULL)
+                    {
+                    if (p->x == j)
+                        {
+                        from = (nLevels - p->anc->y) * levelDepth;
+                        to   = (nLevels - p->y) * levelDepth;
+                        if (p->y == 0)
+                            to = SCREENWIDTH-1;
+                        if (to >= SCREENWIDTH)
+                            to = SCREENWIDTH-1;
+                            
+                        for (k=from; k<to; k++)
+                            treeLine[k] = '-';
+                        if (p->anc->left == p)
+                            treeLine[from] = '/';
+                        else
+                            treeLine[from] = '\\';
+                        if (p->left != NULL)
+                            {
+                            treeLine[to] = '+';
+                            }
+                        if (p->anc->anc == t->root && p->anc->right == p)
+                            {
+                            if (t->isRooted == NO)
+                                treeLine[to] = '+';
+                            else
+                                treeLine[from] = '\\';
+                            }
+                        }
+                    else
+                        {
+                        if (p->left != NULL && p->right != NULL)
+                            {
+                            if (j < p->x && j > p->left->x)
+                                {
+                                from = (nLevels - p->y) * levelDepth;
+                                treeLine[from] = '|';
+                                }
+                            else if (j > p->x && j < p->right->x && p->left != NULL)
+                                {
+                                from = (nLevels - p->y) * levelDepth;
+                                treeLine[from] = '|';
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    if (p->x == j)
+                        {
+                        treeLine[0] = '|'; /* temp */
+                        }
+                    else if (j < p->x && j > p->left->x)
+                        {
+                        treeLine[0] = '|';
+                        }
+                    else if (j > p->x && j < p->right->x)
+                        {
+                        treeLine[0] = '|';
+                        }
+                    if (t->isRooted == NO)
+                        {
+                        if (j > p->x && j <= nLines-2)
+                            treeLine[0] = '|';
+                        if (j == p->right->x)
+                            treeLine[0] = '+';
+                        }
+                    else
+                        {
+                        if (j == p->x)
+                            treeLine[0] = '+';
+                        }
+                    }
+                }
+            }
+        treeLine[SCREENWIDTH-1] = '\0';
+        if (j % 2 == 0)
+            MrBayesPrint ("   %s %s\n", treeLine, labelLine);
+        else
+            MrBayesPrint ("   %s \n", treeLine);
+        }
+
+    if (t->isRooted == NO)
+        {
+        for (i=0; i<SCREENWIDTH; i++)
+            treeLine[i] = ' ';
+        treeLine[SCREENWIDTH-1] = '\0';
+        MrBayesPrint ("   |\n");
+        for (k=0; k<SCREENWIDTH; k++)
+            treeLine[k] = '-';
+        treeLine[SCREENWIDTH-1] = '\0';
+        treeLine[0] = '\\';
+        strcpy (labelLine, t->root->label);
+        labelLine[19] = '\0';
+        MrBayesPrint ("   %s %s\n", treeLine, labelLine);
+        }
+    
+#   if defined (DEBUG_CONSTRAINTS)
+    for (i=0; i<t->nNodes; i++)
+        printf ("%d -- %s\n", t->allDownPass[i]->index + 1, t->allDownPass[i]->isLocked == YES ? "locked" : "free");
+#   endif
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreRPolyTopology: Same as StoreRTopology but for
+|   binary polytree source trees.
+|
+--------------------------------------------------------*/
+int StoreRPolyTopology (PolyTree *t, int *order)
+{
+    int         i, numTaxa;
+    PolyNode    *p, *q;
+    
+    /* find number of taxa */
+    numTaxa = t->nNodes - t->nIntNodes;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first two taxa */
+        if (p->index > 1 && p->index < numTaxa)
+            order[p->index-2] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else
+            {
+            if (p->left->y < p->left->sib->y)
+                {
+                p->y = p->left->y;
+                p->x = p->left->sib->y + numTaxa - 1;
+                }
+            else
+                {
+                p->y = p->left->sib->y;
+                p->x = p->left->y + numTaxa - 1;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    for (i=0; i<numTaxa-2; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTaxa-3-i]];
+        q = p->anc;
+        if (q->left == p)
+            {
+            order[numTaxa-3-i] = q->left->sib->x;
+            p->sib->anc = q->anc;
+            if (q->anc == NULL)
+                {
+                p->sib->left->sib->sib = p->sib->sib;
+                p->sib->sib = NULL;
+                }
+            else if (q->anc->left == q)
+                {
+                q->anc->left = q->left->sib;
+                p->sib->sib = q->sib;
+                }
+            else
+                q->anc->left->sib = q->left->sib;
+            }
+        else
+            {
+            order[numTaxa-3-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc == NULL)
+                {
+                q->left->left->sib->sib = p->sib;
+                q->left->sib = NULL;
+                }
+            else if (q->anc->left == q)
+                {
+                q->anc->left = q->left;
+                q->anc->left->sib = q->sib;
+                }
+            else
+                {
+                q->anc->left->sib = q->left;
+                q->left->sib = NULL;
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreRPolyTree: Same as StoreRTree but for
+|      binary rooted polytree source trees.
+|
+--------------------------------------------------------*/
+int StoreRPolyTree (PolyTree *t, int *order, MrBFlt *brlens)
+{
+    int         i, j, numTaxa;
+    PolyNode    *p, *q;
+    
+    /* find number of taxa */
+    numTaxa = t->nNodes - t->nIntNodes;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first two taxa */
+        if (p->index > 1 && p->index < numTaxa)
+            order[p->index-2] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else
+            {
+            if (p->left->y < p->left->sib->y)
+                {
+                p->y = p->left->y;
+                p->x = p->left->sib->y + numTaxa - 1;
+                }
+            else
+                {
+                p->y = p->left->sib->y;
+                p->x = p->left->y + numTaxa - 1;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    j = t->nNodes - 2;     /* index of first branch length */
+    for (i=0; i<numTaxa-2; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTaxa-3-i]];
+        q = p->anc;
+        brlens[j--] = p->length;
+        brlens[j--] = q->length;
+        if (q->left == p)
+            {
+            order[numTaxa-3-i] = q->left->sib->x;
+            p->sib->anc = q->anc;
+            if (q->anc == NULL)
+                {
+                p->sib->left->sib->sib = p->sib->sib;
+                p->sib->sib = NULL;
+                }
+            else if (q->anc->left == q)
+                {
+                q->anc->left = q->left->sib;
+                p->sib->sib = q->sib;
+                }
+            else
+                q->anc->left->sib = q->left->sib;
+            }
+        else
+            {
+            order[numTaxa-3-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc == NULL)
+                {
+                q->left->left->sib->sib = p->sib;
+                q->left->sib = NULL;
+                }
+            else if (q->anc->left == q)
+                {
+                q->anc->left = q->left;
+                q->anc->left->sib = q->sib;
+                }
+            else
+                {
+                q->anc->left->sib = q->left;
+                q->left->sib = NULL;
+                }
+            }
+        }
+
+    /* store the last two lengths; index 0 and 1 */
+    p = t->root;
+    brlens[p->left->index] = p->left->length;
+    brlens[p->left->sib->index] = p->left->sib->length;
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreRTopology: This routine will break a rooted tree
+|      into an array of ints describing the structure
+|      of the tree. The tree will be destroyed
+|      in the process (the node pointers, that is).
+|      However, the tree is not deleted.
+|
+--------------------------------------------------------*/
+int StoreRTopology (Tree *t, int *order)
+{
+    int         i, numTaxa;
+    TreeNode    *p, *q;
+    
+    /* find number of taxa */
+    numTaxa = t->nNodes - t->nIntNodes - 1;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first two taxa */
+        if (p->index > 1 && p->index < numTaxa)
+            order[p->index-2] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else if (p->right != NULL)
+            {
+            if (p->left->y < p->right->y)
+                {
+                p->y = p->left->y;
+                p->x = p->right->y + numTaxa - 1;
+                }
+            else
+                {
+                p->y = p->right->y;
+                p->x = p->left->y + numTaxa - 1;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    for (i=0; i<numTaxa-2; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTaxa-3-i]];
+        q = p->anc;
+        if (q->left == p)
+            {
+            order[numTaxa-3-i] = q->right->x;
+            q->right->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->right;
+            else
+                q->anc->right = q->right;
+            }
+        else
+            {
+            order[numTaxa-3-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->left;
+            else
+                q->anc->right = q->left;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreRTree: This routine will break a rooted tree
+|      into an array of ints describing the structure
+|      of the tree and an array of doubles storing
+|      the branch lengths. The tree will be
+|      destroyed in the process (the node pointers,
+|      that is). However, the tree is not deleted.
+|
+--------------------------------------------------------*/
+int StoreRTree (Tree *t, int *order, MrBFlt *brlens)
+{
+    int         i, j, numTaxa;
+    TreeNode    *p, *q;
+
+    extern void ShowNodes (TreeNode *p, int indent, int isRooted);
+
+    /* find number of taxa */
+    numTaxa = t->nNodes - t->nIntNodes - 1;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first two taxa */
+        if (p->index > 1 && p->index < numTaxa)
+            order[p->index-2] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else if (p->right != NULL)
+            {
+            if (p->left->y < p->right->y)
+                {
+                p->y = p->left->y;
+                p->x = p->right->y + numTaxa - 1;
+                }
+            else
+                {
+                p->y = p->right->y;
+                p->x = p->left->y + numTaxa - 1;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    j = 2 * numTaxa - 3;
+    for (i=0; i<numTaxa-2; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTaxa-3-i]];
+        q = p->anc;
+        brlens[j--] = p->length;
+        if (q->left == p)
+            {
+            if (q->anc->anc != NULL)
+                brlens[j--] = q->length;
+            else
+                brlens[j--] = q->right->length;
+            order[numTaxa-3-i] = q->right->x;
+            q->right->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->right;
+            else
+                q->anc->right = q->right;
+            }
+        else
+            {
+            if (q->anc->anc != NULL)
+                brlens[j--] = q->length;
+            else
+                brlens[j--] = q->left->length;
+            order[numTaxa-3-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->left;
+            else
+                q->anc->right = q->left;
+            }
+        }
+
+    /* store the final two branch lengths in the right order; they have indices 0 and 1 */
+    p = t->root->left;
+    brlens[p->left->index] = p->left->length;
+    brlens[p->right->index] = p->right->length;
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreRTreeWithIndices: This routine will break a rooted
+|      tree into an array of ints describing the structure
+|      of the tree and the interior node indices, and an array
+|      of doubles storing the branch lengths. The tree will be
+|      destroyed in the process (the node pointers,
+|      that is). However, the tree is not deleted.
+|
+--------------------------------------------------------*/
+int StoreRTreeWithIndices (Tree *t, int *order, MrBFlt *brlens)
+{
+    int         i, j, k, numTaxa;
+    TreeNode    *p, *q;
+
+    extern void ShowNodes (TreeNode *p, int indent, int isRooted);
+
+    /* find number of taxa */
+    numTaxa = t->nNodes - t->nIntNodes - 1;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first two taxa */
+        if (p->index > 1 && p->index < numTaxa)
+            order[p->index-2] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else if (p->right != NULL)
+            {
+            if (p->left->y < p->right->y)
+                {
+                p->y = p->left->y;
+                p->x = p->right->y + numTaxa - 1;
+                }
+            else
+                {
+                p->y = p->right->y;
+                p->x = p->left->y + numTaxa - 1;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    j = 2 * numTaxa - 3;
+    k = 2*(numTaxa - 2);
+    for (i=0; i<numTaxa-2; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTaxa-3-i]];
+        q = p->anc;
+        brlens[j--] = p->length;
+        if (q->left == p)
+            {
+            if (q->anc->anc != NULL)
+                brlens[j--] = q->length;
+            else
+                brlens[j--] = q->right->length;
+            order[k--] = q->right->x;
+            order[k--] = q->index;
+            q->right->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->right;
+            else
+                q->anc->right = q->right;
+            }
+        else
+            {
+            if (q->anc->anc != NULL)
+                brlens[j--] = q->length;
+            else
+                brlens[j--] = q->left->length;
+            order[k--] = q->left->x;
+            order[k--] = q->index;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->left;
+            else
+                q->anc->right = q->left;
+            }
+        }
+
+    /* store the final two branch lengths in the right order; they have indices 0 and 1 */
+    p = t->root->left;
+    order[k] = p->index;
+    brlens[p->left->index] = p->left->length;
+    brlens[p->right->index] = p->right->length;
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreUPolyTopology: Same as StoreUTopology but for
+|      binary polytree source.
+|
+--------------------------------------------------------*/
+int StoreUPolyTopology (PolyTree *t, int *order)
+{
+    int         i, numTips;
+    PolyNode    *p, *q;
+
+    /* check if the tree is rooted on taxon 0 */
+    if (t->root->left->sib->sib->index != 0)
+        MovePolyCalculationRoot (t, 0);
+
+    /* rearrange the root */
+    t->root->anc = t->root->left->sib->sib;
+    t->root->left->sib->sib = NULL;
+    t->root->anc->left = t->root;
+    t->root->anc->sib = NULL;
+    t->root->anc->anc = NULL;
+    t->root = t->root->anc;
+
+    /* find number of tips */
+    numTips = t->nNodes - t->nIntNodes;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first three taxa */
+        if (p->index > 2 && p->index < numTips)
+            order[p->index-3] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL || p->anc == NULL)
+            p->x = p->y = p->index;
+        else
+            {
+            if (p->left->y < p->left->sib->y)
+                {
+                p->y = p->left->y;
+                p->x = p->left->sib->y + numTips - 2;
+                }
+            else
+                {
+                p->y = p->left->sib->y;
+                p->x = p->left->y + numTips - 2;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    for (i=0; i<numTips-3; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTips-4-i]];
+        q = p->anc;
+        if (q->left == p)
+            {
+            order[numTips-4-i] = q->left->sib->x;
+            p->sib->anc = q->anc;
+            if (q->anc->left == q)
+                {
+                q->anc->left = p->sib;
+                p->sib->sib = q->sib;
+                }
+            else
+                {
+                q->anc->left->sib = p->sib;
+                p->sib->sib = q->sib;
+                }
+            }
+        else
+            {
+            order[numTips-4-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                {
+                q->anc->left = q->left;
+                q->left->sib = q->sib;
+                }
+            else
+                {
+                q->anc->left->sib = q->left;
+                q->left->sib = q->sib;
+                }
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreUPolyTree: Same as StoreUTopology but for
+|      binary polytree source.
+|
+--------------------------------------------------------*/
+int StoreUPolyTree (PolyTree *t, int *order, MrBFlt *brlens)
+{
+    int         i, j, numTips;
+    PolyNode    *p, *q;
+
+    /* check if the tree is rooted on taxon 0 */
+    if (t->root->left->sib->sib->index != 0)
+        MovePolyCalculationRoot (t, 0);
+
+    /* rearrange the root */
+    t->root->anc = t->root->left->sib->sib;
+    t->root->left->sib->sib = NULL;
+    t->root->anc->left = t->root;
+    t->root->anc->sib = NULL;
+    t->root->anc->anc = NULL;
+    t->root = t->root->anc;
+
+    /* find number of tips */
+    numTips = t->nNodes - t->nIntNodes;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first three taxa */
+        if (p->index > 2 && p->index < numTips)
+            order[p->index-3] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL || p->anc == NULL)
+            p->x = p->y = p->index;
+        else
+            {
+            if (p->left->y < p->left->sib->y)
+                {
+                p->y = p->left->y;
+                p->x = p->left->sib->y + numTips - 2;
+                }
+            else
+                {
+                p->y = p->left->sib->y;
+                p->x = p->left->y + numTips - 2;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    j = 2*numTips - 4;
+    for (i=0; i<numTips-3; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTips-4-i]];
+        assert (p->index > 2 && p->index < numTips);
+        assert (p->anc->anc != NULL);
+        q = p->anc;
+        brlens[j--] = p->length;
+        brlens[j--] = q->length;
+        if (q->left == p)
+            {
+            order[numTips-4-i] = q->left->sib->x;
+            p->sib->anc = q->anc;
+            if (q->anc->left == q)
+                {
+                q->anc->left = p->sib;
+                p->sib->sib = q->sib;
+                }
+            else
+                {
+                q->anc->left->sib = p->sib;
+                p->sib->sib = q->sib;
+                }
+            }
+        else
+            {
+            order[numTips-4-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                {
+                q->anc->left = q->left;
+                q->left->sib = q->sib;
+                }
+            else
+                {
+                q->anc->left->sib = q->left;
+                q->left->sib = q->sib;
+                }
+            }
+        }
+
+    /* store last three branch lengths, index 0, 1, 2 */
+    q = t->root;
+    assert (q->index == 0);
+    brlens[q->index] = q->length;
+    q = q->left->left;
+    assert (q->index == 1 || q->index == 2);
+    brlens[q->index] = q->length;
+    q = q->sib;
+    assert (q->index == 1 || q->index == 2);
+    brlens[q->index] = q->length;
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreUTopology: This routine will break an unrooted tree
+|      into an array of ints describing the structure
+|      of the tree. The tree will be destroyed
+|      in the process (the node pointers, that is).
+|      However, the tree is not deleted.
+|
+--------------------------------------------------------*/
+int StoreUTopology (Tree *t, int *order)
+{
+    int         i, numTips;
+    TreeNode    *p, *q;
+
+    /* check if the tree is rooted on taxon 0 */
+    if (t->root->index != 0)
+        MoveCalculationRoot (t, 0);
+
+    /* find number of tips */
+    numTips = t->nNodes - t->nIntNodes;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first three taxa */
+        if (p->index > 2 && p->index < numTips)
+            order[p->index-3] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else if (p->right != NULL)
+            {
+            if (p->left->y < p->right->y)
+                {
+                p->y = p->left->y;
+                p->x = p->right->y + numTips - 2;
+                }
+            else
+                {
+                p->y = p->right->y;
+                p->x = p->left->y + numTips - 2;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    for (i=0; i<numTips-3; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTips-4-i]];
+        q = p->anc;
+        if (q->left == p)
+            {
+            order[numTips-4-i] = q->right->x;
+            q->right->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->right;
+            else
+                q->anc->right = q->right;
+            }
+        else
+            {
+            order[numTips-4-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->left;
+            else
+                q->anc->right = q->left;
+            }
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*-------------------------------------------------------
+|
+|   StoreUTree: This routine will break an unrooted tree
+|      into an array of ints describing the structure
+|      of the tree and an array of doubles storing
+|      the branch lengths. The tree will be
+|      destroyed in the process (the node pointers,
+|      that is). However, the tree is not deleted.
+|
+--------------------------------------------------------*/
+int StoreUTree (Tree *t, int *order, MrBFlt *brlens)
+{
+    int         i, j, numTips;
+    TreeNode    *p, *q;
+
+    /* check if the tree is rooted on taxon 0 */
+    if (t->root->index != 0)
+        MoveCalculationRoot(t, 0);
+
+    /* find number of tips */
+    numTips = t->nNodes - t->nIntNodes;
+
+    /* first get the terminal taxon positions and store
+       them in the order array. */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        /* we do not need to worry about the first three taxa */
+        if (p->index > 2 && p->index < numTips)
+            order[p->index-3] = i;
+        }
+
+    /* label the interior nodes with the correct index */
+    for (i=0; i<t->nNodes; i++)
+        {
+        p = t->allDownPass[i];
+        if (p->left == NULL)
+            p->x = p->y = p->index;
+        else if (p->right != NULL)
+            {
+            if (p->left->y < p->right->y)
+                {
+                p->y = p->left->y;
+                p->x = p->right->y + numTips - 2;
+                }
+            else
+                {
+                p->y = p->right->y;
+                p->x = p->left->y + numTips - 2;
+                }
+            }
+        }
+
+    /* break the tree into pieces */
+    j = 2 * numTips - 4;
+    for (i=0; i<numTips-3; i++)
+        {
+        /* find the next node to remove */
+        p = t->allDownPass[order[numTips-4-i]];
+        q = p->anc;
+        brlens[j--] = p->length;
+        brlens[j--] = q->length;
+        if (q->left == p)
+            {
+            order[numTips-4-i] = q->right->x;
+            q->right->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->right;
+            else
+                q->anc->right = q->right;
+            }
+        else
+            {
+            order[numTips-4-i] = q->left->x;
+            q->left->anc = q->anc;
+            if (q->anc->left == q)
+                q->anc->left = q->left;
+            else
+                q->anc->right = q->left;
+            }
+        }
+
+    /* store the final three branch lengths */
+    /* we need to check the rotation of the tree to 
+           store the brlens in the right order (after node index) */
+    p = t->root->left;
+    if (p->right->index == 2)
+            {
+            brlens[j--] = p->right->length;
+        brlens[j--] = p->left->length;
+            }
+    else
+            {
+            brlens[j--] = p->left->length;
+            brlens[j--] = p->right->length;
+            }
+    brlens[j--] = p->length;
+
+    return (NO_ERROR);
+}
+
+
+/* TreeLength: Calculate tree length */
+MrBFlt TreeLen (Tree *t)
+{
+    int     i, numLenNodes;
+    MrBFlt  len = 0.0;
+
+    if (t->isRooted == NO)
+        numLenNodes = t->nNodes - 1;
+    else
+        numLenNodes = t->nNodes - 2;
+
+    for (i=0; i<numLenNodes; i++)
+        len += t->allDownPass[i]->length;
+
+    return len;
+}
+
+
+/*-------------------------------------------------------------------------------------------
+|
+|   Unmark: This routine will unmark a subtree rooted at p
+|
+---------------------------------------------------------------------------------------------*/
+void Unmark (TreeNode *p)
+{
+    if (p != NULL)
+        {
+        p->marked = NO;
+        Unmark (p->left);
+        Unmark (p->right);
+        }
+}
+
+
+void WriteEventTree (TreeNode *p, int chain, Param *param)
+{
+    int             j, nEvents;
+    MrBFlt          brlen, *position, *rateMult;
+
+    if (p != NULL)
+        {
+        if (p->left == NULL && p->right == NULL)
+            {
+            printf ("%d:%s", p->index + 1, MbPrintNum(p->length));
+            if (param->paramType == P_CPPEVENTS)
+                {
+                nEvents = param->nEvents[2*chain+state[chain]][p->index];
+                if (nEvents > 0)
+                    {
+                    printf ("[&E %s %d: (", param->name, nEvents);
+                    position = param->position[2*chain+state[chain]][p->index];
+                    rateMult = param->rateMult[2*chain+state[chain]][p->index];
+                    for (j=0; j<nEvents; j++)
+                        {
+                        printf ("%s %s", MbPrintNum(position[j]), MbPrintNum(rateMult[j]));
+                        if (j != nEvents-1)
+                            printf (", ");
+                        }
+                    printf (")]");
+                    }
+                else
+                    printf ("[&E %s 0]", param->name);
+                }
+            brlen = GetParamSubVals (param, chain, state[chain])[p->index];
+            // brlen = (GetParamSubVals (param, chain, state[chain])[p->index] + GetParamVals (param, chain, state[chain])[p->anc->index]) / 2.0;
+            printf ("[&B %s %s]", param->name, MbPrintNum(brlen));
+            }
+        else
+            {
+            if (p->anc != NULL)
+                printf ("(");
+            WriteEventTree(p->left, chain, param);
+            printf (",");
+            WriteEventTree(p->right, chain, param);
+            if (p->anc != NULL)
+                {               
+                if (p->anc->anc != NULL)
+                    {
+                    printf ("):%s", MbPrintNum(p->length));
+                    if (param->paramType == P_CPPEVENTS)
+                        {
+                        nEvents = param->nEvents[2*chain+state[chain]][p->index];
+                        if (nEvents > 0)
+                            {
+                            printf ("[&E %s %d: (", param->name, nEvents);
+                            position = param->position[2*chain+state[chain]][p->index];
+                            rateMult = param->rateMult[2*chain+state[chain]][p->index];
+                            for (j=0; j<nEvents; j++)
+                                {
+                                printf ("%s %s", MbPrintNum(position[j]), MbPrintNum(rateMult[j]));
+                                if (j != nEvents-1)
+                                    printf (", ");
+                                }
+                            printf (")]");
+                            }
+                        else
+                            printf ("[&E %s 0]", param->name);
+                        }
+                    brlen = GetParamSubVals (param, chain, state[chain])[p->index];
+                    // brlen = (GetParamSubVals (param, chain, state[chain])[p->index] + GetParamVals (param, chain, state[chain])[p->anc->index]) / 2.0;
+                    printf ("[&B %s %s]", param->name, MbPrintNum(brlen));
+                    }
+                else
+                    printf (")");
+                }
+            }
+        }
+}
+
+
+void WriteEventTreeToPrintString (TreeNode *p, int chain, Param *param, int printAll)
+{
+    char            *tempStr;
+    int             i, j, nEvents, tempStrSize = TEMPSTRSIZE;
+    MrBFlt          brlen, *position, *rateMult;
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+
+    if (p != NULL)
+        {
+        if (p->left == NULL && p->right == NULL)
+            {
+            SafeSprintf (&tempStr, &tempStrSize, "%d:%s", p->index + 1, MbPrintNum(p->length));
+            AddToPrintString (tempStr);
+            for (i=0; i<param->nSubParams; i++)
+                {
+                if (param->subParams[i]->paramType == P_CPPEVENTS)
+                    {
+                    nEvents = param->subParams[i]->nEvents[2*chain+state[chain]][p->index];
+                    if (nEvents > 0)
+                        {
+                        SafeSprintf (&tempStr, &tempStrSize, "[&E %s %d", param->subParams[i]->name, nEvents);
+                        AddToPrintString (tempStr);
+                        position = param->subParams[i]->position[2*chain+state[chain]][p->index];
+                        rateMult = param->subParams[i]->rateMult[2*chain+state[chain]][p->index];
+                        if (printAll == YES)
+                            {
+                            SafeSprintf (&tempStr, &tempStrSize, ": (");
+                            AddToPrintString (tempStr);
+                            for (j=0; j<nEvents; j++)
+                                {
+                                SafeSprintf (&tempStr, &tempStrSize, "%s", MbPrintNum(position[j]));
+                                AddToPrintString (tempStr);
+                                SafeSprintf (&tempStr, &tempStrSize, " %s",  MbPrintNum(rateMult[j]));
+                                AddToPrintString (tempStr);
+                                if (j != nEvents-1)
+                                    AddToPrintString (",");
+                                else
+                                    AddToPrintString (")");
+                                }
+                            }
+                        AddToPrintString ("]");
+                        }
+                    else
+                        {
+                        SafeSprintf (&tempStr, &tempStrSize, "[&E %s 0]", param->subParams[i]->name);
+                        AddToPrintString (tempStr);
+                        }
+                    }
+                else if (param->subParams[i]->paramType != P_CPPEVENTS)
+                    {
+                    /* other relaxed clock models */
+                    brlen = GetParamSubVals (param->subParams[i], chain, state[chain])[p->index];
+                    SafeSprintf (&tempStr, &tempStrSize, "[&B %s %s]", param->subParams[i]->name, MbPrintNum(brlen));
+                    AddToPrintString (tempStr);
+                    }
+                }
+            }
+        else
+            {
+            if (p->anc != NULL)
+                AddToPrintString ("(");
+            WriteEventTreeToPrintString (p->left, chain, param, printAll);
+            AddToPrintString (",");
+            WriteEventTreeToPrintString (p->right, chain, param, printAll); 
+            if (p->anc != NULL)
+                {               
+                if (p->anc->anc != NULL)
+                    {
+                    SafeSprintf (&tempStr, &tempStrSize, "):%s", MbPrintNum(p->length));
+                    AddToPrintString (tempStr);
+                    for (i=0; i<param->nSubParams; i++)
+                        {
+                        if (param->subParams[i]->paramType == P_CPPEVENTS)
+                            {
+                            nEvents = param->subParams[i]->nEvents[2*chain+state[chain]][p->index];
+                            if (nEvents > 0)
+                                {
+                                SafeSprintf (&tempStr, &tempStrSize, "[&E %s %d", param->subParams[i]->name, nEvents);
+                                AddToPrintString (tempStr);
+                                position = param->subParams[i]->position[2*chain+state[chain]][p->index];
+                                rateMult = param->subParams[i]->rateMult[2*chain+state[chain]][p->index];
+                                if (printAll == YES)
+                                    {
+                                    SafeSprintf (&tempStr, &tempStrSize, ": (");
+                                    AddToPrintString (tempStr);
+                                    for (j=0; j<nEvents; j++)
+                                        {
+                                        SafeSprintf (&tempStr, &tempStrSize, "%s", MbPrintNum(position[j]));
+                                        AddToPrintString (tempStr);
+                                        SafeSprintf (&tempStr, &tempStrSize, " %s",  MbPrintNum(rateMult[j]));
+                                        AddToPrintString (tempStr);
+                                        if (j != nEvents-1)
+                                            AddToPrintString (",");
+                                        else
+                                            AddToPrintString (")");
+                                        }
+                                    }
+                                AddToPrintString ("]");
+                                }
+                            else
+                                {
+                                SafeSprintf (&tempStr, &tempStrSize, "[&E %s 0]", param->subParams[i]->name);
+                                AddToPrintString (tempStr);
+                                }
+                            }
+                        else if (param->subParams[i]->paramType != P_CPPEVENTS)
+                            {
+                            /* other relaxed clock models */
+                            brlen = GetParamSubVals (param->subParams[i], chain, state[chain])[p->index];
+                            SafeSprintf (&tempStr, &tempStrSize, "[&B %s %s]", param->subParams[i]->name, MbPrintNum(brlen));
+                            AddToPrintString (tempStr);
+                            }
+                        }
+                    }
+                else
+                    AddToPrintString(")");
+                }
+            }
+        }
+    free (tempStr);
+}
+
+
+void WriteEvolTree (TreeNode *p, int chain, Param *param)
+{
+    MrBFlt          *length;
+
+    if (p != NULL)
+        {
+        length = GetParamSubVals(param, chain, state[chain]);
+        if (p->left == NULL && p->right == NULL)
+            {
+            printf ("%d:%s", p->index + 1, MbPrintNum(length[p->index]));
+            }
+        else
+            {
+            if (p->anc != NULL)
+                printf ("(");
+            WriteEvolTree(p->left, chain, param);
+            printf (",");
+            WriteEvolTree(p->right, chain, param);
+            if (p->anc != NULL)
+                {               
+                if (p->anc->anc != NULL)
+                    printf ("):%s", MbPrintNum(length[p->index]));
+                else
+                    printf (")");
+                }
+            }
+        }
+}
+
+
+void WriteNoEvtTreeToPrintString (TreeNode *p, int chain, Param *param, int showBrlens, int isRooted)
+{
+    char            *tempStr;
+    int             i, tempStrSize = TEMPSTRSIZE, nEvents;
+    MrBFlt          brlen, N;
+
+    tempStr = (char *) SafeMalloc((size_t)tempStrSize * sizeof(char));
+    if (!tempStr)
+        MrBayesPrint ("%s   Problem allocating tempString (%d)\n", spacer, tempStrSize * sizeof(char));
+
+    if (p != NULL)
+        {
+        if (p->left == NULL && p->right == NULL)
+            {
+            if (showBrlens == YES)
+                {
+                SafeSprintf (&tempStr, &tempStrSize, "%d:%s", p->index + 1, MbPrintNum(p->length));
+                }
+            else
+                SafeSprintf (&tempStr, &tempStrSize, "%d", p->index + 1);
+            AddToPrintString (tempStr);
+            if (param->paramType == P_BRLENS)
+                {
+                for (i=0; i<param->nSubParams; i++)
+                    {
+                    if (param->subParams[i]->paramType == P_CPPEVENTS)
+                        {
+                        nEvents = param->subParams[i]->nEvents[2*chain+state[chain]][p->index];
+                        SafeSprintf (&tempStr, &tempStrSize, "[&E %s %d]", param->subParams[i]->name, nEvents);
+                        AddToPrintString (tempStr);
+                        }
+                    brlen = GetParamSubVals (param->subParams[i], chain, state[chain])[p->index];
+                    SafeSprintf (&tempStr, &tempStrSize, "[&B %s %s]", param->subParams[i]->name, MbPrintNum(brlen));
+                    AddToPrintString (tempStr);
+                    }
+                }
+            else if (param->paramType == P_SPECIESTREE && modelSettings[param->relParts[0]].popSize->nValues > 1)
+                {
+                N = GetParamVals (modelSettings[param->relParts[0]].popSize, chain, state[chain])[p->index];
+                SafeSprintf (&tempStr, &tempStrSize, "[&N %s %s]", modelSettings[param->relParts[0]].popSize->name, MbPrintNum(N));
+                AddToPrintString (tempStr);
+                }
+            }
+        else
+            {
+            if (p->anc != NULL)
+                AddToPrintString ("(");
+            WriteNoEvtTreeToPrintString (p->left,  chain, param, showBrlens, isRooted);
+            if (p->anc != NULL)
+                AddToPrintString (",");
+            WriteNoEvtTreeToPrintString (p->right, chain, param, showBrlens, isRooted);
+            if (p->anc != NULL)
+                {
+                if (p->anc->anc == NULL && isRooted == NO)
+                    {
+                    if (showBrlens == YES)
+                        SafeSprintf (&tempStr, &tempStrSize, ",%d:%s)", p->anc->index + 1, MbPrintNum(p->length));
+                    else
+                        SafeSprintf (&tempStr, &tempStrSize, ",%d)", p->anc->index + 1);
+                    AddToPrintString (tempStr);
+                    }
+                else if (p->anc->anc != NULL)
+                    {
+                    if (showBrlens == YES)
+                        SafeSprintf (&tempStr, &tempStrSize, "):%s", MbPrintNum(p->length));
+                    else
+                        SafeSprintf (&tempStr, &tempStrSize, ")");
+                    AddToPrintString (tempStr);
+                    if (param->paramType == P_BRLENS)
+                        {
+                        for (i=0; i<param->nSubParams; i++)
+                            {
+                            if (param->subParams[i]->paramType == P_CPPEVENTS)
+                                {
+                                nEvents = param->subParams[i]->nEvents[2*chain+state[chain]][p->index];
+                                SafeSprintf (&tempStr, &tempStrSize, "[&E %s %d]", param->subParams[i]->name, nEvents);
+                                AddToPrintString (tempStr);
+                                }
+                            brlen = GetParamSubVals (param->subParams[i], chain, state[chain])[p->index];
+                            SafeSprintf (&tempStr, &tempStrSize, "[&B %s %s]", param->subParams[i]->name, MbPrintNum(brlen));
+                            AddToPrintString (tempStr);
+                            }
+                        }
+                    else if (param->paramType == P_SPECIESTREE && modelSettings[param->relParts[0]].popSize->nValues > 1)
+                        {
+                        N = GetParamVals (modelSettings[param->relParts[0]].popSize, chain, state[chain])[p->index];
+                        SafeSprintf (&tempStr, &tempStrSize, "[&N %s %s]", modelSettings[param->relParts[0]].popSize->name, MbPrintNum(N));
+                        AddToPrintString (tempStr);
+                        }
+                    }
+                else if (param->paramType == P_SPECIESTREE && modelSettings[param->relParts[0]].popSize->nValues > 1)
+                    {
+                    N = GetParamVals (modelSettings[param->relParts[0]].popSize, chain, state[chain])[p->index];
+                    SafeSprintf (&tempStr, &tempStrSize, ")[&N %s %s]", modelSettings[param->relParts[0]].popSize->name, MbPrintNum(N));
+                    AddToPrintString (tempStr);
+                    }
+                else
+                    AddToPrintString(")");
+                }
+            }
+        }
+    free (tempStr);
+}
+
+
+/* WriteTopologyToFile: Simply write topology to file */
+void WriteTopologyToFile (FILE *fp, TreeNode *p, int isRooted)
+{
+    if (p != NULL)
+        {
+        if (p->left == NULL && p->right == NULL)
+            fprintf (fp, "%d", p->index + 1);
+        else
+            {
+            if (p->anc != NULL)
+                fprintf (fp, "(");
+            WriteTopologyToFile (fp, p->left, isRooted);
+            if (p->anc != NULL)
+                fprintf (fp, ",");
+            WriteTopologyToFile (fp, p->right, isRooted);   
+            if (p->anc != NULL)
+                {
+                if (p->anc->anc == NULL && isRooted == NO)
+                    fprintf (fp, ",%d", p->anc->index + 1);
+                fprintf (fp, ")");
+                }
+            }
+        }
+}
+
+
+/* the following are moved from mbmath.c */
+/*---------------------------------------------------------------------------------
+|
+|   AddTwoMatrices
+|
+|   Takes the sum of two matrices, "a" and "b", and puts the results in a matrix
+|   called "result".
+|
+---------------------------------------------------------------------------------*/
+void AddTwoMatrices (int dim, MrBFlt **a, MrBFlt **b, MrBFlt **result)
+{
+    int         row, col;
+
+    for (row=0; row<dim; row++)
+        {
+        for (col=0; col<dim; col++) 
+            {
+            result[row][col] = a[row][col] + b[row][col];
+            }
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   AllocateSquareComplexMatrix
+|
+|   Allocate memory for a square (dim X dim) complex matrix.
+|
+---------------------------------------------------------------------------------*/
+complex **AllocateSquareComplexMatrix (int dim)
+{
+    int         i;
+    complex     **m;
+
+    m = (complex **) SafeMalloc ((size_t)dim * sizeof(complex*));
+    if (!m) 
+        {
+        MrBayesPrint ("%s   Error: Problem allocating a square complex matrix.\n", spacer);
+        exit (0);
+        }
+    m[0]=(complex *) SafeMalloc ((size_t)dim * (size_t)dim *sizeof(complex));
+    if (!m[0]) 
+        {
+        MrBayesPrint ("%s   Error: Problem allocating a square complex matrix.\n", spacer);
+        exit (0);
+        }
+    for (i=1;i<dim;i++) 
+        {
+        m[i] = m[i-1] + dim;
+        }
+        
+    return (m);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   AllocateSquareDoubleMatrix
+|
+|   Allocate memory for a square (dim X dim) matrix of doubles.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt **AllocateSquareDoubleMatrix (int dim)
+{
+    int         i;
+    MrBFlt      **m;
+    
+    m = (MrBFlt **) SafeMalloc ((size_t)dim * sizeof(MrBFlt*));
+    if (!m)
+        {
+        MrBayesPrint ("%s   Error: Problem allocating a square matrix of doubles.\n", spacer);
+        exit(1);
+        }
+    m[0] = (MrBFlt *) SafeMalloc ((size_t)dim * (size_t)dim * sizeof(MrBFlt));
+    if (!m[0])
+        {
+        MrBayesPrint ("%s   Error: Problem allocating a square matrix of doubles.\n", spacer);
+        exit(1);
+        }
+    for (i=1; i<dim; i++)
+        {
+        m[i] = m[i-1] + dim;
+        }
+
+    return (m);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   AllocateSquareIntegerMatrix
+|
+|   Allocate memory for a square (dim X dim) matrix of integers.
+|
+---------------------------------------------------------------------------------*/
+int **AllocateSquareIntegerMatrix (int dim)
+{
+    int     i, **m;
+    
+    m = (int **) SafeMalloc ((size_t)dim * sizeof(int*));
+    if (!m)
+        {
+        MrBayesPrint ("%s   Error: Problem allocating a square matrix of integers.\n", spacer);
+        exit(1);
+        }
+    m[0] = (int *) SafeMalloc ((size_t)dim * (size_t)dim * sizeof(int));
+    if (!m[0])
+        {
+        MrBayesPrint ("%s   Error: Problem allocating a square matrix of integers.\n", spacer);
+        exit(1);
+        }
+    for (i=1; i<dim; i++)
+        {
+        m[i] = m[i-1] + dim;
+        }
+
+    return (m);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   AutodGamma
+|
+|   Auto-discrete-gamma distribution of rates over sites, K equal-probable
+|   categories, with the mean for each category used.         
+|   This routine calculates M[], using rho and K (numGammaCats)     
+|
+---------------------------------------------------------------------------------*/
+int AutodGamma (MrBFlt *M, MrBFlt rho, int K)
+{
+    int         i, j, i1, i2;
+    MrBFlt      point[MAX_GAMMA_CATS], x, y, large = 20.0, sum;
+
+    for (i=0; i<K-1; i++) 
+        point[i] = PointNormal ((i + 1.0) / K);
+    for (i=0; i<K; i++) 
+        {
+        for (j=0; j<K; j++) 
+            {
+            x = (i < K-1 ? point[i]:large);
+            y = (j < K-1 ? point[j]:large);
+            M[i * K + j] = CdfBinormal (x, y, rho);
+            }
+        }
+    for (i1=0; i1<2*K-1; i1++) 
+        {
+        for (i2=0; i2<K*K; i2++) 
+            {
+            i = i2 / K; 
+            j = i2 % K;
+            if (AreDoublesEqual(i+j, 2*(K-1.0)-i1, ETA)==NO)
+                continue;
+            y = 0;
+            if (i > 0) 
+                y -= M[(i-1)*K+j];
+            if (j > 0) 
+                y -= M[i*K+(j-1)];
+            if (i > 0 && j > 0) 
+                y += M[(i-1)*K+(j-1)];
+            M[i*K+j] = (M[i*K+j] + y) * K;
+            }
+        }
+    for (i=0; i<K; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<K; j++)
+            {
+            if (M[i*K+j] < 0.0)
+                M[i*K+j] = 0.0;
+            sum += M[i*K+j];
+            }
+        for (j=0; j<K; j++)
+            M[i*K+j] /= sum;
+        }
+    
+//    MrBayesPrint ("rho = %lf\n", rho);
+//    for (i=0; i<K; i++)
+//        {
+//        for (j=0; j<K; j++)
+//            MrBayesPrint ("%lf ", M[i*K + j]);
+//        MrBayesPrint ("\n");
+//        }
+    
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   BackSubstitutionRow
+|
+---------------------------------------------------------------------------------*/
+void BackSubstitutionRow (int dim, MrBFlt **u, MrBFlt *b)
+{
+    int             i, j;
+    MrBFlt          dotProduct;
+
+    b[dim-1] /= u[dim-1][dim-1];
+    for (i=dim-2; i>=0; i--) 
+        {
+        dotProduct = 0.0;
+        for (j=i+1; j<dim; j++)
+            dotProduct += u[i][j] * b[j];
+        b[i] = (b[i] - dotProduct) / u[i][i];
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Balanc
+|
+|   This subroutine balances a real matrix and isolates
+|   eigenvalues whenever possible.
+|
+|   On input:
+|
+|    * dim is the order of the matrix
+|
+|    * a contains the input matrix to be balanced
+|
+|   On output:
+|
+|    * a contains the balanced matrix.
+|
+|    * low and high are two integers such that a(i,j)
+|      is equal to zero if
+|         (1) i is greater than j and
+|         (2) j=1,...,low-1 or i=igh+1,...,n.
+|
+|    * scale contains information determining the
+|      permutations and scaling factors used.
+|
+|   Suppose that the principal submatrix in rows pLow through pHigh
+|   has been balanced, that p(j) denotes the index interchanged
+|   with j during the permutation step, and that the elements
+|   of the diagonal matrix used are denoted by d(i,j). Then
+|      scale(j) = p(j),    for j = 1,...,pLow-1
+|               = d(j,j),      j = pLow,...,pHigh
+|               = p(j)         j = pHigh+1,...,dim.
+|   The order in which the interchanges are made is dim to pHigh+1,
+|   then 1 to pLow-1.
+|
+|   Note that 1 is returned for pHigh if pHigh is zero formally.
+|
+|   The algol procedure exc contained in balance appears in
+|   balanc in line.  (Note that the algol roles of identifiers
+|   k,l have been reversed.)
+|
+|   This routine is a translation of the Algol procedure from
+|   Handbook for Automatic Computation, vol. II, Linear Algebra,
+|   by Wilkinson and Reinsch, Springer-Verlag.
+|
+|   This function was converted from FORTRAN by D. L. Swofford.
+|   
+---------------------------------------------------------------------------------*/
+void Balanc (int dim, MrBFlt **a, int *low, int *high, MrBFlt *scale)
+{
+    int         i, j, k, l, m, noconv;
+    MrBFlt      c, f, g, r, s, b2;
+
+    b2 = FLT_RADIX * FLT_RADIX;
+    k = 0;
+    l = dim - 1;
+    
+    for (j=l; j>=0; j--)
+        {
+        for (i=0; i<=l; i++)
+            {
+            if (i != j)
+                {
+                  if (AreDoublesEqual(a[j][i],0.0, ETA)==NO)
+                    goto next_j1;
+                }
+            }
+            
+        /* bug that DLS caught */
+        /*m = l;
+        Exchange(j, k, l, m, dim, a, scale);
+        if (l < 0)
+            goto leave;
+        else
+            j = --l;*/
+        m = l;
+        Exchange(j, k, l, m, dim, a, scale);
+        if (--l < 0)
+            goto leave;
+        next_j1:
+            ;
+        }
+
+    for (j=k; j<=l; j++)
+        {
+        for (i=k; i<=l; i++)
+            {
+            if (i != j)
+                {
+                if (AreDoublesEqual(a[i][j], 0.0, ETA)==NO)
+                    goto next_j;
+                }
+            }
+        m = k;
+        Exchange(j, k, l, m, dim, a, scale);
+        k++;
+        next_j:
+            ;
+        }
+
+    for (i=k; i<=l; i++)
+        scale[i] = 1.0;
+    
+    do  {
+        noconv = FALSE;
+        for (i=k; i<=l; i++)
+            {
+            c = 0.0;
+            r = 0.0;
+            for (j=k; j<=l; j++)
+                {
+                if (j != i)
+                    {
+                    c += fabs(a[j][i]);
+                    r += fabs(a[i][j]);
+                    }
+                }
+            if (AreDoublesEqual(c,0.0,ETA)==NO && AreDoublesEqual(r,0.0,ETA)==NO)
+                {
+                g = r / FLT_RADIX;
+                f = 1.0;
+                s = c + r;
+                while (c < g)
+                    {
+                    f *= FLT_RADIX;
+                    c *= b2;
+                    }
+                g = r * FLT_RADIX;
+                while (c >= g)
+                    {
+                    f /= FLT_RADIX;
+                    c /= b2;
+                    }
+                if ((c + r) / f < s * .95)
+                    {
+                    g = 1.0 / f;
+                    scale[i] *= f;
+                    noconv = TRUE;              
+                    for (j=k; j<dim; j++)
+                        a[i][j] *= g;
+                    for (j=0; j<=l; j++)
+                        a[j][i] *= f;
+                    }
+                }
+            }   
+        }
+        while (noconv);
+    leave:
+        *low = k;
+        *high = l;
+    
+#   if 0 
+/* begin f2c version of code:
+   balanc.f -- translated by f2c (version 19971204) */
+int balanc (int *nm, int *n, MrBFlt *a, int *low, int *igh, MrBFlt *scale)
+
+{
+
+    /* System generated locals */
+    int a_dim1, a_offset, i__1, i__2;
+    MrBFlt d__1;
+
+    /* Local variables */
+    static MrBFlt iexc;
+    static MrBFlt c__, f, g;
+    static MrBFlt i__, j, k, l, m;
+    static MrBFlt r__, s, radix, b2;
+    static MrBFlt jj;
+    static logical noconv;
+
+    /* parameter adjustments */
+    --scale;
+    a_dim1 = *nm;
+    a_offset = a_dim1 + 1;
+    a -= a_offset;
+
+    /* function Body */
+    radix = 16.0;
+
+    b2 = radix * radix;
+    k = 1;
+    l = *n;
+    goto L100;
+    
+    /* .......... in-line procedure for row and column exchange .......... */
+    L20:
+    scale[m] = (MrBFlt) j;
+    if (j == m) 
+        goto L50;
+
+    i__1 = l;
+    for (i__ = 1; i__ <= i__1; ++i__) 
+        {
+        f = a[i__ + j * a_dim1];
+        a[i__ + j * a_dim1] = a[i__ + m * a_dim1];
+        a[i__ + m * a_dim1] = f;
+        /* L30: */
+        }
+
+    i__1 = *n;
+    for (i__ = k; i__ <= i__1; ++i__) 
+        {
+        f = a[j + i__ * a_dim1];
+        a[j + i__ * a_dim1] = a[m + i__ * a_dim1];
+        a[m + i__ * a_dim1] = f;
+        /* L40: */
+        }
+
+    L50:
+    switch (iexc) 
+        {
+        case 1:  
+            goto L80;
+        case 2:  
+            goto L130;
+        }
+        
+    /* .......... search for rows isolating an eigenvalue and push them down .......... */
+    L80:
+    if (l == 1) 
+        goto L280;
+    --l;
+    
+    /* .......... for j=l step -1 until 1 do -- .......... */
+    L100:
+    i__1 = l;
+    for (jj = 1; jj <= i__1; ++jj) 
+        {
+        j = l + 1 - jj;
+        i__2 = l;
+        for (i__ = 1; i__ <= i__2; ++i__) 
+            {
+            if (i__ == j) 
+                goto L110;
+            if (a[j + i__ * a_dim1] != 0.) 
+                goto L120;
+            L110:
+            ;
+            }
+        m = l;
+        iexc = 1;
+        goto L20;
+        L120:
+        ;
+        }
+
+    goto L140;
+    /* .......... search for columns isolating an eigenvalue and push them left .......... */
+    L130:
+    ++k;
+
+    L140:
+    i__1 = l;
+    for (j = k; j <= i__1; ++j) 
+        {
+        i__2 = l;
+        for (i__ = k; i__ <= i__2; ++i__) 
+            {
+            if (i__ == j) 
+                goto L150;
+            if (a[i__ + j * a_dim1] != 0.) 
+                goto L170;
+            L150:
+            ;
+            }
+        m = k;
+        iexc = 2;
+        goto L20;
+        L170:
+        ;
+        }
+        
+    /* .......... now balance the submatrix in rows k to l .......... */
+    i__1 = l;
+    for (i__ = k; i__ <= i__1; ++i__) 
+        {
+        /* L180: */
+        scale[i__] = 1.0;
+        }
+    /* .......... iterative loop for norm reduction .......... */
+    L190:
+    noconv = FALSE;
+
+    i__1 = l;
+    for (i__ = k; i__ <= i__1; ++i__) 
+        {
+        c__ = 0.0;
+        r__ = 0.0;
+        i__2 = l;
+        for (j = k; j <= i__2; ++j) 
+            {
+            if (j == i__) 
+                goto L200;
+            c__ += (d__1 = a[j + i__ * a_dim1], abs(d__1));
+            r__ += (d__1 = a[i__ + j * a_dim1], abs(d__1));
+            L200:
+            ;
+            }
+        
+        /* .......... guard against zero c or r due to underflow .......... */
+        if (c__ == 0. || r__ == 0.) 
+            goto L270;
+        g = r__ / radix;
+        f = 1.0;
+        s = c__ + r__;
+        L210:
+        if (c__ >= g) 
+            goto L220;
+        f *= radix;
+        c__ *= b2;
+        goto L210;
+        L220:
+        g = r__ * radix;
+        L230:
+        if (c__ < g) 
+            goto L240;
+        f /= radix;
+        c__ /= b2;
+        goto L230;
+        
+        /*     .......... now balance .......... */
+        L240:
+        if ((c__ + r__) / f >= s * .95) 
+            goto L270;
+        g = 1.0 / f;
+        scale[i__] *= f;
+        noconv = TRUE;
+        
+        i__2 = *n;
+        for (j = k; j <= i__2; ++j) 
+            {
+            /* L250: */
+            a[i__ + j * a_dim1] *= g;
+            }
+
+        i__2 = l;
+        for (j = 1; j <= i__2; ++j) 
+            {
+            /* L260: */
+            a[j + i__ * a_dim1] *= f;
+            }
+
+        L270:
+        ;
+        }
+
+    if (noconv) 
+        goto L190;
+
+    L280:
+    *low = k;
+    *igh = l;
+    return 0;
+    
+} 
+/* end f2c version of code */
+#   endif
+    
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   BalBak
+|
+|   This subroutine forms the eigenvectors of a real general 
+|   matrix by back transforming those of the corresponding 
+|   balanced matrix determined by  balance. 
+|
+|   On input:
+|
+|    * dim is the order of the matrix
+|
+|    * low and high are integers determined by  balance
+|
+|    * scale contains information determining the permutations 
+|      and scaling factors used by balance
+|
+|    * m is the number of columns of z to be back transformed
+|
+|    * z contains the real and imaginary parts of the eigen-
+|      vectors to be back transformed in its first m columns
+|
+|   On output:
+|
+|    * z contains the real and imaginary parts of the
+|      transformed eigenvectors in its first m columns
+|
+|   This routine is a translation of the Algol procedure from
+|   Handbook for Automatic Computation, vol. II, Linear Algebra,
+|   by Wilkinson and Reinsch, Springer-Verlag.
+|   
+---------------------------------------------------------------------------------*/
+void BalBak (int dim, int low, int high, MrBFlt *scale, int m, MrBFlt **z)
+{
+    int         i, j, k, ii;
+    MrBFlt      s;
+
+    if (m != 0) /* change "==" to "!=" to eliminate a goto statement */
+        {
+        if (high != low) /* change "==" to "!=" to eliminate a goto statement */
+            {
+            for (i=low; i<=high; i++)
+                {
+                s = scale[i];
+                for (j=0; j<m; j++)
+                    z[i][j] *= s;
+                }
+            }
+        for (ii=0; ii<dim; ii++)
+            {
+            i = ii;
+            if ((i < low) || (i > high)) /* was (i >= lo) && (i<= hi) but this */
+                {                        /* eliminates a goto statement        */
+                if (i < low)
+                    i = low - ii;
+                k = (int)scale[i];
+                if (k != i) /* change "==" to "!=" to eliminate a goto statement */
+                    {
+                    for (j = 0; j < m; j++)
+                        {
+                        s = z[i][j];
+                        z[i][j] = z[k][j];
+                        z[k][j] = s;
+                        }
+                    }
+                }
+            }
+        }
+
+#if 0
+/* begin f2c version of code:
+   balbak.f -- translated by f2c (version 19971204) */
+int balbak (int *nm, int *n, int *low, int *igh, MrBFlt *scale, int *m, MrBFlt *z__)
+
+{
+
+    /* system generated locals */
+    int z_dim1, z_offset, i__1, i__2;
+
+    /* Local variables */
+    static int i__, j, k;
+    static MrBFlt s;
+    static int ii;
+
+    /* parameter adjustments */
+    --scale;
+    z_dim1 = *nm;
+    z_offset = z_dim1 + 1;
+    z__ -= z_offset;
+
+    /* function Body */
+    if (*m == 0) 
+        goto L200;
+    if (*igh == *low) 
+        goto L120;
+
+    i__1 = *igh;
+    for (i__ = *low; i__ <= i__1; ++i__) 
+        {
+        s = scale[i__];
+        /* .......... left hand eigenvectors are back transformed */
+        /*            if the foregoing statement is replaced by */
+        /*            s=1.0d0/scale(i) ........... */
+        i__2 = *m;
+        for (j = 1; j <= i__2; ++j) 
+            {
+            /* L100: */
+            z__[i__ + j * z_dim1] *= s;
+            }
+
+        /* L110: */
+        }
+        
+    /* .........for i=low-1 step -1 until 1, igh+1 step 1 until n do -- .......... */
+    L120:
+    i__1 = *n;
+    for (ii = 1; ii <= i__1; ++ii) 
+        {
+        i__ = ii;
+        if (i__ >= *low && i__ <= *igh) 
+            goto L140;
+    if (i__ < *low) 
+        i__ = *low - ii;
+    k = (integer) scale[i__];
+    if (k == i__) 
+        goto L140;
+
+    i__2 = *m;
+    for (j = 1; j <= i__2; ++j) 
+        {
+        s = z__[i__ + j * z_dim1];
+        z__[i__ + j * z_dim1] = z__[k + j * z_dim1];
+        z__[k + j * z_dim1] = s;
+        /* L130: */
+        }
+    L140:
+    ;
+    }
+
+    L200:
+    return 0;
+    
+}
+/* end f2c version of code */
+#endif
+        
+}
+
+
+void BetaBreaks (MrBFlt alpha, MrBFlt beta, MrBFlt *values, int K)
+{
+    int             i;
+    MrBFlt          r, quantile, lower, upper;
+            
+    r = (1.0 / K) * 0.5;
+    lower = 0.0;
+    upper = (1.0 / K);
+    r = (upper - lower) * 0.5 + lower;
+    for (i=0; i<K; i++)
+        {
+        quantile = BetaQuantile (alpha, beta, r);
+        values[i] = quantile;
+        lower += (1.0/K);
+        upper += (1.0/K);
+        r += (1.0/K);
+        }
+        
+#   if 0
+    for (i=0; i<K; i++)
+        {
+        MrBayesPrint ("%4d %lf %lf\n", i, values[i]);
+        }
+#   endif
+}
+
+
+MrBFlt BetaCf (MrBFlt a, MrBFlt b, MrBFlt x)
+{
+    int         m, m2;
+    MrBFlt      aa, c, d, del, h, qab, qam, qap;
+    
+    qab = a + b;
+    qap = a + 1.0;
+    qam = a - 1.0;
+    c = 1.0;
+    d = 1.0 - qab * x / qap;
+    if (fabs(d) < (1.0e-30))
+        d = (1.0e-30);
+    d = 1.0 / d;
+    h = d;
+    for (m=1; m<=100; m++)
+        {
+        m2 = 2 * m;
+        aa = m * (b-m) * x / ((qam+m2) * (a+m2));
+        d = 1.0 + aa * d;
+        if (fabs(d) < (1.0e-30))
+            d = (1.0e-30);
+        c = 1.0 + aa / c;
+        if (fabs(c) < (1.0e-30))
+            c = (1.0e-30);
+        d = 1.0 / d;
+        h *= d * c;
+        aa = -(a+m) * (qab+m) * x / ((a+m2) * (qap+m2));
+        d = 1.0 + aa * d;
+        if (fabs(d) < (1.0e-30))
+            d = (1.0e-30);
+        c = 1.0 + aa / c;
+        if (fabs(c) < (1.0e-30))
+            c = (1.0e-30);
+        d = 1.0 / d;
+        del = d * c;
+        h *= del;
+        if (fabs(del - 1.0) < (3.0e-7))
+            break;
+        }
+    if (m > 100)
+        {
+        MrBayesPrint ("%s   Error in BetaCf.\n", spacer);
+        exit(0);
+        }
+    return (h);
+}
+
+
+MrBFlt BetaQuantile (MrBFlt alpha, MrBFlt beta, MrBFlt x)
+{
+    int     i, stopIter, direction, nswitches;
+    MrBFlt  curPos, curFraction, increment;
+    
+    i = nswitches = 0;
+    curPos = 0.5;
+    stopIter = NO;
+    increment = 0.25;
+    curFraction = IncompleteBetaFunction (alpha, beta, curPos);
+    if (curFraction > x)
+        direction = DOWN;
+    else
+        direction = UP;
+
+    while (stopIter == NO)
+        {
+        curFraction = IncompleteBetaFunction (alpha, beta, curPos);
+        if (curFraction > x && direction == DOWN)
+            {
+            /* continue going down */
+            while (curPos - increment <= 0.0)
+                {
+                increment /= 2.0;
+                }
+            curPos -= increment;
+            }
+        else if (curFraction > x && direction == UP)
+            {
+            /* switch directions, and go down */
+            nswitches++;
+            direction = DOWN;
+            while (curPos - increment <= 0.0)
+                {
+                increment /= 2.0;
+                }
+            increment /= 2.0;
+            curPos -= increment;
+            }
+        else if (curFraction < x && direction == UP)
+            {
+            /* continue going up */
+            while (curPos + increment >= 1.0)
+                {
+                increment /= 2.0;
+                }
+            curPos += increment;
+            }
+        else if (curFraction < x && direction == DOWN)
+            {
+            /* switch directions, and go up */
+            nswitches++;
+            direction = UP;
+            while (curPos + increment >= 1.0)
+                {
+                increment /= 2.0;
+                }
+            increment /= 2.0;
+            curPos += increment;
+            }
+        else
+            {
+            stopIter = YES;
+            }
+        if (i > 1000 || nswitches > 20)
+            stopIter = YES;
+        i++;
+        }
+        
+    return (curPos);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   CalcCijk
+|
+|   This function precalculates the product of the eigenvectors and their
+|   inverse for faster calculation of transition probabilities. The output
+|   is a vector of precalculated values. The input is the eigenvectors (u) and
+|   the inverse of the eigenvector matrix (v).
+|
+---------------------------------------------------------------------------------*/
+void CalcCijk (int dim, MrBFlt *c_ijk, MrBFlt **u, MrBFlt **v)
+{
+    register int    i, j, k;
+    MrBFlt          *pc;
+
+    pc = c_ijk;
+    for (i=0; i<dim; i++)
+        for (j=0; j<dim; j++)
+            for (k=0; k<dim; k++)
+                *pc++ = u[i][k] * v[k][j];
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   CdfBinormal
+|
+|   F(h1,h2,r) = prob(x<h1, y<h2), where x and y are standard binormal.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt CdfBinormal (MrBFlt h1, MrBFlt h2, MrBFlt r)
+{
+    return (LBinormal(h1, h2, r) + CdfNormal(h1) + CdfNormal(h2) - 1.0);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   CdfNormal
+|
+|   Calculates the cumulative density distribution (CDF) for the normal using:
+|
+|   Hill, I. D.  1973.  The normal integral.  Applied Statistics, 22:424-427.
+|      (AS66)                                                  
+|
+---------------------------------------------------------------------------------*/
+MrBFlt CdfNormal (MrBFlt x)
+{
+    int             invers = 0;
+    MrBFlt          p, limit = 10.0, t = 1.28, y = x*x/2.0;
+
+    if (x < 0.0) 
+        {  
+        invers = 1;  
+        x  *= -1.0; 
+        }
+    if (x > limit)  
+        return (invers ? 0 : 1);
+    if (x < t)  
+        p = 0.5 - x * (0.398942280444 - 0.399903438504 * y /
+            (y + 5.75885480458 - 29.8213557808 /
+            (y + 2.62433121679 + 48.6959930692 /
+            (y + 5.92885724438))));
+    else 
+        p = 0.398942280385 * exp(-y) /
+            (x - 3.8052e-8 + 1.00000615302 /
+            (x + 3.98064794e-4 + 1.98615381364 /
+            (x - 0.151679116635 + 5.29330324926 /
+            (x + 4.8385912808 - 15.1508972451 /
+            (x + 0.742380924027 + 30.789933034 /
+            (x + 3.99019417011))))));
+            
+    return (invers ? p : 1-p);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Complex
+|
+|   Returns a complex number with specified real and imaginary parts.
+|
+---------------------------------------------------------------------------------*/
+complex Complex (MrBFlt a, MrBFlt b)
+{
+    complex c;
+    
+    c.re = a;
+    c.im = b;
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexAbsoluteValue
+|
+|   Returns the complex absolute value (modulus) of a complex number.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt ComplexAbsoluteValue (complex a)
+{
+    MrBFlt      x, y, answer, temp;
+    
+    x = fabs(a.re);
+    y = fabs(a.im);
+    if (AreDoublesEqual(x, 0.0, ETA)==YES)  /* x == 0.0 */
+        answer = y;
+    else if (AreDoublesEqual(y, 0.0, ETA)==YES) /* y == 0.0 */
+        answer = x;
+    else if (x > y) 
+        {
+        temp = y / x;
+        answer = x * sqrt(1.0 + temp * temp);
+        }
+    else
+        {
+        temp = x / y;
+        answer = y * sqrt(1.0 + temp * temp);
+        }
+
+    return (answer);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexAddition
+|
+|   Returns the complex sum of two complex numbers.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexAddition (complex a, complex b)
+{
+    complex     c;
+    
+    c.re = a.re + b.re;
+    c.im = a.im + b.im;
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexConjugate
+|
+|   Returns the complex conjugate of a complex number.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexConjugate (complex a)
+{
+    complex     c;
+    
+    c.re = a.re;
+    c.im = -a.im;
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexDivision
+|
+|   Returns the complex quotient of two complex numbers.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexDivision (complex a, complex b)
+{
+    complex     c;
+    MrBFlt      r, den;
+    
+    if (fabs(b.re) >= fabs(b.im)) 
+        {
+        r = b.im / b.re;
+        den = b.re + r * b.im;
+        c.re = (a.re + r * a.im) / den;
+        c.im = (a.im - r * a.re) / den;
+        } 
+    else
+        {
+        r = b.re / b.im;
+        den = b.im + r * b.re;
+        c.re = (a.re * r + a.im) / den;
+        c.im = (a.im * r - a.re) / den;
+        }
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexDivision2
+|
+|   Returns the complex quotient of two complex numbers. It does not require that
+|   the numbers be in a complex structure.
+|
+---------------------------------------------------------------------------------*/
+void ComplexDivision2 (MrBFlt ar, MrBFlt ai, MrBFlt br, MrBFlt bi, MrBFlt *cr, MrBFlt *ci)
+{
+    MrBFlt      s, ais, bis, ars, brs;
+
+    s = fabs(br) + fabs(bi);
+    ars = ar / s;
+    ais = ai / s;
+    brs = br / s;
+    bis = bi / s;
+    s = brs*brs + bis*bis;
+    *cr = (ars*brs + ais*bis) / s;
+    *ci = (ais*brs - ars*bis) / s;
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexExponentiation
+|
+|   Returns the complex exponential of a complex number.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexExponentiation (complex a)
+{
+    complex     c;
+
+    c.re = exp(a.re);
+    if (AreDoublesEqual(a.im,0.0, ETA)==YES) /* == 0 */
+        c.im = 0; 
+    else
+        { 
+        c.im = c.re*sin(a.im); 
+        c.re *= cos(a.im); 
+        }
+
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexInvertMatrix
+|
+|   Inverts a matrix of complex numbers using the LU-decomposition method. 
+|   The program has the following variables:
+|
+|      a        -- the matrix to be inverted
+|      aInverse -- the results of the matrix inversion
+|      dim      -- the dimension of the square matrix a and its inverse
+|      dwork    -- a work vector of doubles
+|      indx     -- a work vector of integers
+|      col      -- carries the results of the back substitution
+|      
+|   The function returns YES (1) or NO (0) if the results are singular.
+|
+---------------------------------------------------------------------------------*/
+int ComplexInvertMatrix (int dim, complex **a, MrBFlt *dwork, int *indx, complex **aInverse, complex *col)
+{
+    int             isSingular, i, j;
+
+    isSingular = ComplexLUDecompose (dim, a, dwork, indx, (MrBFlt *)NULL);
+
+    if (isSingular == 0) 
+        {
+        for (j=0; j<dim; j++) 
+            {
+            for (i=0; i<dim; i++)
+                col[i] = Complex (0.0, 0.0);
+            col[j] = Complex (1.0, 0.0);
+            ComplexLUBackSubstitution (dim, a, indx, col);
+            for (i=0; i<dim; i++)
+                aInverse[i][j] = col[i];
+            }
+        }
+
+    return (isSingular);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexExponentiation
+|
+|   Returns the complex exponential of a complex number.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexLog (complex a)
+{
+    complex     c;
+    
+    c.re = log(ComplexAbsoluteValue(a));
+    if (AreDoublesEqual(a.re,0.0,ETA)==YES) /* == 0.0 */ 
+        {
+        c.im = PIOVER2;
+        } 
+    else 
+        {
+        c.im = atan2(a.im, a.re);
+        }
+        
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexLUBackSubstitution
+|
+|   Perform back-substitution into a LU-decomposed matrix to obtain
+|   the inverse.
+|      
+---------------------------------------------------------------------------------*/
+void ComplexLUBackSubstitution (int dim, complex **a, int *indx, complex *b)
+{
+    int             i, ip, j, ii = -1;
+    complex         sum;
+
+    for (i = 0; i < dim; i++) 
+        {
+        ip = indx[i];
+        sum = b[ip];
+        b[ip] = b[i];
+        if (ii >= 0) 
+            {
+            for (j = ii; j <= i - 1; j++)
+                sum = ComplexSubtraction (sum, ComplexMultiplication (a[i][j], b[j]));
+            } 
+        else if (AreDoublesEqual(sum.re,0.0,ETA)==NO || AreDoublesEqual(sum.im, 0.0, ETA)==NO) /* 2x != 0.0 */
+            ii = i;
+        b[i] = sum;
+        }
+    for (i = dim - 1; i >= 0; i--) 
+        {
+        sum = b[i];
+        for (j = i + 1; j < dim; j++)
+            sum = ComplexSubtraction (sum, ComplexMultiplication (a[i][j], b[j]));
+        b[i] = ComplexDivision (sum, a[i][i]);
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexLUDecompose
+|
+|   Replaces the matrix a with its LU-decomposition. 
+|   The program has the following variables:
+|
+|      a        -- the matrix
+|      dim      -- the dimension of the square matrix a and its inverse
+|      vv       -- a work vector of doubles
+|      indx     -- row permutation according to partitial pivoting sequence
+|      pd       -- 1 if number of row interchanges was even, -1 if number of
+|                  row interchanges was odd. Can be NULL.
+|      
+|   The function returns YES (1) or NO (0) if the results are singular.
+|
+---------------------------------------------------------------------------------*/
+int ComplexLUDecompose (int dim, complex **a, MrBFlt *vv, int *indx, MrBFlt *pd)
+{
+    int             i, imax, j, k;
+    MrBFlt          big, dum, temp, d;
+    complex         sum, cdum;
+
+    d = 1.0;
+    imax = 0;
+
+    for (i = 0; i < dim; i++) 
+        {
+        big = 0.0;
+        for (j = 0; j < dim; j++) 
+            {
+            if ((temp = ComplexAbsoluteValue (a[i][j])) > big)
+                big = temp;
+            }
+        if (AreDoublesEqual(big, 0.0, ETA)==YES) /* == 0.0 */
+            {
+            MrBayesPrint ("%s   Error: Problem in ComplexLUDecompose\n", spacer);
+            return (1);
+            }
+        vv[i] = 1.0 / big;
+        }
+
+    for (j = 0; j < dim; j++) 
+        {
+        for (i = 0; i < j; i++) 
+            {
+            sum = a[i][j];
+            for (k = 0; k < i; k++) 
+                sum = ComplexSubtraction (sum, ComplexMultiplication (a[i][k], a[k][j]));
+            a[i][j] = sum;
+            }
+        big = 0.0;
+        for (i = j; i < dim; i++) 
+            {
+            sum = a[i][j];
+            for (k = 0; k < j; k++)
+            sum = ComplexSubtraction (sum, ComplexMultiplication (a[i][k], a[k][j]));
+            a[i][j] = sum;
+            dum = vv[i] * ComplexAbsoluteValue (sum);
+            if (dum >= big) 
+                {
+                big = dum;
+                imax = i;
+                }
+            }
+        if (j != imax) 
+            {
+            for (k = 0; k < dim; k++) 
+                {
+                cdum = a[imax][k];
+                a[imax][k] = a[j][k];
+                a[j][k] = cdum;
+                }       
+            d = -d;
+            vv[imax] = vv[j];
+            }
+        indx[j] = imax;
+        if (AreDoublesEqual(a[j][j].re, 0.0, ETA)==YES && AreDoublesEqual(a[j][j].im, 0.0, ETA)==YES) /* 2x == 0.0 */
+            a[j][j] = Complex (1.0e-20, 1.0e-20);
+        if (j != dim - 1)
+            {
+            cdum = ComplexDivision (Complex(1.0, 0.0), a[j][j]);
+            for (i = j + 1; i < dim; i++)
+            a[i][j] = ComplexMultiplication (a[i][j], cdum);
+            }
+        }
+
+    if (pd != NULL)
+        *pd = d;
+        
+    return (0);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexMultiplication
+|
+|   Returns the complex product of two complex numbers.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexMultiplication (complex a, complex b)
+{
+    complex     c;
+    
+    c.re = a.re * b.re - a.im * b.im;
+    c.im = a.im * b.re + a.re * b.im;
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexSquareRoot
+|
+|   Returns the complex square root of a complex number.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexSquareRoot (complex a)
+{
+    complex         c;
+    MrBFlt          x, y, w, r;
+    
+    if (AreDoublesEqual(a.re, 0.0, ETA)==YES && AreDoublesEqual(a.im, 0.0, ETA)==YES) /* 2x == 0.0 */
+        {
+        c.re = 0.0;
+        c.im = 0.0;
+        return (c);
+        }
+    else
+        {
+        x = fabs(a.re);
+        y = fabs(a.im);
+        if (x >= y)
+            {
+            r = y / x;
+            w = sqrt(x) * sqrt(0.5 * (1.0 + sqrt(1.0 + r * r)));
+            }
+        else
+            {
+            r = x / y;
+            w = sqrt(y) * sqrt(0.5 * (r + sqrt(1.0 + r * r)));
+            }
+        if (a.re >= 0.0)
+            {
+            c.re = w;
+            c.im = a.im / (2.0 * w);
+            }
+        else
+            {
+            c.im = (a.im >= 0.0) ? w : -w;
+            c.re = a.im / (2.0 * c.im);
+            }
+        return (c);
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComplexSubtraction
+|
+|   Returns the complex difference of two complex numbers.
+|
+---------------------------------------------------------------------------------*/
+complex ComplexSubtraction (complex a, complex b)
+{
+    complex     c;
+    
+    c.re = a.re - b.re;
+    c.im = a.im - b.im;
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComputeEigenSystem
+|
+|   Calculates the eigenvalues, eigenvectors, and the inverse of the eigenvectors
+|   for a matrix of real numbers.
+|
+---------------------------------------------------------------------------------*/
+int ComputeEigenSystem (int dim, MrBFlt **a, MrBFlt *v, MrBFlt *vi, MrBFlt **u, int *iwork, MrBFlt *dwork)
+{
+    int         i, rc;
+
+    rc = EigensForRealMatrix (dim, a, v, vi, u, iwork, dwork);
+    if (rc != NO_ERROR)
+        {
+        MrBayesPrint ("%s   Error in ComputeEigenSystem.\n", spacer);
+        return (ERROR);
+        }
+    for (i=0; i<dim; i++)
+        {
+        if (AreDoublesEqual(vi[i], 0.0, ETA)==NO) /* != 0.0 */
+            return (EVALUATE_COMPLEX_NUMBERS);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComputeLandU
+|
+|   This function computes the L and U decomposition of a matrix. Basically,
+|   we find matrices lMat and uMat such that
+|
+|      lMat * uMat = aMat
+|
+---------------------------------------------------------------------------------*/
+void ComputeLandU (int dim, MrBFlt **aMat, MrBFlt **lMat, MrBFlt **uMat)
+{
+    int         i, j, k, m, row, col;
+
+    for (j=0; j<dim; j++) 
+        {
+        for (k=0; k<j; k++)
+            for (i=k+1; i<j; i++)
+                aMat[i][j] = aMat[i][j] - aMat[i][k] * aMat[k][j];
+
+        for (k=0; k<j; k++)
+            for (i=j; i<dim; i++)
+                aMat[i][j] = aMat[i][j] - aMat[i][k]*aMat[k][j];
+
+        for (m=j+1; m<dim; m++)
+            aMat[m][j] /= aMat[j][j]; 
+        }
+
+    for (row=0; row<dim; row++)
+        {
+        for (col=0; col<dim; col++) 
+            {
+            if (row <= col) 
+                {
+                uMat[row][col] = aMat[row][col];
+                lMat[row][col] = (row == col ? 1.0 : 0.0);
+                }
+            else 
+                {
+                lMat[row][col] = aMat[row][col];
+                uMat[row][col] = 0.0;
+                }
+            }
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ComputeMatrixExponential
+|
+|   The method approximates the matrix exponential, f = e^a, using
+|   the algorithm 11.3.1, described in:
+|  
+|   Golub, G. H., and C. F. Van Loan. 1996. Matrix Computations, Third Edition.
+|      The Johns Hopkins University Press, Baltimore, Maryland.
+|
+|   The method has the advantage of error control. The error is controlled by
+|   setting qValue appropriately (using the function SetQValue).
+|
+---------------------------------------------------------------------------------*/
+void ComputeMatrixExponential (int dim, MrBFlt **a, int qValue, MrBFlt **f)
+{
+    int         i, j, k, negativeFactor;
+    MrBFlt      maxAValue, c, **d, **n, **x, **cX;
+
+    d  = AllocateSquareDoubleMatrix (dim);
+    n  = AllocateSquareDoubleMatrix (dim);
+    x  = AllocateSquareDoubleMatrix (dim);
+    cX = AllocateSquareDoubleMatrix (dim);
+
+    SetToIdentity (dim, d);
+    SetToIdentity (dim, n);
+    SetToIdentity (dim, x);
+
+    maxAValue = 0;
+    for (i=0; i<dim; i++)
+        maxAValue = MAX (maxAValue, a[i][i]);
+
+    j = MAX (0, LogBase2Plus1 (maxAValue));
+
+    DivideByTwos (dim, a, j);
+    
+    c = 1;
+    for (k=1; k<=qValue; k++) 
+        {
+        c = c * (qValue - k + 1.0) / ((2.0 * qValue - k + 1.0) * k);
+
+        /* X = AX */
+        MultiplyMatrices (dim, a, x, x);
+
+        /* N = N + cX */
+        MultiplyMatrixByScalar (dim, x, c, cX);
+        AddTwoMatrices (dim, n, cX, n);
+
+        /* D = D + (-1)^k*cX */
+        negativeFactor = (k % 2 == 0 ? 1 : -1);
+        if (negativeFactor == -1)
+            MultiplyMatrixByScalar (dim, cX, negativeFactor, cX);
+        AddTwoMatrices (dim, d, cX, d);      
+        }
+
+    GaussianElimination (dim, d, n, f);
+
+    for (k = 0; k < j; k++)
+        MultiplyMatrices (dim, f, f, f);
+    
+    for (i=0; i<dim; i++)
+        {
+        for (j=0; j<dim; j++)
+            {
+            if (f[i][j] < 0.0)
+                f[i][j] = fabs(f[i][j]);
+            }
+        }
+        
+    FreeSquareDoubleMatrix (d);
+    FreeSquareDoubleMatrix (n);
+    FreeSquareDoubleMatrix (x);
+    FreeSquareDoubleMatrix (cX);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   CopyComplexMatrices
+|
+|   Copies the contents of one matrix of complex numbers to another matrix.
+|
+---------------------------------------------------------------------------------*/
+void CopyComplexMatrices (int dim, complex **from, complex **to)
+{
+    int         i, j;
+    
+    for (i=0; i<dim; i++)
+        {
+        for (j=0; j<dim; j++) 
+            {
+            to[i][j].re = from[i][j].re;
+            to[i][j].im = from[i][j].im;
+            }
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   CopyDoubleMatrices
+|
+|   Copies the contents of one matrix of doubles to another matrix.
+|
+---------------------------------------------------------------------------------*/
+void CopyDoubleMatrices (int dim, MrBFlt **from, MrBFlt **to)
+{
+    int         i, j;
+    
+    for (i=0; i<dim; i++)
+        {
+        for (j=0; j<dim; j++) 
+            {
+            to[i][j] = from[i][j];
+            }
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   DirichletRandomVariable
+|
+|   Generate a Dirichlet-distributed random variable. The parameter of the
+|   Dirichlet is contained in the vector alp. The random variable is contained
+|   in the vector z.
+|      
+---------------------------------------------------------------------------------*/
+void DirichletRandomVariable (MrBFlt *alp, MrBFlt *z, int n, RandLong *seed)
+{
+    int     i;
+    MrBFlt  sum;
+
+    sum = 0.0;
+    for (i=0; i<n; i++)
+        {
+        z[i] = RndGamma (alp[i], seed) / 1.0;
+        sum += z[i];
+        }
+    for (i=0; i<n; i++)
+        z[i] /= sum;
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   DiscreteGamma
+|
+|   Discretization of gamma distribution with equal proportions in each
+|   category.
+|
+---------------------------------------------------------------------------------*/
+int DiscreteGamma (MrBFlt *rK, MrBFlt alfa, MrBFlt beta, int K, int median)
+{
+    int             i;
+    MrBFlt          gap05 = 1.0/(2.0*K), t, factor = alfa/beta*K, lnga1;
+
+    if (median) 
+        {
+        for (i=0; i<K; i++) 
+            rK[i] = POINTGAMMA((i*2.0+1.0)*gap05, alfa, beta);
+        for (i=0,t=0; i<K; i++) 
+            t += rK[i];
+        for (i=0; i<K; i++)     
+            rK[i] *= factor / t;
+        }
+    else 
+        {
+        lnga1 = LnGamma(alfa+1);
+        /* calculate the points in the gamma distribution */
+        for (i=0; i<K-1; i++) 
+            rK[i] = POINTGAMMA((i+1.0)/K, alfa, beta);
+        /* calculate the cumulative values */
+        for (i=0; i<K-1; i++) 
+            rK[i] = IncompleteGamma(rK[i] * beta, alfa + 1.0, lnga1);
+        rK[K-1] = 1.0;
+        /* calculate the relative values and rescale */
+        for (i=K-1; i>0; i--)
+            {
+            rK[i] -= rK[i-1];
+            rK[i] *= factor;
+            }
+        rK[0] *= factor;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+ |
+ |   DiscreteLogNormal
+ |
+ |   Discretization of lognormal distribution with equal proportions in each
+ |   category.
+ |
+ |   LBH Notes:     K = # of rate classes
+ |                *rK = pointer to output rate class matrix
+ |               alfa = alpha param
+ |               beta = beta param
+ |             median = flag to use media or not (1 = use median, 0 = mean?)
+ |
+ ---------------------------------------------------------------------------------*/
+int DiscreteLogNormal (MrBFlt *rK, MrBFlt sigma, int K, int median)
+{
+    int i;
+    MrBFlt t, factor;
+    MrBFlt sigmaL = sqrt(sigma);
+    MrBFlt mu = -1.0*((0.5*pow(sigmaL,2.0)));
+    if (median)
+        {
+        for (i=0; i<K; i++) {
+            rK[i] = QuantileLogNormal( ((2.0*i + 1) / (2.0 * K)), mu, sigmaL);
+            }
+        for (i=0,t=0.0; i<K; i++) {
+            t = t+rK[i];
+            }
+        t /= K;
+        for (i=0; i<K; i++)
+            rK[i] /= t;
+        }
+    else
+        {
+        mu = -1.0*((0.5*pow(sigmaL,2.0)));
+        /* Mean set to 1.0 so factor = K */
+        factor = 1.0*K;
+        for (i=0; i<K-1; i++) {
+            rK[i] = QuantileLogNormal(((i + 1.0) / (K)), mu, sigmaL);
+            }
+        for (i=0; i<K-1; i++) {
+            //rK[i] = LogNormalPoint(rK[i], mu, sigma);
+            //rK[i] = QuantileLogNormal(rK[i], mu, sigma);
+            //rK[i] = CdfNormal((log(rK[i])-mu)/sigma);
+            rK[i] = 1 - (1.0 * CdfNormal((mu + pow(sigmaL,2.0) - log(rK[i]))/sigmaL));
+            }
+        rK[K-1] = 1.0;
+        for (i=K-1; i>0; i--) {
+            rK[i] -= rK[i-1];
+            rK[i] *= factor;
+            }
+        rK[0] *= factor;
+        }
+
+    return (NO_ERROR);
+}
+
+
+/* LogNormal Quantile Function */
+MrBFlt QuantileLogNormal (MrBFlt prob, MrBFlt mu, MrBFlt sigma)
+{
+    MrBFlt a = 0.0, b = 0.0;
+    a = PointNormal((0.5*(2.0*prob-1.0))+0.5) / sqrt(2.0);
+    b = mu+(sqrt(2.0)* sigma * a);
+    return exp(b);
+}
+
+
+/* LogNormal Point Function */
+MrBFlt LogNormalPoint (MrBFlt x, MrBFlt mu, MrBFlt sigma)
+{
+    if(x <= 0.0) return(0.0);
+    MrBFlt a = LnProbLogNormal(mu, sigma, x);
+    return exp(a);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   DivideByTwos
+|
+|   Divides all of the elements of the matrix a by 2^power.
+|      
+---------------------------------------------------------------------------------*/
+void DivideByTwos (int dim, MrBFlt **a, int power)
+{
+    int         divisor = 1, i, row, col;
+
+    for (i=0; i<power; i++)
+        divisor = divisor * 2;
+
+    for (row=0; row<dim; row++)
+        for (col=0; col<dim; col++)
+            a[row][col] /= divisor;
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   D_sign
+|
+|   This function is called from "Hqr2".
+|
+---------------------------------------------------------------------------------*/
+MrBFlt D_sign (MrBFlt a, MrBFlt b)
+{
+    MrBFlt      x;
+
+    x = (a >= 0 ? a : -a);
+    
+    return (b >= 0 ? x : -x);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Eigens
+|
+|   The matrix of interest is a. The ouptut is the real and imaginary parts of the 
+|   eigenvalues (wr and wi). z contains the real and imaginary parts of the 
+|   eigenvectors. iv2 and fv1 are working vectors.
+|      
+---------------------------------------------------------------------------------*/
+int EigensForRealMatrix (int dim, MrBFlt **a, MrBFlt *wr, MrBFlt *wi, MrBFlt **z, int *iv1, MrBFlt *fv1)
+{
+    static int  is1, is2;
+    int         ierr;
+
+    Balanc (dim, a, &is1, &is2, fv1);
+    ElmHes (dim, is1, is2, a, iv1);
+    ElTran (dim, is1, is2, a, iv1, z);
+    ierr = Hqr2 (dim, is1, is2, a, wr, wi, z);
+    if (ierr == 0)
+        BalBak (dim, is1, is2, fv1, dim, z);
+
+    return (ierr);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ElmHes
+|
+|   Given a real general matrix, this subroutine
+|   reduces a submatrix situated in rows and columns
+|   low through high to upper Hessenberg form by
+|   stabilized elementary similarity transformations.
+|
+|   On input:
+|
+|    * dim is the order of the matrix
+|
+|    * low and high are integers determined by the balancing
+|      subroutine  balanc.  if  balanc  has not been used,
+|      set low=1, high=dim.
+|
+|    * a contains the input matrix.
+|
+|   On output:
+|
+|    * a contains the hessenberg matrix.  The multipliers
+|      which were used in the reduction are stored in the
+|      remaining triangle under the hessenberg matrix.
+|
+|    * interchanged contains information on the rows and columns
+|      interchanged in the reduction.
+|
+|   Only elements low through high are used.
+|
+---------------------------------------------------------------------------------*/
+void ElmHes (int dim, int low, int high, MrBFlt **a, int *interchanged)
+{
+    int         i, j, m, la, mm1, kp1, mp1;
+    MrBFlt      x, y;
+    
+    la = high - 1;
+    kp1 = low + 1;
+    if (la < kp1)
+        return; /* remove goto statement, which exits at bottom of function */
+
+    for (m=kp1; m<=la; m++)
+        {
+        mm1 = m - 1;
+        x = 0.0;
+        i = m;
+    
+        for (j=m; j<=high; j++)
+            {
+            if (fabs(a[j][mm1]) > fabs(x)) /* change direction of inequality */
+                {                          /* remove goto statement          */
+                x = a[j][mm1];
+                i = j;
+                }
+            }
+    
+        interchanged[m] = i;
+        if (i != m) /* change "==" to "!=", eliminating goto statement */
+            {
+            /* interchange rows and columns of a */
+            for (j=mm1; j<dim; j++)
+                {
+                y = a[i][j];
+                a[i][j] = a[m][j];
+                a[m][j] = y;
+                }
+            for (j=0; j<=high; j++)
+                {
+                y = a[j][i];
+                a[j][i] = a[j][m];
+                a[j][m] = y;
+                }
+            }
+
+        if (AreDoublesEqual(x, 0.0, ETA)==NO) /* change "==" to "!=", eliminating goto statement */
+            {
+            mp1 = m + 1;
+        
+            for (i=mp1; i<=high; i++)
+                {
+                y = a[i][mm1];
+                if (AreDoublesEqual(y, 0.0, ETA)==NO) /* != 0.0 */
+                    {
+                    y /= x;
+                    a[i][mm1] = y;
+                    for (j = m; j < dim; j++)
+                        a[i][j] -= y * a[m][j];
+                    for (j = 0; j <= high; j++)
+                        a[j][m] += y * a[j][i];
+                    }
+                }
+            }
+        }
+
+#if 0
+/* begin f2c version of code:
+   elmhes.f -- translated by f2c (version 19971204) */
+int elmhes (int *nm, int *n, int *low, int *igh, MrBFlt *a, int *int__)
+
+{
+
+    /*system generated locals */
+    int a_dim1, a_offset, i__1, i__2, i__3;
+    MrBFlt d__1;
+
+    /* local variables */
+    static int i__, j, m;
+    static MrBFlt x, y;
+    static int la, mm1, kp1, mp1;
+
+    /* parameter adjustments */
+    a_dim1 = *nm;
+    a_offset = a_dim1 + 1;
+    a -= a_offset;
+    --int__;
+
+    /* function body */
+    la = *igh - 1;
+    kp1 = *low + 1;
+    if (la < kp1) 
+        goto L200;
+
+    i__1 = la;
+    for (m = kp1; m <= i__1; ++m) 
+        {
+        mm1 = m - 1;
+        x = 0.;
+        i__ = m;
+        i__2 = *igh;
+        for (j = m; j <= i__2; ++j) 
+            {
+            if ((d__1 = a[j + mm1 * a_dim1], abs(d__1)) <= abs(x)) 
+                goto L100;
+            x = a[j + mm1 * a_dim1];
+            i__ = j;
+            L100:
+            ;
+        }
+
+    int__[m] = i__;
+    if (i__ == m) 
+        goto L130;
+
+    /* .......... interchange rows and columns of a.......... */
+    i__2 = *n;
+    for (j = mm1; j <= i__2; ++j) 
+        {
+        y = a[i__ + j * a_dim1];
+        a[i__ + j * a_dim1] = a[m + j * a_dim1];
+        a[m + j * a_dim1] = y;
+        /* L110: */
+        }
+
+    i__2 = *igh;
+    for (j = 1; j <= i__2; ++j) 
+        {
+        y = a[j + i__ * a_dim1];
+        a[j + i__ * a_dim1] = a[j + m * a_dim1];
+        a[j + m * a_dim1] = y;
+        /* L120: */
+        }
+        
+    /* .......... end interchange .......... */
+    L130:
+    if (x == 0.) 
+        goto L180;
+    mp1 = m + 1;
+
+    i__2 = *igh;
+    for (i__ = mp1; i__ <= i__2; ++i__) 
+        {
+        y = a[i__ + mm1 * a_dim1];
+        if (y == 0.) 
+            goto L160;
+        y /= x;
+        a[i__ + mm1 * a_dim1] = y;
+
+        i__3 = *n;
+        for (j = m; j <= i__3; ++j) 
+            {
+            /* L140: */
+            a[i__ + j * a_dim1] -= y * a[m + j * a_dim1];
+            }
+
+        i__3 = *igh;
+        for (j = 1; j <= i__3; ++j) 
+            {
+            /* L150: */
+            a[j + m * a_dim1] += y * a[j + i__ * a_dim1];
+            }
+
+        L160:
+            ;
+        }
+
+    L180:
+        ;
+    }
+
+    L200:
+    return 0;
+    
+}
+/* end f2c version of code */
+#endif
+        
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ElTran
+|
+|   This subroutine accumulates the stabilized elementary
+|   similarity transformations used in the reduction of a
+|   real general matrix to upper Hessenberg form by ElmHes.
+|
+|   On input:
+|
+|    * dim is the order of the matrix.
+|
+|    * low and high are integers determined by the balancing
+|      subroutine  balanc. If Balanc has not been used,
+|      set low=0, high=dim-1.
+|
+|    * a contains the multipliers which were used in the
+|      reduction by  ElmHes in its lower triangle
+|      below the subdiagonal.
+|
+|    * interchanged contains information on the rows and columns
+|      interchanged in the reduction by ElmHes.
+|      only elements low through high are used.
+|
+|   On output:
+|
+|    * z contains the transformation matrix produced in the
+|      reduction by ElmHes.
+|
+|   This routine is a translation of the Algol procedure from
+|   Handbook for Automatic Computation, vol. II, Linear Algebra,
+|   by Wilkinson and Reinsch, Springer-Verlag.
+|   
+---------------------------------------------------------------------------------*/
+void ElTran (int dim, int low, int high, MrBFlt **a, int *interchanged, MrBFlt **z)
+{
+    int         i, j, mp;
+
+    /* initialize z to identity matrix */
+    for (j=0; j<dim; j++)
+        {
+        for (i=0; i<dim; i++)
+            z[i][j] = 0.0;
+        z[j][j] = 1.0;
+        }
+    for (mp=high-1; mp>=low+1; mp--) /* there were a number of additional    */
+        {                            /* variables (kl, la, m, mm, mp1) that  */
+        for (i=mp+1; i<=high; i++)   /* have been eliminated here simply by  */
+            z[i][mp] = a[i][mp-1];   /* initializing variables appropriately */
+        i = interchanged[mp];        /* in the loops                         */
+        if (i != mp) /* change "==" to "!=" to eliminate a goto statement */
+            {
+            for (j=mp; j<=high; j++)
+                {
+                z[mp][j] = z[i][j];
+                z[i][j] = 0.0;
+                }
+            z[i][mp] = 1.0;
+            }
+        }
+    
+#if 0
+/* begin f2c version of code:
+   eltran.f -- translated by f2c (version 19971204) */
+int eltran (int *nm, int *n, int *low, int *igh, MrBFlt *a, int *int__, MrBFlt *z__)
+
+{
+
+    /* system generated locals */
+    int a_dim1, a_offset, z_dim1, z_offset, i__1, i__2;
+
+    /* local variables */
+    static int i__, j, kl, mm, mp, mp1;
+
+    /*     .......... initialize z to identity matrix .......... */
+    
+    /* parameter adjustments */
+    z_dim1 = *nm;
+    z_offset = z_dim1 + 1;
+    z__ -= z_offset;
+    --int__;
+    a_dim1 = *nm;
+    a_offset = a_dim1 + 1;
+    a -= a_offset;
+
+    /* function Body */
+    i__1 = *n;
+    for (j = 1; j <= i__1; ++j) 
+        {
+        i__2 = *n;
+        for (i__ = 1; i__ <= i__2; ++i__) 
+            {
+            /* L60: */
+            z__[i__ + j * z_dim1] = 0.0;
+            }
+        z__[j + j * z_dim1] = 1.0;
+        /* L80: */
+        }
+
+    kl = *igh - *low - 1;
+    if (kl < 1) 
+        goto L200;
+
+    /* .......... for mp=igh-1 step -1 until low+1 do -- .......... */
+    i__1 = kl;
+    for (mm = 1; mm <= i__1; ++mm) 
+        {
+        mp = *igh - mm;
+        mp1 = mp + 1;
+        i__2 = *igh;
+        for (i__ = mp1; i__ <= i__2; ++i__) 
+            {
+            /* L100: */
+            z__[i__ + mp * z_dim1] = a[i__ + (mp - 1) * a_dim1];
+            }
+        i__ = int__[mp];
+        if (i__ == mp) 
+            goto L140;
+        i__2 = *igh;
+        for (j = mp; j <= i__2; ++j) 
+            {
+            z__[mp + j * z_dim1] = z__[i__ + j * z_dim1];
+            z__[i__ + j * z_dim1] = 0.;
+            /* L130: */
+            }
+        z__[i__ + mp * z_dim1] = 1.;
+        L140:
+            ;
+        }
+
+    L200:
+    return 0;
+
+}
+/* end f2c version of code */
+#endif
+    
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Exchange
+|
+---------------------------------------------------------------------------------*/
+void Exchange (int j, int k, int l, int m, int n, MrBFlt **a, MrBFlt *scale)
+{
+    int         i;
+    MrBFlt      f;
+
+    scale[m] = (MrBFlt)j;
+    if (j != m)
+        {
+        for (i = 0; i <= l; i++)
+            {
+            f = a[i][j];
+            a[i][j] = a[i][m];
+            a[i][m] = f;
+            }   
+        for (i = k; i < n; i++)
+            {
+            f = a[j][i];
+            a[j][i] = a[m][i];
+            a[m][i] = f;
+            }
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Factorial
+|
+|   Returns x!
+|      
+---------------------------------------------------------------------------------*/
+MrBFlt Factorial (int x)
+{
+    int         i;
+    MrBFlt      fac;
+    
+    fac = 1.0;
+    for (i=0; i<x; i++)
+        {
+        fac *= (i+1);
+        }
+        
+    return (fac);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ForwardSubstitutionRow
+|
+---------------------------------------------------------------------------------*/
+void ForwardSubstitutionRow (int dim, MrBFlt **L, MrBFlt *b)
+{
+    int         i, j;
+    MrBFlt      dotProduct;
+
+    b[0] = b[0] / L[0][0];
+    for (i=1; i<dim; i++) 
+        {
+        dotProduct = 0.0;
+        for (j=0; j<i; j++)
+            dotProduct += L[i][j] * b[j];
+        b[i] = (b[i] - dotProduct) / L[i][i];
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   FreeSquareComplexMatrix
+|
+|   Frees a matrix of complex numbers.
+|      
+---------------------------------------------------------------------------------*/
+void FreeSquareComplexMatrix (complex **m)
+{
+    free((char *) (m[0]));
+    free((char *) (m));
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   FreeSquareDoubleMatrix
+|
+|   Frees a matrix of doubles.
+|      
+---------------------------------------------------------------------------------*/
+void FreeSquareDoubleMatrix (MrBFlt **m)
+{
+    free((char *) (m[0]));
+    free((char *) (m));
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   FreeSquareIntegerMatrix
+|
+|   Frees a matrix of integers.
+|      
+---------------------------------------------------------------------------------*/
+void FreeSquareIntegerMatrix (int **m)
+{
+    free((char *) (m[0]));
+    free((char *) (m));
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   GammaRandomVariable
+|
+|   This function generates a gamma-distributed random variable with parameters
+|   a and b. The mean is E(X) = a / b and the variance is Var(X) = a / b^2.
+|      
+---------------------------------------------------------------------------------*/
+MrBFlt GammaRandomVariable (MrBFlt a, MrBFlt b, RandLong *seed)
+{
+    return (RndGamma (a, seed) / b);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   GaussianElimination
+|      
+---------------------------------------------------------------------------------*/
+void GaussianElimination (int dim, MrBFlt **a, MrBFlt **bMat, MrBFlt **xMat)
+{
+    int         i, k;
+    MrBFlt      *bVec, **lMat, **uMat;
+
+    lMat = AllocateSquareDoubleMatrix (dim);
+    uMat = AllocateSquareDoubleMatrix (dim);
+    bVec = (MrBFlt *) SafeMalloc ((size_t)dim * sizeof(MrBFlt));
+    if (!bVec)
+        {
+        MrBayesPrint ("%s   Error: Problem allocating bVec\n", spacer);
+        exit (0);
+        }
+
+    ComputeLandU (dim, a, lMat, uMat);
+
+    for (k=0; k<dim; k++) 
+        {
+        
+        for (i=0; i<dim; i++)
+            bVec[i] = bMat[i][k];
+
+        /* Answer of Ly = b (which is solving for y) is copied into b. */
+        ForwardSubstitutionRow (dim, lMat, bVec);
+
+        /* Answer of Ux = y (solving for x and the y was copied into b above) 
+           is also copied into b. */
+        BackSubstitutionRow (dim, uMat, bVec);
+
+        for (i=0; i<dim; i++)
+            xMat[i][k] = bVec[i];
+
+        }
+    
+    FreeSquareDoubleMatrix (lMat);
+    FreeSquareDoubleMatrix (uMat);
+    free (bVec);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   GetEigens
+|
+|   returns NO if non complex eigendecomposition, YES if complex eigendecomposition,  ABORT if an error has occured
+|
+---------------------------------------------------------------------------------*/
+int GetEigens (int dim, MrBFlt **q, MrBFlt *eigenValues, MrBFlt *eigvalsImag, MrBFlt **eigvecs, MrBFlt **inverseEigvecs, complex **Ceigvecs, complex **CinverseEigvecs)
+{
+    int         i, j, rc, *iWork, isComplex;
+    MrBFlt      **tempWork, *dWork;
+    complex     **cWork, *Ccol;
+
+    /* allocate memory */
+    dWork = (MrBFlt *) SafeMalloc ((size_t)dim * sizeof(MrBFlt));
+    iWork = (int *) SafeMalloc ((size_t)dim * sizeof(int));
+    if (!dWork || !iWork)
+        {
+        MrBayesPrint ("%s   Error: Problem in GetEigens\n", spacer);
+        exit (0);
+        }
+
+    /* calculate eigenvalues and eigenvectors */
+    isComplex = NO;
+    rc = ComputeEigenSystem (dim, q, eigenValues, eigvalsImag, eigvecs, iWork, dWork);
+    if (rc != NO_ERROR)
+        {
+        if (rc == EVALUATE_COMPLEX_NUMBERS)
+            isComplex = YES;
+        else
+            isComplex = ABORT;
+        }
+
+    /* invert eigenvectors */
+    if (isComplex == NO)
+        {
+        tempWork = AllocateSquareDoubleMatrix (dim);
+        CopyDoubleMatrices (dim, eigvecs, tempWork);
+        InvertMatrix (dim, tempWork, dWork, iWork, inverseEigvecs);
+        FreeSquareDoubleMatrix (tempWork);
+        }
+    else if (isComplex == YES)
+        {
+        for (i=0; i<dim; i++)
+            {
+              if (fabs(eigvalsImag[i])<1E-20) /* == 0.0 */
+                { 
+                for (j=0; j<dim; j++)
+                    {
+                    Ceigvecs[j][i].re = eigvecs[j][i];
+                    Ceigvecs[j][i].im = 0.0;
+                    }
+                }
+            else if (eigvalsImag[i] > 0)
+                { 
+                for (j=0; j<dim; j++)
+                    {
+                    Ceigvecs[j][i].re = eigvecs[j][i];
+                    Ceigvecs[j][i].im = eigvecs[j][i + 1];
+                    }
+                }
+            else if (eigvalsImag[i] < 0)
+                { 
+                for (j=0; j<dim; j++)
+                    {
+                    Ceigvecs[j][i].re =  eigvecs[j][i-1];
+                    Ceigvecs[j][i].im = -eigvecs[j][i];
+                    }
+                }
+            }
+        Ccol = (complex *) SafeMalloc ((size_t)dim * sizeof(complex));
+        if (!Ccol)
+            {
+            MrBayesPrint ("%s   Error: Problem in GetEigens\n", spacer);
+            exit (0);
+            }
+        cWork = AllocateSquareComplexMatrix (dim);
+        CopyComplexMatrices (dim, Ceigvecs, cWork);
+        ComplexInvertMatrix (dim, cWork, dWork, iWork, CinverseEigvecs, Ccol);
+        free (Ccol);
+        FreeSquareComplexMatrix (cWork);
+        }
+
+    free (dWork);
+    free (iWork);
+
+    return (isComplex);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Hqr2
+|
+|   This subroutine finds the eigenvalues and eigenvectors
+|   of a real upper Hessenberg matrix by the QR method. The
+|   eigenvectors of a real general matrix can also be found
+|   if ElmHes  and ElTran or OrtHes and OrTran have
+|   been used to reduce this general matrix to Hessenberg form
+|   and to accumulate the similarity transformations.
+|
+|   On input:
+|
+|    * dim is the order of the matrix.
+|
+|    * low and high are integers determined by the balancing
+|      subroutine  balanc. If  balanc has not been used,
+|      set low=0, high=dim-1.
+|
+|    * h contains the upper hessenberg matrix. Information about
+|      the transformations used in the reduction to Hessenberg
+|      form by  ElmHes  or OrtHes, if performed, is stored
+|      in the remaining triangle under the Hessenberg matrix.
+|
+|   On output:
+|
+|    * h has been destroyed.
+|
+|    * wr and wi contain the real and imaginary parts,
+|      respectively, of the eigenvalues. The eigenvalues
+|      are unordered except that complex conjugate pairs
+|      of values appear consecutively with the eigenvalue
+|      having the positive imaginary part first. If an
+|      error exit is made, the eigenvalues should be correct
+|      for indices j,...,dim-1.
+|
+|    * z contains the transformation matrix produced by ElTran
+|      after the reduction by ElmHes, or by OrTran after the
+|      reduction by OrtHes, if performed. If the eigenvectors
+|      of the Hessenberg matrix are desired, z must contain the
+|      identity matrix.
+|
+|   Calls ComplexDivision2 for complex division.
+|
+|   This function returns:
+|      zero       for normal return,
+|      j          if the limit of 30*n iterations is exhausted
+|                 while the j-th eigenvalue is being sought.
+|
+|   This subroutine is a translation of the ALGOL procedure HQR2,
+|   Num. Math. 14, 219,231(1970) by Martin, Peters, and Wilkinson.
+|   Handbook for Automatic Computation, vol. II - Linear Algebra,
+|   pp. 357-391 (1971).
+|   
+---------------------------------------------------------------------------------*/
+int Hqr2 (int dim, int low, int high, MrBFlt **h, MrBFlt *wr, MrBFlt *wi, MrBFlt **z)
+{
+    int         i, j, k, l, m, na, en, notlas, mp2, itn, its, enm2, twoRoots;
+    MrBFlt      norm, p=0.0, q=0.0, r=0.0, s=0.0, t, w=0.0, x, y=0.0, ra, sa, vi, vr, zz=0.0, tst1, tst2;
+
+    norm = 0.0;
+    k = 0;  /* used for array indexing. FORTRAN version: k = 1 */
+    
+    /* store roots isolated by balance, and compute matrix norm */
+    for (i=0; i<dim; i++)
+        {
+        for (j=k; j<dim; j++)
+            norm += fabs(h[i][j]);
+
+        k = i;
+        if ((i < low) || (i > high))
+            {
+            wr[i] = h[i][i];
+            wi[i] = 0.0;
+            }
+        }
+    en = high;
+    t = 0.0;
+    itn = dim * 30;
+
+    /* search for next eigenvalues */
+    while (en >= low) /* changed from an "if (en < lo)" to eliminate a goto statement */
+        {
+        its = 0;
+        na = en - 1;
+        enm2 = na - 1;
+        twoRoots = FALSE;
+
+        for (;;)
+            {
+            for (l=en; l>low; l--) /* changed indexing, got rid of lo, ll */
+                {
+                s = fabs(h[l-1][l-1]) + fabs(h[l][l]);
+                if (AreDoublesEqual(s, 0.0, ETA)==YES) /* == 0.0 */
+                    s = norm;
+                tst1 = s;
+                tst2 = tst1 + fabs(h[l][l-1]);
+                if (fabs(tst2 - tst1) < ETA) /* tst2 == tst1 */
+                    break; /* changed to break to remove a goto statement */
+                }
+    
+            /* form shift */
+            x = h[en][en];
+            if (l == en) /* changed to break to remove a goto statement */
+                break;
+            y = h[na][na];
+            w = h[en][na] * h[na][en];
+            if (l == na)         /* used to return to other parts of the code */
+                {
+                twoRoots = TRUE;
+                break;
+                }
+            if (itn == 0)
+                return (en);
+                
+            /* form exceptional shift */
+            if ((its == 10) || (its == 20)) /* changed to remove a goto statement */
+                {
+                t += x;
+                for (i = low; i <= en; i++)
+                    h[i][i] -= x;
+                s = fabs(h[en][na]) + fabs(h[na][enm2]);
+                x = 0.75 * s;
+                y = x;
+                w = -0.4375 * s * s;
+                }
+            its++;
+            itn--;
+            
+            /* look for two consecutive small sub-diagonal elements */
+            for (m=enm2; m>=l; m--)
+                {
+                /* removed m = enm2 + l - mm and above loop to remove variables */
+                zz = h[m][m];
+                r = x - zz;
+                s = y - zz;
+                p = (r * s - w) / h[m+1][m] + h[m][m+1];
+                q = h[m+1][m+1] - zz - r - s;
+                r = h[m+2][m+1];
+                s = fabs(p) + fabs(q) + fabs(r);
+                p /= s;
+                q /= s;
+                r /= s;
+                if (m == l)
+                    break; /* changed to break to remove a goto statement */
+                tst1 = fabs(p) * (fabs(h[m-1][m-1]) + fabs(zz) + fabs(h[m+1][m+1]));
+                tst2 = tst1 + fabs(h[m][m-1]) * (fabs(q) + fabs(r));
+                if (fabs(tst2 - tst1) < ETA) /* tst2 == tst1 */
+                    break; /* changed to break to remove a goto statement */
+                }
+        
+            mp2 = m + 2;
+            for (i = mp2; i <= en; i++)
+                {
+                h[i][i-2] = 0.0;
+                if (i != mp2) /* changed "==" to "!=" to remove a goto statement */
+                    h[i][i-3] = 0.0;
+                }
+    
+            /* MrBFlt QR step involving rows l to en and columns m to en */
+            for (k=m; k<=na; k++)
+                {
+                notlas = (k != na);
+                if (k != m) /* changed "==" to "!=" to remove a goto statement */
+                    {
+                    p = h[k][k-1];
+                    q = h[k+1][k-1];
+                    r = 0.0;
+                    if (notlas)
+                        r = h[k+2][k-1];
+                    x = fabs(p) + fabs(q) + fabs(r);
+                    if (x < ETA) /* == 0.0 */
+                        continue; /* changed to continue remove a goto statement */
+                    p /= x;
+                    q /= x;
+                    r /= x;
+                    }
+    
+                /*s = sqrt(p*p+q*q+r*r);
+                sgn = (p<0)?-1:(p>0);
+                s = sgn*sqrt(p*p+q*q+r*r);*/
+                s = D_sign(sqrt(p*p + q*q + r*r), p);
+                if (k != m) /* changed "==" to "!=" to remove a goto statement */
+                    h[k][k-1] = -s * x;
+                else if (l != m) /* else if gets rid of another goto statement */
+                    h[k][k-1] = -h[k][k-1];
+                p += s;
+                x = p / s;
+                y = q / s;
+                zz = r / s;
+                q /= p;
+                r /= p;
+                if (!notlas) /* changed to !notlas to remove goto statement (see **) */
+                    {
+                    /* row modification */
+                    for (j=k; j<dim; j++)
+                        {
+                        p = h[k][j] + q * h[k+1][j];
+                        h[k][j] -= p * x;
+                        h[k+1][j] -= p * y;
+                        } 
+                    j = MIN(en, k + 3);
+                    
+                    /* column modification */
+                    for (i=0; i<=j; i++)
+                        {
+                        p = x * h[i][k] + y * h[i][k+1];
+                        h[i][k] -= p;
+                        h[i][k+1] -= p * q;
+                        }
+                        
+                    /* accumulate transformations */
+                    for (i=low; i<=high; i++)
+                        {
+                        p = x * z[i][k] + y * z[i][k+1];
+                        z[i][k] -= p;
+                        z[i][k+1] -= p * q;
+                        }
+                    }
+                else /* (**) also put in else */
+                    {
+                    /* row modification */
+                    for (j=k; j<dim; j++)
+                        {
+                        p = h[k][j] + q * h[k+1][j] + r * h[k+2][j];
+                        h[k][j] -= p * x;
+                        h[k+1][j] -= p * y;
+                        h[k+2][j] -= p * zz;
+                        }
+                    j = MIN(en, k + 3);
+                    
+                    /* column modification */
+                    for (i = 0; i <= j; i++)
+                        {
+                        p = x * h[i][k] + y * h[i][k+1] + zz * h[i][k+2];
+                        h[i][k] -= p;
+                        h[i][k+1] -= p * q;
+                        h[i][k+2] -= p * r;
+                        }
+                        
+                    /* accumulate transformations */
+                    for (i = low; i <= high; i++)
+                        {
+                        p = x * z[i][k] + y * z[i][k+1] + zz * z[i][k+2];
+                        z[i][k] -= p;
+                        z[i][k+1] -= p * q;
+                        z[i][k+2] -= p * r;
+                        }
+                    }
+                }
+            }
+
+        if (twoRoots)
+            {
+            /* two roots found */
+            p = (y - x) / 2.0;
+            q = p * p + w;
+            zz = sqrt(fabs(q));
+            h[en][en] = x + t;
+            x = h[en][en];
+            h[na][na] = y + t;
+            if (q >= -1e-12) /* change "<" to ">=", and also change "0.0" to */
+                {            /* a small number (Swofford's change)           */
+                /* real pair */
+                zz = p + D_sign(zz, p);
+                wr[na] = x + zz;
+                wr[en] = wr[na];
+                if (fabs(zz) > ETA) /* != 0.0 */
+                    wr[en] = x - w/zz;
+                wi[na] = 0.0;
+                wi[en] = 0.0;
+                x = h[en][na];
+                s = fabs(x) + fabs(zz);
+                p = x / s;
+                q = zz / s;
+                r = sqrt(p*p + q*q);
+                p /= r;
+                q /= r;
+                
+                /* row modification */
+                for (j=na; j<dim; j++)
+                    {
+                    zz = h[na][j];
+                    h[na][j] = q * zz + p * h[en][j];
+                    h[en][j] = q * h[en][j] - p * zz;
+                    }
+                    
+                /* column modification */
+                for (i = 0; i <= en; i++)
+                    {
+                    zz = h[i][na];
+                    h[i][na] = q * zz + p * h[i][en];
+                    h[i][en] = q * h[i][en] - p * zz;
+                    }
+                    
+                /* accumulate transformations */
+                for (i = low; i <= high; i++)
+                    {
+                    zz = z[i][na];
+                    z[i][na] = q * zz + p * z[i][en];
+                    z[i][en] = q * z[i][en] - p * zz;
+                    }
+                }
+            else
+                {
+                /* complex pair */
+                wr[na] = x + p;
+                wr[en] = x + p;
+                wi[na] = zz;
+                wi[en] = -zz;
+                }
+            en = enm2;
+            }
+        else
+            {
+            /* one root found */
+            h[en][en] = x + t;
+            wr[en] = h[en][en];
+            wi[en] = 0.0;
+            en = na;
+            }
+        }
+    
+    if (fabs(norm) < ETA) /* == 0.0 */
+        return (0); /* was a goto end of function */
+
+    for (en=dim-1; en>=0; en--)
+        {
+        /*en = n - nn - 1; and change for loop */
+        p = wr[en];
+        q = wi[en];
+        na = en - 1;
+
+        if (q < -1e-12)
+            {
+            /* last vector component chosen imaginary so that eigenvector
+               matrix is triangular */
+            m = na;
+            if (fabs(h[en][na]) > fabs(h[na][en]))
+                {
+                h[na][na] = q / h[en][na];
+                h[na][en] = -(h[en][en] - p) / h[en][na];
+                }
+            else
+                ComplexDivision2 (0.0, -h[na][en], h[na][na] - p, q, &h[na][na], &h[na][en]);
+
+            h[en][na] = 0.0;
+            h[en][en] = 1.0;
+            enm2 = na - 1;
+            if (enm2 >= 0) /* changed direction to remove goto statement */
+                {
+                for (i=enm2; i>=0; i--)
+                    {
+                    w = h[i][i] - p;
+                    ra = 0.0;
+                    sa = 0.0;
+            
+                    for (j=m; j<=en; j++)
+                        {
+                        ra += h[i][j] * h[j][na];
+                        sa += h[i][j] * h[j][en];
+                        }
+            
+                    if (wi[i] < 0.0) /* changed direction to remove goto statement */
+                        {
+                        zz = w;
+                        r = ra;
+                        s = sa;
+                        }
+                    else
+                        {
+                        m = i;
+                        if (fabs(wi[i])<ETA) /* == 0.0 */ /* changed direction to remove goto statement */
+                            ComplexDivision2 (-ra, -sa, w, q, &h[i][na], &h[i][en]);
+                        else
+                            {
+                            /* solve complex equations */
+                            x = h[i][i+1];
+                            y = h[i+1][i];
+                            vr = (wr[i] - p) * (wr[i] - p) + wi[i] * wi[i] - q * q;
+                            vi = (wr[i] - p) * 2.0 * q;
+                            if ((fabs(vr)<ETA) && (fabs(vi)<ETA))
+                                {
+                                tst1 = norm * (fabs(w) + fabs(q) + fabs(x) + fabs(y) + fabs(zz));
+                                vr = tst1;
+                                do  {
+                                    vr *= .01;
+                                    tst2 = tst1 + vr;
+                                    }
+                                    while (tst2 > tst1); /* made into a do/while loop */
+                                }
+                            ComplexDivision2 (x * r - zz * ra + q * sa, x * s - zz * sa - q * ra, vr, vi, &h[i][na], &h[i][en]);
+                            if (fabs(x) > fabs(zz) + fabs(q)) /* changed direction to remove goto statement */
+                                {
+                                h[i+1][na] = (-ra - w * h[i][na] + q * h[i][en]) / x;
+                                h[i+1][en] = (-sa - w * h[i][en] - q * h[i][na]) / x;
+                                }
+                            else
+                                ComplexDivision2 (-r - y * h[i][na], -s - y * h[i][en], zz, q, &h[i+1][na], &h[i+1][en]);
+                            }
+                            
+                        /* overflow control */
+                        tst1 = fabs(h[i][na]);
+                        tst2 = fabs(h[i][en]);
+                        t = MAX(tst1, tst2);
+                        if (t > ETA) /* t != 0.0 */
+                            {
+                            tst1 = t;
+                            tst2 = tst1 + 1.0 / tst1;
+                            if (tst2 <= tst1)
+                                {
+                                for (j = i; j <= en; j++)
+                                    {
+                                    h[j][na] /= t;
+                                    h[j][en] /= t;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        else if (fabs(q)<ETA)
+            {
+            /* real vector */
+            m = en;
+            h[en][en] = 1.0;
+            if (na >= 0)
+                {
+                for (i=na; i>=0; i--)
+                    {
+                    w = h[i][i] - p;
+                    r = 0.0;
+                    for (j = m; j <= en; j++)
+                        r += h[i][j] * h[j][en];
+                    if (wi[i] < 0.0) /* changed direction to remove goto statement */
+                        {
+                        zz = w;
+                        s = r;
+                        continue;  /* changed to continue to remove goto statement */
+                        }
+                    else
+                        {
+                        m = i;
+                        if (fabs(wi[i])<ETA) /* changed to remove goto statement */
+                            {
+                            t = w;
+                            if (fabs(t)<ETA)  /* changed to remove goto statement */
+                                {
+                                tst1 = norm;
+                                t = tst1;
+                                do  {
+                                    t *= .01;
+                                    tst2 = norm + t;
+                                    }
+                                    while (tst2 > tst1);
+                                }           
+                            h[i][en] = -r / t;
+                            }
+                        else
+                            {
+                            /* solve real equations */
+                            x = h[i][i+1];
+                            y = h[i+1][i];
+                            q = (wr[i] - p) * (wr[i] - p) + wi[i] * wi[i];
+                            t = (x * s - zz * r) / q;
+                            h[i][en] = t;
+                            if (fabs(x) > fabs(zz))  /* changed direction to remove goto statement */
+                                h[i+1][en] = (-r - w * t) / x;
+                            else
+                                h[i+1][en] = (-s - y * t) / zz;
+                            }
+                
+                        /* overflow control */
+                        t = fabs(h[i][en]);
+                        if (t > ETA)
+                            {
+                            tst1 = t;
+                            tst2 = tst1 + 1. / tst1;
+                            if (tst2 <= tst1)
+                                {
+                                for (j = i; j <= en; j++)
+                                    h[j][en] /= t;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    
+    for (i=0; i<dim; i++)
+        {
+        if ((i < low) || (i > high)) /* changed to rid goto statement */
+            {
+            for (j=i; j<dim; j++)
+                z[i][j] = h[i][j];
+            }
+        }
+
+    /* multiply by transformation matrix to give vectors of original
+       full matrix */
+    for (j=dim-1; j>=low; j--)
+        {
+        m = MIN(j, high);
+        for (i=low; i<=high; i++)
+            {
+            zz = 0.0;
+            for (k = low; k <= m; k++)
+                zz += z[i][k] * h[k][j];
+            z[i][j] = zz;
+            }
+        }
+
+    return (0);
+    
+#if 0
+int hqr2 (int *nm, int *n, int *low, int *igh, MrBFlt *h__, MrBFlt *wr, MrBFlt *wi, MrBFlt *z__, int *ierr)
+    
+{
+
+    /* system generated locals */
+    int h_dim1, h_offset, z_dim1, z_offset, i__1, i__2, i__3;
+    MrBFlt d__1, d__2, d__3, d__4;
+
+    /* builtin functions */
+    MrBFlt sqrt(doublereal), d_sign(doublereal *, doublereal *);
+
+    /* Local variables */
+    static MrBFlt norm;
+    static int i__, j, k, l, m;
+    static MrBFlt p, q, r__, s, t, w, x, y;
+    static int na, ii, en, jj;
+    static MrBFlt ra, sa;
+    static int ll, mm, nn;
+    static MrBFlt vi, vr, zz;
+    static logical notlas;
+    static int mp2, itn, its, enm2;
+    static MrBFlt tst1, tst2;
+
+    /* parameter adjustments */
+    z_dim1 = *nm;
+    z_offset = z_dim1 + 1;
+    z__ -= z_offset;
+    --wi;
+    --wr;
+    h_dim1 = *nm;
+    h_offset = h_dim1 + 1;
+    h__ -= h_offset;
+
+    /* function Body */
+    *ierr = 0;
+    norm = 0.;
+    k = 1;
+    
+    /* .......... store roots isolated by balanc and compute matrix norm .......... */
+    i__1 = *n;
+    for (i__ = 1; i__ <= i__1; ++i__) 
+        {
+        i__2 = *n;
+        for (j = k; j <= i__2; ++j) 
+            {
+            /* L40: */
+            norm += (d__1 = h__[i__ + j * h_dim1], abs(d__1));
+            }
+        k = i__;
+        if (i__ >= *low && i__ <= *igh) 
+            goto L50;
+        wr[i__] = h__[i__ + i__ * h_dim1];
+        wi[i__] = 0.;
+        L50:
+            ;
+        }
+
+    en = *igh;
+    t = 0.;
+    itn = *n * 30;
+    
+    /* ..........search for next eigenvalues.......... */
+    L60:
+    if (en < *low) 
+        goto L340;
+    its = 0;
+    na = en - 1;
+    enm2 = na - 1;
+    
+    /* ..........look for single small sub-diagonal element for l=en step -1 until low do -- .......... */
+    L70:
+    i__1 = en;
+    for (ll = *low; ll <= i__1; ++ll) 
+        {
+        l = en + *low - ll;
+        if (l == *low) 
+            goto L100;
+        s = (d__1 = h__[l - 1 + (l - 1) * h_dim1], abs(d__1)) + (d__2 = h__[l + l * h_dim1], abs(d__2));
+        if (s == 0.0) 
+            s = norm;
+        tst1 = s;
+        tst2 = tst1 + (d__1 = h__[l + (l - 1) * h_dim1], abs(d__1));
+        if (tst2 == tst1) 
+            goto L100;
+        /* L80: */
+        }
+        
+    /* .......... form shift .......... */
+    L100:
+    x = h__[en + en * h_dim1];
+    if (l == en) 
+        goto L270;
+    y = h__[na + na * h_dim1];
+    w = h__[en + na * h_dim1] * h__[na + en * h_dim1];
+    if (l == na) 
+        goto L280;
+    if (itn == 0) 
+        goto L1000;
+    if (its != 10 && its != 20) 
+        goto L130;
+
+    /* .......... form exceptional shift .......... */
+    t += x;
+
+    i__1 = en;
+    for (i__ = *low; i__ <= i__1; ++i__) 
+        {
+        /* L120: */
+        h__[i__ + i__ * h_dim1] -= x;
+        }
+
+    s = (d__1 = h__[en + na * h_dim1], abs(d__1)) + (d__2 = h__[na + enm2 * h_dim1], abs(d__2));
+    x = s * 0.75;
+    y = x;
+    w = s * -0.4375 * s;
+    L130:
+    ++its;
+    --itn;
+    
+    /* .......... look for two consecutive small sub-diagonal elements for m=en-2 step -1 until l do -- .......... */
+    i__1 = enm2;
+    for (mm = l; mm <= i__1; ++mm) 
+        {
+        m = enm2 + l - mm;
+        zz = h__[m + m * h_dim1];
+        r__ = x - zz;
+        s = y - zz;
+        p = (r__ * s - w) / h__[m + 1 + m * h_dim1] + h__[m + (m + 1) * h_dim1];
+        q = h__[m + 1 + (m + 1) * h_dim1] - zz - r__ - s;
+        r__ = h__[m + 2 + (m + 1) * h_dim1];
+        s = abs(p) + abs(q) + abs(r__);
+        p /= s;
+        q /= s;
+        r__ /= s;
+        if (m == l) 
+            goto L150;
+        tst1 = abs(p) * ((d__1 = h__[m - 1 + (m - 1) * h_dim1], abs(d__1)) + 
+        abs(zz) + (d__2 = h__[m + 1 + (m + 1) * h_dim1], abs(d__2)));
+        tst2 = tst1 + (d__1 = h__[m + (m - 1) * h_dim1], abs(d__1)) * (abs(q) + abs(r__));
+        if (tst2 == tst1) 
+            goto L150;
+        /* L140: */
+        }
+    L150:
+    mp2 = m + 2;
+
+    i__1 = en;
+    for (i__ = mp2; i__ <= i__1; ++i__) 
+        {
+        h__[i__ + (i__ - 2) * h_dim1] = 0.0;
+        if (i__ == mp2)
+            goto L160;
+        h__[i__ + (i__ - 3) * h_dim1] = 0.;
+        L160:
+            ;
+        }
+        
+    /*     .......... MrBFlt qr step involving rows l to en and columns m to en .......... */
+    i__1 = na;
+    for (k = m; k <= i__1; ++k) 
+        {
+        notlas = k != na;
+        if (k == m) 
+            goto L170;
+        p = h__[k + (k - 1) * h_dim1];
+        q = h__[k + 1 + (k - 1) * h_dim1];
+        r__ = 0.;
+        if (notlas) 
+            r__ = h__[k + 2 + (k - 1) * h_dim1];
+        x = abs(p) + abs(q) + abs(r__);
+        if (x == 0.) 
+            goto L260;
+        p /= x;
+        q /= x;
+        r__ /= x;
+        L170:
+        d__1 = sqrt(p * p + q * q + r__ * r__);
+        s = d_sign(&d__1, &p);
+        if (k == m) 
+            goto L180;
+        h__[k + (k - 1) * h_dim1] = -s * x;
+        goto L190;
+        L180:
+        if (l != m) 
+            {
+            h__[k + (k - 1) * h_dim1] = -h__[k + (k - 1) * h_dim1];
+            }
+        L190:
+        p += s;
+        x = p / s;
+        y = q / s;
+        zz = r__ / s;
+        q /= p;
+        r__ /= p;
+        if (notlas) 
+            goto L225;
+        
+        /* .......... row modification .......... */
+        i__2 = *n;
+        for (j = k; j <= i__2; ++j) 
+            {
+            p = h__[k + j * h_dim1] + q * h__[k + 1 + j * h_dim1];
+            h__[k + j * h_dim1] -= p * x;
+            h__[k + 1 + j * h_dim1] -= p * y;
+            /* L200: */
+            }
+
+        /* computing MIN */
+        i__2 = en, i__3 = k + 3;
+        j = min(i__2,i__3);
+        
+        /* .......... column modification .......... */
+        i__2 = j;
+        for (i__ = 1; i__ <= i__2; ++i__) 
+            {
+            p = x * h__[i__ + k * h_dim1] + y * h__[i__ + (k + 1) * h_dim1];
+            h__[i__ + k * h_dim1] -= p;
+            h__[i__ + (k + 1) * h_dim1] -= p * q;
+            /* L210: */
+            }
+            
+        /* .......... accumulate transformations .......... */
+        i__2 = *igh;
+        for (i__ = *low; i__ <= i__2; ++i__) 
+            {
+            p = x * z__[i__ + k * z_dim1] + y * z__[i__ + (k + 1) * z_dim1];
+            z__[i__ + k * z_dim1] -= p;
+            z__[i__ + (k + 1) * z_dim1] -= p * q;
+            /* L220: */
+            }
+        goto L255;
+        L225:
+        
+        /* .......... row modification .......... */
+        i__2 = *n;
+        for (j = k; j <= i__2; ++j) 
+            {
+            p = h__[k + j * h_dim1] + q * h__[k + 1 + j * h_dim1] + r__ * h__[k + 2 + j * h_dim1];
+            h__[k + j * h_dim1] -= p * x;
+            h__[k + 1 + j * h_dim1] -= p * y;
+            h__[k + 2 + j * h_dim1] -= p * zz;
+            /* L230: */
+            }
+
+        /* computing MIN */
+        i__2 = en, i__3 = k + 3;
+        j = min(i__2,i__3);
+        
+        /* .......... column modification .......... */
+        i__2 = j;
+        for (i__ = 1; i__ <= i__2; ++i__) 
+            {
+            p = x * h__[i__ + k * h_dim1] + y * h__[i__ + (k + 1) * h_dim1] + 
+            zz * h__[i__ + (k + 2) * h_dim1];
+            h__[i__ + k * h_dim1] -= p;
+            h__[i__ + (k + 1) * h_dim1] -= p * q;
+            h__[i__ + (k + 2) * h_dim1] -= p * r__;
+            /* L240: */
+            }
+        
+        /* .......... accumulate transformations .......... */
+        i__2 = *igh;
+        for (i__ = *low; i__ <= i__2; ++i__) 
+            {
+            p = x * z__[i__ + k * z_dim1] + y * z__[i__ + (k + 1) * z_dim1] + zz * z__[i__ + (k + 2) * z_dim1];
+            z__[i__ + k * z_dim1] -= p;
+            z__[i__ + (k + 1) * z_dim1] -= p * q;
+            z__[i__ + (k + 2) * z_dim1] -= p * r__;
+            /* L250: */
+            }
+        L255:
+        L260:
+            ;
+        }
+    goto L70;
+    
+    /* .......... one root found .......... */
+    L270:
+    h__[en + en * h_dim1] = x + t;
+    wr[en] = h__[en + en * h_dim1];
+    wi[en] = 0.;
+    en = na;
+    goto L60;
+    
+    /* .......... two roots found .......... */
+    L280:
+    p = (y - x) / 2.;
+    q = p * p + w;
+    zz = sqrt((abs(q)));
+    h__[en + en * h_dim1] = x + t;
+    x = h__[en + en * h_dim1];
+    h__[na + na * h_dim1] = y + t;
+    if (q < 0.) 
+        goto L320;
+    
+    /* .......... real pair .......... */
+    zz = p + d_sign(&zz, &p);
+    wr[na] = x + zz;
+    wr[en] = wr[na];
+    if (zz != 0.) 
+        {
+        wr[en] = x - w / zz;
+        }
+    wi[na] = 0.0;
+    wi[en] = 0.0;
+    x = h__[en + na * h_dim1];
+    s = abs(x) + abs(zz);
+    p = x / s;
+    q = zz / s;
+    r__ = sqrt(p * p + q * q);
+    p /= r__;
+    q /= r__;
+    
+    /* .......... row modification .......... */
+    i__1 = *n;
+    for (j = na; j <= i__1; ++j) 
+        {
+        zz = h__[na + j * h_dim1];
+        h__[na + j * h_dim1] = q * zz + p * h__[en + j * h_dim1];
+        h__[en + j * h_dim1] = q * h__[en + j * h_dim1] - p * zz;
+        /* L290: */
+        }
+    
+    /* .......... column modification .......... */
+    i__1 = en;
+    for (i__ = 1; i__ <= i__1; ++i__) 
+        {
+        zz = h__[i__ + na * h_dim1];
+        h__[i__ + na * h_dim1] = q * zz + p * h__[i__ + en * h_dim1];
+        h__[i__ + en * h_dim1] = q * h__[i__ + en * h_dim1] - p * zz;
+        /* L300: */
+        }
+        
+    /* .......... accumulate transformations .......... */
+    i__1 = *igh;
+    for (i__ = *low; i__ <= i__1; ++i__) 
+        {
+        zz = z__[i__ + na * z_dim1];
+        z__[i__ + na * z_dim1] = q * zz + p * z__[i__ + en * z_dim1];
+        z__[i__ + en * z_dim1] = q * z__[i__ + en * z_dim1] - p * zz;
+        /* L310: */
+        }
+    goto L330;
+    
+    /* .......... complex pair .......... */
+    L320:
+    wr[na] = x + p;
+    wr[en] = x + p;
+    wi[na] = zz;
+    wi[en] = -zz;
+    L330:
+    en = enm2;
+    goto L60;
+    
+    /* .......... all roots found.  backsubstitute to find vectors of upper triangular form .......... */
+    L340:
+    if (norm == 0.0) 
+        goto L1001;
+
+    /* .......... for en=n step -1 until 1 do -- .......... */
+    i__1 = *n;
+    for (nn = 1; nn <= i__1; ++nn) 
+        {
+        en = *n + 1 - nn;
+        p = wr[en];
+        q = wi[en];
+        na = en - 1;
+        if (q < 0.) 
+            goto L710;
+        else if (q == 0) 
+            goto L600;
+        else 
+            goto L800;
+            
+        /* .......... real vector .......... */
+        L600:
+        m = en;
+        h__[en + en * h_dim1] = 1.0;
+        if (na == 0) 
+            goto L800;
+        
+        /*     .......... for i=en-1 step -1 until 1 do -- .......... */
+        i__2 = na;
+        for (ii = 1; ii <= i__2; ++ii) 
+            {
+            i__ = en - ii;
+            w = h__[i__ + i__ * h_dim1] - p;
+            r__ = 0.0;
+
+            i__3 = en;
+            for (j = m; j <= i__3; ++j) 
+                {
+                /* L610: */
+                r__ += h__[i__ + j * h_dim1] * h__[j + en * h_dim1];
+                }
+
+            if (wi[i__] >= 0.0) 
+                goto L630;
+            zz = w;
+            s = r__;
+            goto L700;
+            L630:
+            m = i__;
+            if (wi[i__] != 0.0) 
+                goto L640;
+            t = w;
+            if (t != 0.0)
+                goto L635;
+            tst1 = norm;
+            t = tst1;
+            L632:
+            t *= 0.01;
+            tst2 = norm + t;
+            if (tst2 > tst1) 
+                goto L632;
+            L635:
+            h__[i__ + en * h_dim1] = -r__ / t;
+            goto L680;
+            
+            /* .......... solve real equations .......... */
+            L640:
+            x = h__[i__ + (i__ + 1) * h_dim1];
+            y = h__[i__ + 1 + i__ * h_dim1];
+            q = (wr[i__] - p) * (wr[i__] - p) + wi[i__] * wi[i__];
+            t = (x * s - zz * r__) / q;
+            h__[i__ + en * h_dim1] = t;
+            if (abs(x) <= abs(zz)) 
+                goto L650;
+            h__[i__ + 1 + en * h_dim1] = (-r__ - w * t) / x;
+            goto L680;
+            L650:
+            h__[i__ + 1 + en * h_dim1] = (-s - y * t) / zz;
+
+            /*     .......... overflow control .......... */
+            L680:
+            t = (d__1 = h__[i__ + en * h_dim1], abs(d__1));
+            if (t == 0.0) 
+                goto L700;
+            tst1 = t;
+            tst2 = tst1 + 1.0 / tst1;
+            if (tst2 > tst1) 
+                goto L700;
+            i__3 = en;
+            for (j = i__; j <= i__3; ++j) 
+                {
+                h__[j + en * h_dim1] /= t;
+                /* L690: */
+                }
+
+            L700:
+                ;
+            }
+            
+        /* .......... end real vector .......... */
+        goto L800;
+        
+        /* .......... complex vector .......... */
+        L710:
+        m = na;
+        
+        /* .......... last vector component chosen imaginary so that eigenvector matrix is triangular .......... */
+        if ((d__1 = h__[en + na * h_dim1], abs(d__1)) <= (d__2 = h__[na + en *
+        h_dim1], abs(d__2))) 
+            goto L720;
+        h__[na + na * h_dim1] = q / h__[en + na * h_dim1];
+        h__[na + en * h_dim1] = -(h__[en + en * h_dim1] - p) / h__[en + na * h_dim1];
+        goto L730;
+        L720:
+        d__1 = -h__[na + en * h_dim1];
+        d__2 = h__[na + na * h_dim1] - p;
+        cdiv_(&c_b49, &d__1, &d__2, &q, &h__[na + na * h_dim1], &h__[na + en *
+        h_dim1]);
+        L730:
+        h__[en + na * h_dim1] = 0.0;
+        h__[en + en * h_dim1] = 1.0;
+        enm2 = na - 1;
+        if (enm2 == 0) 
+            goto L800;
+
+        /*     .......... for i=en-2 step -1 until 1 do -- .......... */
+        i__2 = enm2;
+        for (ii = 1; ii <= i__2; ++ii) 
+            {
+            i__ = na - ii;
+            w = h__[i__ + i__ * h_dim1] - p;
+            ra = 0.0;
+            sa = 0.0;
+
+            i__3 = en;
+            for (j = m; j <= i__3; ++j) 
+                {
+                ra += h__[i__ + j * h_dim1] * h__[j + na * h_dim1];
+                sa += h__[i__ + j * h_dim1] * h__[j + en * h_dim1];
+                /* L760: */
+                }
+
+            if (wi[i__] >= 0.0) 
+                goto L770;
+            zz = w;
+            r__ = ra;
+            s = sa;
+            goto L795;
+            L770:
+            m = i__;
+            if (wi[i__] != 0.0) 
+                goto L780;
+            d__1 = -ra;
+            d__2 = -sa;
+            cdiv_(&d__1, &d__2, &w, &q, &h__[i__ + na * h_dim1], &h__[i__ + en * h_dim1]);
+            goto L790;
+            
+            /*     .......... solve complex equations .......... */
+            L780:
+            x = h__[i__ + (i__ + 1) * h_dim1];
+            y = h__[i__ + 1 + i__ * h_dim1];
+            vr = (wr[i__] - p) * (wr[i__] - p) + wi[i__] * wi[i__] - q * q;
+            vi = (wr[i__] - p) * 2.0 * q;
+            if (vr != 0.0 || vi != 0.0) 
+                goto L784;
+            tst1 = norm * (abs(w) + abs(q) + abs(x) + abs(y) + abs(zz));
+            vr = tst1;
+            L783:
+            vr *= 0.01;
+            tst2 = tst1 + vr;
+            if (tst2 > tst1) 
+                goto L783;
+            L784:
+            d__1 = x * r__ - zz * ra + q * sa;
+            d__2 = x * s - zz * sa - q * ra;
+            cdiv_(&d__1, &d__2, &vr, &vi, &h__[i__ + na * h_dim1], &h__[i__ + en * h_dim1]);
+            if (abs(x) <= abs(zz) + abs(q)) 
+                goto L785;
+            h__[i__ + 1 + na * h_dim1] = (-ra - w * h__[i__ + na * h_dim1] + q * h__[i__ + en * h_dim1]) / x;
+            h__[i__ + 1 + en * h_dim1] = (-sa - w * h__[i__ + en * h_dim1] - q * h__[i__ + na * h_dim1]) / x;
+            goto L790;
+            L785:
+            d__1 = -r__ - y * h__[i__ + na * h_dim1];
+            d__2 = -s - y * h__[i__ + en * h_dim1];
+            cdiv_(&d__1, &d__2, &zz, &q, &h__[i__ + 1 + na * h_dim1], &h__[i__ + 1 + en * h_dim1]);
+
+            /*     .......... overflow control .......... */
+            L790:
+            /* Computing MAX */
+            d__3 = (d__1 = h__[i__ + na * h_dim1], abs(d__1)), d__4 = (d__2 = h__[i__ + en * h_dim1], abs(d__2));
+            t = max(d__3,d__4);
+            if (t == 0.0) 
+                goto L795;
+            tst1 = t;
+            tst2 = tst1 + 1.0 / tst1;
+            if (tst2 > tst1) 
+                goto L795;
+            i__3 = en;
+            for (j = i__; j <= i__3; ++j) 
+                {
+                h__[j + na * h_dim1] /= t;
+                h__[j + en * h_dim1] /= t;
+                /* L792: */
+                }
+            L795:
+                ;
+            }
+        /*     .......... end complex vector .......... */
+        L800:
+            ;
+        }
+    /*     .......... end back substitution vectors of isolated roots .......... */
+    i__1 = *n;
+    for (i__ = 1; i__ <= i__1; ++i__) 
+        {
+        if (i__ >= *low && i__ <= *igh) 
+            goto L840;
+        i__2 = *n;
+        for (j = i__; j <= i__2; ++j) 
+            {
+            /* L820: */
+            z__[i__ + j * z_dim1] = h__[i__ + j * h_dim1];
+            }
+        L840:
+        ;
+        }
+        
+    /* .......... multiply by transformation matrix to give vectors of original full matrix. */
+    /*            for j=n step -1 until low do -- .......... */
+    i__1 = *n;
+    for (jj = *low; jj <= i__1; ++jj) 
+        {
+        j = *n + *low - jj;
+        m = min(j,*igh);
+
+        i__2 = *igh;
+        for (i__ = *low; i__ <= i__2; ++i__) 
+            {
+            zz = 0.0;
+            i__3 = m;
+            for (k = *low; k <= i__3; ++k) 
+                {
+                /* L860: */
+                zz += z__[i__ + k * z_dim1] * h__[k + j * h_dim1];
+                }
+
+            z__[i__ + j * z_dim1] = zz;
+            /* L880: */
+            }
+        }
+
+    goto L1001;
+    /* .......... set error -- all eigenvalues have not converged after 30*n iterations .......... */
+    L1000:
+    *ierr = en;
+    L1001:
+    return 0;
+    
+}
+/* end f2c version of code */
+#endif
+
+}
+
+
+MrBFlt IncompleteBetaFunction (MrBFlt alpha, MrBFlt beta, MrBFlt x)
+{
+    MrBFlt      bt, gm1, gm2, gm3, temp;
+    
+    if (x < 0.0 || x > 1.0) 
+        {
+        MrBayesPrint ("%s   Error: Problem in IncompleteBetaFunction.\n", spacer);
+        exit (0);
+        }
+    if (fabs(x) < ETA || fabs(x-1.0)<ETA) /* x == 0.0 || x == 1.0 */
+        {
+        bt = 0.0;
+        }
+    else
+        {
+        gm1 = LnGamma (alpha + beta);
+        gm2 = LnGamma (alpha);
+        gm3 = LnGamma (beta);
+        temp = gm1 - gm2 - gm3 + (alpha) * log(x) + (beta) * log(1.0 - x);
+        bt = exp(temp);
+        }
+    if (x < (alpha + 1.0)/(alpha + beta + 2.0))
+        return (bt * BetaCf(alpha, beta, x) / alpha);
+    else
+        return (1.0 - bt * BetaCf(beta, alpha, 1.0-x) / beta);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   IncompleteGamma
+|
+|   Returns the incomplete gamma ratio I(x,alpha) where x is the upper
+|   limit of the integration and alpha is the shape parameter.  Returns (-1)
+|   if in error.   
+|
+|   Bhattacharjee, G. P.  1970.  The incomplete gamma integral.  Applied
+|      Statistics, 19:285-287 (AS32)
+|
+---------------------------------------------------------------------------------*/
+MrBFlt IncompleteGamma (MrBFlt x, MrBFlt alpha, MrBFlt LnGamma_alpha)
+{
+    int             i;
+    MrBFlt      p = alpha, g = LnGamma_alpha,
+                    accurate = 1e-8, overflow = 1e30,
+                    factor, gin = 0.0, rn = 0.0, a = 0.0, b = 0.0, an = 0.0, 
+                    dif = 0.0, term = 0.0, pn[6];
+
+    if (fabs(x) < ETA) 
+        return (0.0);
+    if (x < 0 || p <= 0) 
+        return (-1.0);
+
+    factor = exp(p*log(x)-x-g);   
+    if (x>1 && x>=p) 
+        goto l30;
+    gin = 1.0;  
+    term = 1.0;  
+    rn = p;
+    l20:
+        rn++;
+        term *= x/rn;   
+        gin += term;
+        if (term > accurate) 
+            goto l20;
+        gin *= factor/p;
+        goto l50;
+    l30:
+        a = 1.0-p;   
+        b = a+x+1.0;  
+        term = 0.0;
+        pn[0] = 1.0;  
+        pn[1] = x;  
+        pn[2] = x+1;  
+        pn[3] = x*b;
+        gin = pn[2]/pn[3];
+    l32:
+        a++;  
+        b += 2.0;  
+        term++;   
+        an = a*term;
+        for (i=0; i<2; i++) 
+            pn[i+4] = b*pn[i+2]-an*pn[i];
+        if (fabs(pn[5]) < ETA) 
+            goto l35;
+        rn = pn[4]/pn[5];   
+        dif = fabs(gin-rn);
+        if (dif>accurate) 
+            goto l34;
+        if (dif<=accurate*rn) 
+            goto l42;
+    l34:
+        gin = rn;
+    l35:
+        for (i=0; i<4; i++) 
+            pn[i] = pn[i+2];
+        if (fabs(pn[4]) < overflow) 
+            goto l32;
+        for (i=0; i<4; i++) 
+            pn[i] /= overflow;
+        goto l32;
+    l42:
+        gin = 1.0-factor*gin;
+    l50:
+        return (gin);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   InvertMatrix
+|
+|   Calculates aInv = a^{-1} using LU-decomposition. The input matrix a is
+|   destroyed in the process. The program returns an error if the matrix is
+|   singular. col and indx are work vectors.
+|      
+---------------------------------------------------------------------------------*/
+int InvertMatrix (int dim, MrBFlt **a, MrBFlt *col, int *indx, MrBFlt **aInv)
+{
+    int         rc, i, j;
+    
+    rc = LUDecompose (dim, a, col, indx, (MrBFlt *)NULL);
+    if (rc == FALSE)
+        {
+        for (j = 0; j < dim; j++)
+            {
+            for (i = 0; i < dim; i++)
+                col[i] = 0.0;
+            col[j] = 1.0;
+            LUBackSubstitution (dim, a, indx, col);
+            for (i = 0; i < dim; i++)
+                aInv[i][j] = col[i];
+            }
+        }
+        
+    return (rc);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LBinormal
+|
+|   L(h1,h2,r) = prob(x>h1, y>h2), where x and y are standard binormal, 
+|   with r=corr(x,y),  error < 2e-7.
+|
+|   Drezner Z., and G.O. Wesolowsky (1990) On the computation of the
+|      bivariate normal integral.  J. Statist. Comput. Simul. 35:101-107.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt LBinormal (MrBFlt h1, MrBFlt h2, MrBFlt r)
+{
+    int i;
+    MrBFlt      x[]={0.04691008, 0.23076534, 0.5, 0.76923466, 0.95308992};
+    MrBFlt      w[]={0.018854042, 0.038088059, 0.0452707394,0.038088059,0.018854042};
+    MrBFlt      Lh=0.0, r1, r2, r3, rr, aa, ab, h3, h5, h6, h7, h12, temp1, temp2, exp1, exp2;
+
+    h12 = (h1 * h1 + h2 * h2) / 2.0;
+    if (fabs(r) >= 0.7) 
+        {
+        r2 = 1.0 - r * r;   
+        r3 = sqrt(r2);
+        if (r < 0) 
+            h2 *= -1;
+        h3 = h1 * h2;   
+        h7 = exp(-h3 / 2.0);
+        if (fabs(r-1.0)>ETA)  /* fabs(r) != 1.0 */
+            {
+            h6 = fabs(h1-h2);  
+            h5 = h6 * h6 / 2.0; 
+            h6 /= r3; 
+            aa = 0.5 - h3 / 8;  
+            ab = 3.0 - 2.0 * aa * h5;
+            temp1 = -h5 / r2;
+            if (temp1 < -100.0)
+                exp1 = 0.0;
+            else
+                exp1 = exp(temp1);
+            Lh = 0.13298076 * h6 * ab * (1.0 - CdfNormal(h6)) - exp1 * (ab + aa * r2) * 0.053051647;
+            for (i=0; i<5; i++) 
+                {
+                r1 = r3 * x[i];
+                rr = r1 * r1;   
+                r2 = sqrt(1.0 - rr);
+                temp1 = -h5 / rr;
+                if (temp1 < -100.0)
+                    exp1 = 0.0;
+                else
+                    exp1 = exp(temp1);
+                temp2 = -h3 / (1.0 + r2);
+                if (temp2 < -100.0)
+                    exp2 = 0.0;
+                else
+                    exp2 = exp(temp2);
+                Lh -= w[i] * exp1 * (exp2 / r2 / h7 - 1.0 - aa * rr);
+                }
+            }
+        if (r > 0) 
+            Lh = Lh * r3 * h7 + (1.0 - CdfNormal(MAX(h1, h2)));
+        else if (r<0) 
+            Lh = (h1 < h2 ? CdfNormal(h2) - CdfNormal(h1) : 0) - Lh * r3 * h7;
+        }
+    else 
+        {
+        h3 = h1 * h2;
+        if (fabs(r)>ETA) 
+            {
+            for (i=0; i<5; i++) 
+                {
+                r1 = r * x[i]; 
+                r2 = 1.0 - r1 * r1;
+                temp1 = (r1 * h3 - h12) / r2;
+                if (temp1 < -100.0)
+                    exp1 = 0.0;
+                else
+                    exp1 = exp(temp1);
+                Lh += w[i] * exp1 / sqrt(r2);
+                }
+            }
+        Lh = (1.0 - CdfNormal(h1)) * (1.0 - CdfNormal(h2)) + r * Lh;
+        }
+    return (Lh);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LnFactorial: Calculates the log of the factorial for an integer
+|
+---------------------------------------------------------------------------------*/
+MrBFlt  LnFactorial (int value)
+{
+    int     i;
+    MrBFlt  result;
+
+    result = 0.0;
+
+    for (i = 2; i<=value; i++)
+        result += log(i);
+
+    return result;
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LnGamma
+|
+|   Calculates the log of the gamma function. The Gamma function is equal
+|   to:
+|
+|      Gamma(alp) = {integral from 0 to infinity} t^{alp-1} e^-t dt
+|
+|   The result is accurate to 10 decimal places. Stirling's formula is used
+|   for the central polynomial part of the procedure.
+|
+|   Pike, M. C. and I. D. Hill.  1966.  Algorithm 291: Logarithm of the gamma
+|      function.  Communications of the Association for Computing
+|      Machinery, 9:684.
+|      
+---------------------------------------------------------------------------------*/
+MrBFlt LnGamma (MrBFlt alp)
+{
+    MrBFlt      x = alp, f = 0.0, z;
+    
+    if (x < 7) 
+        {
+        f = 1.0;
+        z = x-1.0;
+        while (++z < 7.0)  
+            f *= z;
+        x = z;   
+        f = -log(f);
+        }
+    z = 1.0 / (x*x);
+    return  (f + (x-0.5)*log(x) - x + 0.918938533204673 + 
+            (((-0.000595238095238*z+0.000793650793651)*z-0.002777777777778)*z +0.083333333333333)/x);
+}
+
+
+/* Calculate probability of a realization for exponential random variable */
+MrBFlt LnPriorProbExponential (MrBFlt val, MrBFlt *params)
+{
+    return log(params[0]) - params[0] * val;
+}
+
+
+/* Calculate probability of a realization for exponential random variable; parameter mean and not rate */
+MrBFlt LnPriorProbExponential_Param_Mean (MrBFlt val, MrBFlt *params)
+{
+    return - log(params[0]) - val / params[0];
+}
+
+
+/* Calculate probability of a realization for a fixed variable */
+MrBFlt LnPriorProbFix (MrBFlt val, MrBFlt *params)
+{
+    if (fabs((val - params[0])/val) < 1E-5)
+        return 0.0;
+    else
+        return NEG_INFINITY;
+}
+
+
+/* Calculate probability of a realization for gamma random variable */
+MrBFlt LnPriorProbGamma (MrBFlt val, MrBFlt *params)
+{
+    return (params[0] - 1) * log(val) + params[0] * log(params[1]) - params[1] * val - LnGamma(params[0]);
+}
+
+
+/* Calculate probability of a realization for gamma random variable; parameters mean and sd */
+MrBFlt LnPriorProbGamma_Param_Mean_Sd (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt  alpha, beta;
+
+    beta  = params[0] / (params[1]*params[1]);
+    alpha = params[0] * beta;
+
+    return (alpha - 1) * log(val) + alpha * log(beta) - beta * val - LnGamma(alpha);
+}
+
+
+/* Calculate probability of a realization for lognormal random variable */
+MrBFlt LnPriorProbLognormal (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt z;
+
+    z = (log(val) - params[0]) / params[1];
+
+    return - log(params[1] * val * sqrt(2.0 * PI)) - z * z / 2.0;
+}
+
+
+/* Calculate probability of a realization for lognormal random variable; parameters mean and sd on linear scale */
+MrBFlt LnPriorProbLognormal_Param_Mean_Sd (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt z, mean_log, sd_log;
+
+    sd_log      = sqrt (log((params[1]*params[1])/(params[0]*params[0]) + 1));
+    mean_log    = log(params[0]) - sd_log * sd_log / 2.0;
+
+    z= (log(val) - mean_log) / sd_log;
+
+    return - log(sd_log * val * sqrt(2.0 * PI)) - z * z / 2.0;
+}
+
+
+/* Calculate probability of a realization for normal random variable */
+MrBFlt LnPriorProbNormal (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt z;
+
+    z = (val - params[0]) / params[1];
+
+    return - log(params[1] * sqrt(2.0 * PI)) - z * z / 2.0;
+}
+
+
+/* Calculate probability of a realization for an offset exponential random variable */
+MrBFlt LnPriorProbOffsetExponential (MrBFlt val, MrBFlt *params)
+{
+    return log(params[1]) - params[1] * (val - params[0]);
+}
+
+
+/* Calculate probability of a realization for an offset exponential random variable; parameters offset and mean */
+MrBFlt LnPriorProbOffsetExponential_Param_Offset_Mean (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt  x, rate;
+
+    x    = val - params[0];
+    rate = 1.0 / (params[1] - params[0]);
+
+    return log(rate) - rate * x;
+}
+
+
+/* Calculate probability of a realization for an offset gamma random variable */
+MrBFlt LnPriorProbOffsetGamma (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt x, alpha, beta;
+    
+    x     = val - params[0];
+    alpha = params[1];
+    beta  = params[2];
+
+    return (alpha - 1) * log(x) + alpha * log(beta) - beta * x - LnGamma(alpha);
+}
+
+
+/* Calculate probability of a realization for an offset gamma random variable; parameters offset, mean and sd */
+MrBFlt LnPriorProbOffsetGamma_Param_Offset_Mean_Sd (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt  x, mean, sd, alpha, beta;
+
+    x     = val - params[0];
+    mean  = params[1] - params[0];
+    sd    = params[2];
+
+    beta  = mean / (sd*sd);
+    alpha = mean * beta;
+
+    return (alpha - 1) * log(x) + alpha * log(beta) - beta * x - LnGamma(alpha);
+}
+
+
+/* Calculate probability of a realization for an offset lognormal random variable */
+MrBFlt LnPriorProbOffsetLognormal (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt x, mean_log, sd_log, z;
+
+    x        = val - params[0];
+    mean_log = params[1] - params[0];
+    sd_log   = params[2];
+
+    z = (log(x) - mean_log) / sd_log;
+
+    return - log(sd_log * x * sqrt(2.0 * PI)) - z * z / 2.0;
+}
+
+
+/* Calculate probability of a realization for an offset lognormal random variable; parameters offset, mean and sd */
+MrBFlt LnPriorProbOffsetLognormal_Param_Offset_Mean_Sd (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt x, mean, sd, mean_log, sd_log, z;
+
+    x        = val - params[0];
+    mean     = params[1] - params[0];
+    sd       = params[2];
+    sd_log   = sqrt (log((sd*sd)/(mean*mean) + 1));
+    mean_log = log(mean) - sd_log * sd_log / 2.0;
+
+    z = (log(x) - mean_log) / sd_log;
+
+    return - log(sd_log * x * sqrt(2.0 * PI)) - z * z / 2.0;
+}
+
+
+/* Calculate probability of a realization for truncated (only positive values) normal random variable */
+MrBFlt LnPriorProbTruncatedNormal (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt z, z_0, normConst;
+
+    z = (val - params[0]) / params[1];
+    z_0 = (0.0 - params[0]) / params[1];
+    normConst = CdfNormal(z_0);
+    
+    return - log(params[1] * sqrt(2.0 * PI)) - z * z / 2.0 - log(1.0 - normConst);
+}
+
+
+/* Calculate probability of a realization for arbitrarily truncated normal random variable; parameters truncation point, mean and sd */
+MrBFlt LnPriorProbTruncatedNormal_Param_Trunc_Mean_Sd (MrBFlt val, MrBFlt *params)
+{
+    MrBFlt z, z_trunc, normConst;
+
+    z = (val - params[1]) / params[2];
+    z_trunc = (params[0] - params[1]) / params[2];
+    normConst = CdfNormal(z_trunc);
+
+    return - log(params[2] * sqrt(2.0 * PI)) - z * z / 2.0 - log(1.0 - normConst);
+}
+
+
+/* Calculate probability of a realization for uniform random variable */
+MrBFlt LnPriorProbUniform (MrBFlt val, MrBFlt *params)
+{
+    return - log(params[1] - params[0]);
+    MrBayesPrint ("%lf", val); /* just because I am tired of seeing the unused parameter error msg */
+}
+
+
+/* Calculate probability ratio of realizations for exponential random variable */
+MrBFlt LnProbRatioExponential (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    return params[0] * (oldX - newX);
+}
+
+
+/* Calculate probability ratio of realizations for exponential random variable; parameter mean and not rate */
+MrBFlt LnProbRatioExponential_Param_Mean (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    return (oldX - newX) / params[0];
+}
+
+
+/* Calculate probability of a realization for a fixed variable */
+MrBFlt LnProbRatioFix (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    if (fabs((newX - params[0])/newX) < 1E-5 && fabs((oldX - params[0])/oldX) < 1E-5)
+        return 0.0;
+    else
+        return NEG_INFINITY;
+}
+
+
+/* Calculate probability ratio of realizations for gamma random variable */
+MrBFlt LnProbRatioGamma (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  alpha, beta;
+
+    alpha   = params[0];
+    beta    = params[1];
+
+    return (alpha - 1.0) * (log(newX) - log(oldX)) - beta * (newX - oldX);
+}
+
+
+/* Calculate probability ratio of realizations for gamma random variable; parameters mean and sd */
+MrBFlt LnProbRatioGamma_Param_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  alpha, beta;
+
+    beta  = params[0] / (params[1]*params[1]);
+    alpha = params[0] * beta;
+
+    return (alpha - 1.0) * (log(newX) - log(oldX)) - beta * (newX - oldX);
+}
+
+
+/* Calculate probability ratio of realizations for log normal random variable */
+MrBFlt LnProbRatioLognormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  newZ, oldZ;
+
+    newZ = (log(newX) - params[0]) / params[1];
+    oldZ = (log(oldX) - params[0]) / params[1];
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0 + log(oldX) - log(newX);
+}
+
+
+/* Calculate probability ratio of realizations for log normal random variable; parameters mean and sd */
+MrBFlt LnProbRatioLognormal_Param_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{    
+    MrBFlt newZ, oldZ, mean_log, sd_log;
+
+    sd_log      = sqrt (log((params[1]*params[1])/(params[0]*params[0]) + 1));
+    mean_log    = log(params[0]) - sd_log * sd_log / 2.0;
+
+    newZ = (log(newX) - mean_log) / sd_log;
+    oldZ = (log(oldX) - mean_log) / sd_log;
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0 + log(oldX) - log(newX);
+}
+
+
+/* Calculate probability ratio of realizations for normal random variable */
+MrBFlt LnProbRatioNormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  newZ, oldZ;
+
+    newZ = (newX - params[0]) / params[1];
+    oldZ = (oldX - params[0]) / params[1];
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0;
+}
+
+
+/* Calculate probability ratio of realizations for offset exponential random variable */
+MrBFlt LnProbRatioOffsetExponential (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    return params[1] * (oldX - newX);
+}
+
+
+/* Calculate probability ratio of realizations for offset exponential random variable; parameters offset and mean */
+MrBFlt LnProbRatioOffsetExponential_Param_Offset_Mean (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    return (oldX - newX) / (params[1] - params[0]);
+}
+
+
+/* Calculate probability ratio of realizations for offset gamma random variable */
+MrBFlt LnProbRatioOffsetGamma (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  alpha, beta, newZ, oldZ;
+
+    alpha = params[1];
+    beta  = params[2];
+    newZ  = newX - params[0];
+    oldZ  = oldX - params[0];
+
+    return (alpha - 1.0) * (log(newZ) - log(oldZ)) - beta * (newZ - oldZ);
+}
+
+
+/* Calculate probability ratio of realizations for offset gamma random variable; parameters offset, mean and sd */
+MrBFlt LnProbRatioOffsetGamma_Param_Offset_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  mean, sd, alpha, beta;
+
+    mean  = params[1] - params[0];
+    sd    = params[2];
+
+    beta  = mean / (sd*sd);
+    alpha = mean * beta;
+
+    newX  -= params[0];
+    oldX  -= params[0];
+
+    return (alpha - 1.0) * (log(newX) - log(oldX)) - beta * (newX - oldX);
+}
+
+
+/* Calculate probability ratio of realizations for offset lognormal random variable */
+MrBFlt LnProbRatioOffsetLognormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt newZ, oldZ, mean_log, sd_log;
+
+    sd_log      = params[2];
+    mean_log    = params[1];
+
+    newZ = (log(newX-params[0]) - mean_log) / sd_log;
+    oldZ = (log(oldX-params[0]) - mean_log) / sd_log;
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0 + log(oldX-params[0]) - log(newX-params[0]);
+}
+
+
+/* Calculate probability ratio of realizations for offset lognormal random variable; parameters offset, mean and sd */
+MrBFlt LnProbRatioOffsetLognormal_Param_Offset_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt newZ, oldZ, mean, sd, mean_log, sd_log;
+
+    mean        = params[1] - params[0];
+    sd          = params[2];
+    sd_log      = sqrt (log((sd*sd)/(mean*mean) + 1));
+    mean_log    = log(mean) - sd_log * sd_log / 2.0;
+
+    newX -= params[0];
+    oldX -= params[0];
+    newZ = (log(newX) - mean_log) / sd_log;
+    oldZ = (log(oldX) - mean_log) / sd_log;
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0 - log(newX / oldX);
+}
+
+
+/* Calculate probability ratio of realizations for truncated normal random variable */
+MrBFlt LnProbRatioTruncatedNormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  newZ, oldZ;
+
+    newZ = (newX - params[0]) / params[1];
+    oldZ = (oldX - params[0]) / params[1];
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0;
+}
+
+
+/* Calculate probability ratio of realizations for arbitrarily truncated normal random variable; parameters truncation point, mean and sd */
+MrBFlt LnProbRatioTruncatedNormal_Param_Trunc_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    MrBFlt  newZ, oldZ;
+
+    newZ = (newX - params[1]) / params[2];
+    oldZ = (oldX - params[1]) / params[2];
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0;
+}
+
+
+/* Calculate probability ratio of realizations for uniform random variable */
+MrBFlt LnProbRatioUniform (MrBFlt newX, MrBFlt oldX, MrBFlt *params)
+{
+    return 0.0;
+    MrBayesPrint ("%lf %lf", newX, oldX); /* just because I am tired of seeing the unused parameter error msg */
+    MrBayesPrint ("%lf", *params);
+}
+
+
+/* Log probability for a value drawn from a gamma distribution */
+MrBFlt LnProbGamma (MrBFlt alpha, MrBFlt beta, MrBFlt x)
+{
+    MrBFlt lnProb;
+
+    lnProb = (alpha-1.0)*log(x) + alpha*log(beta) - x*beta - LnGamma(alpha);
+
+    return lnProb;
+}
+
+
+/* Log probability for a value drawn from a truncated gamma distribution */
+MrBFlt LnProbTruncGamma (MrBFlt alpha, MrBFlt beta, MrBFlt x, MrBFlt min, MrBFlt max)
+{
+    MrBFlt lnProb;
+
+    lnProb = (alpha-1.0)*log(x) + alpha*log(beta) - x*beta - LnGamma(alpha);
+
+    lnProb -= log (IncompleteGamma (max*beta, alpha, LnGamma(alpha)) - IncompleteGamma (min*beta, alpha, LnGamma(alpha)));
+
+    return lnProb;
+}
+
+
+/* Log probability for a value drawn from a lognormal distribution */
+MrBFlt LnProbLogNormal (MrBFlt exp, MrBFlt sd, MrBFlt x)
+{
+    MrBFlt lnProb, z;
+    
+    z = (log(x) - exp) / sd;
+    
+    lnProb = - log (x * sd * sqrt (2.0 * PI)) - (z * z / 2.0);
+    
+    return lnProb;
+}
+
+
+/* Log ratio for two values drawn from a lognormal distribution */
+MrBFlt LnRatioLogNormal (MrBFlt exp, MrBFlt sd, MrBFlt xNew, MrBFlt xOld)
+{
+    MrBFlt  newZ, oldZ;
+    
+    newZ = (log(xNew) - exp) / sd;
+    oldZ = (log(xOld) - exp) / sd;
+    
+    return (oldZ * oldZ - newZ * newZ) / 2.0 + log(xOld) - log(xNew);
+}
+
+
+/* Log probability for a value drawn from a lognormal distribution;
+   parameters are mean and variance of value (not of log value) */
+MrBFlt LnProbTK02LogNormal (MrBFlt mean, MrBFlt var, MrBFlt x)
+{
+    MrBFlt  z, lnProb, mu, sigma;
+    
+    sigma = sqrt(log(1.0 + (var / (mean*mean))));
+    mu    = log(mean) - sigma * sigma / 2.0;
+    
+    z = (log(x) - mu) / sigma;
+    
+    lnProb = - log (x * sigma * sqrt (2.0 * PI)) - (z * z / 2.0);
+    
+    return lnProb;
+}
+
+
+/* Log ratio for two values drawn from a lognormal distribution */
+MrBFlt LnRatioTK02LogNormal (MrBFlt mean, MrBFlt var, MrBFlt xNew, MrBFlt xOld)
+{
+    MrBFlt  newZ, oldZ, mu, sigma;
+
+    sigma = sqrt(log(1.0 + (var / (mean*mean))));
+    mu    = log(mean) - sigma * sigma / 2.0;
+
+    newZ = (log(xNew) - mu) / sigma;
+    oldZ = (log(xOld) - mu) / sigma;
+
+    return (oldZ * oldZ - newZ * newZ) / 2.0 + log(xOld) - log(xNew);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LogBase2Plus1
+|
+|   This function is called from ComputeMatrixExponential.
+|      
+---------------------------------------------------------------------------------*/
+int LogBase2Plus1 (MrBFlt x)
+{
+    int     j = 0;
+
+    while (x > 1.0 - 1.0e-07) 
+        {
+        x /= 2.0;
+        j++;
+        }
+        
+    return (j);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LogNormalRandomVariable
+|
+|   Draw a random variable from a lognormal distribution.
+|      
+---------------------------------------------------------------------------------*/
+MrBFlt LogNormalRandomVariable (MrBFlt mean, MrBFlt sd, RandLong *seed)
+{
+    MrBFlt      x;
+    
+    x = PointNormal(RandomNumber(seed));
+
+    x*= sd;
+    x += mean;
+    
+    return exp(x);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LUBackSubstitution
+|
+|   Back substitute into an LU-decomposed matrix.
+|      
+---------------------------------------------------------------------------------*/
+void LUBackSubstitution (int dim, MrBFlt **a, int *indx, MrBFlt *b)
+{
+    int         i, ip, j, ii = -1;
+    MrBFlt      sum;
+
+    for (i=0; i<dim; i++)
+        {
+        ip = indx[i];
+        sum = b[ip];
+        b[ip] = b[i];
+        if (ii >= 0)
+            {
+            for (j=ii; j<=i-1; j++)
+                sum -= a[i][j] * b[j];
+            }
+        else if (fabs(sum)>ETA)
+            ii = i;
+        b[i] = sum;
+        }
+    for (i=dim-1; i>=0; i--)
+        {
+        sum = b[i];
+        for (j=i+1; j<dim; j++)
+            sum -= a[i][j] * b[j];
+        b[i] = sum / a[i][i];
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   LUDecompose
+|
+|   Calculate the LU-decomposition of the matrix a. The matrix a is replaced.
+|      
+---------------------------------------------------------------------------------*/
+int LUDecompose (int dim, MrBFlt **a, MrBFlt *vv, int *indx, MrBFlt *pd)
+{
+    int         i, imax=0, j, k;
+    MrBFlt      big, dum, sum, temp, d;
+
+    d = 1.0;
+    for (i=0; i<dim; i++)
+        {
+        big = 0.0;
+        for (j = 0; j < dim; j++)
+            {
+            if ((temp = fabs(a[i][j])) > big)
+                big = temp;
+            }
+        if (fabs(big)<ETA)
+            {
+            MrBayesPrint ("%s   Error: Problem in LUDecompose\n", spacer);
+            return (ERROR);
+            }
+        vv[i] = 1.0 / big;
+        }
+    for (j=0; j<dim; j++)
+        {
+        for (i = 0; i < j; i++)
+            {
+            sum = a[i][j];
+            for (k = 0; k < i; k++)
+                sum -= a[i][k] * a[k][j];
+            a[i][j] = sum;
+            }
+        big = 0.0;
+        for (i=j; i<dim; i++)
+            {
+            sum = a[i][j];
+            for (k = 0; k < j; k++)
+                sum -= a[i][k] * a[k][j];
+            a[i][j] = sum;
+            dum = vv[i] * fabs(sum);
+            if (dum >= big)
+                {
+                big = dum;
+                imax = i;
+                }
+            }
+        if (j != imax)
+            {
+            for (k=0; k<dim; k++)
+                {
+                dum = a[imax][k];
+                a[imax][k] = a[j][k];
+                a[j][k] = dum;
+                }   
+            d = -d;
+            vv[imax] = vv[j];
+            }
+        indx[j] = imax;
+        if (fabs(a[j][j])<ETA)
+            a[j][j] = TINY;
+        if (j != dim - 1)
+            {
+            dum = 1.0 / (a[j][j]);
+            for (i=j+1; i<dim; i++)
+                a[i][j] *= dum;
+            }
+        }
+    if (pd != NULL)
+        *pd = d;
+        
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   MultiplyMatrices
+|
+|   Multiply matrix a by matrix b and put the results in matrix result.
+|
+---------------------------------------------------------------------------------*/
+void MultiplyMatrices (int dim, MrBFlt **a, MrBFlt **b, MrBFlt **result)
+{
+    register int    i, j, k;
+    MrBFlt          **temp;
+
+    temp = AllocateSquareDoubleMatrix (dim);
+
+    for (i=0; i<dim; i++)
+        {
+        for (j=0; j<dim; j++) 
+            {
+            temp[i][j] = 0.0;
+            for (k=0; k<dim; k++) 
+                {
+                temp[i][j] += a[i][k] * b[k][j];
+                }
+            }
+        }
+    for (i=0; i<dim; i++)
+        {
+        for (j=0; j<dim; j++) 
+            {
+            result[i][j] = temp[i][j];
+            }
+        }
+        
+    FreeSquareDoubleMatrix (temp);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   MultiplyMatrixByScalar
+|
+|   Multiply the elements of matrix a by a scalar.
+|
+---------------------------------------------------------------------------------*/
+void MultiplyMatrixByScalar (int dim, MrBFlt **a, MrBFlt scalar, MrBFlt **result)
+{
+    int         row, col;
+
+    for (row=0; row<dim; row++)
+        for (col=0; col<dim; col++)
+             result[row][col] = a[row][col] * scalar;
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   MultiplyMatrixNTimes
+|
+---------------------------------------------------------------------------------*/
+int MultiplyMatrixNTimes (int dim, MrBFlt **Mat, int power, MrBFlt **Result)
+{
+    register int    i, j;
+    int             k, numSquares, numRemaining;
+    MrBFlt          **TempIn, **TempOut;
+
+    if (power < 0)
+        {
+        MrBayesPrint ("%s   Error: Power cannot be a negative number.\n", spacer);
+        return (ERROR);
+        }
+    else if (power == 0)
+        {
+        for (i=0; i<dim; i++)
+            for (j=0; j<dim; j++)
+                Result[i][j] = 1.0;
+        }
+    else
+        {
+        TempIn  = AllocateSquareDoubleMatrix (dim);
+        TempOut = AllocateSquareDoubleMatrix (dim);
+
+        /* how many times can I multiply the matrices together */
+        numSquares = 0;
+        while (pow (2.0, (MrBFlt)(numSquares)) < power)
+            numSquares++;
+        numRemaining = power - (int)(pow(2.0, (MrBFlt)(numSquares)));
+        
+        /* now, multiply matrix by power of 2's */
+        CopyDoubleMatrices (dim, Mat, TempIn);
+        for (k=0; k<numSquares; k++)
+            {
+            MultiplyMatrices (dim, TempIn, TempIn, TempOut);
+            CopyDoubleMatrices (dim, TempOut, TempIn);
+            }
+            
+        /* TempIn is Mat^numSquares. Now, multiply it by Mat numRemaining times */
+        for (k=0; k<numRemaining; k++)
+            {
+            MultiplyMatrices (dim, TempIn, Mat, TempOut);
+            CopyDoubleMatrices (dim, TempOut, TempIn);
+            }
+            
+        /* copy result */
+        CopyDoubleMatrices (dim, TempIn, Result);
+        
+        FreeSquareDoubleMatrix (TempIn);
+        FreeSquareDoubleMatrix (TempOut);
+        }
+
+    return (NO_ERROR);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PointChi2
+|
+|   Returns z so that Prob(x < z) = prob where x is Chi2 distributed with df=v. 
+|   Returns -1 if in error.   0.000002 < prob < 0.999998.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt PointChi2 (MrBFlt prob, MrBFlt v)
+{
+    MrBFlt      e = 0.5e-6, aa = 0.6931471805, p = prob, g,
+                    xx, c, ch, a = 0.0, q = 0.0, p1 = 0.0, p2 = 0.0, t = 0.0, 
+                    x = 0.0, b = 0.0, s1, s2, s3, s4, s5, s6;
+
+    if (p < 0.000002 || p > 0.999998 || v <= 0.0) 
+        return (-1.0);
+    g = LnGamma (v/2.0);
+    xx = v/2.0;   
+    c = xx - 1.0;
+    if (v >= -1.24*log(p)) 
+        goto l1;
+    ch = pow((p*xx*exp(g+xx*aa)), 1.0/xx);
+    if (ch-e<0) 
+        return (ch);
+    goto l4;
+    l1:
+        if (v > 0.32) 
+            goto l3;
+        ch = 0.4;   
+        a = log(1.0-p);
+    l2:
+        q = ch;  
+        p1 = 1.0+ch*(4.67+ch);  
+        p2 = ch*(6.73+ch*(6.66+ch));
+        t = -0.5+(4.67+2.0*ch)/p1 - (6.73+ch*(13.32+3.0*ch))/p2;
+        ch -= (1.0-exp(a+g+0.5*ch+c*aa)*p2/p1)/t;
+        if (fabs(q/ch-1.0)-0.01 <= 0.0) 
+            goto l4;
+        else                       
+            goto l2;
+    l3: 
+        x = PointNormal (p);
+        p1 = 0.222222/v;   
+        ch = v*pow((x*sqrt(p1)+1.0-p1), 3.0);
+        if (ch > 2.2*v+6.0)  
+            ch = -2.0*(log(1.0-p)-c*log(0.5*ch)+g);
+    l4:
+        q = ch;   
+        p1 = 0.5*ch;
+        if ((t = IncompleteGamma (p1, xx, g)) < 0.0) 
+            {
+            MrBayesPrint ("%s   Error: Problem in PointChi2", spacer);
+            return (-1.0);
+            }
+        p2 = p-t;
+        t = p2*exp(xx*aa+g+p1-c*log(ch));   
+        b = t/ch;  
+        a = 0.5*t-b*c;
+        s1 = (210.0+a*(140.0+a*(105.0+a*(84.0+a*(70.0+60.0*a))))) / 420.0;
+        s2 = (420.0+a*(735.0+a*(966.0+a*(1141.0+1278.0*a))))/2520.0;
+        s3 = (210.0+a*(462.0+a*(707.0+932.0*a)))/2520.0;
+        s4 = (252.0+a*(672.0+1182.0*a)+c*(294.0+a*(889.0+1740.0*a)))/5040.0;
+        s5 = (84.0+264.0*a+c*(175.0+606.0*a)) / 2520.0;
+        s6 = (120.0+c*(346.0+127.0*c)) / 5040.0;
+        ch += t*(1+0.5*t*s1-b*c*(s1-b*(s2-b*(s3-b*(s4-b*(s5-b*s6))))));
+        if (fabs(q/ch-1.0) > e) 
+            goto l4;
+        return (ch);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PointNormal
+|
+|   Returns z so That Prob{x<z} = prob where x ~ N(0,1) and
+|   (1e-12) < prob < 1-(1e-12).  Returns (-9999) if in error.
+|
+|   Odeh, R. E. and J. O. Evans.  1974.  The percentage points of the normal
+|     distribution.  Applied Statistics, 22:96-97 (AS70).
+|
+|   Newer methods:
+|
+|   Wichura, M. J.  1988.  Algorithm AS 241: The percentage points of the
+|      normal distribution.  37:477-484.
+|   Beasley, JD & S. G. Springer.  1977.  Algorithm AS 111: The percentage
+|      points of the normal distribution.  26:118-121.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt PointNormal (MrBFlt prob)
+{
+    MrBFlt      a0 = -0.322232431088, a1 = -1.0, a2 = -0.342242088547, a3 = -0.0204231210245,
+                    a4 = -0.453642210148e-4, b0 = 0.0993484626060, b1 = 0.588581570495,
+                    b2 = 0.531103462366, b3 = 0.103537752850, b4 = 0.0038560700634,
+                    y, z = 0, p = prob, p1;
+
+    p1 = (p<0.5 ? p : 1-p);
+    if (p1<1e-20) 
+       return (-9999);
+    y = sqrt (log(1/(p1*p1)));   
+    z = y + ((((y*a4+a3)*y+a2)*y+a1)*y+a0) / ((((y*b4+b3)*y+b2)*y+b1)*y+b0);
+    
+    return (p<0.5 ? -z : z);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PrintComplexVector
+|
+|   Prints a vector of dim complex numbers.
+|
+---------------------------------------------------------------------------------*/
+void PrintComplexVector (int dim, complex *vec)
+{
+    int     i;
+
+    MrBayesPrint ("{");
+    for (i = 0; i < (dim - 1); i++) 
+        {
+        MrBayesPrint ("%lf + %lfi, ", vec[i].re, vec[i].im);
+        if (i == 1) 
+            MrBayesPrint("\n    ");
+        }
+    MrBayesPrint ("%lf + %lfi}\n", vec[dim - 1].re, vec[dim - 1].im);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PrintSquareComplexMatrix
+|
+|   Prints a square matrix of complex numbers.
+|
+---------------------------------------------------------------------------------*/
+void PrintSquareComplexMatrix (int dim, complex **m)
+{
+    int     row, col;
+
+    MrBayesPrint ("{");
+    for (row = 0; row < (dim - 1); row++) 
+        {
+        MrBayesPrint ("{");
+        for (col = 0; col < (dim - 1); col++) 
+            {
+            MrBayesPrint ("%lf + %lfi, ", m[row][col].re, m[row][col].im);
+            if (col == 1) 
+                MrBayesPrint ("\n    ");
+            }
+        MrBayesPrint ("%lf + %lfi},\n", 
+        m[row][dim - 1].re, m[row][dim - 1].im);
+        }
+    MrBayesPrint ("{");
+    for (col = 0; col < (dim - 1); col++) 
+        {
+        MrBayesPrint ("%lf + %lfi, ", m[dim - 1][col].re, m[dim - 1][col].im);
+        if (col == 1) 
+            MrBayesPrint ("\n    ");
+        }
+    MrBayesPrint ("%lf + %lfi}}", m[dim - 1][dim - 1].re, m[dim - 1][dim - 1].im);
+    MrBayesPrint ("\n");
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PrintSquareDoubleMatrix
+|
+|   Prints a square matrix of doubles.
+|
+---------------------------------------------------------------------------------*/
+void PrintSquareDoubleMatrix (int dim, MrBFlt **matrix)
+{
+    int         i, j;
+    
+    for (i=0; i<dim; i++) 
+        {
+        for (j=0; j<dim; j++)
+            MrBayesPrint ("%1.6lf ", matrix[i][j]);
+        MrBayesPrint ("\n");
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PrintSquareIntegerMatrix
+|
+|   Prints a square matrix of integers.
+|
+---------------------------------------------------------------------------------*/
+void PrintSquareIntegerMatrix (int dim, int **matrix)
+{
+    int         i, j;
+    
+    for (i=0; i<dim; i++) 
+        {
+        for (j=0; j<dim; j++)
+            MrBayesPrint ("%d ", matrix[i][j]);
+        MrBayesPrint ("\n");
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   ProductOfRealAndComplex
+|
+|   Returns the complex product of a real and complex number.
+|
+---------------------------------------------------------------------------------*/
+complex ProductOfRealAndComplex (MrBFlt a, complex b)
+{
+    complex     c;
+    
+    c.re = a * b.re;
+    c.im = a * b.im;
+    
+    return (c);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PsiExp: Returns psi (also called digamma) exponentiated
+|       Algorithm from http://lib.stat.cmu.edu/apstat/103
+|
+---------------------------------------------------------------------------------*/
+MrBFlt  PsiExp (MrBFlt alpha)
+{
+    MrBFlt      digamma, y, r, s, c, s3, s4, s5, d1;
+    
+    s = 1.0e-05;
+    c = 8.5;
+    s3 = 8.333333333333333333333333e-02;
+    s4 = 8.333333333333333333333333e-03;
+    s5 = 3.968253968e-03;
+    d1 = -0.577215664901532860606512;   /* negative of Euler's constant */
+
+    digamma = 0.0;
+    y = alpha;
+    if (y <= 0.0)
+        return (0.0);
+    
+    if (y <= s)
+        {
+        digamma = d1 - 1.0 / y;
+        return (exp (digamma));
+        }
+    
+    while (y < c)
+        {
+        digamma -= 1.0 / y;
+        y += 1.0;
+        }
+
+    r = 1.0 / y;
+    digamma += (log (y) - 0.5 * r);
+    r *= r;
+    digamma -= r * (s3 - r * (s4 - r * s5));
+    
+    return (exp (digamma));
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PsiGammaLnProb: Calculates the log probability of a PsiGamma distributed
+|      variable
+|
+---------------------------------------------------------------------------------*/
+MrBFlt  PsiGammaLnProb (MrBFlt alpha, MrBFlt value)
+{
+    MrBFlt  beta, lnProb;
+
+    beta = PsiExp (alpha);
+
+    lnProb = alpha * log (beta) - LnGamma (alpha) + (alpha - 1.0) * log (value) - beta * value;
+
+    return lnProb;
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PsiGammaLnRatio: Calculates the log prob ratio of two PsiGamma distributed
+|      variables
+|
+---------------------------------------------------------------------------------*/
+MrBFlt  PsiGammaLnRatio (MrBFlt alpha, MrBFlt numerator, MrBFlt denominator)
+{
+    MrBFlt beta, lnRatio;
+
+    beta = PsiExp (alpha);
+
+    lnRatio = (alpha - 1.0) * (log (numerator) - log (denominator)) - beta * (numerator - denominator);
+    
+    return (lnRatio);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   PsiGammaRandomVariable: Returns a random draw from the PsiGamma
+|
+---------------------------------------------------------------------------------*/
+MrBFlt  PsiGammaRandomVariable (MrBFlt alpha, RandLong *seed)
+{
+    return GammaRandomVariable (alpha, PsiExp(alpha), seed);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   QuantileGamma
+|
+---------------------------------------------------------------------------------*/
+MrBFlt QuantileGamma (MrBFlt x, MrBFlt alfa, MrBFlt beta)
+{
+    MrBFlt      quantile;
+
+    quantile = POINTGAMMA(x, alfa, beta);
+    
+    return (quantile);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   RandomNumber
+|
+|   This pseudorandom number generator is described in:
+|   Park, S. K. and K. W. Miller.  1988.  Random number generators: good
+|      ones are hard to find.  Communications of the ACM, 31(10):1192-1201.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt RandomNumber (RandLong *seed)
+{
+    RandLong    lo, hi, test;
+
+    hi = (*seed) / 127773;
+    lo = (*seed) % 127773;
+    test = 16807 * lo - 2836 * hi;
+    if (test > 0)
+        *seed = test;
+    else
+        *seed = test + 2147483647;
+    return ((MrBFlt)(*seed) / (MrBFlt)2147483647);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   RndGamma
+|
+---------------------------------------------------------------------------------*/
+MrBFlt RndGamma (MrBFlt s, RandLong *seed)
+{
+    MrBFlt  r=0.0;
+    
+    if (s <= 0.0)    
+        puts ("Gamma parameter less than zero\n");
+
+    else if (s < 1.0)  
+        r = RndGamma1 (s, seed);
+    else if (s > 1.0)  
+        r = RndGamma2 (s, seed);
+    else    /* 0-log() == -1 * log(), but =- looks confusing */
+        r -= log(RandomNumber(seed));
+        
+    return (r);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   RndGamma1
+|
+---------------------------------------------------------------------------------*/
+MrBFlt RndGamma1 (MrBFlt s, RandLong *seed)
+{
+    MrBFlt          r, x=0.0, tiny=1e-37, w;
+    static MrBFlt   a, p, uf, ss=10.0, d;
+    
+    if (fabs(s-ss)>ETA) /* s != ss */ 
+        {
+        a  = 1.0 - s;
+        p  = a / (a + s * exp(-a));
+        uf = p * pow(tiny / a, s);
+        d  = a * log(a);
+        ss = s;
+        }
+    for (;;) 
+        {
+        r = RandomNumber(seed);
+        if (r > p)        
+            x = a - log((1.0 - r) / (1.0 - p)), w = a * log(x) - d;
+        else if (r>uf)  
+            x = a * pow(r / p, 1.0 / s), w = x;
+        else            
+            return (0.0);
+        r = RandomNumber(seed);
+        if (1.0 - r <= w && r > 0.0)
+        if (r*(w + 1.0) >= 1.0 || -log(r) <= w)  
+            continue;
+        break;
+        }
+        
+    return (x);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   RndGamma2
+|
+---------------------------------------------------------------------------------*/
+MrBFlt RndGamma2 (MrBFlt s, RandLong *seed)
+{
+    MrBFlt          r , d, f, g, x;
+    static MrBFlt   b, h, ss=0.0;
+    
+    if (fabs(s-ss)>ETA) /* s != ss */
+        {
+        b  = s - 1.0;
+        h  = sqrt(3.0 * s - 0.75);
+        ss = s;
+        }
+    for (;;) 
+        {
+        r = RandomNumber(seed);
+        g = r - r * r;
+        f = (r - 0.5) * h / sqrt(g);
+        x = b + f;
+        if (x <= 0.0) 
+            continue;
+        r = RandomNumber(seed);
+        d = 64 * r * r * g * g * g;
+        if (d * x < x - 2.0 * f * f || log(d) < 2.0 * (b * log(x / b) - f))  
+            break;
+        }
+        
+    return (x);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   SetQvalue
+|
+|   The Pade method for calculating the matrix exponential, tMat = e^{qMat * v}, 
+|   has an error, e(p,q), that can be controlled by setting p and q to appropriate
+|   values. The error is:
+|
+|      e(p,q) = 2^(3-(p+q)) * ((p!*q!) / (p+q)! * (p+q+1)!)
+|
+|   Setting p = q will minimize the error for a given amount of work. This function 
+|   assumes that p = q. The function takes in as a parameter the desired tolerance
+|   for the accuracy of the matrix exponentiation, and returns qV = p = q, that
+|   will achieve the tolerance. The Pade approximation method is described in:
+|  
+|   Golub, G. H., and C. F. Van Loan. 1996. Matrix Computations, Third Edition.
+|      The Johns Hopkins University Press, Baltimore, Maryland.
+|
+|   The function is called from TiProbsUsingPadeApprox.
+|
+---------------------------------------------------------------------------------*/
+int SetQvalue (MrBFlt tol)
+{
+    int         qV;
+    MrBFlt      x;
+    
+    x = pow(2.0, 3.0 - (0 + 0)) * Factorial(0) * Factorial (0) / (Factorial(0+0) * Factorial (0+0+1));
+    qV = 0;
+    while (x > tol)
+        {
+        qV++;
+        x = pow(2.0, 3.0 - (qV + qV)) * Factorial(qV) * Factorial (qV) / (Factorial(qV+qV) * Factorial (qV+qV+1));
+        }
+        
+    return (qV);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   SetToIdentity
+|
+|   Make a dim X dim identity matrix.
+|
+---------------------------------------------------------------------------------*/
+void SetToIdentity (int dim, MrBFlt **matrix)
+{
+    int         row, col;
+
+    for (row=0; row<dim; row++)
+        for (col=0; col<dim; col++)
+            matrix[row][col] = (row == col ? 1.0 : 0.0);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   Tha
+|
+|   Calculate Owen's (1956) T(h,a) function, -inf <= h, a <= inf, 
+|   where h = h1/h2, a = a1/a2, from the program of: 
+|
+|   Young, J. C. and C. E. Minder.  1974.  Algorithm AS 76.  An integral  
+|      useful in calculating non-central t and bivariate normal  
+|      probabilities.  Appl. Statist., 23:455-457.  [Correction: Appl.  
+|      Statist., 28:113 (1979).  Remarks: Appl. Statist. 27:379 (1978),
+|      28: 113 (1979), 34:100-101 (1985), 38:580-582 (1988)]  
+|
+|   See also: 
+|
+|   Johnson, N. L.  and S. Kotz.  1972.  Distributions in statistics:
+|      multivariate distributions.  Wiley and Sons.  New York.  pp. 93-100.
+|
+---------------------------------------------------------------------------------*/
+MrBFlt Tha (MrBFlt h1, MrBFlt h2, MrBFlt a1, MrBFlt a2)
+{
+    int             ng = 5, i;
+    MrBFlt          U[] = {0.0744372, 0.2166977, 0.3397048, 0.4325317, 0.4869533},
+                    R[] = {0.1477621, 0.1346334, 0.1095432, 0.0747257, 0.0333357},
+                    pai2 = 6.283185307, tv1 = 1e-35, tv2 = 15.0, tv3 = 15.0, tv4 = 1e-5,
+                    a, h, rt, t, x1, x2, r1, r2, s, k, sign = 1.0;
+
+    if (fabs(h2) < tv1) 
+        return (0.0);
+    h = h1 / h2;
+    if (fabs(a2) < tv1) 
+        {
+        t = CdfNormal(h);
+        if (h >= 0.0) 
+            t = (1.0 - t) / 2.0;
+        else      
+            t /= 2.0;
+        return (t*(a1 >= 0.0 ? 1.0 : -1.0));
+        }
+    a = a1 / a2;
+    if (a < 0.0) 
+        sign = -1.0;  
+    a = fabs(a);  
+    h = fabs(h);   
+    k = h*a;
+    if (h > tv2 || a < tv1) 
+        return (0.0);
+    if (h < tv1) 
+        return (atan(a)/pai2*sign);
+    if (h < 0.3 && a > 7.0) /* (Boys RJ, 1989) */
+        {             
+        x1 = exp(-k*k/2.0)/k;
+        x2 = (CdfNormal(k)-0.5)*sqrt(pai2);
+        t = 0.25 - (x1+x2)/pai2*h + ((1.0+2.0/(k*k))*x1+x2)/(6.0*pai2)*h*h*h;
+        return (MAX(t,0)*sign);
+        }
+    t = -h*h / 2.0;  
+    x2 = a;  
+    s = a*a;
+    if (log(1.0+s)-t*s >= tv3) 
+        {
+        x1 = a/2;  
+        s /= 4.0;
+    for (;;) /* truncation point by Newton iteration */
+        {        
+        x2 = x1 + (t*s+tv3-log(s+1.0)) / (2.0*x1*(1.0/(s+1.0)-t));
+        s = x2*x2;
+        if (fabs(x2-x1) < tv4) 
+            break;
+        x1 = x2;
+        }
+    }
+    for (i=0,rt=0; i<ng; i++) /* Gauss quadrature */
+        {          
+        r1 = 1.0+s*SQUARE(0.5+U[i]);
+        r2 = 1.0+s*SQUARE(0.5-U[i]);
+        rt+= R[i]*(exp(t*r1)/r1 + exp(t*r2)/r2);
+        }
+        
+    return (MAX(rt*x2/pai2,0)*sign);
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   TiProbsUsingEigens
+|
+---------------------------------------------------------------------------------*/
+void TiProbsUsingEigens (int dim, MrBFlt *cijk, MrBFlt *eigenVals, MrBFlt v, MrBFlt r, MrBFlt **tMat, MrBFlt **fMat, MrBFlt **sMat)
+{
+    int             i, j, s;
+    MrBFlt          sum, sumF, sumS, *ptr, EigValexp[192];
+
+    for (s=0; s<dim; s++)
+        EigValexp[s] = exp(eigenVals[s] * v * r);
+
+    ptr = cijk;
+    for (i=0; i<dim; i++)
+        {
+        for (j=0; j<dim; j++)
+            {
+            sum = 0.0;
+            for (s=0; s<dim; s++)
+                sum += (*ptr++) * EigValexp[s];
+            tMat[i][j] = (sum < 0.0) ? 0.0 : sum;
+            }
+        }
+        
+#   if 0
+    for (i=0; i<dim; i++)
+        {
+        sum = 0.0;
+        for (j=0; j<dim; j++)
+            {
+            sum += tMat[i][j];
+            }
+        if (sum > 1.0001 || sum < 0.9999)
+            {
+            MrBayesPrint ("%s   Warning: Transition probabilities do not sum to 1.0 (%lf)\n", spacer, sum);
+            }
+        }
+#   endif
+    
+    if (fMat != NULL && sMat != NULL)
+        {
+        ptr = cijk;
+        for (i=0; i<dim; i++)
+            {
+            for (j=0; j<dim; j++)
+                {
+                sumF = sumS = 0.0;
+                for (s=0; s<dim; s++)
+                    {
+                    sumF += (*ptr) * eigenVals[s] * r * EigValexp[s];
+                    sumS += (*ptr++) * eigenVals[s] * eigenVals[s] * r * r * EigValexp[s];
+                    }
+                fMat[i][j] = sumF;
+                sMat[i][j] = sumS;
+                }
+            }
+        }
+}
+
+
+/*---------------------------------------------------------------------------------
+|
+|   TiProbsUsingPadeApprox
+|
+|   The method approximates the matrix exponential, tMat = e^{qMat * v}, using
+|   the Pade approximation method, described in:
+|  
+|   Golub, G. H., and C. F. Van Loan. 1996. Matrix Computations, Third Edition.
+|      The Johns Hopkins University Press, Baltimore, Maryland.
+|
+|   The method approximates the matrix exponential with accuracy tol.
+|
+---------------------------------------------------------------------------------*/
+void TiProbsUsingPadeApprox (int dim, MrBFlt **qMat, MrBFlt v, MrBFlt r, MrBFlt **tMat, MrBFlt **fMat, MrBFlt **sMat)
+{
+    int         qValue;
+    MrBFlt      **a, tol;
+    
+    tol = 0.0000001;
+    
+    a = AllocateSquareDoubleMatrix (dim);
+    
+    MultiplyMatrixByScalar (dim, qMat, v * r, a);
+
+    qValue = SetQvalue (tol);
+
+    ComputeMatrixExponential (dim, a, qValue, tMat);
+    
+    FreeSquareDoubleMatrix (a);
+
+    if (fMat != NULL && sMat != NULL)
+        {
+        MultiplyMatrices (dim, qMat, tMat, fMat);
+        MultiplyMatrices (dim, qMat, fMat, sMat);
+        }
+}
+
diff --git a/src/utils.h b/src/utils.h
new file mode 100644 (file)
index 0000000..d7a1dfe
--- /dev/null
@@ -0,0 +1,270 @@
+#ifndef __UTILS_H__
+#define __UTILS_H__
+
+#undef complex
+struct complex
+{
+    MrBFlt re;
+    MrBFlt im;
+};
+typedef struct complex complex;
+
+typedef struct
+    {
+    MrBFlt     mean;
+    MrBFlt     median;
+    MrBFlt     lower;
+    MrBFlt     upper;
+    MrBFlt     var;
+    MrBFlt     PSRF;
+    MrBFlt     avrESS;
+    MrBFlt     minESS;
+    }
+    Stat;
+
+int      AddBitfield (BitsLong ***list, int listLen, int *set, int setLen);
+#if defined (SSE_ENABLED)
+void    *AlignedMalloc (size_t size, size_t alignment);
+void     AlignedSafeFree (void **ptr);
+#endif
+int      AreBitfieldsEqual (BitsLong *p, BitsLong *q, int length);
+int      Bit (int n, BitsLong *p);
+void     ClearBit (int i, BitsLong *bits);
+void     ClearBits (BitsLong *bits, int nLongs);
+void     CopyBits (BitsLong *dest, BitsLong *source, int nLongs);
+int      CopyResults (FILE *toFile, char *fromFileName, int lastGen);
+int      CopyProcessSsFile (FILE *toFile, char *fromFileName, int lastStep, MrBFlt *marginalLnLSS, MrBFlt *splitfreqSS);
+int      CopyTreeResults (FILE *toFile, char *fromFileName, int lastGen, int *treeNum);
+int      FirstTaxonInPartition (BitsLong *partition, int length);
+long     FirstTree (FILE *fp, char *lineBuf, int longestLine);
+int      Flip01 (int x);
+void     FlipBits (BitsLong *partition, int length, BitsLong *mask);
+void     FlipOneBit (int n, BitsLong *p);
+int      FromGrowthFxnToIndex (int *growthFxn);
+void     FromIndexToGrowthFxn (int index, int *growthFxn);
+void     GetIntSummary (int **vals, int nRows, int *rowCount, Stat *theStats, int HPD);
+int      GetKFromGrowthFxn (int *growthFxn);
+void     GetSummary (MrBFlt **vals, int nRows, int *rowCount, Stat *theStats, int HPD);
+int      HarmonicArithmeticMeanOnLogs (MrBFlt *vals, int nVals, MrBFlt *mean, MrBFlt *harm_mean);
+int      IsBitSet (int i, BitsLong *bits);
+int      IsConsistentWith (const char *token, const char *expected);
+int      IsPartNested (BitsLong *smaller, BitsLong *larger, int length);
+int      IsPartCompatible (BitsLong *smaller, BitsLong *larger, int length);
+int      IsSectionEmpty (BitsLong *bitField1, BitsLong *bitField2, int length);
+int      IsUnionEqThird (BitsLong *bitField1, BitsLong *bitField2, BitsLong *bitField3, int length);
+long     LastBlock (FILE *fp, char *lineBuf, int longestLine);
+int      LineTermType (FILE *fp);
+int      LongestLine (FILE *fp);
+void     LowerUpperMedian (MrBFlt *vals, int nVals, MrBFlt *lower, MrBFlt *upper, MrBFlt *median);
+void     LowerUpperMedianHPD (MrBFlt *vals, int nVals, MrBFlt *lower, MrBFlt *upper, MrBFlt *median);
+void     MeanVariance (MrBFlt *vals, int nVals, MrBFlt *mean, MrBFlt *var);
+void     MeanVarianceLog (MrBFlt *vals, int nVals, MrBFlt *mean, MrBFlt *var, MrBFlt *varEst);
+int      NextTaxonInPartition (int currentTaxon, BitsLong *partition, int length);
+int      NBits (int x);
+int      NumBits (BitsLong *x, int len);
+char    *MbPrintNum (MrBFlt num);
+void     MrBayesPrint (char *format, ...);
+void     MrBayesPrintf (FILE *f, char *format, ...);
+FILE    *OpenBinaryFileR (char *name);
+FILE    *OpenTextFileA (char *name);
+FILE    *OpenTextFileR (char *name);
+FILE    *OpenTextFileRQuait (char *name);
+FILE    *OpenTextFileW (char *name);
+MrBFlt   PotentialScaleReduction (MrBFlt **vals, int nRows, int *count);
+void     EstimatedSampleSize (MrBFlt **vals, int nRuns, int *count, MrBFlt *returnESS);
+void    *SafeCalloc (size_t n, size_t s);
+int      SafeFclose (FILE **fp);
+void     SafeFree (void **ptr);
+void    *SafeMalloc (size_t s);
+void    *SafeRealloc (void *ptr, size_t s);
+char    *SafeStrcat (char **target, const char *source);
+char    *SafeStrcpy (char **target, const char *source);
+void     SetBit (int i, BitsLong *bits);
+void     SortInts (int *item, int *assoc, int count, int descendingOrder);
+void     SortInts2 (int *item, int *assoc, int left, int right, int descendingOrder);
+void     SortMrBFlt (MrBFlt *item, int left, int right);
+int      StrCmpCaseInsensitive (char *s, char *t);
+void     StripComments (char *s);
+FILE    *TestOpenTextFileR (char *name);
+void     UpdateGrowthFxn (int *growthFxn);
+int      UpperTriangIndex (int i, int j, int size);
+int      WantTo (const char *msg);
+
+/* tree utility functions */
+int       AddToTreeList (TreeList *treeList, Tree *tree);
+Tree     *AllocateTree (int numTaxa);
+Tree     *AllocateFixedTree (int numTaxa, int isRooted);
+int       AllocateTreePartitions (Tree *t);
+PolyTree *AllocatePolyTree (int numTaxa);
+int       AllocatePolyTreePartitions (PolyTree *pt);
+int       AllocatePolyTreeRelClockParams (PolyTree *pt, int nBSets, int nESets);
+int       AreTopologiesSame (Tree *t1, Tree *t2);
+int       AreTreesSame (Tree *t1, Tree *t2);
+int       BuildConstraintTree (Tree *t, PolyTree *pt, char **localTaxonNames);
+int       BuildRandomRTopology (Tree *t, RandLong *seed);
+int       BuildRandomUTopology (Tree *t, RandLong *seed);
+int       CheckConstraints (Tree *t);
+int       CheckSetConstraints (Tree *t);
+void      ColorClusters (TreeNode *p, int *index);
+void      CopySubtreeToTree (Tree *subtree, Tree *t);
+int       CopyToPolyTreeFromPolyTree (PolyTree *to, PolyTree *from);
+int       CopyToSpeciesTreeFromPolyTree (Tree *to, PolyTree *from);
+int       CopyToTreeFromPolyTree (Tree *to, PolyTree *from);
+void      CopyPolyNodes (PolyNode *p, PolyNode *q, int nLongsNeeded);
+int       CopyToTreeFromTree (Tree *to, Tree *from);
+void      CopyTreeNodes (TreeNode *p, TreeNode *q, int nLongsNeeded);
+void      CopyTreeToSubtree (Tree *t, Tree *subtree);
+int       Deroot (PolyTree *pt);
+void      EraseTreeList (TreeList *treeList);
+void      findAllowedClockrate (Tree *t, MrBFlt *minClockRate, MrBFlt *maxClockRate);
+void      FreePolyTree (PolyTree *pt);
+void      FreePolyTreePartitions (PolyTree *pt);
+void      FreePolyTreePopSizeParams (PolyTree *pt);
+void      FreePolyTreeRelClockParams (PolyTree *pt);
+void      FreeTree (Tree *t);
+void      FreeTreePartitions (Tree *pt);
+void      GetDatedNodeDepths (TreeNode *p, MrBFlt *nodeDepths);
+void      GetDatedNodes (TreeNode *p, TreeNode **datedNodes);
+void      GetDownPass (Tree *t);
+void      GetNodeDownPass (Tree *t, TreeNode *p, int *i, int *j);
+void      GetPolyAges (PolyTree *t);
+void      GetPolyDepths (PolyTree *t);
+void      GetPolyDownPass (PolyTree *t);
+void      GetPolyNodeDownPass (PolyTree *t, PolyNode *p, int *i, int *j);
+int       GetRandomEmbeddedSubtree (Tree *t, int nTerminals, RandLong *seed, int *nEmbeddedTrees);
+int       GetFromTreeList (TreeList *treeList, Tree *tree);
+int       InitBrlens (Tree *t, MrBFlt v);
+int       InitCalibratedBrlens (Tree *t, MrBFlt minLength, RandLong *seed);
+int       InitClockBrlens (Tree *t);
+int       IsCalibratedClockSatisfied (Tree *t,MrBFlt *minClockRate,MrBFlt *maxClockRate , MrBFlt tol);
+int       IsClockSatisfied (Tree *t, MrBFlt tol);
+int       IsTreeConsistent (Param *param, int chain, int state);
+int       LabelTree (Tree *t, char **taxonNames);
+void      Mark (TreeNode *p);
+void      MarkDistance (TreeNode *p, int YESorNO, int dist, int *n);
+void      MarkUnconstrained (TreeNode *p);
+int       MoveCalculationRoot (Tree *t, int outgroup);
+int       MovePolyCalculationRoot (PolyTree *t, int outgroup);
+int       NumConstrainedTips (TreeNode *p);
+int       NumDatedTips (TreeNode *p);
+void      OrderTips (PolyTree *t);
+void      PrintNewick (char **s, int *len, Tree *t);
+void      PrintNodes (Tree *t);
+void      PrintPolyNodes (PolyTree *pt);
+void      PrintTranslateBlock (FILE *fp, Tree *t);
+int       PrunePolyTree (PolyTree *pt);
+int       RandPerturb (Tree *t, int nPert, RandLong *seed);
+int       RandResolve (Tree *tt, PolyTree *t, RandLong *seed, int destinationIsRooted);
+int       ResetBrlensFromTree (Tree *tree, Tree *vTree);
+void      ResetIntNodeIndices (PolyTree *t);
+void      ResetPolyTree (PolyTree *t);
+void      ResetPolyTreePartitions (PolyTree *pt);
+void      ResetPolyTreeRelClockParams (PolyTree *pt);
+int       ResetRootHeight (Tree *t, MrBFlt rootHeight);
+void      ResetTipIndices (PolyTree *pt);
+int       ResetTopology (Tree *t, char *s);
+int       ResetTopologyFromTree (Tree *tree, Tree *top);
+int       ResetTopologyFromPolyTree (Tree *tree, PolyTree *top);
+void      ResetTreePartitions (Tree *t);
+int       RetrieveRTopology (Tree *t, int *order);
+int       RetrieveRTree (Tree *t, int *order, MrBFlt *brlens);
+int       RetrieveRTreeWithIndices (Tree *t, int *order, MrBFlt *brlens);
+int       RetrieveUTopology (Tree *t, int *order);
+int       RetrieveUTree (Tree *t, int *order, MrBFlt *brlens);
+void      SetDatedNodeAges (Param* param, int chain, int state);
+void      SetNodeDepths (Tree *t);
+int       SetTreeNodeAges (Param *param, int chain, int state);
+int       ShowPolyNodes (PolyTree *pt);
+int       ShowTree (Tree *t);
+int       StoreRPolyTopology (PolyTree *t, int *order);
+int       StoreRPolyTree (PolyTree *t, int *order, MrBFlt *brlens);
+int       StoreRTopology (Tree *t, int *order);
+int       StoreRTree (Tree *t, int *order, MrBFlt *brlens);
+int       StoreRTreeWithIndices (Tree *t, int *order, MrBFlt *brlens);
+int       StoreUPolyTopology (PolyTree *t, int *order);
+int       StoreUPolyTree (PolyTree *t, int *order, MrBFlt *brlens);
+int       StoreUTopology (Tree *t, int *order);
+int       StoreUTree (Tree *t, int *order, MrBFlt *brlens);
+MrBFlt    TreeLen (Tree *t);
+void      Unmark (TreeNode *p);
+void      UpdateTreeWithClockrate (Tree *t, MrBFlt clockRate);
+void      WriteEventTree (TreeNode *p, int chain, Param *param);
+void      WriteEventTreeToPrintString (TreeNode *p, int chain, Param *param, int printAll);
+void      WriteNoEvtTreeToPrintString (TreeNode *p, int chain, Param *param, int showBrlens, int isRooted);
+void      WriteEvolTree (TreeNode *p, int chain, Param *param);
+void      WriteTopologyToFile (FILE *fp, TreeNode *p, int isRooted);
+
+/* math utility functions */
+complex **AllocateSquareComplexMatrix (int dim);
+MrBFlt  **AllocateSquareDoubleMatrix (int dim);
+int     **AllocateSquareIntegerMatrix (int dim);
+int       AutodGamma (MrBFlt *M, MrBFlt rho, int K);
+void      BetaBreaks (MrBFlt alpha, MrBFlt beta, MrBFlt *values, int K);
+MrBFlt    BetaQuantile (MrBFlt alpha, MrBFlt beta, MrBFlt x);
+void      CalcCijk (int dim, MrBFlt *c_ijk, MrBFlt **u, MrBFlt **v);
+void      CopyComplexMatrices (int dim, complex **from, complex **to);
+void      CopyDoubleMatrices (int dim, MrBFlt **from, MrBFlt **to);
+void      DirichletRandomVariable (MrBFlt *alp, MrBFlt *z, int n, RandLong *seed);
+int       DiscreteGamma (MrBFlt *rK, MrBFlt alfa, MrBFlt beta, int K, int median);
+void      FreeSquareComplexMatrix (complex **m);
+void      FreeSquareDoubleMatrix (MrBFlt **m);
+void      FreeSquareIntegerMatrix (int **m);
+int       GetEigens (int dim, MrBFlt **q, MrBFlt *eigenValues, MrBFlt *eigvalsImag, MrBFlt **eigvecs, MrBFlt **inverseEigvecs, complex **Ceigvecs, complex **CinverseEigvecs);
+MrBFlt    LnFactorial (int value);
+MrBFlt    LnGamma (MrBFlt alp);
+MrBFlt    LnPriorProbExponential (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbExponential_Param_Mean (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbFix (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbGamma (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbGamma_Param_Mean_Sd (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbLognormal (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbLognormal_Param_Mean_Sd (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbNormal (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbOffsetExponential (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbOffsetExponential_Param_Offset_Mean (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbOffsetGamma (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbOffsetGamma_Param_Offset_Mean_Sd (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbOffsetLognormal (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbOffsetLognormal_Param_Offset_Mean_Sd (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbTruncatedNormal (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbTruncatedNormal_Param_Trunc_Mean_Sd (MrBFlt val, MrBFlt *params);
+MrBFlt    LnPriorProbUniform (MrBFlt val, MrBFlt *params);
+MrBFlt    LnProbRatioExponential (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioExponential_Param_Mean (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioFix (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioGamma (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioGamma_Param_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioLognormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioLognormal_Param_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioNormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioOffsetExponential (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioOffsetExponential_Param_Offset_Mean (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioOffsetGamma (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioOffsetGamma_Param_Offset_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioOffsetLognormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioOffsetLognormal_Param_Offset_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioTruncatedNormal (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioTruncatedNormal_Param_Trunc_Mean_Sd (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbRatioUniform (MrBFlt newX, MrBFlt oldX, MrBFlt *params);
+MrBFlt    LnProbGamma (MrBFlt alpha, MrBFlt beta, MrBFlt x);
+MrBFlt    LnProbTruncGamma (MrBFlt alpha, MrBFlt beta, MrBFlt x, MrBFlt min, MrBFlt max);
+MrBFlt    LnProbLogNormal (MrBFlt exp, MrBFlt sd, MrBFlt x);
+MrBFlt    LnRatioLogNormal (MrBFlt exp, MrBFlt sd, MrBFlt xNew, MrBFlt xOld);
+MrBFlt    LnProbTK02LogNormal (MrBFlt mean, MrBFlt var, MrBFlt x);
+MrBFlt    LnRatioTK02LogNormal (MrBFlt exp, MrBFlt sd, MrBFlt xNew, MrBFlt xOld);
+MrBFlt    LogNormalRandomVariable (MrBFlt mean, MrBFlt var, RandLong *seed);
+MrBFlt    MaximumValue (MrBFlt x, MrBFlt y);
+MrBFlt    MinimumValue (MrBFlt x, MrBFlt y);
+void      MultiplyMatrices (int dim, MrBFlt **a, MrBFlt **b, MrBFlt **result);
+int       MultiplyMatrixNTimes (int dim, MrBFlt **Mat, int power, MrBFlt **Result);
+MrBFlt    PointNormal (MrBFlt prob);
+MrBFlt    PsiGammaLnProb (MrBFlt alpha, MrBFlt value);
+MrBFlt    PsiGammaLnRatio (MrBFlt alpha, MrBFlt numerator, MrBFlt denominator);
+MrBFlt    PsiGammaRandomVariable (MrBFlt alpha, RandLong *seed);
+MrBFlt    QuantileGamma (MrBFlt x, MrBFlt alfa, MrBFlt beta);
+MrBFlt    RandomNumber (RandLong *seed);
+MrBFlt    QuantileLogNormal (MrBFlt prob, MrBFlt mu, MrBFlt sigma);
+int       DiscreteLogNormal (MrBFlt *rK, MrBFlt sigma, int K, int median);
+MrBFlt    LogNormalPoint (MrBFlt x, MrBFlt mu, MrBFlt sigma);
+
+#endif  /* __UTILS_H__ */