# RNA duplex melting

## Introduction

This example shows how our code can be used to calculate melting temperature of an RNA duplex (8-mer) using the Virtual Move Monte Carlo (VMMC) algorithm.
The corresponding files are located in the repository in subdirectory `EXAMPLES/RNA_DUPLEX_MELT`

## Setting the order parameters and weights

The example uses umbrella sampling in order to make the sampling more efficient. In order to obtain a correct estimate
of the melting temperature, the simulation has to sample many times the transitions between unbonded and bonded states.
The sampling is aided by assigning weights to a particular state, specified for this example in file ` wfile.txt `, where the first column specifies the value of order parameter
(number of native bonds in the duplex in our case) and second column specifies the weight assigned to the state:

0 8. 1 16204 2 1882.94 3 359.746 4 52.5898 5 15.0591 6 7.21252 7 2.2498 8 2.89783

The weights are typically chosen first by an educated guess, and then by running the simulations and adapting the weights manually to ensure that all relevant states are sampled.
The order parameters, in this case base pairs, are specified in a file which is in our example called `op.txt`:

{ order_parameter = bond name = all_native_bonds pair1 = 0, 15 pair2 = 1, 14 pair3 = 2, 13 pair4 = 3, 12 pair5 = 4, 11 pair6 = 5, 10 pair7 = 6, 9 pair8 = 7, 8 }

which specifies what base pairs count towards the order parameters. In our example, it specifies all complementary base pairs. The nucleotides are numbered from 0 to N-1, where N is the total number of nucleotides in the simulation. In our example, we have two complementary strands with eight nucleotides each, so in total sixteen nucleotides. The nucleotides are numbered from 3' end to the 5' end, so the first 3' nucleotides of the first strand (with index 0) is complementary to the first 5' nucleotide on the second strand (which has index 15). The system can have between 0 to 8 bonds formed, and for each possible value of an order parameter, a corresponding weight is assigned in the `wfile.txt`.

We need to specify the weight file and ordere parameter file in the `input` file, which is done by including the following options:

op_file = op.txt weights_file = wfile.txt

The program will now count the number of time the simulation spends in the respective states (i.e. how much time the simulation spends in states with 0 bonds, 1 bond, ..., 8 bonds). In order to be able to calculate the melting temperature, one is interested in the ratio of the number states where the system is in duplex state (i.e. has at least 1 bonds) and the number of states when the system has 0 bonds. We also need to know this ratio for a range of temperatures, so that we can interpolate them and find when is the ratio equal to 2, which is the definition of melting temperature when the finite size effects are taken into account (see discussion in [this paper] for details). One possibility is to run a series of simulations, each at different temperature. However, it is more efficient to use histogram reweighting in order to calculate the respective yields at different temperatures by extrapolating the contribution of states visited in one simulation. This is achieved by specifying

extrapolate_hist = 52C, 54C, 56C, 58C, 60C, 62C, 64C, 66C, 68C, 70C

in the `input` file.