Now not using the allocated array, but the "epl" array thing instead which is normally used for ENERg, and then using epl(8) to sum up the element volumes instead of normally the potential energy, I get the following behavior.
When I run a simulation with a cube having an edge length of 1 and having 16x16x16 elements, I get the following wrong value for the total volume:
1.0307617187500002
Dividing (1.0307617187500002 - 1.0) by the volume of one element, i.e. 1/(16x16x16)=0.000244140625 yields pretty much exactly 126.
So it includes some elements more than once I guess.
When I remove
c Check for ghost elements (no energy contribution)
if (jsw.eq.13 .and. ix(nen1-1,n).eq.21) cycle
from pform.f (cf. my last reply), I get
1.2478027343750002
which then yields 1015 elements when I divide it by the elemental volume.
To get these values, I just added
write(*,*) epl(8)
to the code in pmacr1. Then I got 8 outputs (using 8 processes) which I summed up manually