[lammps-users] Question about atom_vec_dipole

Hello,

I wondered, how I can remove the charge q from the atom_vec_dipole.cpp and
.h, because I only need orienational degrees of freedom but no charge.

Is it ok to set
atom->q_flag = 0;

and to erase every:

q = atom->q = (double *)
    memory->srealloc(atom->q,nmax*sizeof(double),"atom:q");
q = atom->q;

q[j] = q[i];

Then it should be fine to get rid of "buf[m++] = q[j];" in blocks like:

buf[m++] = x[j][0];
buf[m++] = x[j][1];
buf[m++] = x[j][2];
buf[m++] = tag[j];
buf[m++] = type[j];
buf[m++] = mask[j];
buf[m++] = q[j];
buf[m++] = mu[j][0];
buf[m++] = mu[j][1];
buf[m++] = mu[j][2];

In the following block I would erase "buf[0] = q[i];" and change the end
to "return 3;":

int AtomVecDipole::pack_border_one(int i, double *buf)
{
  buf[0] = q[i];
  buf[1] = mu[i][0];
  buf[2] = mu[i][1];
  buf[3] = mu[i][2];
  return 4;
}

But how about this in the AtomVecDipole::data_atom: "q[nlocal] =
atof(values[2]);" I would erase it, but I am unsure what I should do with
the

  mu[nlocal][0] = atof(values[6]);
  mu[nlocal][1] = atof(values[7]);
  mu[nlocal][2] = atof(values[8]);

should bei change them to:

  mu[nlocal][0] = atof(values[5]);
  mu[nlocal][1] = atof(values[6]);
  mu[nlocal][2] = atof(values[7]);

void AtomVecDipole::data_atom(double *coord, int imagetmp, char **values)
{
  int nlocal = atom->nlocal;
  if (nlocal == nmax) grow(0);

  tag[nlocal] = atoi(values[0]);
  if (tag[nlocal] <= 0)
    error->one("Invalid atom ID in Atoms section of data file");

  type[nlocal] = atoi(values[1]);
  if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
    error->one("Invalid atom type in Atoms section of data file");

  q[nlocal] = atof(values[2]);

  x[nlocal][0] = coord[0];
  x[nlocal][1] = coord[1];
  x[nlocal][2] = coord[2];

  mu[nlocal][0] = atof(values[6]);
  mu[nlocal][1] = atof(values[7]);
  mu[nlocal][2] = atof(values[8]);

  image[nlocal] = imagetmp;

  mask[nlocal] = 1;
  v[nlocal][0] = 0.0;
  v[nlocal][1] = 0.0;
  v[nlocal][2] = 0.0;
  omega[nlocal][0] = 0.0;
  omega[nlocal][1] = 0.0;
  omega[nlocal][2] = 0.0;

  atom->nlocal++;
}

Thanks for help in advance.

Best regards.
G. Rosenthal

Just set the q of each atom to 0.0.
Not clear why you want to edit the source code?

Steve