LeMonADE-project / LeMonADE

Library for Monte Carlo Simulation applying the Bond Fluctuation Model
Other
3 stars 11 forks source link

Inconsistency in the Writing/Reading of Bonds #151

Open tonimueller opened 2 years ago

tonimueller commented 2 years ago

The class WriteMcs skips the linearization of chains, if the connection is a valid bonds plus a multiple of the box size https://github.com/LeMonADE-project/LeMonADE/blob/7523a6b102b5b5d6162c5ba94c618ec16168c4b3/include/LeMonADE/core/MoleculesWrite.h#L151

On the other hand, the two linear parts are written on the same line and in addition the bond is written to the bfm file in the function void WriteAddBonds<IngredientsType>::writeStream(std::ostream& strm) . In this case, the bond is written two times to the file, although only one connection happened.

In the current reading process a second connection between the same monomers is not taken into account https://github.com/LeMonADE-project/LeMonADE/blob/7523a6b102b5b5d6162c5ba94c618ec16168c4b3/include/LeMonADE/core/ConnectedDecorator.h#L218

For consistency I would be good to only write the additional bond in !add_bonds if it is not taken into account by the linearization.

For this situation a test where two monomers are connected should be added (in the same box, apart by a periodic box).