tri-clinic box ghost cutoff calculation


Is there a particular geometric reasoning behind this calculation in comm_brick.cpp:

length0 = sqrt(h_inv[0]*h_inv[0] + h_inv[5]*h_inv[5] + h_inv[4]*h_inv[4]);
cutghost[0] = cut * length0;
length1 = sqrt(h_inv[1]*h_inv[1] + h_inv[3]*h_inv[3]);
cutghost[1] = cut * length1;
length2 = h_inv[2];
cutghost[2] = cut * length2;

found within the setup routine? I understand this is trying to map a cutoff length into lambda coords in some fashion or another; what I don’t get is how that mapped length ensures all the requisite ghost atoms are inside the expanded box. There are no comments so I’m not sure how that calculation ensures the distance between the triclinic sub box surface and the new box surface always has a minimum of the cutoff radius. Does anyone have a picture of how this is expanding the box with the requisite vectors and geometry supporting that calculation? when I attempt the spirit of such a calculation of lengths for each of the triclinic vectors I end up with a different arithmetic solution in order to ensure the ghosts are captured.

Explanation below …