- #1
SchroedingersLion
- 215
- 57
Greetings,
for a Monte Carlo simulation of N hard spheres, I want to set up the initial configuration as a fcc lattice. I am thinking about how to do it most efficiently.
Here is the lattice structure:
The 3 lattice vectors, each one pointing to a different type of the 12 nearest neighbors (see colors in picture), are given by
$$\vec a_{1}=\frac a 2 \begin{pmatrix} 0 \\ 1 \\ 1 \end{pmatrix},
\vec a_{2}=\frac a 2 \begin {pmatrix} 1 \\ 0 \\ 1 \end {pmatrix},
\vec a_{3}=\frac a 2 \begin {pmatrix} 1 \\ 1 \\ 0 \end {pmatrix}
$$
How would you do this most easily in C++?
My first idea was to simply set up the nearest neighbors. First, I use the three lattice vectors separately to set up the first 3 nearest neighbors. Then I combine two of them to get the other 9. Then I combine all 3 to get the next-nearest neighbors.
But what then? I have to repeat these steps with different pre-factors in the linear combinations, but I don't know how to do it systematically in a loop.Regards,
SL
for a Monte Carlo simulation of N hard spheres, I want to set up the initial configuration as a fcc lattice. I am thinking about how to do it most efficiently.
Here is the lattice structure:
The 3 lattice vectors, each one pointing to a different type of the 12 nearest neighbors (see colors in picture), are given by
$$\vec a_{1}=\frac a 2 \begin{pmatrix} 0 \\ 1 \\ 1 \end{pmatrix},
\vec a_{2}=\frac a 2 \begin {pmatrix} 1 \\ 0 \\ 1 \end {pmatrix},
\vec a_{3}=\frac a 2 \begin {pmatrix} 1 \\ 1 \\ 0 \end {pmatrix}
$$
How would you do this most easily in C++?
My first idea was to simply set up the nearest neighbors. First, I use the three lattice vectors separately to set up the first 3 nearest neighbors. Then I combine two of them to get the other 9. Then I combine all 3 to get the next-nearest neighbors.
But what then? I have to repeat these steps with different pre-factors in the linear combinations, but I don't know how to do it systematically in a loop.Regards,
SL