# Computation of the volume of molecules

Hello again to my third blog post!

Today I want to tell you what I was working on the last few weeks. As I have mentioned in my previous blog post (https://summerofhpc.prace-ri.eu/how-to-distinguish-different-surfaces-of-molecules/), one goal of this year’s project is to distinguish different disconnected surfaces automatically. It can happen that the computation yields several very small surface components which are physically irrelevant. For example, in the image above we see one large surface (grey), and several tiny surface components inside of the large surface. The goal is to sort out these small surfaces automatically. For doing that we need a criterium when a surface should be sorted out and when not. The approach that we used in our implementation is the computation of the volume of each single surface component. If the volume falls off a certain threshold value, the corresponding surface can be sorted out.

In this blog post, I want to describe how we computed the volume of a molecule. The divergence theorem, also known as the Gauss-Ostrogradsky theorem (https://mathworld.wolfram.com/DivergenceTheorem.html), gives us a formula for doing this.

Let S be the surface of a molecule. Then, the theorem leads to the following formula:

Volume of the molecule = $\frac{1}{3} \int_S (x,y,z) \cdot \vec{N} ds.$

Here, for each point (x,y,z) on S, \vec{N} is the unit normal pointing outwards of the surface S at (x,y,z). To use this formula for our computations, we approximate the integral by a finite sum:

Volume of the molecule $\approx \frac{1}{3} \sum_{i=0}^n (\vec{p_i} \cdot \vec{N_i}) A_i$

Our program computes a triangulation that approximates the surface of a molecule. Each $\vec{p_i}$ is a triangle vertex of this triangulation, $\vec{N_i}$ is the average normal of all the triangles containing $\vec{p_i}$, and $A_i$ is one-third of the sum of the areas of the triangles containing $\vec{p_i}$ (see the image below).

In our program, for each disconnected surface, we compute its volume. As a threshold value, we chose the volume of a $H_2O$ molecule, which is approximately 14 Ångström^3. We tested the computation of the volume for several molecules. For example, the grey outer surface of the molecule in the title image has a volume of 4642 and the volumes of the small surfaces inside lie within the range of 0 and 0.7. So, with our computation, we can sort out these small surfaces automatically.

This was a rough overview of the computation of the volumes. If you are interested in more details, feel free to ask your questions in the comments below.

Tagged with: , , ,

This site uses Akismet to reduce spam. Learn how your comment data is processed.