grid point and grid spacing in a cp2k cube file

Skip to first unread message

Oct 20, 2021, 3:28:36 PMOct 20
to cp2k
Dear all,

For a cp2k cube file, the box length is equal to:
the number of grid points * grid spacing?

Am I correct? 



Fangyong Yan

Oct 20, 2021, 3:45:02 PMOct 20
A more detailed description would be, suppose we have a box in 1 dimension, and box = 400 (points) * spacing,
now if we want to put the grid points on the box, and if we start the first grid point at the edge of the box, we have to use 401 points to fill the box.

However, if we put the first grid point a half spacing near the edge of the box, we need exactly 400 points.

So, my question is: what is the format for cp2k, does cp2k starts at the edge of the box, so that the box length = (number of points - 1) * spacing;
or cp2k starts at the half of the spacing near the edge, so the box length = (number of points) * spacing. 

Based on the cube file I obtained from cp2k, I assume cp2k uses the second definition. However, I think it is better to ask cp2k developers directly. 

So cp2k developers, could you please tell me which definition you use for relating the grid points and grid spacing to the box length? Thanks!


You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Fangyong Yan

Oct 20, 2021, 5:31:48 PMOct 20
I think if we have 4 points in 1D, and the box length is 4 * spacing, the grid point location should be:
            |          1          2          3           4|
(box edge)                                       (box edge) 
where the starting point 1, is not located at the box edge, but one spacing from the edge, 
on the other hand, the points 4 (the ending point), is located at the box edge. 

Probably cp2k add the grid points like this: the starting point is one spacing from the box edge, and the ending point is at the box edge. 

Dear CP2K developers, could you please verify this? Thanks!


Fangyong Yan

Oct 20, 2021, 10:34:30 PMOct 20
I think I have figured it out, the starting point is the ending point. 

Reply all
Reply to author
0 new messages