run pre/post using lammps as a library

Hello,

I would like your help to understand whereas I properly understood the role of the pre/post keywords associated to the run command.

I am using lammps (10 Aug 15) as a library, and I would like to set up a loop with the following steps:

1) compute forces & fixes (no update of the positions)
2) modify some property of the system (e.g., add a force to few atoms); e.g. something a fix would do
3) update the positions

The operations in 2 would correspond to a fix_postforce(), but I would need to perform it from the driver.

Am I right to say that "run 1 pre yes post no" would do step 1) above,
and "run 1 pre no post yes" would do step 3) above?

If not, any suggestion about how to proceed?

Many thanks,
Massimo

Forces are used twice during a timestep, at the very start

and the very end, to update velocities. And they are

zeroed in the middle of the step (before pair styles, etc

recompute them). So even if you don’t define a pair

style, a “run 1” will not do what you want.

You can look at fix external, which is designed to

let an external program set/adjust forces in the middle

of the timestep.

Steve

Hi Steve,

thanks for your feedback - fix external works perfectly!

Cheers,

Massimo