2017 - Budapest - Hungary

PAGE 2017: Methodology - Other topics
Rikard Nordgren

Calling C functions from NONMEM

Rikard Nordgren (1), Chunli Chen (1), Ulrika S H Simonsson (1) and Sebastian G Wicha (1)

(1) Department of Pharmaceutical Biosciences, Uppsala University, Sweden

Objectives: Some PK-PD modelling activities require the use of root finding techniques when an explicit solution of a function is not available. In a recent pharmacometric study [1], Loewe additivity [2], a criterion to define a pharmacodynamic additive interaction, was required, which only has an implicit solution. A C function had previously been developed to solve this equation using the GNU scientific library [3]. When implementing the model in NONMEM, we needed either a rootfinder written in Fortran or a way to be able to call the C function from NONMEM. We choose the second option to be able to reuse our code.

Methods: The rootfinder C function was a function of double precision type variables returning a double, which should be called from an NM-TRAN abbreviated function [4]. Fortran 2003 introduces a standardized way of interoperability between C and Fortran via the iso_c_binding intrinsic module. This module was used to create a Fortran function interface to the C function. The C function could now be called via the Fortran function interface from an abbreviated NM-TRAN function, which in turn can be called from an NM-TRAN control stream. An additional difficulty was due to the fact that our C function took 12 arguments and the abbreviated functions of NONMEM 7.3 could maximum take 9 arguments. This was solved by introducing an additional function off-loading the extra arguments to global variables. For the control stream to be able to compile and link correctly a $SUBROUTINE for the Fortran code needs to be included in the control stream and an addition of the C object code file and gsl libraries in the link step of the nmfe script had to be made.

Results: The C function could be called from a NM-TRAN control stream via an NM-TRAN abbreviated function and the result of the implicit function could be directly used in $DES defined items. The approach is applicable to any other interoperable C function.

Conclusion: The Fortran 2003 iso_c_binding intrinsic module allows for many different types of C functions to be called from Fortran and therefore also NM-TRAN in a portable way. A slightly specialized nmfe script is needed to add the C file and dependencies to the linkage. The possibility to add files for linkage to nmfe without changing the script would simplify the future use of C together with NONMEM.



References:
[1] Chunli Chen, Sebastian G Wicha, Rikard Nordgren, Ulrika S H Simonsson. Comparisons of Analysis Methods for Assessment of Pharmacodynamic Interactions including Design recommendations. Submitted
[2] Loewe S. The problem of synergism and antagonism of combined drugs. Arzneimittelforschung. 1953 Jun;3(6):285–90.
[3] M. Galassi et al. GNU Scientific Library Reference Manual (3rd Ed.)
[4] Beal, S., Sheiner, L.B., Boeckmann, A., & Bauer, R.J., NONMEM User's
Guides. (1989-2017), Icon Development Solutions, Ellicott City, MD, USA,
2009.


Reference: PAGE 26 (2017) Abstr 7104 [www.page-meeting.org/?abstract=7104]
Poster: Methodology - Other topics
Click to open PDF poster/presentation (click to open)
Top