Thursday, December 12, 2013

Radial Distribution Functions of Water from Experiment

Site-site radial distribution functions, sometimes called g(r) for short, are one of the most important measured quantities in molecular simulations. As usual, wikipedia has a nice overview of them. Probably the most famous non-trivial g(r) is the water oxygen-oxygen radial distribution function. It's often taught in statistical mechanics courses that it's possible to compare a simulation g(r) with X-ray or neutron-diffraction experiments with a simple Fourier transform. In fact, this is almost never the case due to sources of error in experiments. Check out the Introduction to this article by AK Soper for more info on the kinds of error which prevent the simple Fourier transform from converting experimental structure factors to a g(r).

In any case, the point of this post is to put the raw data for an experimental g(r) for water. The AK Soper article uses the empirical potential structure refinement method for converting experimental neutron diffraction data at 298 K 1 bar into the three radial distribution functions for water (O-O, O-H, H-H). This is the best method I know of for obtaining these radial distribution functions and this is the data used to test the TIP4P/2005 water model. I've extracted the data from their paper and made it available here. Make sure to cite their paper if you use the data in a publication. Hopefully these g(r)s will help you in creating your own new special water models! See the figure below the break:

Tuesday, October 1, 2013

Indexing an Emacs Macro

This post is about how to increment and paste a counter while executing an emacs macro. For some reason, this is not easy to find on the Internet. So I'll write it down on my blog since I keep forgetting.


  1. Set the start point of the counter
    M-: (setq i 1)
  2. Start recording macro with
    C-x (
  3. Insert index as needed with
    C-u M-: i
  4. Increment index when finished with macro
    M-: (setq i (+ i 1))
  5. Complete macro with
    C-x )
  6. Execute Macro with
    C-x e
To execute the macro multiple times, use ALT-(# of times) C-x e.

Thursday, May 16, 2013

Extending Radial Distributions

Radial distribution functions are one of the most important quantities to calculate when running a molecular dynamics simulation. They give good insight into the phase and pair potentials between molecules. Practically, they are calculated according to the following equation:

Tuesday, April 30, 2013

Cube-Sphere Intersection Volume

This week's math problem was particularly difficult. I wanted to know the intersection volume between a cube and a sphere. Imagine a sphere contained in a cube. The sphere will first touch the cube when its radius is equal to half the width of the cube. Until that point, its volume is just the formula for the volume of a sphere. Once the sphere's radius is 2 sqrt(3) times the width of the cube, then it completely engulfs the cube and the intersection of the 2 objects is just the volume of a cube. In between, I've found it looks like this:


Thursday, April 25, 2013

Bacteria in Blender

I made this while drinking my morning coffee. I just stretched a UV Sphere, stuck two layers of hair on it (flagella, cilia) and added a few modifiers to get it bumpy. The texture is just some glass, Voronoi textures, and diffuse shaders. Meh, it's OK.


Wednesday, April 24, 2013

Generating n-Dimensional Lattice Coordinates

It comes up sometimes in my research that I need to generate coordinates along a lattice. For example, when generating an initial structure for a molecular dynamics simulation. I thought I share my code for this. The code works by recursively enumerating each dimension in a lattice and calling a given function each time it reaches a point. So, it could be used to execute any function along a lattice. Here's what it looks like for a 2D and 3D example. In the 3D example I didn't choose a cubic number of points on the lattice, so that it sort of stops in the middle.



Tuesday, April 23, 2013

Category Colors in R

I thought I'd write down the color palette I use for categories. I've seen many discussions about gradient color choices, but category colors are less often discussed. I have a function given below which generates colors where there is not meant to be an ordering to the color. It is important when data points are near, that they are easy to distinguish with the eye. It makes more sense to see it:


Monday, April 22, 2013

ggplot Style in Classic R Plots

ggplot is a highly acclaimed R package for plotting. I have had very little experience with the library because I've mostly memorized all the quirks of normal R plots. I like the ggplot default style though, so I thought write down how to replicate it in R plots. The distinctive feature of ggplot is the gray rectangle and white grid lines. This may be replicated like so:



Here's an example

Saturday, April 20, 2013

DNA-Polymer Nanoparticle

DNA-Polymer nanoparticle are used to deliver DNA to cell nuclei for curing diseases at the genetic level. In my research group, we work with carboxy-betaine acrylamide polymers. I modeled an exceptionally large DNA-polymer nanoparticle below. The polymer is 80 kDa and the DNA is a single strand of 65 base pairs. After condensing it (in blender, not a true physical simulation), the nanoparticle comes out to about 15nm in diameter. 



Friday, April 19, 2013

The Accuracy of Ghose-Crippen ALogP for Peptides

I was using the Ghose-Crippen ALogP predictor implemented in CDK as a QSAR for looking at peptide solubilities. Unfortunately, this partition coefficient predictor is fit on small organic molecules and does a pretty bad job at predicting peptide partition coefficients. Here's what it looks like on single amino acids compared with experimental data.


Thursday, April 18, 2013

Visualizing Size in Biochemical Systems - Update

After some helpful suggestions, I've revised the previous image I made. This time I've used the atom representation for the proteins and peptides, so atoms are used everywhere for visualization and they have the correct radii. Doesn't look as cool, but it is more consistent.





Monday, April 15, 2013

Visualizing Size in Biochemical Systems

I decided to waste a few hours and make a Blender image based on my post on the relative size of common elements in biochemical systems. Using 1 blender unit = 1 nm, I modeled a gold nanoparticle, an antibody, albumin, an iron oxide nanoparticle, a 10 amino acid length peptide, and salicylic acid.



Relative Size of Proteins, Nanoparticles, Antibodies, Peptides, and Drugs

Needing to know the relative size of these elements in biochemical systems often comes up in my research, so I've decided to write them.


Component Size [nm] Reference
Gold Nanoparticle ~20 Can vary, most common is 20. Frens (1973)
Iron Oxide Nanoparticle 5-15 Can be much larger with emulsion methods. This size is most common when magentic properties are desired. Called partial reduction coprecipitation method.
Antibody 15.5 x 11 PDB: 1igt measured in VMD
Human Serum Albumin 7.6 x 7 PDB: 1e7i measured in VMD
10 Amino Acid Peptide ~1.5 (coiled globule sphere) Paper I wrote on Peptide Conformations
Salicylic Acid (drug) 0.6 x 0.5 PubChem structure measured in VMD

Friday, April 12, 2013

Approximate Restricted Integer Partition With Exact Part Number

I'm interested in a certain type of mathematical structure this week: integer partitions. An integer partition, p(n), is the set of sets of integers that add up to n. For example,

  • p(3) = 1 + 1 + 1, 1 + 2, 3
  • p(4) = 1 + 1 + 1 + 1, 1 + 1 + 2, 2 + 2, ...

Thursday, April 11, 2013

Speeding up R

I've been programming in R for a while now. Whenever I've had performance problems, it almost always is due to data.frame usage. To check what's slowing down your R code, just use the Rprof command like so:

Friday, April 5, 2013

Changing Image Size in Tachyon in VMD

I always forget how to change the image size for rending molecular images in VMD using the (external) Tachyon rendering engine, so I thought I'd write down the steps here:

In the TCL console, get the aspect ratio correct for the image. So, for example to make a nice 1920x1080 image, we'll make the view at half of that:

 
display resize 960 540

Now, add simply add -res 1920 1080 to the end of the render command in the file render controls window. Here's an example of one of my render commands:
 
"$HOME/VMD/tachyon_LINUXAMD64" -aasamples 12 %s -format TARGA -o %s.tga  -res 1920 1080

Here's the result of one my renders:

Wednesday, April 3, 2013

Making nanoparticles in Blender

Today I made some nanoparticles in Blender. I used the node compositor to create the fluorophore effect. Making science in Blender is fun!


Saturday, March 23, 2013

Making Proteins and Polymer in Blender

I was messing around in Blender and decided to create some artwork related to a recent paper published in my current research group. The idea is to create a two layers of polymer. One layer is to make a biosensor resistant to noise from non-target molecules adsorbing on the sensor surface. A second longer layer of polymer is used to attach anti-body to the sensor. The anti-body allows the sensor to target very specific molecules. Here's the image I made using Blender's cycles render engine:


Wednesday, March 20, 2013

CDK QSARs of Peptides

I was doing some working in CDK and was pleasantly surprised at how easy it is to calculate descriptors on short peptides. The code to do this is actually only three lines! Adding in a bug fix though, it becomes four. Here's the code to calculate every QSAR descriptor on a peptide


Monday, March 11, 2013

Reading Command Line args in R

I'm writing this down in my blog because I keep forgetting my standard way for adding command line arguments to R. I like to use executable R scripts that don't require --vanilla --args etc. The syntax in the R script is:

Thursday, February 28, 2013

Markov Chains in JS — Part 1

I'm in the process of writing a new post or two on working with Markov Chains in javascrtipt. I created the javascript files already and I've decided to post them below for now. I'll write up more about it and hopefully use the code for something interesting in a future post. See below for the javascript Markov Chain Simulator! See the code here.