You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using WCA interactions and compiling Espresso without the LENNARD_JONES and with the WCA feature, the expression in this line evaluates to false since the radius will be 0.5. The reason for this is that the interaction does not have the lennard_jones attribute when not compiled with the feature.
However, if one compiles with LENNARD_JONES , it will have the attribute even if no LJ interaction is used. Thus the line above will set the radius to zero (since ia.lennard_jones.sigma is zero) and the issue will not appear.
This is a MWE:
importespressomdimportespressomd.visualizationsystem=espressomd.System(box_l=[20.0]*3)
system.time_step=0.01p0=system.part.add(pos=[2.0, 2.0, 2.0], type=0)
# p0 will have a radius of 0.5 in visualization but should have 2.0system.non_bonded_inter[0, 0].wca.set_params(
epsilon=1.0, sigma=4.0)
visualizer=espressomd.visualization.openGLLive(
system,
particle_sizes="auto",
window_size=[1024, 1024],
)
visualizer.screenshot("test.png")
I think one could just remove the radius == 0 check when there is a WCA interaction to make the above code work. But I am not sure if someone will have a problem if he has LJ and WCA interactions on the same particles.
The text was updated successfully, but these errors were encountered:
My bad, I made a mistake when converting the try...except statement to an if...else chain.
The original code gave LJ precedence over WCA, so the fix has to set radius = 0.0 initially.
When using WCA interactions and compiling Espresso without the
LENNARD_JONES
and with theWCA
feature, the expression in this line evaluates to false since the radius will be 0.5. The reason for this is that the interaction does not have thelennard_jones
attribute when not compiled with the feature.However, if one compiles with
LENNARD_JONES
, it will have the attribute even if no LJ interaction is used. Thus the line above will set the radius to zero (sinceia.lennard_jones.sigma
is zero) and the issue will not appear.This is a MWE:
I think one could just remove the
radius == 0
check when there is a WCA interaction to make the above code work. But I am not sure if someone will have a problem if he has LJ and WCA interactions on the same particles.The text was updated successfully, but these errors were encountered: