Questions about "fix external"

Dear All,

When I use the command “fix external” with “fix nve” to add an additional force to atoms in certain region, I know that it’s the function Verlet::run(int) that calls modify->post_force(vflag) in order to add the force, and modify->post_force(vflag) is between modify->initial_integrate(vflag) and modify->final_integrate(), that means in function quest_callback() (taking couple\lammps_quest as an example) I can only get the velocity, coordinate and force of atoms after half timestep, but not the moment after a complete timestep.
How can I get these information (velocity, coordinate and force) at the end of a timestep and use these information to obtain the force which will be added at the next half timestep in function quest_callback()? Thanks.

Best regards
Wenjing Zhou

2011/8/13 ZWJ <[email protected]>:

Dear All,

When I use the command "fix external" with "fix nve" to add an additional
force to atoms in certain region, I know that it's the function
Verlet::run(int) that calls modify->post_force(vflag) in order to add the
force, and modify->post_force(vflag) is between
modify->initial_integrate(vflag) and modify->final_integrate(), that means
in function quest_callback() (taking couple\lammps_quest as an example) I
can only get the velocity, coordinate and force of atoms after half
timestep, but not the moment after a complete timestep.
How can I get these information (velocity, coordinate and force) at the end
of a timestep and use these information to obtain the force which will be
added at the next half timestep in function quest_callback()? Thanks.

http://lammps.sandia.gov/doc/Section_modify.html#fix

lists all the possible "hooks" that you can use in a fix.
pick the right ones for your needs, implement them in
your fix and then set the corresponding flags to tell
lammps which of these hooks are provided and how/when
to run them. for details, you have to look at fix.h

cheers,
      axel.

Thanks for your quick response, Axel.
So I just need to add a final_integrate() in fix_external.cpp, and in this final_integrate() I can get the information at end of each timestep, right?

Best regards
Wenjing Zhou

2011/8/13 ZWJ <[email protected]>:

Thanks for your quick response, Axel.
So I just need to add a final_integrate() in fix_external.cpp, and in this
final_integrate() I can get the information at end of each timestep, right?

something like that, yes.

axel.

Assuming you are actually using fix_external from an external
program that is calling LAMMPS as a library (that's what it is
designed to do), then you can add any hooks you want to
have the LAMMPS timestepper "call back" to your caller
at any point in the timestep, e.g. from fix::end_of_step() if
you like.

Steve