[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a bug or a feature?
From: |
Rudolf Weeber |
Subject: |
Re: a bug or a feature? |
Date: |
Fri, 16 Apr 2021 16:30:52 +0200 |
Hi,
the expected behavior is ( in my opinion):
If (and only if) there are periodic boundaries in a given direction, minimum
image convenion is applied for distance calculation (bond or otherwise).
The observed behavior of ES is:
* with pbc: correct:
* without pbc: only correct if the pbc was turned off, before the particle was
placed. That's a bug. The order of particle placement and boundary condition
setup should not matter.
MNWE:
```
import espressomd
from espressomd.interactions import HarmonicBond
system = espressomd.System(box_l=[1]*3)
system.cell_system.skin =0
system.time_step = 0.01
h = HarmonicBond(r_0=0,k=1)
system.bonded_inter.add(h)
system.periodicity = False, False, False
p1 =system.part.add(pos=[0,0,0])
p2 =system.part.add(pos=[1,0,0],bonds=[(h,p1)])
assert system.analysis.energy()["total"] ==0
print(p1.pos, p1.image_box, p2.pos,p2.image_box)
system.periodicity = False, False, False
print(p1.pos, p1.image_box, p2.pos,p2.image_box)
assert system.analysis.energy()["total"] == 0.5 # 1/2 (k*r)^2
```
* If you swap the order, i.e., check the non-periodic case first, it passes
* The behavior is apparently not due to a change in pos or image box counter on
the particles.
Or am I missing sth?
Regards, Rudolf
--
Dr. Rudolf Weeber
Institute for Computational Physics
Universität Stuttgart
Allmandring 3
70569 Stuttgart
Germany
Phone: +49(0)711/685-67717
Email: weeber@icp.uni-stuttgart.de
http://www.icp.uni-stuttgart.de/~icp/Rudolf_Weeber