{
“cells”: [
{

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“# Elastic Properties and Deformation Energyn”, “n”, “* This tutorial discuss the analyses that can be performed using the [dnaMD Python module](http://do-x3dna.readthedocs.io/en/latest/api_summary.html) included in the _do\_x3dna_ package. The tutorial is prepared using [Jupyter Notebook](https://jupyter.org/) and this notebook tutorial file could be downloaded from this [link](http://rjdkmr.github.io/do_x3dna/tut_notebook/calculate_elasticity_tutorial.ipynb).n”, “n”, “n”, “* Download the input files that are used in the tutorial from this [link](http://rjdkmr.github.io/do_x3dna/tutorial_data.tar.gz).n”, “n”, “n”, “* Two following input files are required in this tutorialn”, “n”, ” * tutorial_data/elasticity_DNA/free_dna.h5 n”, ” * tutorial_data/elasticity_DNA/bound_dna.h5n”, ” n”, “These two files should be present inside tutorial_data/elasticity_DNA of the present working directory.n”, ” n”, ” n”, “* The above two files can be created by the steps as shown [here](http://do-x3dna.readthedocs.io/en/latest/global_elasticity_example.html#Calculate-stretching-twisting-and-bending-motions)n

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Importing Python Modulesn”, “n”, “* [numpy](http://www.numpy.org/): Required for the calculations involving large arraysn”, “n”, “n”, “* [matplotlib](http://matplotlib.org/): Required to plot the resultsn”, “n”, “n”, “* [dnaMD](http://do-x3dna.readthedocs.io/en/latest/api_summary.html): Python module to analyze DNA/RNA structures from the do_x3dna output files.”

]

}, {

“cell_type”: “code”, “execution_count”: 1, “metadata”: {}, “outputs”: [], “source”: [

“import numpy as npn”, “import matplotlib as mpln”, “import matplotlib.pyplot as pltn”, “import dnaMDn”, “n”, “%matplotlib inline”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Initializing eyDNA object with free_dna.h5 filen”, “n”, “* [eyDNA object](https://do-x3dna.readthedocs.io/en/latest/dnaEY_api.html) is initialized by using the total number of base-pairs and HDF5 file.n”, “n”, “* This class contains all the required functions to calculate the elastic properties and deformation free energy.”

]

}, {

“cell_type”: “code”, “execution_count”: 2, “metadata”: {}, “outputs”: [], “source”: [

“eyDNA = dnaMD.dnaEY(27, ‘BST’, filename=’elasticity_DNA/free_dna.h5’)”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Determining modulus matrix - bending, stretching and twistingn”, “n”, “Modulus matrix for all three major motions (bending, stretching and twisting) can be obtained with getStrecthTwistBend method.n”, “n”, “In the following example, matrix is calculated for all frames and first 5000 frames, respectively.n”

]

}, {

“cell_type”: “code”, “execution_count”: 3, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Average values for all frames: [0.02137576 0.06756513 5.35794425 9.5425644 ]n”, “Modulus matrix for all frames: n”, ” [[ 337.23299773 28.50565693 -6.98412669 -20.71008355]n”, ” [ 28.50565693 373.86276276 7.97658176 39.50860135]n”, ” [ -6.98412669 7.97658176 1080.72200976 -96.19760022]n”, ” [ -20.71008355 39.50860135 -96.19760022 448.34908519]]n”, ” n”, “Average values for all frames: [0.02137576 0.06756513 5.35794425 9.5425644 ]n”, “Elastic constant matrix for all frames: n”, ” [[15.19593397 1.28448308 -0.3147092 -0.93320957]n”, ” [ 1.28448308 16.84649455 0.35942986 1.78028278]n”, ” [-0.3147092 0.35942986 48.69802306 -4.33472522]n”, ” [-0.93320957 1.78028278 -4.33472522 20.20289574]]n”, ” n”

]

}

], “source”: [

“# All framesn”, “avg, mod_matrix = eyDNA.getStretchTwistBendModulus([4,20], paxis=’X’)n”, “print(‘Average values for all frames: ‘, avg)n”, “print(‘Modulus matrix for all frames: \n’, mod_matrix )n”, “print(’ ‘)n”, “n”, “# Elastic matrixn”, “avg, mod_matrix = eyDNA.getStretchTwistBendModulus([4,20], paxis=’X’, matrix=True)n”, “print(‘Average values for all frames: ‘, avg)n”, “print(‘Elastic constant matrix for all frames: \n’, mod_matrix )n”, “print(’ ‘)”

]

}, {

“raw_mimetype”: “text/markdown”

}, “source”: [

“The elastic matrix is in this form:n”, “n”, “$$\text{Elastic matrix} = \begin{bmatrix}n”, ” K_{Bx} & K_{Bx,By} & K_{Bx,S} & K_{Bx,T} \\n”, ” K_{Bx,By} & K_{By} & K_{By,S} & K_{By,T} \\n”, ” K_{Bx,S} & K_{By,S} & K_{S} & K_{S,T} \\n”, ” K_{Bx,T} & K_{Bx,T} & K_{S,T} & K_{T}n”, “\end{bmatrix}n”, “$$n”, “n”, “Where:n”, “n”, “* $Bx$ - Bending motion in one planen”, “* $By$ - Bending motion in another orthogonal planen”, “* $S$ - Stretching motionn”, “* $T$ - Twisting motionn”, “n”, “n”, “$$\text{modulus matrix} =n”, “\begin{bmatrix}n”, “M_{Bx} & M_{Bx,By} & M_{Bx,S} & M_{Bx,T} \\n”, “M_{Bx,By} & M_{By} & M_{By,S} & M_{By,T} \\n”, “M_{Bx,S} & M_{By,S} & M_{S} & M_{S,T} \\n”, “M_{Bx,T} & M_{Bx,T} & M_{S,T} & M_{T}n”, “\end{bmatrix}n”, “$$n”, “n”, “$$n”, “= 4.1419464 \times \begin{bmatrix}n”, “K_{Bx} & K_{Bx,By} & K_{Bx,S} & K_{Bx,T} \\n”, “K_{Bx,By} & K_{By} & K_{By,S} & K_{By,T} \\n”, “K_{Bx,S} & K_{By,S} & K_{S} & K_{S,T} \\n”, “K_{Bx,T} & K_{Bx,T} & K_{S,T} & K_{T}n”, “\end{bmatrix} \times L_0n”, “$$n”, “n”, “Where:n”, “n”, “* $M_{Bx}$ - Bending-1 stiffness in one planen”, “* $M_{By}$ - Bending-2 stiffness in another orthogonal planen”, “* $M_{S}$ - Stretch Modulusn”, “* $M_{T}$ - Twist rigidityn”, “* $M_{Bx,By}$ - Bending-1 and Bending-2 couplingn”, “* $M_{By,S}$ - Bending-2 and stretching couplingn”, “* $M_{S,T}$ - Stretching Twsiting couplingn”, “* $M_{Bx,S}$ - Bending-1 Stretching couplingn”, “* $M_{By,T}$ - Bending-2 Twisting couplingn”, “* $M_{Bx,T}$ - Bending-1 Twisting couplingn”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Convergence in bending, stretching and twisting with their couplingsn”, “n”, “Elasticities cannot be calcualted from an individual snapshot or frame. However, these properties can be calculated as a function of time by considering all the frames up to that time. For example, 0-50 ns, 0-100 ns, 0-150 ns etc. By this method, we can analyze the convergence and also further we can calculate error using block average method.n”, “n”, “Elasticities over the time can be calculated using getElasticityByTime method.n”, “n”, “If esType=’BST’, A ordered dictionary of 1D arrays of shape (nframes). The keys in dictionary are name of the elasticity in the same order as listed above..n”, “n”, “1. $M_{Bx}$ - bend-1 - Bending-1 stiffness in one planen”, “2. $M_{By}$ - bend-2 - Bending-2 stiffness in another orthogonal planen”, “3. $M_{S}$ - stretch - Stretch Modulusn”, “4. $M_{T}$ - twist - Twist rigidityn”, “5. $M_{Bx,By}$ - bend-1-bend-2 - Bending-1 and Bending-2 couplingn”, “6. $M_{By,S}$ - bend-2-stretch - Bending-2 and stretching couplingn”, “7. $M_{S,T}$ - stretch-twist - Stretching Twsiting couplingn”, “8. $M_{Bx,S}$ - bend-1-stretch - Bending-1 Stretching couplingn”, “9. $M_{By,T}$ - bend-2-twist - Bending-2 Twisting couplingn”, “10. $M_{Bx,T}$ - bend-1-twist - Bending-1 Twisting couplingn”, “n”, “If esType=’ST’, 2D array with three properties of shape (3, frame) will be returned.n”, “n”, “1. $M_{S}$ - stretch - Stretch Modulusn”, “2. $M_{T}$ - twist - Twist rigidityn”, “3. $M_{S,T}$ -stretch-twist - Stretching Twsiting couplingn”, “n”, “In the following example, modulus as a function of time was calculated by adding 1000 frames.”

]

}, {

“cell_type”: “code”, “execution_count”: 4, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Keys in returned dictionary:n”, ” bend-1n”, “bend-2n”, “stretchn”, “twistn”, “bend-1-bend-2n”, “bend-2-stretchn”, “stretch-twistn”, “bend-1-stretchn”, “bend-2-twistn”, “bend-1-twist n”, “———–n”

]

}, {

“data”: {

“<Figure size 432x288 with 1 Axes>”

]

}, {

“data”: {

“<Figure size 432x288 with 1 Axes>”

]

}, {

“data”: {

“<Figure size 432x288 with 1 Axes>”

]

}

], “source”: [

“time, modulus = eyDNA.getModulusByTime([4,20], frameGap=500, masked=True)n”, “print(‘Keys in returned dictionary:\n’, ‘\n’.join(list(modulus.keys())), ‘\n———–‘)n”, “n”, “# Stretching modulusn”, “plt.plot(time, modulus[‘stretch’])n”, “plt.scatter(time, modulus[‘stretch’])n”, “plt.xlabel(‘Time (ps)’)n”, “plt.ylabel(r’Stretching Modulus (pN)’)n”, “plt.show()n”, “n”, “# Twist rigidityn”, “plt.plot(time, modulus[‘twist’])n”, “plt.scatter(time, modulus[‘twist’])n”, “plt.xlabel(‘Time (ps)’)n”, “plt.ylabel(r’Rigidity (pN nm$^2$)’)n”, “plt.show()n”, “n”, “# Stretch twist couplingn”, “plt.plot(time, modulus[‘stretch-twist’])n”, “plt.scatter(time, modulus[‘stretch-twist’])n”, “plt.xlabel(‘Time (ps)’)n”, “plt.ylabel(r’Stretch-Twist Coupling (pN nm)’,)n”, “plt.show()”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Deformation free energy of bound DNAn”, “n”, “Deformation energy of a probe DNA (bound DNA) can be calculated with reference to the DNA present in the current object.n”, “n”, “The deformation free energy is calculated using elastic matrix as followsn”, “n”, “$$G = \frac{1}{2L_0}\mathbf{xKx^T}$$n”, “n”, “$$\mathbf{x} = \begin{bmatrix}n”, ” (\theta^{x} - \theta^{x}_0) & (\theta^{y} - \theta^{y}_0) & (L - L_0) & (\phi - \phi_0)n”, ” \end{bmatrix}$$n”, “n”, “n”, “Where, $\mathbf{K}$, $\theta^{x}_0$, $\theta^{y}_0$, $L_0$ and $\phi_0$ is calculated from reference DNA while $\theta^{x}$, $\theta^{y}$, $L$ and $\phi$ is calculated for probe DNA from each frame.n”, “n”, “We already loaded the data for reference DNA above. Here, we will load data for probe DNA.”

]

}, {

“cell_type”: “code”, “execution_count”: 5, “metadata”: {}, “outputs”: [], “source”: [

“# Load parameters of bound DNAn”, “boundDNA = dnaMD.DNA(27, filename=’elasticity_DNA/bound_dna.h5’)”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“Deformation free energy can be calculated for the following motions that can be used with which option.n”, “n”, “* 'full' : Use entire elastic matrix – all motions with their couplingn”, “* 'diag' : Use diagonal of elastic matrix – all motions but no couplingn”, “* 'b1' : Only bending-1 motionn”, “* 'b2' : Only bending-2 motionn”, “* 'stretch' : Only stretching motionn”, “* 'twist' : Only Twisting motionsn”, “* 'st_coupling' : Only stretch-twist coupling motionn”, “* 'bs_coupling' : Only Bending and stretching couplingn”, “* 'bt_coupling' : Only Bending and Twisting couplingn”, “* 'bb_coupling' : Only bending-1 and bending-2 couplingn”, “* 'bend' : Both bending motions with their couplingn”, “* 'st' : Stretching and twisting motions with their couplingn”, “* 'bs' : Bending (b1, b2) and stretching motions with their couplingn”, “* 'bt' : Bending (b1, b2) and twisting motions with their couplingn”, “n”, “which can be either 'all' or a list of energy terms given above.n”

]

}, {

“cell_type”: “code”, “execution_count”: 6, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Keys in returned dictionary:n”, ” fulln”, “diagn”, “stretchn”, “twistn”, “st_couplingn”, “b1n”, “b2n”, “bendn”, “bs_couplingn”, “bt_couplingn”, “bb_couplingn”, “stn”, “bsn”, “bt n”, “———–n”

]

}, {

“data”: {

“<Figure size 576x576 with 2 Axes>”

]

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“==============================================n”, “Energy(kJ/mol) Average Errorn”, “———————————————-n”, “full 27.714 0.724n”, “diag 27.012 0.751n”, “stretch 2.468 0.157n”, “twist 15.061 0.478n”, “st_coupling -0.743 0.040n”, “b1 1.477 0.180n”, “b2 8.005 0.266n”, “bend 9.718 0.386n”, “bs_coupling 0.034 0.002n”, “bt_coupling 0.825 0.020n”, “bb_coupling 0.235 0.020n”, “st 26.269 0.713n”, “bs 11.984 0.499n”, “bt 25.369 0.634n”, “==============================================n”, “n”

]

}

], “source”: [

“# Deformation free energy of bound DNA and calculate all above listed termsn”, “time, energy = eyDNA.getGlobalDeformationEnergy([4,20], boundDNA, paxis=’X’, which=’all’, masked=True)n”, “energyTerms=list(energy.keys())n”, “print(‘Keys in returned dictionary:\n’, ‘\n’.join(energyTerms), ‘\n———–‘)n”, “n”, “# Plot two energy termsn”, “fig = plt.figure(figsize=(8,8))n”, “fig.subplots_adjust(hspace=0.3)n”, “n”, “ax1 = fig.add_subplot(211)n”, “ax1.set_title(‘Bound DNA, entire elastic matrix’)n”, “ax1.plot(time, energy[‘full’])n”, “ax1.set_xlabel(‘Time (ps)’)n”, “ax1.set_ylabel(r’Deformation Free Energy (kJ/mol)’,)n”, “n”, “ax2 = fig.add_subplot(212)n”, “ax2.set_title(‘Bound DNA, only diagonal of elastic matrix’)n”, “ax2.plot(time, energy[‘diag’])n”, “ax2.set_xlabel(‘Time (ps)’)n”, “ax2.set_ylabel(r’Deformation Free Energy (kJ/mol)’,)n”, “n”, “plt.show()n”, “n”, “n”, “# Calculate average and error for each energy termsn”, “error = dnaMD.get_error(time, list(energy.values()), len(energyTerms), err_type=’block’, tool=’gmx analyze’)n”, “n”, “print("==============================================")n”, “print(‘{0:<16}{1:>14}{2:>14}’.format(‘Energy(kJ/mol)’, ‘Average’, ‘Error’))n”, “print("———————————————-")n”, “for i in range(len(energyTerms)):n”, ” print(‘{0:<16}{1:>14.3f}{2:>14.3f}’.format(energyTerms[i], np.mean(energy[energyTerms[i]]),error[i]))n”, “print("==============================================\n")”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Local elastic properties or stiffnessn”, “n”, “Local elastic properties can be caluclated using either local base-step parameters or local helical base-step parameters.n”, “n”, “In case of base-step parameters: Shift ($Dx$), Slide ($Dy$), Rise ($Dz$), Tilt ($\tau$), Roll ($\rho$) and Twist ($\omega$), following elastic matrix is calculated.n”, “n”, “$$n”, “\mathbf{K}_{base-step} = \begin{bmatrix}n”, “K_{Dx} & K_{Dx,Dy} & K_{Dx,Dz} & K_{Dx,\tau} & K_{Dx,\rho} & K_{Dx,\omega} \\n”, “K_{Dx,Dy} & K_{Dy} & K_{Dy,Dz} & K_{Dy,\tau} & K_{Dy,\rho} & K_{Dy,\omega} \\n”, “K_{Dx,Dz} & K_{Dy,Dz} & K_{Dz} & K_{Dz,\tau} & K_{Dz,\rho} & K_{Dz,\omega} \\n”, “K_{Dx,\tau} & K_{Dy,\tau} & K_{Dz,\tau} & K_{\tau} & K_{\tau, \rho} & K_{\tau,\omega} \\n”, “K_{Dx,\rho} & K_{Dy,\rho} & K_{Dz,\rho} & K_{\tau, \rho} & K_{\rho} & K_{\rho,\omega} \\n”, “K_{Dx,\omega} & K_{Dy,\omega} & K_{Dz,\omega} & K_{\tau, \omega} & K_{\rho, \omega} & K_{\omega} \\n”, “\end{bmatrix}n”, “$$n”, “n”, “In case of helical-base-step parameters: x-displacement ($dx$), y-displacement ($dy$), h-rise ($h$), inclination ($\eta$), tip ($\theta$) and twist ($\Omega$), following elastic matrix is calculated.n”, “n”, “$$n”, “\mathbf{K}_{helical-base-step} = \begin{bmatrix}n”, “K_{dx} & K_{dx,dy} & K_{dx,h} & K_{dx,\eta} & K_{dx,\theta} & K_{dx,\Omega} \\n”, “K_{dx,dy} & K_{dy} & K_{dy,h} & K_{dy,\eta} & K_{dy,\theta} & K_{dy,\Omega} \\n”, “K_{dx,h} & K_{dy,h} & K_{h} & K_{h,\eta} & K_{h,\theta} & K_{h,\Omega} \\n”, “K_{dx,\eta} & K_{dy,\eta} & K_{h,\eta} & K_{\eta} & K_{\eta, \theta} & K_{\eta,\Omega} \\n”, “K_{dx,\theta} & K_{dy,\theta} & K_{h,\theta} & K_{\eta, \theta} & K_{\theta} & K_{\theta,\Omega} \\n”, “K_{dx,\Omega} & K_{dy,\Omega} & K_{h,\Omega} & K_{\eta, \Omega} & K_{\theta, \Omega} & K_{\Omega} \\n”, “\end{bmatrix}n”, “$$n”

]

}, {

“cell_type”: “code”, “execution_count”: 7, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Average values for all frames: 0.032 -0.490 1.365 -1.353 21.767 120.816 n”, “=========== ============== Elastic Matrix =============== ===========n”, “n”, ” 182.38193 -0.43894 -33.29158 -1.10677 -0.10263 0.06223n”, ” -0.43894 144.96085 47.83000 0.17088 -0.41365 -1.97614n”, ” -33.29158 47.83000 536.89374 0.88922 0.19157 -0.04720n”, ” -1.10677 0.17088 0.88922 0.03967 0.00187 -0.00237n”, ” -0.10263 -0.41365 0.19157 0.00187 0.01341 0.01044n”, ” 0.06223 -1.97614 -0.04720 -0.00237 0.01044 0.05663n”, “n”, “=========== ====================== ====================== ===========n”, “n”, “n”, “Average values for all frames: -1.345 -0.077 1.238 40.943 2.313 126.065 n”, “=========== ============== Elastic Matrix =============== ===========n”, “n”, ” 36.97195 -1.71920 -17.32508 0.28692 -0.00210 -1.27421n”, ” -1.71920 51.72183 17.63716 0.06741 0.23741 -0.00462n”, ” -17.32508 17.63716 399.75293 1.17117 -0.14549 0.09748n”, ” 0.28692 0.06741 1.17117 0.00973 -0.00077 -0.01152n”, ” -0.00210 0.23741 -0.14549 -0.00077 0.01009 -0.00028n”, ” -1.27421 -0.00462 0.09748 -0.01152 -0.00028 0.07528n”, “n”, “=========== ====================== ====================== ===========n”

]

}

], “source”: [

“# base-stepn”, “avg, matrix = eyDNA.calculateLocalElasticity([10,13], helical=False)n”, “n”, “# Print matrix in nice formatn”, “out = ‘’n”, “mean_out = ‘’n”, “for i in range(matrix.shape[0]):n”, ” for j in range(matrix.shape[0]):n”, ” if j != matrix.shape[0]-1:n”, ” out += ‘{0:>10.5f} ‘.format(matrix[i][j])n”, ” else:n”, ” out += ‘{0:>10.5f}\n’.format(matrix[i][j])n”, ” mean_out += ‘{0:>15.3f} ‘.format(avg[i])n”, “n”, “print(‘Average values for all frames: ‘, mean_out)n”, “print(‘=========== ============== Elastic Matrix =============== ===========\n’)n”, “print(out)n”, “print(‘=========== ====================== ====================== ===========’)n”, “n”, “# helical base-stepn”, “avg, matrix = eyDNA.calculateLocalElasticity([10,13], helical=True)n”, “n”, “# Print matrix in nice formatn”, “out = ‘’n”, “mean_out = ‘’n”, “for i in range(matrix.shape[0]):n”, ” for j in range(matrix.shape[0]):n”, ” if j != matrix.shape[0]-1:n”, ” out += ‘{0:>10.5f} ‘.format(matrix[i][j])n”, ” else:n”, ” out += ‘{0:>10.5f}\n’.format(matrix[i][j])n”, ” mean_out += ‘{0:>15.3f} ‘.format(avg[i])n”, “n”, “print(’\n\nAverage values for all frames: ‘, mean_out)n”, “print(‘=========== ============== Elastic Matrix =============== ===========\n’)n”, “print(out)n”, “print(‘=========== ====================== ====================== ===========’)n”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Local deformation energy of a local small segmentn”, “Using the above elastic matrix, deformation energy of this base-step in bound DNA can be calucalted.”

]

}, {

“cell_type”: “code”, “execution_count”: 8, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Keys in returned dictionary:n”, ” fulln”, “diagn”, “shiftn”, “sliden”, “risen”, “tiltn”, “rolln”, “twist n”, “———–n”

]

}, {

“data”: {

“<Figure size 576x576 with 2 Axes>”

]

}, {

“name”: “stdout”, “output_type”: “stream”, “text”: [

“==============================================n”, “Energy(kJ/mol) Average Errorn”, “———————————————-n”, “full 7.673 0.269n”, “diag 17.583 0.737n”, “shift 0.547 0.026n”, “slide 6.411 0.429n”, “rise 0.479 0.012n”, “tilt 0.683 0.016n”, “roll 2.552 0.146n”, “twist 6.911 0.313n”, “==============================================n”, “n”

]

}

], “source”: [

“# Here calculate energy for one base-stepn”, “time, energy = eyDNA.getLocalDeformationEnergy([10,13], boundDNA, helical=False, which=’all’)n”, “energyTerms=list(energy.keys())n”, “print(‘Keys in returned dictionary:\n’, ‘\n’.join(energyTerms), ‘\n———–‘)n”, “n”, “# Plot two energy termsn”, “fig = plt.figure(figsize=(8,8))n”, “fig.subplots_adjust(hspace=0.3)n”, “n”, “ax1 = fig.add_subplot(211)n”, “ax1.set_title(‘Bound DNA, entire elastic matrix’)n”, “ax1.plot(time, energy[‘full’])n”, “ax1.set_xlabel(‘Time (ps)’)n”, “ax1.set_ylabel(r’Local Deformation Energy (kJ/mol)’,)n”, “n”, “ax2 = fig.add_subplot(212)n”, “ax2.set_title(‘Bound DNA, only diagonal of elastic matrix’)n”, “ax2.plot(time, energy[‘diag’])n”, “ax2.set_xlabel(‘Time (ps)’)n”, “ax2.set_ylabel(r’Local Deformation Energy (kJ/mol)’,)n”, “n”, “plt.show()n”, “n”, “# Calculate average and error for each energy termsn”, “error = dnaMD.get_error(time, list(energy.values()), len(energyTerms), err_type=’block’, tool=’gmx analyze’)n”, “print("==============================================")n”, “print(‘{0:<16}{1:>14}{2:>14}’.format(‘Energy(kJ/mol)’, ‘Average’, ‘Error’))n”, “print("———————————————-")n”, “for i in range(len(energyTerms)):n”, ” print(‘{0:<16}{1:>14.3f}{2:>14.3f}’.format(energyTerms[i], np.mean(energy[energyTerms[i]]),error[i]))n”, “print("==============================================\n")n”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

“### Deformation energy of the consecutive overlapped DNA segmentsn”, “n”, “Above method gives energy of a small local segment of the DNA. However, we mostly interested in large segment of the DNA. This large segment can be further divided into smaller local segments. For these smaller segments local deformation energy can be calculated. Here these segments overlapped with each other.”

]

}, {

“cell_type”: “code”, “execution_count”: 9, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Keys in returned dictionary:n”, ” fulln”, “diagn”, “shiftn”, “sliden”, “risen”, “tiltn”, “rolln”, “twist n”, “———–n”

]

}, {

“data”: {

“<Figure size 1008x576 with 1 Axes>”

]

}

], “source”: [

“# First calculation for local base-step parametersn”, “segments, energies, error = eyDNA.getLocalDeformationEnergySegments([4,20], boundDNA, span=4, n”, ” helical=False, which=’all’,n”, ” err_type=’block’,n”, ” tool=’gmx analyze’)n”, “energyTerms=list(energies.keys())n”, “print(‘Keys in returned dictionary:\n’, ‘\n’.join(energyTerms), ‘\n———–‘)n”, “n”, “# Now plot the datan”, “fig = plt.figure(figsize=(14,8))n”, “fig.subplots_adjust(hspace=0.3)n”, “mpl.rcParams.update({‘font.size’: 16})n”, “n”, “xticks = range(len(segments))n”, “n”, “ax1 = fig.add_subplot(111)n”, “ax1.set_title(‘Local base-step parameters’)n”, “n”, “for term in energyTerms:n”, ” ax1.errorbar(xticks, energies[term], yerr=error[term], ms=10, elinewidth=3, fmt=’-o’, label=term)n”, “ax1.set_xticks(xticks)n”, “ax1.set_xticklabels(segments, rotation=’vertical’)n”, “ax1.set_xlabel(‘base-step number’)n”, “ax1.set_ylabel(r’Deformation Energy (kJ/mol)’,)n”, “plt.legend()n”, “n”, “plt.show()”

]

}, {

“cell_type”: “markdown”, “metadata”: {}, “source”: [

***n”, “n”, “n”, “Same as the above but energy is calculated using helical base-step parameters”

]

}, {

“cell_type”: “code”, “execution_count”: 10, “metadata”: {}, “outputs”: [

{

“name”: “stdout”, “output_type”: “stream”, “text”: [

“Keys in returned dictionary:n”, ” fulln”, “diagn”, “x-dispn”, “y-dispn”, “h-risen”, “inclinationn”, “tipn”, “h-twist n”, “———–n”

]

}, {

“data”: {

“<Figure size 1008x576 with 1 Axes>”

]

}

], “source”: [

“# Secind calculation for local base-step parametersn”, “segments, energies, error = eyDNA.getLocalDeformationEnergySegments([4,20], boundDNA, span=4, n”, ” helical=True, which=’all’,n”, ” err_type=’block’,n”, ” tool=’gmx analyze’)n”, “energyTerms=list(energies.keys())n”, “print(‘Keys in returned dictionary:\n’, ‘\n’.join(energyTerms), ‘\n———–‘)n”, “n”, “# Now plot the datan”, “fig = plt.figure(figsize=(14,8))n”, “fig.subplots_adjust(hspace=0.3)n”, “mpl.rcParams.update({‘font.size’: 16})n”, “n”, “xticks = range(len(segments))n”, “n”, “ax1 = fig.add_subplot(111)n”, “ax1.set_title(‘Local base-step parameters’)n”, “n”, “for term in energyTerms:n”, ” ax1.errorbar(xticks, energies[term], yerr=error[term], ms=10, elinewidth=3, fmt=’-o’, label=term)n”, “ax1.set_xticks(xticks)n”, “ax1.set_xticklabels(segments, rotation=’vertical’)n”, “ax1.set_xlabel(‘base-step number’)n”, “ax1.set_ylabel(r’Deformation Energy (kJ/mol)’,)n”, “plt.legend()n”, “n”, “plt.show()”

]

}

“kernelspec”: {

“display_name”: “Python 3”, “language”: “python”, “name”: “python3”

}, “language_info”: {

“codemirror_mode”: {

“name”: “ipython”, “version”: 3

}, “file_extension”: “.py”, “mimetype”: “text/x-python”, “name”: “python”, “nbconvert_exporter”: “python”, “pygments_lexer”: “ipython3”, “version”: “3.6.6”

}

}, “nbformat”: 4, “nbformat_minor”: 2

}