OrgPad logo

Modeling Pharmacology - CVUT 2026 presentation

Created by Tomas Kulhanek

pharmacolibrary

#modelica, #pharmacolibrary

Modeling Pharmacology - CVUT 2026 presentation

Modeling Pharmacology

Tomáš Kulhánek, Ph.D.

VITO, 1.LF UK

Filip Ježek, Ph.D.

Univ of Michigan, 1.LFUK

Agenda seminar:

00:00 - interactive intro - do it yourself

3 patients - same diagnosis, same pharmacotherapy, but ...

imageimageimage

find optimal dose for each of them, continue at:

https://digital-biosystems.github.io/pharma/

and do Patient1, Patient2 and Patient 3  - not Patient 4

equation models and basic simulation, pharmacokinetics of gentamicin, dose adjustment / change regimen, caffeine → effect

Agenda lecture: Pharmacokinetics, PHarmacodynamics, Pharmacogenomics 

Try patient 4: https://digital-biosystems.github.io/pharma/

PRIBE - personal reference intervals

brave ZR8tgl5Xml

RAIDO

image

DigiTwin4PH - PGx digital twin

image

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

ONCOSCREEN

image

Pharmacology

Pharmacokinetics (PK) body → drug

Pharmacodynamics (PD) drug → body

Pharmacogenomics (PGx) genetics→drug&body

pharmacokinetics(PK): body → drug

Administration(absorption), Distribution, Metabolism, Elimination(excretion)image

observation - concentration of a drug during time among different patients

brave JW8Psddw3W

1-compartment PK model

c = c_0 \times e^{-Cl.t}

or derivative form:

c=\frac{M}{V_d}

\frac{dM}{dt} = - Cl \times c

2-compartment PK model

C_1=\frac{M_1}{V_{d1}}

C_2=\frac{M_2}{V_{d2}}

brave AYU2OQg3y6

3-compartment PK model

image

standard Modelica language

image

image

Commercial tools:

imageDymola,image

image

, …

Open-source:

image

software engineering principles in mathematical modeling

can write equations

image

can plug & play with well defined components

why Modelica?

model of complex system may lead to implementation errors

 

image

A C Guyton, T G Coleman, H J Granger, Circulation: overall regulation, Annu Rev Physiol.1972;34:13-46.doi: 10.1146/annurev.ph.34.030172.000305.

Correction of schema after reimplementation in 2010

image

J.Kofránek, et al., Restoration of Guyton‘s Diagram for Regulation of the Circulation ...Physiol Res. 2010;59(6):897-908.doi: 10.33549/physiolres.931838.

Guyton's original scheme part of circulatory dynamics

image

equivalent implementation in component and acausal modeling language

image

.

Frank-Starling law is  much more visible in component model - "force of the heart muscle depends on pressure of incoming blood". 

small models - equation based

VirtualBoxVM 4UK0GmE2mR

Readability & Plausability

medium/complex models- composition of smaller models as components (icons) in diagrams

Dymola 9CIA5zGnUy

pk1


model pk1
Real C;
Real M(start=dosage);
parameter Real dosage = 400 / 1000000;
parameter Real Vd = 17.5 / 1000;
parameter Real Cl = 0.1 / 1000 / 60 ;
parameter Real MIC = 2 / 1000000 * 1000; //mg/l -> kg/m3
equation
C = M / Vd;
der(M) = -Cl * C;
end pk1;

pk2


model pk2
Real C;
Real M(start=dosage);
parameter Real dosage = 500 / 1000000;
parameter Real t1 = 8 * 3600; //hour -> seconds
parameter Real Vd = 17.5 / 1000;
parameter Real Cl = 0.1 / 1000 / 60 ;
parameter Real MIC = 2 / 1000000 * 1000; //mg/l -> kg/m3
equation
C = M / Vd;
der(M) = -Cl * C;
when sample(t1,t1) then
reinit(M,pre(M)+dosage);
end when;
end pk2;

seminar task 1

create pharmacokinetic model pk1 of gentamicin (1 dosage=400mg, Vd=17.5 l, Cl=0.1 l/min)

  1.  one dosage - simulate 24h (86400 s)
  2. create copy pk2 with dosage every 8 hours
  3. what regimen/dosage lead the C > MIC (2mg/l) during treatment
  4. simulate 10 days of treatment (864 000 s)

pk2

dosage> 400mg - e.g. 500

t1 = 8 hours

standard Modelica library 4.0.0

image

custom libraries for specific domains

image

Physiolibrary - for modeling physiology (v1.0.0 won 1st library award at Modelica conference, Lund, 2014)

Mateják, M. (2023, December). Creating cardiovascular and respiratory models using Physiolibrary 3.0. In Modelica Conferences (pp. 463-468). https://doi.org/10.3384/ecp204463

image

Chemical - for modeling chemical processes (v1.0.0 won 1st library award at Modelica conference, 2015)

Mateják, M., Tribula, M., Ježek, F., & Kofránek, J. (2015, September). Free modelica library for chemical and electrochemical processes. In 11th International Modelica Conference, Versailles, France (Vol. 118, pp. 359-66). http://dx.doi.org/10.3384/ecp15118359

Pharmacolibrary

for modeling Pharmacology (v25.09 wan 1st library award at Modelica conference,Luzerne, 2025)

image

Kulhanek, T., Jezek, F., Kofránek, J., Mateják, M., & Rommes, S. (2025, October). Pharmacolibrary-Free Library to Model Pharmacology. In Modelica Conferences (pp. 61-72). https://doi.org/10.3384/ecp21861

class for compartment

image

class for elimination

image

class for administration

image

creating model = composing components

VirtualBoxVM SSD3EQXp9H

model of pharmacokinetics

image

1-compartment model Gentamicin (aminoglycoside antibacterials)

image

gentamicin - 1 day simulation

image

Hodiamont, Caspar J et al. (2022-08). “Clinical pharmacokinetics of gentamicin in various patient populations and consequences for optimal dosing for Gram-negative infections: An updated review”. en. In: Clin. Pharmacokinet. 61.8, pp. 1075–1094. ISSN: 0312-5963,1179-1926. DOI: 10.1007/s40262 - 022 - 01143 - 0. URL: http://dx.doi.org/10.1007/s40262-022-01143-0

gentamicin - 1 day simulation logscale

pk 1c simlog

2-compartment model Midazolam (hypnotics and sedatives)

image

midazolam - 12 h simulation

image

logscale - 12h with peripheral

pk2csimlog

Heizmann, P., Eckert, M. and Ziegler, W. (1983), Pharmacokinetics and bioavailability of midazolam in man.. British Journal of Clinical Pharmacology, 16: 43S-49S. https://doi.org/10.1111/j.1365-2125.1983.tb02270.x

3-compartment model Fentanyl (anesthetics)

image

fentanyl - 10h simulation

image

fentanyl - 10h simulation logscale

pk3csim

Kaneda, Kotaro and Tae-Hyung Han (2009-09). “Comparative population pharmacokinetics of fentanyl using non-linear mixed effect modeling: burns vs. non-burns”. en. In: Burns 35.6, pp. 790–797. ISSN: 0305-4179,1879-1409. DOI: 10.1016/j.burns.2008.12.006. URL: http://dx.doi.org/10.1016/j.burns.2008.12.006

class for compartment with blood flow

image

follows more physiology and anatomy of body parts and tissues

physiology based PK model - propranolol (beta blocker)

image

PBPK simulation - propranolol (beta-blocker)

image

5496 models of drugs by Anatomical Therapeutical Chemical (ATC) classification - knowledge base extracted and combined from Pubmed, Drugbank using LLM

image

ATC level 1

image

ATC level 3

image

ATC level 5

image

Drug model variants

image

caffeine

image

1-compartment model - caffeine

image

1 cup = 100 mg of caffeine in 8 hours

caffeine in 24 hours

image

seminar task

create model of pk of caffeine - using components fom Pharmacolibrary

oral intake - 95 mg(coffee) and 50 mg(tea)

Vd = 35 l    Cl = 6.8 l/h ka=0.1 /min Tlag= 10 min

What is relation between concentration and effect?

linear effect

effectlin

image

Emax effect

effectemax

image

pharmacodynamics (PD): drug → body

What effect has a drug to body

dose/response relation ~ effect

irreversible effect

time dependent (R response, C concentration, k rate of irreversible effect)

\frac{dR}{dt}=-k\times C\times R

with recovery growth factor ks

\frac{dR}{dt}=k_s \times R - k\times C\times R

sigmoid Emax effect

effectsigmoid

image

seminar task 3

create model of dose response effect for caffein

behavioural (excitacy) 0 - 100%

EC50 = 10ug/ml, hill coeff = 1.85

cardiac effect (increased heart rate) 0-100%

EC50 = 20ug/ml, ...

  1.  model/simulate effect curve after 1 cup of coffee (95mg) (12 hours)
  2. model/simulate effect curve after 1 cup of black tea (50mg) (12 hours)

PK PD model digoxin on hemodynamics of cardiovascular system

PKPD HemodynamicsMeurs flatNorm

pressure volume (PV) diagram

image

simulation 2

Go to https://digital-biosystems.github.io/pharma/#hemo/hemo2.md

Can we predict individual drug dose → blood plasma concentration → effect/response?

individual co-variates:

age, weight, height, sex, ethnicity, …, genomics

Pharmacogenomics (PGx)

What is individual variability of PK and PD based on genotype and phenotype?

PK PGx model metoprolol - illustrative influence CYP2D6 & CYP3A4

image

metoprolol

PK PGx population of 4 different patients

image

PK PGx simulation (metoprolol)

VirtualBoxVM w1OLlExIsM

Zamir, A., Hussain, I., ur Rehman, A. et al. Clinical Pharmacokinetics of Metoprolol: A Systematic Review. Clin Pharmacokinet 61, 1095–1114 (2022). https://doi.org/10.1007/s40262-022-01145-y

Metabolismus

obecně, první průchod (first pass) přes játerní buňky

aktivní lék → neaktivní lék (paracetamol)

neaktivní lék → aktivní lék (aspirin)

aktivní lék → více aktivní lék

více toxický (ethanol)

lék → více rozpustný ve vodě

image

paracetamol

acetaminophen → sulfate_conjugate

metabolism paracetamol

image

12h simulation - paracetamol metabolites (NAPQI is toxic)

image

most common pharmacogenes and mutation in Europe

omprehensive clinical pharmacogenomic (PGx) resource

https://www.clinpgx.org/

CYP2D6

CYP2C19

CYP2C9

DPYD

SLC01B1

genetic impact for paracetamol

Python workflow - fit to external data from PK-DB.com

VirtualBoxVM TIsoOjFLH2

howto find a drug

VirtualBoxVM quF8UzRISk

CA125 concentration based on tumor growth, interactive simulator - change growth factor (logistic function) and CA125 production rate

VR JIPKA - projekt 1.LFUK, FBMI ČVUT, VirtualLab s.r.o.

brave UOvACzHPK9

bring virtual reality to life

vr

image

WebGL+WebXR                           Unity+WebView

VR JIPKA + eGolem monitor životních funkcí

brave 0Rks5PPqHX

léčiva podávána ve scénáři

  1. anestetikum a sedativum: Např. Propofol nebo Midazolam
  2. infůze fyziologického roztoku: Např. Lactated Ringer/Hartman solution
  3. antibiotika pro léčbu zánětu: např. piperacillin-tazobactam

blood-gas exchange

Dymola qmDZxxtrfj

respiration

Dymola sdXGmJf24o

hemodynamics of cardiovascular system

Dymola 9CIA5zGnUy

Conclusion

Pharmacolibrary: https://github.com/digital-biosystems/Pharmacolibrary (fork)

components for modeling pharmacology

+ repository of drug models

pharmacokinetic: 5496 drugs models, 1st version parameters extracted from primary papers, Drugbank, Pubmed & LLM (GPT4.1)

pharmacodynamics: various effects <10 models

pharmacogenomics: various genotype/phenotype influence <10 models

near future:

co-simulation of multiple models via FMI in static web app with bodylight.js

iimage

https://egolem.online/demo/

hemodynamics of cardiovascular system

Dymola 9CIA5zGnUy

blood-gas exchange

Dymola qmDZxxtrfj

respiration

Dymola sdXGmJf24o

Physiomodel

firefox SHzAoizS4q

Complex model of physiology in Modelica and Physiolibrary

https://physiomodel.org

1-compartment PK model in Modelica (text variant)

image

1-compartment PK model

c = c_0 \times e^{-Cl.t}

or derivative form:

c=\frac{M}{V_d}

\frac{dM}{dt} = - Cl \times c

1-compartment PK model in component diagram

equations are behind each component

image

connecting components → equations among variables

compartment

image

q_m =\frac{dM}{dt}

c=\frac{M}{V_d}

elimination

q_m=Cl*cimage

q_m=Cl*c

connectors

image

qm_1 +qm_2 = 0\

c_1 = c_2

logscale - 12h simulation

image

comprehensibility

Chemical 2.0

modeling physical chemistry

image

Physiolibrary 3.0.0

www.physiolibrary.orgimage

Dymola qmDZxxtrfj

Distribution

simplified - ideal mixing, no volume flow rate, compartment (Vd volume of distribution)

image

q_m =\frac{dM}{dt}

c=\frac{M}{V_d}

and 1st order kinetics

image

q_m=Cl_a*c_a-Cl_b*c_b

Metabolism

generally, first pass

active drug → inactive drug (paracetamol)

inactive drug → active drug (aspirin)

active drug → more active drug

make drug more toxic (ethanol)

make drug more water soluble

1st order kinetics between compartments

image

paracetamol

acetaminophen → sulfate_conjugate

for more complex - use Chemical library (https://www.physiolibrary.org

equivalent 1-compartment model (in equations)

VirtualBoxVM 4UK0GmE2mR

1-compartment model

image

parameters for intravenous administration of gentamicin, type of antibiotic against bacterial infections

2-compartment model

image

parameters for intravenous administration of midazolam, a short-acting benzodiazepine used for sedation, anesthesia, ...

Distribution - physiology based

compartment - with concentration mixing based on volumetric flow through organs and tissues:

image

\frac{dM}{dt} = q_{v_{a}}*actualStream(c_a)+q_{v_{b}}*actualStream(c_b)+q_m

fixed volumetric flow component:

image

Elimination

via kidney or liver using clearance rate Cl

image

q_m=Cl*c

computed half life

t_{1/2} = \frac{ln(2) \times V_d}{Cl}

seminar task 2

create derived pharmacokinetic model of gentamicin.

Patient has chronic kidney disease (clearance is 20% of norm)

  1. what is maximum peak concentration
  2. adjust regimen/dosage so C>MIC(2mg/l) and C<Ctox (35 mg/l)

pk3, pk4

dosage < 400 mg or t1 = 24 hour or combination

Administration (absorption) - route

parenteral (e.g. intravenous, intraarterial (rare), main parameters: F bioavailability (almost 100%)adminMass, adminDuration):

image

enteral (e.g. oral, main parameters: F bioavailability, adminMass, Tlag, ka absorption rate)

image

Administration (absorption kinetics)

instanteous (e.g. intravenous, intraarterial, main parameters: bolus injection adminMass):

image

Zero-order (e.g. continuous infusion, main parameter: adminDuration):

image

First-order (rate proportional to the amount of drug remaining to be absorbed, main parameters:  adminMass, ka (absorption rate))

image

3-compartment model

image

connectors

image

image

web simulator - 10 minutes

try by yourself https://digital-biosystems.github.io/pharma/

PK PD model Midazolam on EEG activity

image

midazolam

PK PD simulation

image

Pharmacolibrary / GITHUB

https://github.com/creative-connections/Pharmacolibrary

image

acknowledgment

image

ONCOSCREEN project, funded by the European Union’s Horizon Europe grant No. 101097036.

subaward to R01 HL173346. funded by NIH

RAIDO

image

PRIBE - personal reference intervals

brave ZR8tgl5Xml

RAIDO

image

PRIBE - personal reference intervals

brave ZR8tgl5Xml

PRIBE - personal reference intervals

brave ZR8tgl5Xml

RAIDO

image

optimal dose of lithium carbonate

brave OZ24t5RrJ2

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

DigiTwin4PH - PGx digital twin

image

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

DigiTwin4PH - PGx digital twin

image

ONCOSCREEN

image

ONCOSCREEN

image

DigiTwin4PH - PGx digital twin

image

ONCOSCREEN

image

iron metabolism visualisation

brave 5rh0hlzHNL

eGolem                           powered by                        bodylight.js

https://egolem.online/irm/                               https://bodylight.physiome.cz

PRIBE - personal reference intervals

brave ZR8tgl5Xml

RAIDO

image

RAIDO

image

PRIBE - personal reference intervals

brave ZR8tgl5Xml

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

co-simulace a bodylight.js - simulace v prohlížeči (WebAssembly)

DigiTwin4PH - PGx digital twin

image

DigiTwin4PH - PGx digital twin

image

ONCOSCREEN

image

ONCOSCREEN

image

bring virtual reality to life

vr

image

WebGL+WebXR                           Unity+WebView

bring virtual reality to life

vr

image

WebGL+WebXR                           Unity+WebView

VR JIPKA - nastavení a připojení

brave UOvACzHPK9

VR JIPKA - nastavení a připojení

brave UOvACzHPK9

VR JIPKA + eGolem monitor životních funkcí

brave 0Rks5PPqHX

VITO

Flemish Institute for Technological Research

Mol, Belgium

Environmental unit

Digital Precision Health group

image

bring virtual reality to life

vr

image

WebGL+WebXR                           Unity+WebView

VR JIPKA - nastavení a připojení

brave UOvACzHPK9

VR JIPKA + eGolem monitor životních funkcí

brave 0Rks5PPqHX

VR JIPKA + eGolem monitor životních funkcí

brave 0Rks5PPqHX

co-simulace a bodylight.js - simulace v prohlížeči (WebAssembly)

co-simulace a bodylight.js - simulace v prohlížeči (WebAssembly)

léčiva podávána ve scénáři

  1. anestetikum a sedativum: Např. Propofol nebo Midazolam
  2. infůze fyziologického roztoku: Např. Lactated Ringer/Hartman solution
  3. antibiotika pro léčbu zánětu: např. piperacillin-tazobactam

blood-gas exchange

Dymola qmDZxxtrfj

blood-gas exchange

Dymola qmDZxxtrfj

co-simulace a bodylight.js - simulace v prohlížeči (WebAssembly)

léčiva podávána ve scénáři

  1. anestetikum a sedativum: Např. Propofol nebo Midazolam
  2. infůze fyziologického roztoku: Např. Lactated Ringer/Hartman solution
  3. antibiotika pro léčbu zánětu: např. piperacillin-tazobactam

léčiva podávána ve scénáři

  1. anestetikum a sedativum: Např. Propofol nebo Midazolam
  2. infůze fyziologického roztoku: Např. Lactated Ringer/Hartman solution
  3. antibiotika pro léčbu zánětu: např. piperacillin-tazobactam

blood-gas exchange

Dymola qmDZxxtrfj

respiration

Dymola sdXGmJf24o

respiration

Dymola sdXGmJf24o

hemodynamics of cardiovascular system

Dymola 9CIA5zGnUy

hemodynamics of cardiovascular system

Dymola 9CIA5zGnUy

respiration

Dymola sdXGmJf24o

hemodynamics of cardiovascular system

Dymola 9CIA5zGnUy