[lammps-users] Question of compute stress/atom

Hi, Steve:

I tried to make use of compute stress/atom to calculate time average of stress/atom on the fly. For this purpose, I implemented a new fix named “sts/info” that can take the compute stress/atom ID as an input and do the average as the system evolves. It works just fine except that the stress calculation doesn’t seem to be updated at each step.

I read the code and realize that “vflag”(or vflag_atom) is controlling whether to do calculation or not. But this “vflag” is not always set to update at each step. So what’s the best way do to force the calculation of stress/atom at each time step? My example input looks like:

compute SE_ALL all stress/atom
fix INFO all sts/info 1 1000 SE_ALL stressbin

Part of my fix_sts.cpp looks like:

void FixStsInfo::end_of_step()
{

compute_stress->compute_peratom();
double **vector = compute_stress->vector_atom;

}

Thanks for the help.

Why not use fix ave'/atom - it sounds like it does what you want.
You can see how it insures that vflag is set for other computes
that it gathers info from.

Steve