Wings for NONMEM Installation


Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References


Last Updated: 20 September 2014


These instructions assume you have already installed NONMEM and a Fortran compiler and wish to install WFN to change the way you use an existing NONMEM installation.


WFN will only work once NONMEM and a Fortran compiler have already been installed. You must be able to identify the file directory paths ('home directory') for NONMEM and the compiler in order to complete the installation of WFN.


There are 3 'home' directories that need to be identified. A home directory contains files and sub-directories used by each main component i.e. WFN, NONMEM and the F77 compiler. Typical values for these home directories are:


Wings for NONMEM                         C:\nm730\wfn7

NONMEM                                          C:\nm730

gfortran Compiler                               C:\nm730\gfortran


Note the home directory is not the same as the directory containing executable files such as the compiler program. These executable files are found in sub-directories of the home directory e.g. in gfortran\bin for the gfortran compiler.


Installing WFN depends on how NONMEM has been installed and the compiler that is used. The NONMEM distribution from Icon Development Systems has a suggested installation for use with the Intel Visual Fortran, gfortran and g95 compilers. These compilers are also supported by WFN.

Installing WFN

WFN is distributed as wfn***.exe (where *** is the version number e.g. 700). Open the wfn***.exe file. You will be presented with options for extracting the contents. You should extract into the WFN home directory. It can be any directory you choose. The suggested default for extracting files when you run wfn***.exe is C:\nm730\wfn7.  Check the “Unzip to folder” option and then click on Unzip. After the files have been extracted you may close the WinZip Self-Extractor window.

The WFN home directory will be referred to as WFNHOME in the following description.  Note that when environment variables such as WFNHOME are used as part of a Windows command expression they are written as %WFNHOME%. When environment variables are set the surrounding % is not used to define the variable name.

Extracting files from wfn***.exe creates a %WFNHOME%\bin directory which contains the WFN command files, a %WFNHOME%\web directory which contains this documentation and a %WFNHOME%\run directory which contains some examples which you can use to run nmgo and qualify your installation.

Creating a WFN Shortcut

You will need to use a Windows shortcut to open an MS-DOS prompt window and invoke a special startup batch file (wfn.bat). You will need to know the full path to wfn.bat.  It is in %WFNHOME%\bin e.g. C:\nm730\wfn7\bin.

·         On the Windows desktop make a right click and select New Shortcut. When prompted to "Type the location of the item" enter %SystemRoot%\system32\cmd.exe /k followed by the full path for wfn.bat e.g.

%SystemRoot%\system32\cmd.exe /k  C:\nm730\wfn7\bin\wfn.bat


 where C:\nm730\wfn7 should be changed to reflect your WFN home directory

Creating WFN.BAT

It is essential that you create a file called wfn.bat. You may do this by using the wfn.txt file in the %WFNHOME% directory e.g.

copy C:\nm730\wfn7\bin\wfn.txt  C:\nm730\wfn7\bin\wfn.bat


open wfn.txt in a text editor and save as wfn.bat.

wfn.bat is used to set up environment variables when you open a Command Prompt window. These variables are used to individualize your WFN installation.
Open wfn.bat in a text editor and look for the sections marked:

rem ******* Check this ************.

Be prepared to make changes to wfn.bat that reflect the setup of WFN, NONMEM and the Fortran compiler you use. The changes you make are to the Command Prompt environment variables.

·  Location of WFN and NONMEM

Change the NMHOME value to the directory which has your installation of NONMEM files in it (e.g. C:\nm7).
Change WFNHOME to reflect the directory you used when extracting files from wfnxxx.exe (e.g. C:\nm730\wfn7).

rem ******* Check this ************
set NMHOME=C:\nm7
set WFNHOME=C:\nm730\wfn7

·  Location of Fortran Compiler and Compiler type

Change the F77HOME to the directory your compiler uses as its home. Usually it has a bin subdirectory in it that contains the compiler executable files.  Do not include the \bin as part of F77HOME. Specific examples are shown below.

Change F77VER to one of the following compiler types:


ivf        - Intel Fortran Version 10

ivf11     - Intel Fortran Version 11

gf         - Gfortran

g95      – G95


Note these compiler types are not necessarily the same as the compiler executable name.

Change F77HOME to the home directory for the gfortran compiler and set the compiler version F77VER to gf e.g.


set F77HOME=C:\nm730\gfortran

set F77VER=gf


Change F77HOME to the home directory for the ivf compiler. Set the compiler version F77VER to ivf


set F77HOME=C:\Program Files\Intel\Compiler\Fortran\10.1.024
set F77VER=ivf


Change F77HOME to the home directory for the ivf11 compiler. Set the compiler version F77VER to ivf11


set F77HOME=C:\Program Files\Intel\Compiler\11.0\061\fortran

set F77VER=iv11


The ivf11 compiler may also to know about Microsoft Visual Studio tools. If you get error messages during compilation suggesting an installation problem then you should go to the :ivf11 section of wfn.bat (search for the text ":ivf11") and enable the setting of VS80COMNTOOLS by removing the ‘rem’ at the start of the line.

Check the VS80COMNTOOLS directory by comparing it with the actual directory path e.g.

set VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools 

Change F77HOME to the home directory for the g95 compiler and set the compiler version F77VER to g95 e.g.


set F77HOME=C:\MingW

set F77VER=g95


·         Paths to Other Software

rem ******* Other Software ******
rem If you use Crossgraphs then set CGHOME
set CGHOME=C:\Program Files\PPD Informatics\CrossGraphs
rem If you have installed the R statistical package you may want to include it in your path by setting RPATH
set RPATH=C:\Program Files\R\R-2.8.0\bin

rem If you use Monolix then set MONOLIX and MONOLIXDATA (Change username to a valid Windows username)

rem set MONOLIX=C:\Monolix\Monolix422\Monolix\monolix422s

rem set MONOLIXDATA="C:\Documents and Settings\username\monolixData"


Compiler Options

You need to be aware that there are 2 steps in compilation of NONMEM. The first step is performed at installation of NONMEM and creates a set of obj files and a nonmem.lib library. This compilation step is only repeated if you make changes to NONMEM source code and rerun the NONMEM setup72.bat. The second is when the user supplied sub-routine FSUBS created by NM-TRAN is compiled and linked with the pre-compiled object files. This happens every time that nmgo is used.

The compiler options used by WFN are set in wfn.bat. The default values are the same as those used by setup72.bat. They are displayed when wfn.bat is executed e.g. for the Intel Fortran compiler:
F77OPT =/Gs /nologo /nbs /w /Ob1gyti /Qprec_div /4Yportlib
and can also be found in the *.log file created in the run sub-directory e.g.
ifort /Gs /nologo /nbs /w /Ob1gyti /Qprec_div /4Yportlib /Fetheopd FSUBS.for @link.txt

The compiler options in wfn.bat may be changed by modifying the compiler specific section of wfn.bat where F77OPT is set. You should take care that the compiler options used for both of these compilation steps are identical by ensuring that the options for the compiler in setup72.bat match the options in wfn.bat.

The standard NONMEM group installation creates an nmfe72.bat file with the compiler options set in the environment variable op. It includes a run time /traceback option that slows down execution by about 10% and has little value for users. The WFN Fortran compiler options do not include this option by default. It can be activated by setting the environment variable F77TRACE=y in wfn.bat.


If you compare the results of NONMEM runs using both nmfe72 and nmgo and discover small differences in the output of NONMEM then this is most likely due to using different compiler options. Be sure to check the compiler options that are set in nmfe72.bat and wfn.bat.


It has been suggested that using other options with the Intel Visual Fortran compiler may give more consistent results across different versions of NONMEM.

On 24/05/2011 8:59 a.m., Rik Schoemaker wrote to nmusers:

Dear all,


In contrast to Dieter's findings, I can assure you it is very well possible to set up MPI on a Windows 7 64 bit installation if you use Intel Visual Fortran.


If you use the following compiler settings:


set op=/Gs /nologo /nbs /w /fp:strict


-fp-model strict -Gs -nologo -nbs -w -static



you will get identical results for NONMEM 7.1, NONMEM 7.2, with and without MPI on Windows 7 64 bit, Linux and Mac OSX providing you have the same Fortran compiler version (we use 11.1). I can assure you that this is definitely not the case when you use the default settings.


WFN Options

There are five WFN options in wfn.bat that you may wish to change:

Qualifying Your Installation

Use the WFN shortcut to open an MS-DOS window. You should see a short list showing the variables WFN is using (OS will be blank if you are not using Windows NT). Here is an example using the gfortran compiler settings:


OS       =Windows_NT

WFNHOME  =C:\nm730\wfn7

NMHOME   =C:\nm730


F77HOME  =C:\Program Files\Apps\gfortran

F77TYP   =gf

F77EXE   =gfortran

F77OPT   =-O3 -ffast-math -w

NMCTL    =.ctl

NMOUT    =.lst


NMLOG    =.log


NMDIR    =.nm7

NMOBJ    =.

NMAWK    =gawk

LIBRARY_PATH=C:\Program Files\Apps\gfortran\lib 


Assuming you start in C:\nm730\wfn7\run you should see the DOS prompt:




If necessary you should change to the wfn7\run directory. There is no need to do this if you start in the C:\nm730\wfn7\run directory.


cd C:\nm730\wfn7\run 


Then run NONMEM using the nmgo command. The run directory contains theopd.ctl and an associated data file, theopd.dat.  If you have changed the NMCTL value from .ctl then you will need to rename theopd.ctl to your preferred extension e.g. if you change NMCTL to .mod then rename theopd.ctl to theopd.mod before trying to use the nmgo command.

nmgo theopd


If nmgo runs correctly you should see this when it finishes (results and the timing information in the last line will depend on the computer and compiler you use):




THETA:      POP_E0      POP_EMAX    POP_EC50

ETA:        PPV_E0      PPV_EMAX    PPV_EC50

ERR:        RUV_SD

theopd.lst      5801.321        FOCE    eval=275 sig=+4.2 sub=153 obs=574 NM7.3.0

THETA     = 139         191         8.8


ETASD     = 0.099       0.268       1.463


ETAPval   = 0.346       0.000       0.605

ETAshr%   = 81.0        55.8        35.6

EBVshr%   = 81.8        59.6        29.9

EPSshr%   = 9.3


EPSSD     = 81.055


THETA:se% = 7.3         10.2        21.4

ETASD:se% = 171.1       20.8        17.1

EPSSD:se% = 5.3




 Ttot 0:4.5 Test 0:1.9 Tcov 0:0.86 Ttcl 0:1.74



Intel Fortran


THETA:      POP_E0      POP_EMAX    POP_EC50

ETA:        PPV_E0      PPV_EMAX    PPV_EC50

ERR:        RUV_SD

theopd.lst      5801.321        FOCE    eval=275 sig=+4.2 sub=153 obs=574 NM7.3.0

THETA     = 139         191         8.8


ETASD     = 0.099       0.268       1.463


ETAPval   = 0.346       0.000       0.605

ETAshr%   = 81.0        55.8        35.6

EBVshr%   = 81.8        59.6        29.9

EPSshr%   = 9.3


EPSSD     = 81.055


THETA:se% = 8.6         11.1        27.7

ETASD:se% = 178.3       21.2        17.2

EPSSD:se% = 5.3




 Ttot 0:5.5 Test 0:1.33 Tcov 0:0.59 Ttcl 0:3.58

Once you have qualified the installation you can go ahead and use nmgo on your own data.  You can execute nmgo from any directory you wish but the NMTRAN control stream file (e.g. theopd.ctl) must be in the current directory. Do not attempt to use a path to point to a control stream in another directory.


Parallel Execution

You may test the use of the file passing interface (fpi) and the message passing interface (mpi) with the fpi.bat and mpi.bat commands in the %wfnhome%\run directory e.g. the following commands will run fpi then mpi with the theopd problem assuming two nodes are available on your computer. Note that mpich2 must be installed before attempting to run mpi.

cd C:\nm730\wfn7\run




Using the NESI Grid

If you have access to the NESI grid you can use WFN to submit jobs and use multiple CPUs on the grid. See the NESI Grid installation instructions.



It is normal to see a message from NM-TRAN giving warnings like this:




It is also normal to find this at the end of the log file created in the run directory:


If you have problems running WFN please let me know and I will try to help. It is helpful if you make a copy of the WFN window that appears immediately after opening the WFN shortcut and send this to me. If you right click on the WFN window title bar you will see an Edit option. Use this to Mark and Copy the WFN window contents and paste it into an email. Please also send a copy of the screen showing error messages and the command you typed that led to the error. Please do not use PrtSc to create bit map screen dumps!


If you wish to remove all wfn files please use the unwfn\unwfn.bat DOS batch command file. Open a DOS window, change to the WFNHOME directory and execute unwfn.bat . This will leave the directory structure, any files not installed by wfn and the unwfn\unwfn.bat file. You may delete the unwfn and unwfn.bat file.

cd C:\nm730\wfn7

NONMEM Versions

See the NONMEM Versions page for instructions on using more than one version of NONMEM with WFN. Installation of NONMEM using the %WFNHOME%\nminstall.bat is the simplest way to do this.

Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References