lumol icon indicating copy to clipboard operation
lumol copied to clipboard

Make center of mass computation of a molecule more robust?

Open g-bauer opened this issue 8 years ago • 5 comments

Currently, the center of mass computation does not check if all particles of a molecule are adjacent, or if some particles are wrapped into the simulation cell. If a molecule is partially wrapped, the current center of mass computation will yield wrong results.

# Awesome sketch of a partially wrapped molecule
---------------
|        o    |<- boundary of the cell
|     x   \   |
|-o        o -|
---------------
# x : wrong center of mass

In the current implementation, everything is working as long as the initial configuration does not contain "partially wrapped" molecules because there are no propagation methods or other system changes that apply such partial wrapping.

We could enhance the current implementation to check for partial wrapping - e.g. compute bonding lengths without period boundary conditions. Do you think that this is needed? It would make the usage of the existing method more robust with respect to custom extensions.

g-bauer avatar Feb 03 '17 13:02 g-bauer

because there are no propagation methods or other system changes that apply such partial wrapping.

Not yet, but that what #3 is about. So we should handle it before implementing rewrap algorithm.

I think we definitively want to get the "right" center of mass here, I don't know how we can do this.

If we rewrap all the atomic positions before computing the center of mass, we still get wrong values:

Before wrapping:
+-------------+-------------+
|             |             |
|             |        o    |
|      +------|------+  \   |
|      |      |- o   |   o -|
|      |      |      |      |
+------|------+------|------+
|      |      |      |      |
|      |      |      |      |
|      +------|------+      |
|             |             |
|             |             |
+-------------+-------------+

After wrapping around origin:
+-------------+-------------+
|             |             |
|             |             |
|      +------|------+      |
|      |   o -|- o   |      |
|      |      |      |      |
+------|------+------|------+
|      |      |      |      |
|      | o    |      |      |
|      +--\---|------+      |
|             |             |
|             |             |
+-------------+-------------+

What would we do if we find a bonding length without PBC that is bigger than the bonding length wit PBC? Wrap this particular atom?

Luthaf avatar Feb 03 '17 14:02 Luthaf

Just though of an easier solution: using the wrapped distances from the first atom of the molecule:

image

Because we are wrapping distances from another atom in the molecule, all wrapped values should fall around the same point, and not in separated parts of the cell. What do you think?

Luthaf avatar Feb 03 '17 14:02 Luthaf

For the internal representation of positions, I would favor to never "partially wrap" molecules. I would wrap the molecule as a whole so that its center of mass lies within the cell. That is done at the moment in the translation of molecules with the implemented wrapping function (again, assuming that all particles of a molecule are adjacent).

What would we do if we find a bonding length without PBC that is bigger than the bonding length wit PBC? Wrap this particular atom?

Or "rewrap" it back so that its real positions is adjacent if we want to keep particles of molecules together.

g-bauer avatar Feb 03 '17 14:02 g-bauer

Because we are wrapping distances from another atom in the molecule, all wrapped values should fall around the same point, and not in separated parts of the cell. What do you think?

That could work. I have to think about it 😄

g-bauer avatar Feb 03 '17 14:02 g-bauer

See https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions for an algorithm that should always be valid

Luthaf avatar Oct 18 '18 22:10 Luthaf