count region function in variable command

Hi,

I divided my simulation box in two separate regions (box1 and box2). Now i want to count the number of atoms in box1 and box2 using variable v1 and v2.
The sum of v1 and v2 is not equal to total number of atoms (created by “create_atoms 1 box” command).
Can anyone explain why v1,v2 sum is not constant?

region box block 0 10 0 10 0 10 units box
region box1 block 0 5 0 10 0 10 units box
region box2 block 5 10 0 10 0 10 units box

variable v1 equal count(all,box1)
variable v2 equal count(all,box2)

Thank you.

Ankit Agrawal (PhD Student)
Comp. Bio.
IMSc Chennai, India

Hi,

I divided my simulation box in two separate regions (box1 and box2). Now
i want to count the number of atoms in box1 and box2 using variable v1 and
v2.
The sum of v1 and v2 is not equal to total number of atoms (created by
"create_atoms 1 box" command).
Can anyone explain why v1,v2 sum is not constant?

​atoms are not perfectly constrained to the simulation box boundaries​. in
between reneighboring operations, they can move outside. you need to extend
your regions to go beyond the box in those areas. since regrions don't wrap
around PBCs, this is not a problem.

axel.