# Question on density access in atom_vec_sphere

Hi all,

This might be very specific question, but please see if you can answer this.
I am trying to compare and older version of lammps (21may08) I accessed “atom_vec_granular.cpp”
In the function

void AtomVecGranular::grow(int n)
{
if (n == 0) nmax += DELTA;
else nmax = n;
atom->nmax = nmax;

tag = atom->tag = (int )
memory->srealloc(atom->tag,nmax
sizeof(int),“atom:tag”);
type = atom->type = (int )
memory->srealloc(atom->type,nmax
sizeof(int),“atom:type”);
image = atom->image = (int )
memory->srealloc(atom->image,nmax
sizeof(int),“atom:image”);
x = atom->x = memory->grow_2d_double_array(atom->x,nmax,3,“atom:x”);
v = atom->v = memory->grow_2d_double_array(atom->v,nmax,3,“atom:v”);
f = atom->f = memory->grow_2d_double_array(atom->f,nmax,3,“atom:f”);

density = atom->density = (double )
memory->srealloc(atom->density,nmax
sizeof(double),“atom:density”);
rmass = atom->rmass = (double )
memory->srealloc(atom->rmass,nmax
sizeof(double),“atom:rmass”);

omega = atom->omega =
memory->grow_2d_double_array(atom->omega,nmax,3,“atom:omega”);
torque = atom->torque =
memory->grow_2d_double_array(atom->torque,nmax,3,“atom:torque”);

if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
}

One can access density information courtesy :
density = atom->density = (double )
memory->srealloc(atom->density,nmax
sizeof(double),“atom:density”);

Now I am using newest version of lammps which employs " atom type sphere" and accessed atom_vec_sphere.cpp
but I could not find a corresponding density line in the code, following is the code :
void AtomVecSphere::grow(int n)
{
if (n == 0) nmax += DELTA;
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,“Per-processor system is too big”);

tag = memory->grow(atom->tag,nmax,“atom:tag”);
type = memory->grow(atom->type,nmax,“atom:type”);
image = memory->grow(atom->image,nmax,“atom:image”);
x = memory->grow(atom->x,nmax,3,“atom:x”);
v = memory->grow(atom->v,nmax,3,“atom:v”);

rmass = memory->grow(atom->rmass,nmax,“atom:rmass”);
omega = memory->grow(atom->omega,nmax,3,“atom:omega”);

if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
}

Am I missing something obvious ? How can I access density if I want to use in the newer lammps

Best wishes
Prashant

mass = 4/3 pi rad^3 * density

LAMMPS only stores mass and radius.
You can infer density from those 2.

Steve

Thanks Steve, did the same .

Best wishes
Prashant