ls1mardyn / ls1-mardyn

ls1-MarDyn is a massively parallel Molecular Dynamics (MD) code for large systems. Its main target is the simulation of thermodynamics and nanofluidics. ls1-MarDyn is designed with a focus on performance and easy extensibility.
http://www.ls1-mardyn.de
Other
28 stars 15 forks source link

Bug in Basis.cpp regarding component ID #315

Open HomesGH opened 4 months ago

HomesGH commented 4 months ago

Describe the bug In ls1 in general, the usage of the component ID is very error-prone since it starts internally with 0 and externally (e.g. in the config.xml) with a 1. This leads to a bug in the Basis.cpp where the externally specified component ID does not start with a 1. See here:

https://github.com/ls1mardyn/ls1-mardyn/blob/baff96a5401d3987de48d122864fd138fddfe827/src/utils/generator/Basis.cpp#L27-L28

 

It should be as in the ReplicaFiller.cpp:

https://github.com/ls1mardyn/ls1-mardyn/blob/baff96a5401d3987de48d122864fd138fddfe827/src/utils/generator/ReplicaFiller.cpp#L175-L183

 

Due to this bug, e.g., the component ID here in the Injection scenario must be 2 instead of 3 (see components.xml) to properly work.

A short-term solution would be to fix the Basis.cpp. However, the problem with the internal vs external component ID is one of the most error-prone things in ls1. In my opinion, the components should be stored within a std::map instead of std::vector. Until now, the component ID is not really used but the position of the single component in the components vector is used as/for the "ID".