About x v f in the code.

Dear Lammps Authors

When I read the code, I found that in atom.h you have defined x v f. However, in atom_vec_atomic.h you also defined another x v f. So for me it is nor necessary to define x v f in atom.h. Also in atom_vec_atomic.h, why you didn’t destroy x v f as that did in atom.cpp:

memory->destroy(x);
memory->destroy(v);
memory->destroy(f);

Thanks very much!

Best!

Hao

Dear Lammps Authors

     When I read the code, I found that in atom.h you have defined x v f.
However, in atom_vec_atomic.h you also defined another x v f. So for me it
is nor necessary to define x v f in atom.h. Also in atom_vec_atomic.h, why

well, in both cases x, v, f are _pointers_. storage for those are
maintained by the corresponding AtomVec classes, which correspond to
atom styles.
but if you look carefully, all AtomVec derived classes allocate
storage on the pointers in Atom and then just store the pointer in
their local variables as well. check out the "grow()" method.

there are a lot of class members and local variables, that are not
strictly not necessary. there are different reasons for having them
(convenience, performance, code readability).

you didn't destroy x v f as that did in atom.cpp:

  memory->destroy(x);
  memory->destroy(v);
  memory->destroy(f);

no. this *must* not be done, since that would try to free the same
address twice. if you run LAMMPS with a memory checker like valgrind's
memcheck tool, you can see that there is no memory leak in that code,
so the code is correct.

axel.