[lammps-users] Same pe value for different atom type


void ComputePartialEnthalpy::compute_vector()
{
invoked_vector = update->ntimestep;



if (!(c_pe_atom->invoked_flag & INVOKED_PERATOM)) {
c_pe_atom->compute_peratom();
c_pe_atom->invoked_flag |= INVOKED_PERATOM;
}

double *pe = c_pe_atom->vector_atom;

int *type = atom->type;

double a, b;
atom->type[2000] = 1;
c_pe_atom->compute_peratom();
a = pe[2000];
atom->type[2000] = 2;
c_pe_atom->compute_peratom();
b = pe[2000];
vector[0] = a;
vector[1] = b;
}

In one of my modified “compute_partial_enthalpy.cpp” file, I wrote the codes above.
but I got same value with a and b, why?
and how can I get different value with changed atom type?
Thanks

Xiaoliang
|

I don’t know what you’re trying to do, but compute pe/atom
has already tallied the pe per atom before you call it. That
happened when pair/bond/etc potentials were calculated.
So changing the type of an atom right before you call it,
changes nothing.

Steve

OK, thanks, but if I want to change the atom type and get different potential energy in a compute, what should I do?
Wether in one timestep, I can’t do this?

Xiaoliang

10年5月13日,周四, Steve Plimpton [email protected] 写道:

Compute pe and compute pe/atom rely on the pair potentials (bond, etc) to
actually compute PE. That will only happen if you run for a timestep (or 0 steps).
Compute group/group will compute the PE (thru the pair style only) at
the time you call it. Those are your only options for PE.

Steve