modify fix_adapt with t_elapsed

Hello everybody,

I'm wondering how I can modify the fix_adapt command, so every certain elapsed time it is invoked - instead of every N timesteps. The reason why I want to have such a command is, because I'm using fix dt/reset and I want that certain properties are changed periodically over time.

I looked at line 240

if (update->ntimestep % nevery) return;
...

and wanted to change it in:
if (FixDtReset->t_elapsed % nevery) return;

I also changed the variable t_elapsed in fix_dt_reset into a public variable and included fix_dt_reset.h in the fix_adapt.cpp.

But I get the error: "expected primary-expression before '->' token"

Can anybody explain to me, why that doesn't work?

Thanks a lot,
best regards

Sebastian

Hello everybody,

I'm wondering how I can modify the fix_adapt command, so every certain
elapsed time it is invoked - instead of every N timesteps. The reason
why I want to have such a command is, because I'm using fix dt/reset and
I want that certain properties are changed periodically over time.

I looked at line 240

if (update->ntimestep % nevery) return;
...

and wanted to change it in:
if (FixDtReset->t_elapsed % nevery) return;

I also changed the variable t_elapsed in fix_dt_reset into a public
variable and included fix_dt_reset.h in the fix_adapt.cpp.

But I get the error: "expected primary-expression before '->' token"

Can anybody explain to me, why that doesn't work?

it doesn't compile, because you don't seem
to know the basics of c++ programming.

there are many steps that are wrong:
there is no FixDtReset member in FixAdapt,
FixDtReset would be a constructor method
or class name, so you cannot use it regardles,
ultimately, the logic that you want to
apply won't work in any case, since t_elapsed
records the total time and nevery is in
time steps. you would have to set nevery to
1 in any case. using the modulus logic on top
if that is likely to miss steps since bitwise
comparisons on floating point numbers may
fail due to rounding or when the total time
would not be commensurate with the time
interval that you want to apply.

axel.