Possible issue in molecule command for 1-2, 3, 4 neighbors

Dear all,

I think I found the issue.

In molecule.cpp, at lines 608-613 there is the automatic calculation of special bonds

if (bondflag && !specialflag) {

specialflag = 1;

nspecialflag = 1;

maxspecial = atom->maxspecial;

if (flag) special_generate();


The code gets run twice, once to allocate memory with flag == 0, the second to generate the specials with flag == 1 (see lines 111-122 of Molecule.cpp).

However the condition “if (bondflag && !specialflag)” prevents special bond generation, as both specialflag and bondflag will be 1 after the memory allocation, and (bondflag && !specialflag) will be false.

I changed the condition to

if (flag || !specialflag && bondflag) {


which seems to solve the problem.

Best regards,

Daniele Savio

good catch - I’ll make the change - it will be in the next patch.

another payoff (for me) for procrastination until someone

else finds the bug.