Mass setting

Hi lammps users,

Is there a better way of setting the mass of granular particles as I have 60 types of particles with varying diameter apart from the obvious solution of manually calculating the mass for all types of particles .I understand that the mass is not automatically adjusted according to diameter.

Regards

Amit

Look into atom style variables. You could calculate a mass using the
diameter property in a per atom variable and use this variable in the
set command. I posted a patch a few weeks ago that makes the particle
diameter available in variable calculations.
Daniel

The data file for atom_style sphere lists the mass density
of each particle, not the mass. The mass is computed
internally from the density and the diameter. So you
typically can specify the same density value for
all particles. Ditto for the set density command.

Steve

diff --git a/src/variable.cpp b/src/variable.cpp
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -3278,6 +3278,8 @@ void Variable::peratom2global(int flag, char *word,
else if (strcmp(word,"fx") == 0) mine = atom->f[index][0];
else if (strcmp(word,"fy") == 0) mine = atom->f[index][1];
else if (strcmp(word,"fz") == 0) mine = atom->f[index][2];
+ else if (strcmp(word,"q") == 0 && atom->q_flag) mine = atom->q[index];

else error->one(FLERR,"Invalid atom vector in variable formula");

@@ -3317,6 +3319,8 @@ int Variable::is_atom_vector(char *word)
if (strcmp(word,"fx") == 0) return 1;
if (strcmp(word,"fy") == 0) return 1;
if (strcmp(word,"fz") == 0) return 1;
+ if (strcmp(word,"q") == 0 && atom->q_flag) return 1;
return 0;
}

@@ -3362,6 +3366,8 @@ void Variable::atom_vector(char *word, Tree **tree,
else if (strcmp(word,"fx") == 0) newtree->array = &atom->f[0][0];
else if (strcmp(word,"fy") == 0) newtree->array = &atom->f[0][1];
else if (strcmp(word,"fz") == 0) newtree->array = &atom->f[0][2];
+ else if (strcmp(word,"q") == 0) newtree->array = atom->q;
}

/* ----------------------------------------------------------------------

shouldn't you simply use this instead?

http://lammps.sandia.gov/doc/compute_property_atom.html

axel.

Thanks for the poniter Axel,
of course you are right!
Daniel

thank you all! problem solved