Modifying a fix script

Dear Users,
I am trying to modify the fix_lineforce.cpp for atom_style ‘sphere’ . I want to change the force in terms of the angular displacement obtained by integrating the variable ‘omega’. So I would like to know how I can use the trap function in this fix script (basically how can I call the trap integration function in the script) or how can I perform the integration in the fix script?
Please give me some suggestions…

Thanks in advance

-Ligesh

Dear Users,
   I am trying to modify the fix_lineforce.cpp for atom_style 'sphere' . I want to change the force in terms of the angular displacement obtained by integrating the variable 'omega'.
So I would like to know how I can use the trap function in this fix script (basically how can I call the trap integration function in the script) or how can I perform the integration in the fix script?

trying to use the trap() variable function is complex and requires
providing data in specific data structures, as you can easily see from
looking at the code in the variable.cpp file (search for
Variable::special_function()). it'll be far fewer and simpler lines of
code to just to program the integration directly.

numerical integration as such is trivial to program directly as the
corresponding algorithms are simple and they are often used as
examples in programming courses for scientists or as examples for
parallel programming. see trapezoidal rule (used in trap()) or
simpson's rule (more accurate) in
https://en.wikipedia.org/wiki/Numerical_integration#Quadrature_rules_based_on_interpolating_functions
and then do a little google search. e.g. many parallel programming
examples compute PI via parallel numerical integration.

axel.