Jump commands with LAMMPS library

Hello,

I am using LAMMPS as a library in a C-style code to perform forward flux sampling. I parse input files line by line inside of my wrapper code using lammps_command(ptr,line), as illustrated in examples/COUPLE/simple/simple.c. The “jump” commands that I am using (see below) do not work in this context, although the code runs fine when supplied via standard in. Is it possible to have LAMMPS to jump back in the input file when parsing the input file line-by-line in a wrapper code? If not, is there an alternative way to run LAMMPS until it crosses a milestone that avoids loops?

Thank you in advance,

Dan

label startrun run 100 pre no post no

Success interface

variable pINT equal “v_N / v_D * v_SEP + (2.0 * v_N) / (v_N + 1.0) * v_P - v_N”

Failure interface

variable bINT equal “v_N / v_D * v_SEP + (2.0 * v_N) / (v_N + 1.0) * v_B - v_N”

Run until we cross an interface…

if “{nbp} > {bINT} && {nbp} < {pINT}” then “jump SELF startrun” else “jump SELF endrun”

label endrun

Hello,

I am using LAMMPS as a library in a C-style code to perform forward flux
sampling. I parse input files line by line inside of my wrapper code using
lammps_command(ptr,line), as illustrated in examples/COUPLE/simple/simple.c.
The "jump" commands that I am using (see below) do not work in this context,
although the code runs fine when supplied via standard in. Is it possible
to have LAMMPS to jump back in the input file when parsing the input file
line-by-line in a wrapper code? If not, is there an alternative way to run
LAMMPS until it crosses a milestone that avoids loops?

you have to do that in your wrapper code.

the jump command works by rewinding (does not always work, e.g. if the
label is too far away from the jump) or closing and reopening the
input file and looking for the jump label. this most certainly is not
possible in your case. the best strategy is to retrieve the value of
the variables in your interface and them just a simple while loop
instead of using LAMMPS loop construct. should make the code much
simpler and cleaner, too.

axel.

p.s.: is it really required to redefine the variables in every loop iteration?

Thank you for the clarification, Axel.

With regards to redefining the variables, they do have to re-defined every loop iteration. My interfaces in forward flux sampling are a function of the center-of-mass separation and the number of base pairs formed between two hybridizing strands of ssDNA; a compute com/molecule command was being used to calculate the center-to-center distance.

Dan