amepproject / amep

The Active Matter Evaluation Package (AMEP) - a Python library for the analysis of particle-based and continuum simulation data of soft and active matter systems
https://amepproject.de/
GNU General Public License v3.0
11 stars 2 forks source link

BUG:<When calculating the Cluster Size Distribution (CSD), some results are missing.> #85

Open wztang opened 1 week ago

wztang commented 1 week ago

Description:

In calculating the Cluster Size Distribution (CSD), clusters with a size of 1 are not included. Even when the 'include_single' parameter is set to 'True'.

Code for reproduction:

import amep
ptraj = amep.load.traj("../examples/data/lammps.h5amep")

pcsd = amep.evaluate.ClusterSizeDist(
    ptraj, nav=5, pbc=True, skip=0.8
)

pcsd.save("./eval/csd-eval.h5", database=True, name="particles")

fig, axs = amep.plot.new()
axs.plot(
    pcsd.sizes, pcsd.avg, marker="*", ls="",
    label="active Brownian particles"
)
axs.loglog()
axs.set_xlabel(r"$m$")
axs.set_ylabel(r"$p(m)$")
axs.legend()
fig.savefig("./figures/evaluate/evaluate-ClusterSizeDist.png")

Error message:

In calculating the Cluster Size Distribution (CSD), clusters with a size of 1 are not included. Even when the 'include_single' parameter is set to 'True'.

Python and AMEP versions:

Python version: '3.10.12 (main, Jul 5 2023, 18:54:27) [GCC 11.2.0]' AMEP version: '1.0.2'

Additional information:

No response

How did you install AMEP?

pip

kay-ro commented 6 days ago

Hi @wztang thank you for noticing. We're looking into that and will get back to you as soon as we have an update :)

kay-ro commented 5 days ago

I fixed the issue. If you want, you can check out branch issue-85_cluster_single for the fixed implementation. It will be merged in the next release.

Thank you for creating an issue :)