Inclination angle with respect to a plane

110 Views Asked by At

I have performed some molecular dynamics simulation and outcome gives position of each atom in Cartesian coordinate system. The outcome looking like this, enter image description here

where the yellow atoms some sort of liquid so they move around and red and blue atoms stick together and act as a solid body. Both solid bodies half submerged inside liquid and it can rotate around itself. My aim is to find the approximate angle of inclination that any solid body makes with respect to liquid plane. The angle can vary from 0 to 90 degree. How can I extract the angle from the position of all atoms?

1

There are 1 best solutions below

0
On

The solid direction can be found either by a PCA on the columns as pointed out by @ad2004 or by a regression to a straight line.

To find the surface normal I propose 2 options:

  1. consider the surface to to be defined by a vector $N$ and a scalar $d$ such that the points $P$ that obey $N\cdot P+d=0$ are on the surface, and thus all the liquid points $L_i$ must obey $N\cdot L_i+d<0$. Find $N,d$ by optimizing a softened version of $\sum sign(N \cdot L_i +d)$. $\,\,erf(x)$ or $\arctan(x)$ come to mind.
  1. Find the boundary layer by looking for sharp changes in the density ( by convolving with a Canny filter or something similar and then thresholding), then take the points that were determined to be on the boundary $B_i$ and do a regression to minimize $\sum(n \cdot B_i +1)^2$ and determine $N,d$ by normalizing $n$ so that $|N|=1$