From:  "Justin Wilkins" 
Subject:[NMusers] WFN for UNIX/Linux
Date:  Mon, 9 Jun 2003 12:03:23 +0200

Hi all,

Has anyone converted Nick's fabulous Wings For NONMEM into
UNIX-compatible shell script? Nick, would you have any objection if I
had a crack?

Best regards

From: Nick Holford 
Subject:Re: [NMusers] WFN for UNIX/Linux
Date:Tue, 10 Jun 2003 08:20:11 +1200


I have a limited version of WFN available for Unix type operating systems. It uses csh
(tested with tcsh) instead of DOS batch files but the awk scripts are identical for the
Windows and Unix. 

The fancier methods that come with WFN (nmbs, nmbs, nmac) are not currently translated for
Unix. I would be delighted if you wanted to try the conversion.


This is the readme for the Unix Version of WFN:

WFN for Unix Version 400u
Nick Holford 
Last modified 23 July 2002

This is an early attempt at creating a WFN distribution for unix. It is
assumed that you already have a working NONMEM installation on the unix

1. Extract the zip file into a home directory for WFN e.g. ~/nmv/wfn.
Be sure to extract with the -a option to create unix text files! E.g. 
assuming you have in ~/nmv :

mkdir wfn
cd wfn
unzip -a ../wfnunix400u

2. Edit the wfn/bin/wfn csh script to point to your NONMEM installation
(NMHOME) and your WFN installation (WFNHOME) e.g.

setenv WFNHOME $NMHOME/wfn
setenv NMHOME ~/nmv

You also need to define a directory for the NONMEM source code and for the
compiled binary files. The default NONMEM installation has the source and
binaries in the same directory which makes it harder to manage different
compilation versions with only minor source code differences. 

If you prefer the NONMEM default and do not plan to use alternate 
compilation versions then use this (it is important that NMOBJ is set to '.'):

setenv NMOBJ .

A more flexible setting uses the NMOBJ variable to identify different
compilation versions (see below). The NMOBJ value identifies the
NONMEM compilation version. 


Some flexibility in the Fortran compiler you use can be achieved by defining
the type (F77TYP) and executable name (F77EXE). F77TYP must be f77 or g77. If
you know you are using the GNU g77 compiler then change F77TYP to g77 but this
is not essential.

setenv F77TYP f77
setenv F77EXE f77

Change the f77 compiler options to match those used when you compile NONMEM
e.g. I use these with the compiler I have on the irix4d system at the
University of Auckland:

setenv NMFOPT '-O2 -n32 -mips4 -OPT:IEEE_a=3:ro=3:unroll_size=0:fast_sqrt=ON'

If you don't know yet what to use then a safe default is:

setenv NMFOPT -O2

Your local version of time should be specified using NMTIME. GNU time is suitable.
You may need to use the -p option with time to get the correct output format e.g.

setenv NMTIME '/usr/bin/time -p'

NMTIME should return 3 lines of output (real, user, sys) e.g. try this test with
NMTIME and the ls command:

bin            make           run            wfnreadme.txt

real 0.003
user 0.000
sys  0.002

NMTIME is used to provide timing information on NONMEM runs. If you don't have a time
that works like this then simply specify a null value for NMTIME and timing
information will appear as zero in the WFN output.

NMMAKE must be able to use a version of GNU make. This is essential for
automatically keeping NONMEM compilation up to date e.g.

setenv NMMAKE /usr/local/bin/make

The other variables in wfn are the same as those described for the DOS
version. See:

3. Edit ~/.login to source the $WFNHOME/bin/wfn csh script and also add
$WFNHOME/bin to the path so that your environment is set up for WFN e.g. add
the following to your ~/.login:

source ~nmv/wfn/bin/wfn std
if ( "$path" !~ *$WFNHOME* ) set path=($path $WFNHOME/bin)

The first argument for wfn (std in the example above) can be used to
select different compilation versions (see below). Use 'wfn' instead of
'wfn std' if you prefer to use the default NONMEM installation..

4. Now set up your WFN environment with this command:

   source ~/.login

5. Set executable permissions for the WFN shell scripts with:

   source $WFNHOME/chmod.lst

You may wish to change the permissions in chmod.lst to reflect your local
preferences. The $WFNHOME/bin commands need to be executable by all WFN users.
The $WFNHOME/make commands by those wishing to recompile versions of NONMEM.

6. Code for 4 compilation versions is provided with WFN named std, s7x, 
50x and 57x. See this page for more details:

If you wish to use different compilation version (highly recommended) you
should copy files from your existing standard NONMEM installation using the
$WFNHOME/make/nm2wfn shell script. 

Before using nm2wfn you must edit nm2wfn to set the OldHome variable to the
location of your existing NONMEM installation e.g.
   set OldHome=~/nmv

nm2wfn copies the NONMEM source and currently compiled files to the std
compilation version directories. It makes the NSIZES, PSIZES, TSIZES,
and LSIZES files writeable in order to support automated compilation
of different versions of NONMEM that must change these files. A backup
copy of the original versions of these files is created with the
extension '.org'. 

7. Check that your compilation is up to date by first generating "make"
files with:


Make files are automatically generated using the names of files in the
Fortran source code directories with the extension '.f'. They are created
in the NONMEM source code directories under NMSRCHOME.
** Do not put other Fortran source code in the same directory as the NONMEM
supplied source code. genmake assumes all the Fortran source code files are
required for NONMEM compilation.

Then check your current compilation with:


This uses the unix make utility to verify that your files are up to date. 
If necessary it will compile any files that are missing or older than
the current source file. If there are errors they can be found in the 
$WFNHOME/make/make.log file.

8. Now qualify your installation with this example problem:

   cd $WFNHOME/run
   nmgo theopd

 for details of the
expected output.

9. If you have successfully compiled the std version of NONMEM then
you may wish to use this command to compile the 3 other versions (s7x,
50x and 57x):


10. Other WFN commands available are
You can find out about these commands by going to:

This is enough for basic NONMEM jobs. At some point I will port the more
complex WFN commands like nmbs, nmrt, nmac.

Note that executing $WFNHOME/bin/wfn once you are logged in will not
change the environment variables. You cannot simply change your NONMEM
compilation version by executing wfn like you can with the DOS version.
The wfn script creates a wfn alias (see $WFNHOME/bin/wfn) which allows
the command wfn to work as it does with the DOS version e.g.

wfn std # selects the std compilation version
wfn s7x # selects the s7x compilation version

Please send comments/suggestions to Nick Holford,