Tell me more ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

The minimum image convention (MIC), see for example a short note of W. Smith, is often used in molecular dynamics or monte carlo simulations of periodic systems with an orthorhombic unit cell. For this special case, it is rather trivial to implement the MIC correctly. How does one apply the MIC to systems with a more general triclinic unit cell? The naive idea to simply generalize the algorithm for orthorhomic cells to triclinic cells, does not seem to work.

I could find this document, which provides some clues, such as the importance of the reduced basis of the lattice vectors, but it does not contain enough details to make a computer implementation.

I will implement the answers below in a test code to check which algorithms work (under given assumptions). The Python test program can be found here: https://gist.github.com/3566972. It tests the lammps implementation and one naive attempt of mine. Both fail. If one finds a bug in this test program, please get in touch.

P.S. For those who get worried about MD or MC codes that use a naive algorithm for triclinic cells: please read the note written by W. Smith. It explains a naive algorithm that works as long as the distance cutoff is shorter than half the shortest distance between the opposite faces of the unit cell. For a given cutoff, one may always construct a triclinic supercell for which naive algorithms will work fine.

share|improve this question

1 Answer

The key is to take the differences $\Delta x$, $\Delta y$, and $\Delta z$ separately before beginning. Given the edge vectors ${\bf a}$, ${\bf b}$, and ${\bf c}$ that define a unit cell that has one corner at the origin, then your tilt factors are $b_1$, $c_1$, and $c_2$, where $n_m$ defines the $m^{th}$ component of vector ${\bf n}$.

Now, for each component:

  • If $|\Delta x| > 0.5(a_{max} - a_{min})$, then subtract off $a_{max} - a_{min}$ if $\Delta x > 0$, and add it for values less than zero.
  • If $|\Delta y| > 0.5(b_{max} - b_{min})$, then subtract off $b_{max} - b_{min}$ if $\Delta y > 0$, and add it for values less than zero. Also add or subtract $b_1$ from $\Delta x$.
  • If $|\Delta z| > 0.5(c_{max} - c_{min})$, then subtract off $c_{max} - c_{min}$ if $\Delta z > 0$, and add it for values less than zero. Also add or subtract $c_1$ from $\Delta x$ and $c_2$ from $\Delta y$.

My source for this is taken from the code for triclinic domains found in domain.cpp in the LAMMPS molecular dynamics package.

share|improve this answer
Thanks for the reply. Unfortunately, this algorithms fails for some cases (see test program). I guess it will (also) only work if the cutoff for the relative vectors is smaller than half the distance between two crystal planes. It is still an interesting answer, because it shows that most MD codes do not bother to implemented a more rigorous (and computationally more demanding) solution. – Toon Verstraelen Sep 1 '12 at 8:30
I am not sure I fully understood your answer. Can you clafify what you mean when you say "* If $|\Delta x| > 0.5(a_{max} - a_{min})$, then subtract off $a_{max} - a_{min}$ if $\Delta x > 0$, and add it for values less than zero." The second if statment, is it dependent on the first being true? When you say "and add it" what do you mean by "and" there doesn't seem to be anything to "and" there. – Magpie Jan 2 at 17:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.